uEnv.txt vs boot.scr

Kousha picture Kousha · Mar 6, 2015 · Viewed 13.8k times · Source

I'm very confused on these two files for the boot configuration. They seem to be doing the same thing and I don't understand why I would need either or.

If I use uEnv.txt, I set it as

bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
aload_script=fatload mmc 0 0x43000000 script.bin;
aload_kernle=fatload mmc 0 0x48000000 uImage;  bootm 0x43000000 - 0x48000000;
uenvcmd=setenv run aload_script aload_kernel

Alternatively, I can create boot.cmd:

setenv bootargs console=console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 script.bin
fatload mmc 0 0x48000000 uImage
bootm 0x48000000

And they both work ...

Answer

MikeW picture MikeW · Jun 22, 2016

Well, they do have different roles:

  • uEnv.txt allows presetting of the U-Boot environment variable values, prior to running bootcmd
  • boot.scr allows running of a U-Boot script file, prior to running bootcmd

So clearly you can set environment values in a script file, to that extent the functionality overlaps.

But if you ONLY want to set some env values (eg for a board ID), then using uEnv.txt is the simplest method.