From 29222e18e9c81ebdca95350ff98235d258a2e38e Mon Sep 17 00:00:00 2001 From: Ejub Sabic Date: Tue, 28 Apr 2026 10:33:33 +0200 Subject: [PATCH] uboot: import first variable from auxiliary environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- board/aarch64/marvell-espressobin/README.md | 2 +- board/common/uboot/scripts/ixpreboot.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board/aarch64/marvell-espressobin/README.md b/board/aarch64/marvell-espressobin/README.md index 409c1aef..bbc8dec2 100644 --- a/board/aarch64/marvell-espressobin/README.md +++ b/board/aarch64/marvell-espressobin/README.md @@ -154,7 +154,7 @@ setenv bootcmd_net \ setenv bootcmd \ 'setenv bootpart 2; setenv bootslot primary; setenv auxpart 1; \ if ext4load mmc 0:$auxpart $loadaddr /uboot.env; then \ - env import -b $loadaddr $filesize BOOT_ORDER; \ + env import -c $loadaddr $filesize BOOT_ORDER; \ fi; \ if test "$BOOT_ORDER" = "secondary primary" || \ test "$BOOT_ORDER" = "secondary primary net"; then \ diff --git a/board/common/uboot/scripts/ixpreboot.sh b/board/common/uboot/scripts/ixpreboot.sh index bfe61a89..3467f3d0 100644 --- a/board/common/uboot/scripts/ixpreboot.sh +++ b/board/common/uboot/scripts/ixpreboot.sh @@ -33,7 +33,7 @@ for tgt in "${boot_targets}"; do setexpr ixmenu_n ${ixmenu_n} + 1 if load ${devtype} ${devnum}:${auxpart} ${loadaddr} /uboot.env; then - env import -b ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact BOARD_VARIANT + env import -c ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact BOARD_VARIANT run ixvariant fi