Load custom script in u-boot


I want to load a script in u-boot to execute it and store it in mmc but please, could you provide how the memory stack is manage to avoid some overwritten action ? (ie to avoid to write it in the same place where uImage is stored)


Hi Vincent

The DDR RAM starts at 0x10000000. U-Boot gets relocated to the end of the DDR RAM, so keep out of that address range.

If your script is to load kernel and device tree you should not use the RAM addresses used for this two components. The kernel is to be loaded at $kernel_addr_r 0x10800000, the device tree gets loaded at $fdt_addr_r 0x12000000.

uImage and device tree are files in the first partition on the eMMC. So storing your stuff also as a file on mmc 0:1 with your unique filename will prevent clashes on the eMMC.

Note that run setupdate loads and executes a script. That script sets additional environment variables, among others update_fdt.
Have a look at update_fdt which loads a file into RAM and stores that file on eMMC.

Hi @max.krummenacher,

Thanks for your answer (always quick and precise, great ^^)


Could you please give the start address of uboot ?


Actually that depends.
U-Boot is loaded at the beginning of the RAM. Then as part of its initialisation it gets relocated to the end of the RAM, so the start address depends on the RAM size of your module.

The U-Boot command bdinfo gives among other things info on the relocation address:

Colibri iMX6 # bdinfo
arch_number = 0x00000000
relocaddr   = 0x1FF5E000

Note that U-Boot uses some additional RAM below that address for its own use.