I'm setting up a custom Yocto distro that will go into a custom board (right now still using dev board).
I have custom partitions A & B for boot & root and I'm implementing RAUC, I've reached a point where it seems that the partitions are ok, RAUC seems to be installed and up but fw_printenv & fw_setenv are not working, so RAUC gets stuck there.
> cat /etc/fw_env.config
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mmcblk0boot0 0x1ff000 0x1000
This is what I have inside fw_env.config and these are theoretically the emmc configurations:
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
Some other stuff that seems to look ok:
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
These are the logs when booting the kernel:
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
Any ideas on how to better debug this or well...ideally on how to fix it?
It seems that the problem is that the env is not saved inside the flash, it's loaded in the U-Boot at RAM and then once the kernel is booted this is lost.
Inside U-Boot if you
saveenv
and then boot, it will fix the issue.