uEnv.txt vs boot.scr
Asked Answered
T

2

8

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 ...

Tingle answered 6/3, 2015 at 2:3 Comment(0)
W
5

It's very platform-dependent. To see what's controlling the boot process, get to u-boot prompt (hit on serial port) before kernel boot starts. Then

printenv

will show the environment. Here is an excerpt from sunxi/u-boot of environment with commands which try different fatload sources in turn, until one works

bootscr=boot.scr
bootenv=uEnv.txt
loadbootscr=fatload mmc 0 ${scriptaddr} ${bootscr} || ext2load mmc 0 ${scriptaddr} ${bootscr} || ext2load mmc 0 ${scriptaddr} boot/${bootscr}
loadbootenv=fatload mmc 0 ${scriptaddr} ${bootenv} || ext2load mmc 0 ${scriptaddr} ${bootenv} || ext2load mmc 0 ${scriptaddr} boot/${bootenv}
boot_mmc=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 ${kernel} && watchdog 0 && bootm 0x48000000
bootcmd=if run loadbootenv; then \
                echo Loaded environment from ${bootenv}; \
                env import -t ${scriptaddr} ${filesize}; \

... more options follow

A default environment is hardcoded in each platform U-Boot source.

Watchtower answered 6/3, 2015 at 14:56 Comment(1)
So they pretty much do the same thing and I just need to have one of those files created.Tingle
U
9

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.

Urmia answered 22/6, 2016 at 14:22 Comment(0)
W
5

It's very platform-dependent. To see what's controlling the boot process, get to u-boot prompt (hit on serial port) before kernel boot starts. Then

printenv

will show the environment. Here is an excerpt from sunxi/u-boot of environment with commands which try different fatload sources in turn, until one works

bootscr=boot.scr
bootenv=uEnv.txt
loadbootscr=fatload mmc 0 ${scriptaddr} ${bootscr} || ext2load mmc 0 ${scriptaddr} ${bootscr} || ext2load mmc 0 ${scriptaddr} boot/${bootscr}
loadbootenv=fatload mmc 0 ${scriptaddr} ${bootenv} || ext2load mmc 0 ${scriptaddr} ${bootenv} || ext2load mmc 0 ${scriptaddr} boot/${bootenv}
boot_mmc=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 ${kernel} && watchdog 0 && bootm 0x48000000
bootcmd=if run loadbootenv; then \
                echo Loaded environment from ${bootenv}; \
                env import -t ${scriptaddr} ${filesize}; \

... more options follow

A default environment is hardcoded in each platform U-Boot source.

Watchtower answered 6/3, 2015 at 14:56 Comment(1)
So they pretty much do the same thing and I just need to have one of those files created.Tingle

© 2022 - 2024 — McMap. All rights reserved.