u-boot: load a kernel that's in a ubi volume

Joel Stanley joel at jms.id.au
Mon Aug 7 17:36:45 AEST 2017


On Mon, Aug 7, 2017 at 1:39 PM, anoo <anoo at linux.vnet.ibm.com> wrote:
> Hi Joel,
>
> Per our discussion, here are the details of what we’re trying to do and the
> things I’ve tried.

Thanks. I spent the afternoon attempting to recreate your results.

>
> Goal: Have u-boot load a kernel that's in a ubi volume.
>
> 1. Added ubi support to uboot by adding the following macros to
> include/configs/ast-g5-ncsi.h temporarily for testing purposes (a new config
> header would probably need to be created for a final implementation):
>
> | +#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

I replicated this. I noted that this increases the size of the u-boot
image a lot:

Old size: 232632
New size: 358320

This is an extra 122kB, or a 54% increase in the u-boot size.

It does still fit in the partition we have, which is 384 KB.

>
> 2. Built a romulus image with the above u-boot change plus commit
> https://gerrit.openbmc-project.xyz/#/c/5812/ which is the top-most commit
> for a set of changes to remove the initramfs and create a flash image that
> builds the kernel and rootsfs into ubi volumes.

Why Romulus? Isn't this work being done for Witherspoon?

> 3. Used the generated obmc-phosphor-image-romulus.ubi.mtd to boot qemu.

What was the Qemu command line you used?

Can you share a mkfs.ubifs command line that I can use to create a ubi image?

When I tried to boot the image I downloaded from the gerrit job, none
of the uboot commands you listed worked:

U-Boot 2016.07 (Jul 27 2017 - 21:13:25 +0000)

       Watchdog enabled
DRAM:  496 MiB
Flash: 32 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   aspeednic#0
Error: aspeednic#0 address not set.

Hit any key to stop autoboot:  0
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ast# mtdparts
Unknown command 'mtdparts' - try 'help'
ast# ubi part kernel0
Unknown command 'ubi' - try 'help'


>
> 4. To be able to use ubi in u-boot, the mtdparts and mtdids variables need
> to be set (reference:
> https://fossies.org/linux/qemu/roms/u-boot/doc/README.ubi).
>
> Here is where I’ve been unable to get u-boot to recognize the existing mtd.
> I’ve tried multiple combinations for mtdids, such as nor0=bmc,
> nor0=<addr>.flash, etc etc. But when running “mtdparts” command from u-boot,
> or a ubi command, always get "Device nor0 not found!”. Ex:
>
> ast# mtdparts
> Device nor0 not found!
>
> ast# ubi part kernel0
> Device nor0 not found!
> Error initializing mtdparts!
>
> I’ve also taken a stab at adding the romulus device tree to u-boot to see if
> that may be the reason, by copying from the kernel and adding to u-boot the
> files arch/arm/dts/aspeed-g5.dtsi, aspeed-bmc-opp-flash-layout.dtsi,
> aspeed-bmc-opp-romulus.dts, and adding the dts to the Makefile. Also added a
> CONFIG_DEFAULT_DEVICE_TREE macro. This might not be the correct or complete
> way to add the device tree to the openbmc version of u-boot.

Can you explain what you were trying to do there?

Cheers,

Joel


More information about the openbmc mailing list