[U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc)

Brendan Simon (eTRIX) brendan.simon at etrix.com.au
Mon Dec 7 12:38:53 CET 2015


Hi.  see inline comments below ...

On 7/12/2015 8:35 PM, Anatolij Gustschin wrote:
> On Sun, 6 Dec 2015 12:01:08 +1100
> "Brendan Simon (eTRIX)" <brendan.simon at etrix.com.au> wrote:
>
>> Here is info from /proc/mtd and my /etc/fw_env.config.
>>
>> root at bjs:~# cat
>> /proc/mtd                                                                                                 
>>
>> dev:    size   erasesize  name
>> mtd0: 00500000 00010000 "boot"
>> mtd1: 00020000 00010000 "bootenv"
>> mtd2: 00020000 00010000 "config"
>> mtd3: 00a80000 00010000 "image"
>> mtd4: 01040000 00010000 "spare"
>>
>> root at bjs:~# cat
>> /etc/fw_env.config                                                                                                 
>>
>> # Configuration file for fw_(printenv/setenv) utility.
>> # Up to two entries are valid, in this case the redundant
>> # environment sector is assumed present.
>> # MTD device name       Device offset   Env. size       Flash sector size
>> #         /dev/mtd1               0x0000          0x20000         0x40000
>> #         /dev/mtd1               0x0000          0x20000         0x20000
>> #         /dev/mtd1               0x0000          0x20000         0x10000
>> #         /dev/mtd2               0x0000          0x20000         0x40000
>> #         /dev/mtd2               0x0000          0x20000         0x20000
>>          /dev/mtd2               0x0000          0x20000         0x10000
>>
>> Does anyone have any insight into what the correct fw_env.config
>> settings should be from the above info?
> Using /dev/mtd2 in /etc/fw_env.config might be wrong. First, you need to figure
> out which mtd partition contains the sectors with U-Boot environment variables.
> According to /proc/mtd info it could be the mtd1, if the mtd partitions layout
> under linux is correct. To check it, just run
>
>   dd if=/dev/mtd1 | hexdump -C
>
> If the dumped data looks like environment variables, e.g.
>
>   00000000  a5 72 49 1b 01 61 64 64  63 6f 6e 73 3d 73 65 74  |.rI..addcons=set|
>   00000010  65 6e 76 20 62 6f 6f 74  61 72 67 73 20 24 7b 62  |env bootargs ${b|
>   00000020  6f 6f 74 61 72 67 73 7d  20 63 6f 6e 73 6f 6c 65  |ootargs} console|
>   00000030  3d 24 7b 63 6f 6e 73 6f  6c 65 7d 2c 24 7b 62 61  |=${console},${ba|
>   ...
>
> then the mtd1 device is correct. Use it in fw_env.config.
> To determine other parameters for fw_env.config you need to check the
> used environment configuration in the U-Boot source, in the board's config
> file (include/configs/zyng_zed.h, include/configs/zynq-common.h). Search
> for CONFIG_ENV_SIZE, CONFIG_ENV_SECT_SIZE and CONFIG_ENV_OFFSET macros.
So u-boot sources tell me the ENV_OFFSET is at 0xE0000 and the ENV_SIZE
is (128 << 10) = 0x20000
I tried dd with "bs=1 skip=917504" and could not find anything in mtd1
or mtd2 ...
I finally tried mtd0 and found env vars :)
I updated /etc/fw_env.config to the following and now fw_printenv works
and no crc errors are reported.  Yay :)

         /dev/mtd0               0xE0000          0x20000         0x20000

Is it normal for the environment to not be at offset 0x0 and not be in
it's own dedicated mtd partition?

>> How can I find out the correct settings.  Is there a command in u-boot
>> itself which will report the correct information?
> for ZedBoard, you probably can not. It depends on the U-Boot configuration.
> If the "mtd" command support is compiled in and the "mtdparts" environment
> variable is set properly, then it could be possible to output some
> info.
"mtd" command is not compiled in.  Might try a custom build of u-boot.

Thanks,
Brendan.



More information about the U-Boot mailing list