Linux – Download kernel+rootfs and boot on it with u-boot

bootlinuxpxe-bootrootfs

We are working with a few single board computers (SBC). We generate linux embedded images with Yocto (using U-boot as bootloader), and we deploy it manually on SD cards. This works well for now, when we are in test phase and don't have a lot of SBCs. But later, it'll be definitely too slow.

We have a central server for the network of the SBCs. Currently, this is a simple DHCP server, affecting IP addresses depending on the MAC addresses of the cards. First, we have thought to make a PXE server, but it seems that the internal boot ROM loader of some SBCs (Freescale i.MX6 sabresd for example) do not support the PXE boot process.

So we'd like to load only u-boot on the cards, and then use a script (a boot.scr) to download all that is needed (zImage, dtb and rootfs) to boot. We don’t want to use NFS (no thin client, we want all the necessary to be downloaded on the cards). Currently, we can download the kernel and the dtb file using this:

U-Boot > dhcp ${image}; tftpboot ${fdt_addr} ${fdt_file} ; fdt addr ${fdt_addr} 
U-Boot > bootz ${loadaddr} - ${fdt_addr}

Of course, as there isn’t any rootfs, the booting of the kernel ends with a kernel panic. But we don’t know how to download the rootfs and make the kernel using it. Any suggestion how to do it is welcome. Thanks.

Best Answer

So, I've found how to do this :

tftpboot 0x12000000 zImage
tftpboot ${fdt_addr} ${fdt_file}
tftpboot 0x19000000 core-image-minimal-boot.cpio.gz.u-boot
bootz 0x12000000 0x19000000 ${fdt_addr}

To create the .cpio.gz.u-boot, I have to edit conf/local.conf :

IMAGE_CLASSES += "image_types_uboot"
IMAGE_FSTYPES = "cpio.gz.u-boot"
Related Topic