[meta-xilinx] u-boot/UBIFS
Joe Hershberger
joe.hershberger at gmail.com
Mon Sep 21 12:39:13 PDT 2015
Hi Edwin,
> I'm trying to get UBIFS working on a custom Zynq 7020 board.
> I have the following issues:
>
> 1) I'm trying to build a u-boot.elf that has UBI support.
> I believe I need to re-compile u-boot with these config items:
> #define CONFIG_CMD_UBI
> #define CONFIG_CMD_UBIFS
> #define CONFIG_RBTREE
> #define CONFIG_MTD_DEVICE
> #define CONFIG_MTD_PARTITIONS
> #define CONFIG_CMD_MTDPARTS
> #define CONFIG_LZO
That's correct.
> Do I need a u-boot-xlnx_2015.04.bbappend file to specify these? What
> would I put in it?
Not sure about the integration with OE.
> 2) If I created a flash partition to store the u-boot environment, how
> do I go about creating an image that contains that environment?
Generally the env will either already there or created at runtime from
the default environment.
> And how do I tell u-boot that this flash partition contains the
> environment for it (e.g., set another config item and re-compile
> u-boot)?
You say "flash partition" here, but it seems like you are trying to
use UBI to store the env, so I'm assuming that.
Given that the partition will be UBI, you need to configure it by
setting CONFIG_ENV_UBI_PART.
You will then have either 1 or 2 UBI volumes that actually store the
env settings. Those must be set by CONFIG_ENV_UBI_VOLUME and possibly
CONFIG_ENV_UBI_VOLUME_REDUND.
You will have to use the "ubi" command to create the volumes with the
settings you want to use. after defining the MTD partition that the
UBI will operate on.
---------
E.g.:
#define MTDIDS_DEFAULT "nand0=xilinx_nand"
#define MTDPARTS_DEFAULT \
"mtdparts=xilinx_nand:" \
"128k(fsbl)ro," \
"4M(u-boot)ro," \
"16M(env-boot)," \
"-(root)"
#define CONFIG_ENV_IS_IN_UBI
#define CONFIG_ENV_UBI_PART "env-boot"
#define CONFIG_ENV_UBI_VOLUME "u-boot-env1"
#define CONFIG_ENV_UBI_VOLUME_REDUND "u-boot-env2"
#undef CONFIG_ENV_SIZE
#define CONFIG_ENV_SIZE 0x20000
E.g. commands:
nand erase.part env-boot
ubi part env-boot
ubi create u-boot-env1 0x20000 dynamic
ubi create u-boot-env2 0x20000 dynamic
ubi create bootfs - dynamic
--------
Note that when u-boot loads, it is using the MTDPARTS_DEFAULT values
that are compiled into the environment, not dynamically what you may
have changed the "mtdparts" variable to be. It would be a catch-22
otherwise. Other settings are always compiled in only.
> 3) Can I use the Yocto-generated ubifs rootfs image on an SD card as
> well as on flash? What u-boot configuration do I use to do this? For
> example, for a ramdisk image, I'd put
> "ramdisk_image=rootfs.cpio.gz.u-boot" in uEnv.txt. What would I need
> to use the ubifs image in place on the SD card?
If you will be running UBIFS on top of your UBI volume and storing the
ramdisk or kernel there, you would need to mount it to read the kernel
file or whatever. Our system packages everything into a U-Boot ITB
(image tree blob) so we just have to load one file from the ubifs, but
the process would just be duplicated if you use separate files. You
would then specify the memory addresses you loaded them to as
parameters to bootm, just like usual.
---------
E.g. commands:
ubi part env-boot
ubifsmount ubi:bootfs
ubifsload $loadaddr linux_rd.itb
setenv bootargs $mtdparts ubi.mtd=env-boot ubi.mtd=root root=/dev/ram rw
bootm $loadaddr
--------
I'm not sure if there are other assumptions that come with Yocto and
how it interacts with configuring U-Boot, but from a more purely
U-Boot point of view, this is what it needed (if my assumptions are
correct).
Cheers,
-Joe
More information about the meta-xilinx
mailing list