Skip to content

U-Boot: First variable in auxiliary environment can not be imported #1431

@wkz

Description

@wkz

Current Behavior

At boot, U-Boot will import a small set of variables from /mnt/aux/uboot.env, primarily to determine the boot order. It seems like the first KEY=val pair in this file can not be imported.

Device 1

ethact is the first variable in the serialized environment file, and can not be imported, while the following variable can be:

(ixboot) load ${devtype} ${devnum}:${auxpart} ${loadaddr} /uboot.env
(ixboot) md.b ${loadaddr} 100
00800000: 2b 44 23 14 65 74 68 61 63 74 3d 65 32 38 00 42  +D#.ethact=e28.B
00800010: 4f 4f 54 5f 6e 65 74 5f 4c 45 46 54 3d 33 00 42  OOT_net_LEFT=3.B
00800020: 4f 4f 54 5f 70 72 69 6d 61 72 79 5f 4c 45 46 54  OOT_primary_LEFT
00800030: 3d 33 00 42 4f 4f 54 5f 73 65 63 6f 6e 64 61 72  =3.BOOT_secondar
00800040: 79 5f 4c 45 46 54 3d 33 00 42 4f 4f 54 5f 4f 52  y_LEFT=3.BOOT_OR
00800050: 44 45 52 3d 6e 65 74 00 00 64 61 72 79 20 6e 65  DER=net..dary ne
00800060: 74 00 00 63 74 3d 65 32 38 00 00 ff ff ff ff ff  t..ct=e28.......
00800070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
00800080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
00800090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
(ixboot) setenv ethact FOOBARNOTSET
(ixboot) env import -b ${loadaddr} ${filesize} ethact
(ixboot) printenv ethact
ethact=FOOBARNOTSET
(ixboot) setenv BOOT_net_LEFT FOOBARNOTSET
(ixboot) env import -b ${loadaddr} ${filesize} BOOT_net_LEFT
(ixboot) printenv BOOT_net_LEFT
BOOT_net_LEFT=3

Device 2

On this system, the order of the two is reversed, and now BOOT_net_LEFT can not be imported, since it now is the first variable in the file:

(ixboot) load ${devtype} ${devnum}:${auxpart} ${loadaddr} /uboot.env
16384 bytes read in 9 ms (1.7 MiB/s)
(ixboot) md.b ${loadaddr} 100
00800000: 9e 0d 03 13 42 4f 4f 54 5f 6e 65 74 5f 4c 45 46  ....BOOT_net_LEF
00800010: 54 3d 31 00 65 74 68 61 63 74 3d 65 32 38 00 42  T=1.ethact=e28.B
00800020: 4f 4f 54 5f 73 65 63 6f 6e 64 61 72 79 5f 4c 45  OOT_secondary_LE
00800030: 46 54 3d 33 00 42 4f 4f 54 5f 70 72 69 6d 61 72  FT=3.BOOT_primar
00800040: 79 5f 4c 45 46 54 3d 33 00 42 4f 4f 54 5f 4f 52  y_LEFT=3.BOOT_OR
00800050: 44 45 52 3d 6e 65 74 00 00 72 79 20 6e 65 74 00  DER=net..ry net.
00800060: 00 00 00 72 79 00 00 65 74 00 00 ff ff ff ff ff  ...ry..et.......
00800070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
00800080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
00800090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
008000f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
(ixboot) setenv ethact FOOBARNOTSET
(ixboot) env import -b ${loadaddr} ${filesize} ethact
(ixboot) printenv ethact
ethact=e28
(ixboot) setenv BOOT_net_LEFT FOOBARNOTSET
(ixboot) env import -b ${loadaddr} ${filesize} BOOT_net_LEFT
(ixboot) printenv BOOT_net_LEFT
BOOT_net_LEFT=FOOBARNOTSET

Expected Behavior

The first variable should also be possible to import.

Steps To Reproduce

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagePending investigation & classification (CCB)

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions