Issue with mkenvimage loading environ variables

Ivan Castell icastell at circontrol.com
Mon Dec 14 10:44:05 CET 2020


Hello all. Having strange issues when using mkenvimage tool. I have generated uEnv.txt with three variables defined: var1, var2 and var3. And I am trying to load it into U-boot. I have done two different tests:

Test1 (null-terminated strings)

OUT=uEnv.txt
echo -ne "var1=1\0" > $OUT
echo -ne "var2=1\0" >> $OUT
echo -ne "var3=1\0" >> $OUT
echo -ne "\0" >> $OUT

mkenvimage -s 8000 -o uEnv_blob uEnv.txt

=> tftp 0x87000000 uEnv_blob
Using FEC0 device
TFTP from server 192.168.1.110; our IP address is 192.168.1.134
Filename 'uEnv_blob'.
Load address: 0x87000000
Loading: #
         1.1 MiB/s
done
Bytes transferred = 8000 (1f40 hex)

=> env import -b 0x87000000 8000
=> printenv
var2=1
var3=1
�ue�var1=1

Test2 (\n terminated strings)

OUT=uEnv.txt
echo "var1=1" > $OUT
echo "var2=1" >> $OUT
echo "var3=1" >> $OUT
echo "" >> $OUT

mkenvimage -s 8000 -o uEnv_blob uEnv.txt

=> tftp 0x87000000 uEnv_blob
Using FEC0 device
TFTP from server 192.168.1.110; our IP address is 192.168.1.134
Filename 'uEnv_blob'.
Load address: 0x87000000
Loading: #
         976.6 KiB/s
done
Bytes transferred = 8000 (1f40 hex)

=> env import -b 0x87000000 8000
=> print
Uل5var1=1
var2=1
var3=1

As you can see, in both cases, variable var1 is not loaded as expected.

This is my current u-boot version:
=> version
U-Boot 2017.03-mx6ul+g434eba6 (Dec 06 2017 - 13:31:34 +0200)
arm-fslc-linux-gnueabi-gcc (GCC) 7.2.0
GNU ld (GNU Binutils) 2.29.0.20170912

And this is u-boot-tools package installed on Ubuntu 20.04

$ dpkg -l|grep boot-tools
ii  u-boot-tools                          2019.07+dfsg-1ubuntu6               amd64        companion tools for Das U-Boot bootloader

I am not sure if some step to clean the memory area where the uEnv_blob is loaded is missing before the tftp tranfer command. Or if this is simply a bug. Please explain what are the exact steps to follow in order to get this working.

Thanks in advance!


More information about the U-Boot mailing list