Combined fs+kernel requirement?

I’m trying to get mender working on an old board. This board uses raw NAND flash, but its U-Boot doesn’t support booting a combined fs+kernel. The kernel is stored in one partition, the fs is stored in another; U-Boot simply loads the kernel into memory at and issues a "bootz ". The cmdline args U-Boot passes to the kernel tells it which fs to use (i.e. root=…).

Am I reading the mender documentation correctly? It looks like adding mender requires U-Boot to be able to boot a combined fs+kernel image? I’m assuming I’d have to use U-Boot’s distro features? (i.e. extlinux.conf) or are there other ways to boot a combined fs+kernel image from U-Boot that are supported?

Hi @twoerner, welcome.

We do normally just move the kernel into the root filesystem and then modify the boot commands to pull the kernel from there. If you do need to load the kernel from an external partition, the first step would be to tweak the partition numbers in your mender.conf to find the proper root filesystem partitions. As for having the Mender boot code load the kernel from an external partition, you can probably use the mender_pre_setup_commands and mender_post_setup_commands environment variables to adjust the variables used by Mender to load the kernel for your particular setup.

Drew

In its simplest form this is what the boot command might look like when Mender is integrated,

run mender_setup
load ${mender_uboot_root} ${kernel_addr_r} /boot/zImage
load ${mender_uboot_root} ${fdt_addr} /boot/dtb
bootz ${kernel_addr_r} - ${fdt_addr}
run mender_try_to_recover

mender_uboot_root in this case points to the current active rootfs partition in an A/B setup.

As @drewmoseley mentions, it is prefererad to package zImage and dtb in the rootfs, this way you would have one atomic way of updating both and fully utilize the A/B setup.

But things should be fairly easy to adjust.

Phew! Thank you @drewmoseley and @mirzak for your words of encouragement :smiley:

I had been stuck for days trying to add all the things to U-Boot required to get it to boot a combined fs+kernel from a single ubi image in raw NAND. I was starting to lose hope and my question was to see if Mender could work another way. Thankfully I’ve got it all worked out (I was missing a single #define in include/configs/<board>.h) and am distro-booting the ubi image in the partition from U-Boot.

Hopefully it’s all downhill from here? :wink:

1 Like