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

Anatolij Gustschin agust at denx.de
Mon Dec 7 10:35:55 CET 2015


Hi,

On Sun, 6 Dec 2015 12:01:08 +1100
"Brendan Simon (eTRIX)" <brendan.simon at etrix.com.au> wrote:

> Hi,
> 
> I'm using a Digilent ZedBoard with a Xilinx Zynq 7020 SoC.  The kernel
> is from Analog Devices and is a fork of 4.0.0 (according to the Makefile).
> 
> I am struggling to work out the fw_env.config file required to use with
> fw_printenv/fw_saveenv.
> fw_printenv continually gives me CRC error and uses the defaults.
> 
> Google hasn't provided much assistance, with some people reporting that
> the settings required are different to what /proc/mtd shows.
> 
> 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.

> 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.

HTH,

Anatolij


More information about the U-Boot mailing list