public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc)
@ 2015-12-06  1:01 Brendan Simon
  2015-12-07  9:35 ` Anatolij Gustschin
  0 siblings, 1 reply; 4+ messages in thread
From: Brendan Simon @ 2015-12-06  1:01 UTC (permalink / raw)
  To: u-boot

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?

How can I find out the correct settings.  Is there a command in u-boot
itself which will report the correct information?

Thanks,
Brendan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc)
  2015-12-06  1:01 [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc) Brendan Simon
@ 2015-12-07  9:35 ` Anatolij Gustschin
  2015-12-07 11:38   ` Brendan Simon
  0 siblings, 1 reply; 4+ messages in thread
From: Anatolij Gustschin @ 2015-12-07  9:35 UTC (permalink / raw)
  To: u-boot

Hi,

On Sun, 6 Dec 2015 12:01:08 +1100
"Brendan Simon (eTRIX)" <brendan.simon@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc)
  2015-12-07  9:35 ` Anatolij Gustschin
@ 2015-12-07 11:38   ` Brendan Simon
  2015-12-07 12:56     ` Anatolij Gustschin
  0 siblings, 1 reply; 4+ messages in thread
From: Brendan Simon @ 2015-12-07 11:38 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc)
  2015-12-07 11:38   ` Brendan Simon
@ 2015-12-07 12:56     ` Anatolij Gustschin
  0 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2015-12-07 12:56 UTC (permalink / raw)
  To: u-boot

On Mon, 7 Dec 2015 22:38:53 +1100
"Brendan Simon (eTRIX)" <brendan.simon@etrix.com.au> wrote:
...
> 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?

It might be normal for Zynq boards. The mtd partition layout is passed
to the kernel in the device tree, and the .dts file author decided to
define this layout with common partition for U-Boot and its environment
for some reason.

Thanks,

Anatolij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-07 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-06  1:01 [U-Boot] fw_env.config settings for Digilent ZedBoard (Zynq 7020 Soc) Brendan Simon
2015-12-07  9:35 ` Anatolij Gustschin
2015-12-07 11:38   ` Brendan Simon
2015-12-07 12:56     ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox