Skip to content

Commit 29222e1

Browse files
committed
uboot: import first variable from auxiliary environment
The U-Boot env file is generated by mkenvimage, which prefixes the variable data with a 4-byte CRC32 by default. ixpreboot.sh previously imported it with `env import -b` as per uboot docs(-b assume binary format (’0’ separated, “00” terminated).), which treats the buffer as raw binary and does not strip the CRC. As a result the first variable's name is parsed a part of CRC. Later variables import correctly because by then the parser is past the CRC. Switching to `env import -c` as per uboot docs (-c assume checksum protected environment format.) makes U-Boot validate and strip the CRC before parsing, so the first variable imports under its real name. Tested on: - QEMU Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
1 parent efa665d commit 29222e1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

board/aarch64/marvell-espressobin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ setenv bootcmd_net \
154154
setenv bootcmd \
155155
'setenv bootpart 2; setenv bootslot primary; setenv auxpart 1; \
156156
if ext4load mmc 0:$auxpart $loadaddr /uboot.env; then \
157-
env import -b $loadaddr $filesize BOOT_ORDER; \
157+
env import -c $loadaddr $filesize BOOT_ORDER; \
158158
fi; \
159159
if test "$BOOT_ORDER" = "secondary primary" || \
160160
test "$BOOT_ORDER" = "secondary primary net"; then \

board/common/uboot/scripts/ixpreboot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ for tgt in "${boot_targets}"; do
3333
setexpr ixmenu_n ${ixmenu_n} + 1
3434

3535
if load ${devtype} ${devnum}:${auxpart} ${loadaddr} /uboot.env; then
36-
env import -b ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact BOARD_VARIANT
36+
env import -c ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact BOARD_VARIANT
3737
run ixvariant
3838
fi
3939

0 commit comments

Comments
 (0)