由于设置自定义 Yocto 映像时 fw_printenv 和 fw_setenv 出现问题,RAUC 无法工作

问题描述 投票:0回答:1

我正在设置一个自定义 Yocto 发行版,它将进入自定义板(目前仍在使用开发板)。

我有用于启动和根的自定义分区 A 和 B,并且我正在实现 RAUC,我已经达到了分区似乎没问题的地步,RAUC 似乎已安装并启动,但 fw_printenv 和 fw_setenv 不起作用,所以RAUC 陷入困境。

> cat /etc/fw_env.config 
# MTD device name   Device offset   Env. size   Flash sector size  Number of sectors
/dev/mmcblk0boot0   0x1ff000        0x1000

这是我在 fw_env.config 中的内容,理论上这些是 emmc 配置:

CONFIG_ENV_SIZE=0x1000
CONFIG_ENV_OFFSET=0x1FF000
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_MMC_ENV_PART=1
CONFIG_SUPPORT_EMMC_BOOT=y

其他一些看起来不错的东西:

root@qsmp-1570:~# ls -l /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 16 Jan  1 01:41 /dev/mmcblk0boot0

root@qsmp-1570:~# fdisk -l             
Found valid GPT with protective MBR; using GPT

Disk /dev/mmcblk0: 7733248 sectors, 3776M
Logical sector size: 512
Disk identifier (GUID): 4d27c97e-fde1-451e-b80f-48e3c3aa58b4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7733214

Number  Start (sector)    End (sector)  Size Name
     1            2048            6143 2048K fip
     2            6144          137215 64.0M boot_a
     3          137216          268287 64.0M boot_b
     4          268288         2365439 1024M rootfs_a
     5         2365440         4462591 1024M rootfs_b
     6         4462592         7732223 1596M data
Disk /dev/mmcblk0boot0: 2 MB, 2097152 bytes, 4096 sectors
64 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk0boot0 doesn't contain a valid partition table
Disk /dev/mmcblk0boot1: 2 MB, 2097152 bytes, 4096 sectors
64 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk0boot1 doesn't contain a valid partition table

这些是启动内核时的日志:

Starting kernel ...

I/TC: Secondary CI/TC: Secondary CPU 1 switching to normal world boot
[    0.144724] Driver 'scmi-optee' was unable to register with bus_type 'tee' because the bus was not initialized.
[    0.322344] stm32-sys-bus 5c007000.etzpc: Failed to create device link (0x180) with firmware:scmi
[    0.322370] stm32-sys-bus 5c007000.etzpc: Failed to create device link (0x180) with firmware:scmi
[    0.368141] stm32-sys-bus 5c007000.etzpc: Failed to create device link (0x180) with 50000000.rcc
INIT: version 3.04 booting
Initializing /var... Done.
Starting udev
mount: /: can't find PARTLABEL=rootfs.
*** ERROR!  Cannot fsck root fs because it is not mounted read-only!

mount: /: can't find PARTLABEL=rootfs.
fsck from util-linux 2.38.1
ALSA: Restoring mixer settings...
INIT: Entering runlevel: 2
Configuring network interfaces... dhcpcd-9.4.1 starting
sandbox unavailable: seccomp
sandbox unavailable: seccomp
[    7.230663] m_can_platform 4400e000.can can0: bit-timing not yet defined
[    7.235991] m_can_platform 4400e000.can can0: failed to open can device
no inter[    7.243634] m_can_platform 4400f000.can can1: bit-timing not yet defined
[    7.250174] m_can_platform 4400f000.can can1: failed to open can device
faces have a carrier
done.
Starting internet superserver: inetd.
Cannot find device "eth0"
Starting system message bus: dbus.
00:00:00.000  [c/debug/seatd/0.7.0-r0/seatd/seat.c:39] Created VT-bound seat seat0
00:00:00.001  [c/debug/seatd/0.7.0-r0/seatd/seatd.c:194] seatd started
Starting OpenBSD Secure Shell server: sshd
  generating ssh RSA host key...
  generating ssh ECDSA host key...
  generating ssh ED25519 host key...
done.
Starting rpcbind daemon...done.
starting statd: done
starting Busybox HTTP Daemon: httpd... done.
Starting ntpd: 00:00:07.402  [c/debug/seatd/0.7.0-r0/seatd/server.c:145] New client connected (pid: 365, uid: 1000, gid: 1000)
00:00:07.402  [c/debug/seatd/0.7.0-r0/seatd/seat.c:170] Added client 1 to seat0
00:00:07.403  [c/debug/seatd/0.7.0-r0/seatd/seat.c:480] Opened client 1 on seat0
00:00:07.407  [c/debug/seatd/0.7.0-r0/seatd/seat.c:418] No clients on seat0 to activate
00:00:07.408  [c/debug/seatd/0.7.0-r0/seatd/seat.c:524] Closed client 1 on seat0
00:00:07.408  [c/debug/seatd/0.7.0-r0/seatd/seat.c:192] Removed client 1 from seat0
00:00:07.409  [c/debug/seatd/0.7.0-r0/seatd/client.c:471] Client disconnected
Internal warning: debug scope 'drm-backend' has not been destroyed.
done
Starting syslogd/klogd: done
Starting crond: OK
Starting nginx: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
2000/01/01 01:41:57 [emerg] 399#399: mkdir() "/run/nginx/client_body_temp" failed (2: No such file or directory)

(rauc:401): rauc-WARNING **: 01:41:57.617: Failed getting primary slot: uboot backend: fw_printenv failed with exit code: 243

rauc mark: Failed marking slot rootfs.0 as good: uboot backend: Failed to run fw_setenv: Child process exited with code 243

关于如何更好地调试这个问题或者...理想情况下如何修复它有什么想法吗?

linux-kernel environment-variables yocto u-boot
1个回答
0
投票

问题似乎在于环境没有保存在闪存内,而是加载到 RAM 中的 U-Boot 中,然后一旦内核启动,环境就会丢失。

在 U-Boot 里面,如果你

saveenv

然后启动,问题就解决了。

© www.soinside.com 2019 - 2024. All rights reserved.