U-boot adaptation guide

= UNDER CONSRUCTION! =

PAGE STILL UNDER CONSTRUCTION...

Basic assumptions / scope

 * This guide is meant for converting a working u-boot to boot to mer / nemo from SD card or internal eMMC.
 * It is assumed that you have some way of accessing u-boot console (serial / adb / etc)
 * Mer / Nemo / etc image with separate FAT or Ext2 boot partition and a root partition on your boot media (SD or eMMC)
 * in case of device internal eMMC you need HW specific flashing tools to transfer the image to it


 * u-boot features needed:
 * working mmc/SD card driver for your board
 * "fat load" or ext2load support (CONFIG_CMD_FAT, CONFIG_CMD_EXT2)
 * hush shell support (CONFIG_SYS_HUSH_PARSER)

Minimum path to boot
What are the absolute minimum things to get u-boot boot a linux-kernel from a SD card or eMMC for mer/nemo?

Here is the list:


 * load the kernel uImage from a disk to memory
 * fat load / ext2load / mmc load
 * start the kernel
 * bootm ${loadaddr}
 * pass right parameters to kernel in "bootargs" environment variable
 * parameters specific for the HW (typically just re-use what is there already in bootargs)
 * Mer/Nemo root FS location
 * systemd.unit=start.getty

Quick & generic SD card boot

 * 1) Boot the device to u-boot console

Then we need to setup the above minimum things in u-boot environment in place. Start with printenv

Now you see what is the current environment, it's good idea to copy-paste this somewhere safe just in case you make a mess of it ;)

Now then, first step was to load the kernel, so we set up a generic script to do that:

setenv nemo_bootcmd 'for j in 2 1 0; do \ echo stepj $j; \ mmc rescan $j; for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19; do \ mmc rescan $j; \ if fat load mmc $j:$i ${loadaddr} /uImage; then \ bootm ${loadaddr}; \ fi; \ if fat load mmc $j:$i ${loadaddr} /boot/uImage; then \ bootm ${loadaddr}; \ fi; \ if ext2load mmc $j:$i ${loadaddr} /uImage; then \ bootm ${loadaddr}; \ fi; \ if ext2load mmc $j:$i ${loadaddr} /boot/uImage; then \ bootm ${loadaddr}; \ fi; \ echo no device found in mmc $j partition $i; \ done; \ done'

TO BE CONTINUED ;)