fw_printenv and fw_setenv in TX2

Hi, we are also having an issue with this. We have a new environment and have moved some of general data partitions around (not boot1, to our knowledge) but when we save the environment with U-Boot’s saveenv we can no longer get past mb1.

Come to think of it, it’s possible our new environment is too large. At boot we see

*** Warning - bad CRC, using default environment

And at the end of a printenv we see:

Environment size: 5814/131067 bytes

Which is way over CONFIG_ENV_SIZE 0x2000 (8192). L4T U-Boot reported ~4000/8188. Does anyone know how we can “loadenv”?

Edit: We solved this. We had three issues:

  1. CONFIG_ENV_SIZE was too large, 0x20000 instead of 0x2000
  2. CONFIG_SYS_MMC_ENV_PART was set to 0, instead of 2 (mmcblk0boot1)
  3. CONFIG_ENV_OFFSET was indeed set to 0x3FE000 (0x400000-0x2000) however we ended up setting this to 0x0 as /dev/mmcblk0boot1 is unused until a 16KB table starting at 0x3fbe00.

I’d like to discuss 3 a little further. /dev/mmcblk0boot1 looks like this:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fbe00  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fbe10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fbe20  00 00 00 00 00 00 00 00  3f 00 00 00 00 00 00 00  |........?.......|
003fbe30  00 00 00 00 00 00 00 00  42 00 43 00 54 00 00 00  |........B.C.T...|
003fbe40  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fbe80  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fbe90  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fbea0  40 00 00 00 00 00 00 00  3f 02 00 00 00 00 00 00  |@.......?.......|
003fbeb0  00 00 00 00 00 00 00 00  6d 00 62 00 31 00 00 00  |........m.b.1...|
003fbec0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fbf00  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fbf10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fbf20  40 02 00 00 00 00 00 00  3f 04 00 00 00 00 00 00  |@.......?.......|
003fbf30  00 00 00 00 00 00 00 00  6d 00 62 00 31 00 5f 00  |........m.b.1._.|
003fbf40  62 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |b...............|
003fbf50  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fbf80  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fbf90  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fbfa0  40 04 00 00 00 00 00 00  bf 04 00 00 00 00 00 00  |@...............|
003fbfb0  00 00 00 00 00 00 00 00  4d 00 42 00 31 00 5f 00  |........M.B.1._.|
003fbfc0  42 00 43 00 54 00 00 00  00 00 00 00 00 00 00 00  |B.C.T...........|
003fbfd0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc000  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc020  c0 04 00 00 00 00 00 00  3f 05 00 00 00 00 00 00  |........?.......|
003fc030  00 00 00 00 00 00 00 00  4d 00 42 00 31 00 5f 00  |........M.B.1._.|
003fc040  42 00 43 00 54 00 5f 00  62 00 00 00 00 00 00 00  |B.C.T._.b.......|
003fc050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc080  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc0a0  40 05 00 00 00 00 00 00  3f 06 00 00 00 00 00 00  |@.......?.......|
003fc0b0  00 00 00 00 00 00 00 00  73 00 70 00 65 00 2d 00  |........s.p.e.-.|
003fc0c0  66 00 77 00 00 00 00 00  00 00 00 00 00 00 00 00  |f.w.............|
003fc0d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc100  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc120  40 06 00 00 00 00 00 00  3f 07 00 00 00 00 00 00  |@.......?.......|
003fc130  00 00 00 00 00 00 00 00  73 00 70 00 65 00 2d 00  |........s.p.e.-.|
003fc140  66 00 77 00 5f 00 62 00  00 00 00 00 00 00 00 00  |f.w._.b.........|
003fc150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc180  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc190  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc1a0  40 07 00 00 00 00 00 00  3f 09 00 00 00 00 00 00  |@.......?.......|
003fc1b0  00 00 00 00 00 00 00 00  6d 00 62 00 32 00 00 00  |........m.b.2...|
003fc1c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc200  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc220  40 09 00 00 00 00 00 00  3f 0b 00 00 00 00 00 00  |@.......?.......|
003fc230  00 00 00 00 00 00 00 00  6d 00 62 00 32 00 5f 00  |........m.b.2._.|
003fc240  62 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |b...............|
003fc250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc280  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc290  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc2a0  40 0b 00 00 00 00 00 00  3f 0d 00 00 00 00 00 00  |@.......?.......|
003fc2b0  00 00 00 00 00 00 00 00  6d 00 74 00 73 00 2d 00  |........m.t.s.-.|
003fc2c0  70 00 72 00 65 00 62 00  6f 00 6f 00 74 00 00 00  |p.r.e.b.o.o.t...|
003fc2d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc300  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc310  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc320  40 0d 00 00 00 00 00 00  3f 0f 00 00 00 00 00 00  |@.......?.......|
003fc330  00 00 00 00 00 00 00 00  6d 00 74 00 73 00 2d 00  |........m.t.s.-.|
003fc340  70 00 72 00 65 00 62 00  6f 00 6f 00 74 00 5f 00  |p.r.e.b.o.o.t._.|
003fc350  62 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |b...............|
003fc360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc380  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc390  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc3a0  40 0f 00 00 00 00 00 00  47 0f 00 00 00 00 00 00  |@.......G.......|
003fc3b0  00 00 00 00 00 00 00 00  53 00 4d 00 44 00 00 00  |........S.M.D...|
003fc3c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003fc400  a2 a0 d0 eb e5 b9 33 44  87 c0 68 b6 b7 26 99 c7  |......3D..h..&..|
003fc410  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003fc420  48 0f 00 00 00 00 00 00  4f 0f 00 00 00 00 00 00  |H.......O.......|
003fc430  00 00 00 00 00 00 00 00  53 00 4d 00 44 00 5f 00  |........S.M.D._.|
003fc440  62 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |b...............|
003fc450  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
003ffe00  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
003ffe10  43 fe b0 0b 00 00 00 00  ff 3f 00 00 00 00 00 00  |C........?......|
003ffe20  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
003ffe30  df 3f 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |.?..............|
003ffe40  00 00 00 00 00 00 00 00  df 3f 00 00 00 00 00 00  |.........?......|
003ffe50  0d 00 00 00 80 00 00 00  82 c5 0a 35 00 00 00 00  |...........5....|
003ffe60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00400000

There is a 0x1e00 gap between 0x3FE000 (start of the U-Boot env) and 0x3ffe00 (start of the 512B EFI block).

Why does L4T try to fit a 0x2000 U-Boot env into a 0x1e00 gap? I believe this is a bug that will only show when U-Boot env is >7680B (0x1e00) in size.

We moved this to 0x0 as it appears to be unused.