u-boot env CRC mismatch

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

u-boot env CRC mismatch

10,246件の閲覧回数
GrzegorzHeldt
Contributor I

Hi there :-).

I'm evaluating LS1028ARDB kit. I have setup Yocto/dunfell build for it.

It is very basic at the moment, consisting of following layers:

 

 

 

distro: poky
machine: ls1028ardb

repos:

  poky:
    url: https://git.yoctoproject.org/git/poky
    refspec: 0839888394a6e42e96f9f0d201376eb38bc79b24
    layers:
      meta:
      meta-poky:
      meta-yocto-bsp:

  meta-openembedded:
    url: https://git.openembedded.org/meta-openembedded
    refspec: 7889158dcd187546fc5e99fd81d0779cad3e8d17
    layers:
      meta-oe:
      meta-python:
      meta-networking:
      
  meta-freescale:
    url: https://github.com/Freescale/meta-freescale.git
    refspec: 99bd73bec2a9d84509cb012a08f9062cb65fb24e

  meta-tr-layerscape:
    layers:
      meta-tr-layerscape:

local_conf_header:
  nxp_eula: |
        ACCEPT_FSL_EULA = "1"

 

 

 

 

Where meta-tr-layerscape contains:

* libubootenv install fw_env.config to /etc/

* u-boot, use mainline u-boot (however u-boot-qoriq give the same result), 

* u-boot, defconfig disable CONFIG_ENV_IS_IN_SPI_FLASH, change bootargs root to SD partition. 

* add WKS file for WIC generation.

My problem is that libubootenv and u-boot env CRC calculation seems to be different.

 

 

 

U-Boot 2020.01 (Jan 06 2020 - 20:56:31 +0000)

SoC:  LS1028AE Rev1.0 (0x870b0010)

<...>

MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

EEPROM: Invalid ID (ff ff ff ff)
<...>
=> setenv aaaasetvar u-boot
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=> run sd_bootcmd 
Trying load from SD ...

<...>

root@ls1028ardb:~# cat /etc/fw_env.config 
# device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mmcblk0        5242880         8192   

root@ls1028ardb:~# fw_printenv aaaasetvar
Cannot read environment, using default
aaaasetvar=
root@ls1028ardb:~# hexdump /dev/mmcblk0 -s 5242880 -n 128 -C
00500000  f3 13 e9 7c 61 61 61 61  73 65 74 76 61 72 3d 75  |...|aaaasetvar=u|
00500010  2d 62 6f 6f 74 00 61 72  63 68 3d 61 72 6d 00 62  |-boot.arch=arm.b|
00500020  61 75 64 72 61 74 65 3d  31 31 35 32 30 30 00 62  |audrate=115200.b|
00500030  6f 61 72 64 3d 6c 73 31  30 32 38 61 72 64 62 00  |oard=ls1028ardb.|
00500040  62 6f 61 72 64 5f 6e 61  6d 65 3d 6c 73 31 30 32  |board_name=ls102|
00500050  38 61 00 62 6f 6f 74 5f  61 5f 73 63 72 69 70 74  |8a.boot_a_script|
00500060  3d 6c 6f 61 64 20 24 7b  64 65 76 74 79 70 65 7d  |=load ${devtype}|
00500070  20 24 7b 64 65 76 6e 75  6d 7d 3a 24 7b 64 69 73  | ${devnum}:${dis|
00500080
root@ls1028ardb:~# fw_setenv aaaasetvar linux
Cannot read environment, using default
root@ls1028ardb:~# hexdump /dev/mmcblk0 -s 5242880 -n 128 -C
00500000  76 42 b0 d3 61 61 61 61  73 65 74 76 61 72 3d 6c  |vB..aaaasetvar=l|
00500010  69 6e 75 78 00 61 72 63  68 3d 61 72 6d 00 62 61  |inux.arch=arm.ba|
00500020  75 64 72 61 74 65 3d 31  31 35 32 30 30 00 62 6f  |udrate=115200.bo|
00500030  61 72 64 3d 6c 73 31 30  32 38 61 72 64 62 00 62  |ard=ls1028ardb.b|
00500040  6f 61 72 64 5f 6e 61 6d  65 3d 6c 73 31 30 32 38  |oard_name=ls1028|
00500050  61 00 62 6f 6f 74 5f 61  5f 73 63 72 69 70 74 3d  |a.boot_a_script=|
00500060  6c 6f 61 64 20 24 7b 64  65 76 74 79 70 65 7d 20  |load ${devtype} |
00500070  24 7b 64 65 76 6e 75 6d  7d 3a 24 7b 64 69 73 74  |${devnum}:${dist|

 

 

 

 

So, from what I understand:

* Both u-boot and libubootenv refer to the same area of sdcard.

* Both are configured to NOT use redundant environment.

* What is not directly visible but I can confirm is that both u-boot and libubootenv use same env size which is 8192.

It seems to me that I have forget about something, or u-boot still use redundant env even after I disable it by defconfig. But I was not able find it on MMC1 and MTD.

I'm attaching both u-boot patches I'm using for my build, I dont think they can be related.

I've started with u-boot-qoriq initially, however I got same result.

Can someone please enlighten me please ?

Best Regards

Grzegorz Heldt.

ラベル(1)
0 件の賞賛
返信
12 返答(返信)

10,118件の閲覧回数
GrzegorzHeldt
Contributor I

Hello.

I will try to improve the issue description. 

The problem is related to the cooperation of u-boot and libubootenv, where the environment is shared between these two components.

I'm aware of fact that the environment has to be initialized, which can be made using the steps you have suggested. And that works.

However then, when you start Linux and need to modify some variable at Linux prompt level, libubootenv (fw_printenv/fw_setenv) utilities report CRC error of environment.

At this point, it is possible to reinitialize the environment and set/read it using fw_utils.

However, when you enter u-boot again, bad CRC is reported AGAIN.

This at the end of the day makes it impossible to manage u-boot-env from Linux userspace, making it impossible to use frameworks like swupdate as an example.

 

The standard scenario is:

  • initialize environment from u-boot or from userspace using libubootenv, depended on your use-case (both should work)
  • then it is possible to read, change environment from both libubootenv and u-boot.

 

Best Regards

Greg.

0 件の賞賛
返信

10,099件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

Please configure /etc/fw_env.config as the following

# device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mmcblk0        0x500000        0x2000   

In addition, please use u-boot(atf) image from Yocto dunfell release.

 

0 件の賞賛
返信

10,096件の閲覧回数
GrzegorzHeldt
Contributor I

Hello @yipingwang 

As you see in very first message, I'm already using same configuration of fw_env.config:

root@ls1028ardb:~# cat /etc/fw_env.config 
# device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mmcblk0        5242880         8192   

as 0x500000 is equal to 5242880 and 0x2000 is equal to 8912.

I have also tried u-boot specified by both poky@dunfell with u-boot as well as meta-freescale@dunfell with u-boot-qoriq, and the result is exactly the same.

0 件の賞賛
返信

10,078件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to my console log on ls1028ardb as the following, I didn't reproduce your problem.

root@ls1028ardb:~# touch /etc/u-boot-initial-env
root@ls1028ardb:~# vi /etc/fw_env.config
root@ls1028ardb:~# cat /etc/fw_env.config
# device name Device offset Env. size Flash sector size Number of sectors
/dev/mmcblk0 0x500000 0x2000
root@ls1028ardb:~# ./fw_setenv aaaasetvar linux
root@ls1028ardb:~# hexdump /dev/mmcblk0 -s 5242880 -n 128 -C
00500000 a4 f6 ef fe 61 61 61 61 73 65 74 76 61 72 3d 6c |....aaaasetvar=l|
00500010 69 6e 75 78 00 61 72 63 68 3d 61 72 6d 00 62 61 |inux.arch=arm.ba|
00500020 75 64 72 61 74 65 3d 31 31 35 32 30 30 00 62 6f |udrate=115200.bo|
00500030 61 72 64 3d 6c 73 31 30 32 38 61 72 64 62 00 62 |ard=ls1028ardb.b|
00500040 6f 61 72 64 5f 6e 61 6d 65 3d 6c 73 31 30 32 38 |oard_name=ls1028|
00500050 61 00 62 6f 6f 74 5f 61 5f 73 63 72 69 70 74 3d |a.boot_a_script=|
00500060 6c 6f 61 64 20 24 7b 64 65 76 74 79 70 65 7d 20 |load ${devtype} |
00500070 24 7b 64 65 76 6e 75 6d 7d 3a 24 7b 64 69 73 74 |${devnum}:${dist|
00500080
root@ls1028ardb:~# reboot

INIT: Sending processes configured via /etc/inittab the TERM signal
root@ls1028ardb:~# Stopping OpenBSD Secure Shell server: sshdstopped /usr/sbin/sshd (pid 918)
.
Stopping network benchmark server: netserverstopped /usr/sbin/netserver (pid 925)
.
Stopping system log daemon...0
Stopping internet superserver: xinetd.
Stopping random number generator daemon.
Deconfiguring network interfaces... done.
Stopping watchdog daemon...Sending all processes the TERM signal...
Sending all processes the KILL signal...
Unmounting remote filesystems...
Deactivating swap...
Unmounting local filesystems...
[ 362.558936] EXT4-fs (ram0): re-mounted. Opts: (null)
Rebooting... [ 362.573535] kvm: exiting hardware virtualization
[ 362.638300] reboot: Restarting system
NOTICE: Fixed DDR on board

NOTICE: 4 GB DDR4, 32-bit, CL=11, ECC on
NOTICE: BL2: v2.4(release):lf-5.10.72-2.2.0-16-gf3b196f23
NOTICE: BL2: Built : 07:51:09, Dec 22 2021
NOTICE: BL2: Booting BL31
NOTICE: BL31: v2.4(release):lf-5.10.72-2.2.0-16-gf3b196f23
NOTICE: BL31: Built : 07:51:09, Dec 22 2021
NOTICE: Welcome to ls1028ardb BL31 Phase


U-Boot 2021.04+fsl+gd65732ae99 (Dec 29 2021 - 08:16:57 +0000)

SoC: LS1028AE Rev1.0 (0x870b0010)
Clock Configuration:
CPU0(A72):1500 MHz CPU1(A72):1500 MHz
Bus: 400 MHz DDR: 1600 MT/s
Reset Configuration Word (RCW):
00000000: 3c004010 00000030 00000000 00000000
00000010: 00000000 018f0000 0030c000 00000000
00000020: 020031a0 00002580 00000000 00003296
00000030: 00000000 00000010 00000000 00000000
00000040: 00000000 00000000 00000000 00000000
00000050: 00000000 00000000 00000000 00000000
00000060: 00000000 00000000 200e705a 00000000
00000070: bb580000 00000000
Model: NXP Layerscape 1028a RDB Board
Board: LS1028AE Rev1.0-RDB, Version: C, boot from NOR
FPGA: v6 (RDB)
SERDES1 Reference : Clock1 = 100.00MHz Clock2 = 100.00MHz
DRAM: 3.9 GiB
DDR 3.9 GiB (DDR4, 32-bit, CL=11, ECC on)
Using SERDES1 Protocol: 47960 (0xbb58)
PCIe1: pcie@3400000 Root Complex: no link
PCIe2: pcie@3500000 Root Complex: no link
WDT: Started with servicing (60s timeout)
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from SPIFlash... SF: Detected mt35xu02g with page size 256 Bytes, erase size 128 KiB, total 256 MiB
OK
EEPROM: NXID v1
In: serial
Out: serial
Err: serial
SEC0: RNG instantiated
Net: eth0: enetc-0, eth1: enetc-2, eth2: swp0, eth3: swp1, eth4: swp2, eth5: swp3
=> qixis_reset sd
=> NOTICE: Fixed DDR on board

NOTICE: 4 GB DDR4, 32-bit, CL=11, ECC on
NOTICE: BL2: v1.5(release):LSDK-20.04-update-290520
NOTICE: BL2: Built : 13:52:31, May 18 2020
NOTICE: BL31: v1.5(release):LSDK-20.04-update-290520
NOTICE: BL31: Built : 13:52:31, May 18 2020
NOTICE: Welcome to LS1028 BL31 Phase


U-Boot 2019.10+fsl+g1e55b2f9e7 (May 26 2020 - 06:54:57 +0000)

SoC: LS1028AE Rev1.0 (0x870b0010)
Clock Configuration:
CPU0(A72):1500 MHz CPU1(A72):1500 MHz
Bus: 400 MHz DDR: 1600 MT/s
Reset Configuration Word (RCW):
00000000: 3c004010 00000030 00000000 00000000
00000010: 00000000 018f0000 0030c000 00000000
00000020: 01e031a0 00002580 00000000 00003296
00000030: 00000000 00000010 00000000 00000000
00000040: 00000000 00000000 00000000 00000000
00000050: 00000000 00000000 00000000 00000000
00000060: 00000000 00000000 200e705a 00000000
00000070: bb580000 00000000
Model: NXP Layerscape 1028a RDB Board
Board: LS1028AE Rev1.0-RDB, Version: C, boot from SD
FPGA: v6 (RDB)
SERDES1 Reference : Clock1 = 100.00MHz Clock2 = 100.00MHz
DRAM: 3.9 GiB
DDR 3.9 GiB (DDR4, 32-bit, CL=11, ECC on)
Using SERDES1 Protocol: 47960 (0xbb58)
PCIe0: pcie@3400000 Root Complex: no link
PCIe1: pcie@3500000 Root Complex: no link
WDT: Started with servicing (60s timeout)
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
EEPROM: NXID v1
In: serial
Out: serial
Err: serial
Net: eth0: enetc-0, eth2: enetc-2, eth4: felix-switch@0, eth5: felix-switch@1, eth6: felix-switch@2, eth7: felix-switch@3, eth8: felix-switch@4
=> pri aaaasetvar
aaaasetvar=linux
=>

0 件の賞賛
返信

10,071件の閲覧回数
GrzegorzHeldt
Contributor I

That is really good info.

Could you please share the set of layers and the versions that you have used to build this image?

This way I can build it on my side, check if it works for me, and understand the differences between your and my config.

In general, I've used versions described in this manual:

https://www.nxp.com/docs/en/user-guide/LSDKYOCTOUG.pdf

but make it minimal, skipping some layers and added libubootenv tools.

I assume your setup must be a bit different, as there is no libubootenv in original setup.

If you can provide your's:

build/conf/bblayers.conf

build/conf/local.conf

and SHA-versions of the layers you've used, then most likely my problem can still be resolved this year :-). 

 

Best Regards

Greg.

0 件の賞賛
返信

9,979件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

I followed procedure in https://source.codeaurora.org/external/qoriq/qoriq-components/yocto-sdk/tree/readme?h=dunfell to download Yocto recipes, and find libubootenv recipe in sources/poky/meta/recipes-bsp/u-boot/libubootenv_0.2.bb.

I run "bitbake libubootenv" to get fw_printenv and fw_setenv binaries in folder build_ls1028ardb/tmp/work/aarch64-fsl-linux/libubootenv/0.2+gitAUTOINC+f4b9cde381-r0/image/usr/bin, I then copied them to the target board to use.

I attached fw_printenv and fw_setenv binaries and atf images to you, please deploy them on your target board to do verification.

0 件の賞賛
返信

9,983件の閲覧回数
GrzegorzHeldt
Contributor I

@yipingwang Any further help ? Could you please provide your build setup ?

0 件の賞賛
返信

10,140件の閲覧回数
GrzegorzHeldt
Contributor I

Hello @yipingwang 

I have followed your advice. Not sure what to expect, to be honest.

=> env default -a
## Resetting to default environment
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=> qixis_reset sd
=> NOTICE: Fixed DDR on board

NOTICE: 4 GB DDR4, 32-bit, CL=11, ECC on
NOTICE: BL2: v1.5(release):LSDK-20.04-update-290520
NOTICE: BL2: Built : 13:52:31, May 18 2020
NOTICE: BL31: v1.5(release):LSDK-20.04-update-290520
NOTICE: BL31: Built : 13:52:31, May 18 2020
NOTICE: Welcome to LS1028 BL31 Phase


U-Boot 2020.01 (Jan 06 2020 - 20:56:31 +0000)

SoC: LS1028AE Rev1.0 (0x870b0010)
Clock Configuration:
CPU0(A72):1500 MHz CPU1(A72):1500 MHz
Bus: 400 MHz DDR: 1600 MT/s
Reset Configuration Word (RCW):
00000000: 3c004010 00000030 00000000 00000000
00000010: 00000000 018f0000 0030c000 00000000
00000020: 01e031a0 00002580 00000000 00003296
00000030: 00000000 00000010 00000000 00000000
00000040: 00000000 00000000 00000000 00000000
00000050: 00000000 00000000 00000000 00000000
00000060: 00000000 00000000 200e705a 00000000
00000070: bb580000 00000000
Model: NXP Layerscape 1028a RDB Board
Board: LS1028AE Rev1.0-RDB, Version: C, boot from SD
FPGA: v8 (RDB)
SERDES1 Reference : Clock1 = 100.00MHz Clock2 = 100.00MHz
DRAM: 3.9 GiB
DDR 3.9 GiB (DDR4, 32-bit, CL=11, ECC on)
Using SERDES1 Protocol: 47960 (0xbb58)
PCIe0: pcie@3400000 Root Complex: no link
PCIe1: pcie@3500000 Root Complex: no link
WDT: Started with servicing (60s timeout)
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
EEPROM: Invalid ID (ff ff ff ff)
In: serial
Out: serial
Err: serial
Net:
Warning: enetc-0 (eth0) using random MAC address - ba:51:30:48:a2:29
eth0: enetc-0
Warning: enetc-2 (eth1) using random MAC address - ba:01:0d:4c:6f:11
, eth1: enetc-2
Warning: enetc-6 (eth2) using random MAC address - 92:54:af:87:72:f9
, eth2: enetc-6
=>

 

0 件の賞賛
返信

10,139件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

There is no the following error in u-boot log.

Loading Environment from MMC... *** Warning - bad CRC, using default environment
0 件の賞賛
返信

10,135件の閲覧回数
GrzegorzHeldt
Contributor I

Dear @yipingwang 

Yes, there is no warning message anymore.

However, that has nothing to do with the problem I've described.

0 件の賞賛
返信

10,174件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

Please execute the following operations under u-boot.

=> env default -a
## Resetting to default environment
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK

=> qixis_reset sd

0 件の賞賛
返信

10,168件の閲覧回数
GrzegorzHeldt
Contributor I

Thank you for your help.

Cannot check it at the moment, will do it on Monday.

Anyway, could you please elaborate on how resetting SD can help, please? 

I would be very glad to understand.

0 件の賞賛
返信