Jetson Nano 上的 Rauc 和 Yocto - 无法找到主引导槽
Rauc and Yocto on Jetson Nano - Unable to find primary boot slot
这是 my other post 的延续。
我已经成功地使用 u-boot 和 rauce 创建了一个映像。
我做了一个简单的 rauc system.conf:
[system]
compatible=Jetson Nano
bootloader=uboot
#
[slot.rootfs.0]
device=/dev/mmcblk0p1
type=ext4
bootname=system0
#
[slot.rootfs.1]
device=/dev/mmcblk0p13
type=ext4
bootname=system1
[更新]:
几乎复制粘贴了 contrib uboot.sh script。
然后我在我的 bsp 层中添加了一个 bb 文件 from here。
并将 rauc 添加到我的 IMAGE_INSTALL。
当我用我的图像启动 nano 时,rauc 没有正常工作。当我使用 systemctl status rauc-mark-service-good.service
检查服务状态时,它 returns:
● rauc-mark-good.service - Rauc Good-marking Service
Loaded: loaded (/lib/systemd/system/rauc-mark-good.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2019-10-01 07:51:22 UTC; 4s ago
Process: 4147 ExecStart=/usr/bin/rauc status mark-good (code=exited, status=0/SUCCESS)
Main PID: 4147 (code=exited, status=0/SUCCESS)
Oct 01 07:51:22 jetson-nano systemd[1]: Started Rauc Good-marking Service.
Oct 01 07:51:22 jetson-nano rauc[4147]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4147]: rauc mark: marked slot rootfs.0 as good
Oct 01 07:51:22 jetson-nano systemd[1]: rauc-mark-good.service: Succeeded.
systemctl status rauc
returns:
● rauc.service - Rauc Update Service
Loaded: loaded (/lib/systemd/system/rauc.service; static; vendor preset: enabled)
Active: active (running) since Tue 2019-10-01 07:49:36 UTC; 2min 0s ago
Docs: https://rauc.readthedocs.io
Main PID: 4092 (rauc)
Tasks: 3 (limit: 4178)
Memory: 4.4M
CGroup: /system.slice/rauc.service
└─4092 /usr/bin/rauc --mount=/run/rauc service
Oct 01 07:49:36 jetson-nano systemd[1]: Starting Rauc Update Service...
Oct 01 07:49:36 jetson-nano systemd[1]: Started Rauc Update Service.
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /slot.raucs: No such file or directory
Oct 01 07:49:48 jetson-nano rauc[4092]: mounting slot /dev/mmcblk0p13
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /run/rauc/rootfs.1/slot.raucs: No such file or directory
Oct 01 07:51:22 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4092]: rauc mark: marked slot rootfs.0 as good
和rauc status
returns:
(rauc:4195): rauc-WARNING **: 07:51:46.126: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Compatible: Jetson Nano
Variant:
Booted from: rootfs.0 (/dev/mmcblk0p1)
Activated: (null) ((null))
slot states:
rootfs.0: class=rootfs, device=/dev/mmcblk0p1, type=ext4, bootname=system0
state=booted, description=, parent=(none), mountpoint=/
boot status=bad
rootfs.1: class=rootfs, device=/dev/mmcblk0p13, type=ext4, bootname=system1
state=inactive, description=, parent=(none), mountpoint=(none)
boot status=bad
所以没有 /slot.raucs
文件并且找不到主引导槽。
之后,systemctl status rauc-mark-good
returns rootfs.0 slot最终被标记为good,但是systemctl status rauc
显示boot status为bad
我在这里错过了什么?
我将 uboot 脚本编辑为以下内容:
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "system0 system1"
test -n "${BOOT_system0_LEFT}" || setenv BOOT_system0_LEFT 3
test -n "${BOOT_system1_LEFT}" || setenv BOOT_system1_LEFT 3
setenv bootargs
for BOOT_SLOT in "${BOOT_ORDER}"; do
if test "x${bootargs}" != "x"; then
# skip remaining slots
elif test "x${BOOT_SLOT}" = "xsystem0"; then
if test ${BOOT_system0_LEFT} -gt 0; then
setexpr BOOT_system0_LEFT ${BOOT_system0_LEFT} - 1
echo "Found valid slot system0, ${BOOT_system0_LEFT} attempts remaining"
setenv distro_bootpart "1"
setenv boot_line "mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf"
fi
elif test "x${BOOT_SLOT}" = "xsystem1"; then
if test ${BOOT_system1_LEFT} -gt 0; then
setexpr BOOT_system1_LEFT ${BOOT_system1_LEFT} - 1
echo "Found valid slot system1, ${BOOT_system1_LEFT} attempts remaining"
setenv distro_bootpart "13"
setenv boot_line "mmc 1:D any ${scriptaddr} /boot/extlinux/extlinux.conf"
fi
fi
done
if test -n "${bootargs}"; then
saveenv
else
echo "No valid slot found, resetting tries to 3"
setenv BOOT_system0_LEFT 3
setenv BOOT_system1_LEFT 3
saveenv
reset
fi
sysboot ${boot_line}
它最终成功了。显然,uboot 脚本中的 BOOT_ORDER "system0 system1"
存在一些问题,与 RAUC system.conf 中的不一样。当我重新编写脚本时,没有任何问题,并且 RAUC 运行 很好。
这是 my other post 的延续。
我已经成功地使用 u-boot 和 rauce 创建了一个映像。
我做了一个简单的 rauc system.conf:
[system]
compatible=Jetson Nano
bootloader=uboot
#
[slot.rootfs.0]
device=/dev/mmcblk0p1
type=ext4
bootname=system0
#
[slot.rootfs.1]
device=/dev/mmcblk0p13
type=ext4
bootname=system1
[更新]:
几乎复制粘贴了 contrib uboot.sh script。
然后我在我的 bsp 层中添加了一个 bb 文件 from here。
并将 rauc 添加到我的 IMAGE_INSTALL。
当我用我的图像启动 nano 时,rauc 没有正常工作。当我使用 systemctl status rauc-mark-service-good.service
检查服务状态时,它 returns:
● rauc-mark-good.service - Rauc Good-marking Service
Loaded: loaded (/lib/systemd/system/rauc-mark-good.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2019-10-01 07:51:22 UTC; 4s ago
Process: 4147 ExecStart=/usr/bin/rauc status mark-good (code=exited, status=0/SUCCESS)
Main PID: 4147 (code=exited, status=0/SUCCESS)
Oct 01 07:51:22 jetson-nano systemd[1]: Started Rauc Good-marking Service.
Oct 01 07:51:22 jetson-nano rauc[4147]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4147]: rauc mark: marked slot rootfs.0 as good
Oct 01 07:51:22 jetson-nano systemd[1]: rauc-mark-good.service: Succeeded.
systemctl status rauc
returns:
● rauc.service - Rauc Update Service
Loaded: loaded (/lib/systemd/system/rauc.service; static; vendor preset: enabled)
Active: active (running) since Tue 2019-10-01 07:49:36 UTC; 2min 0s ago
Docs: https://rauc.readthedocs.io
Main PID: 4092 (rauc)
Tasks: 3 (limit: 4178)
Memory: 4.4M
CGroup: /system.slice/rauc.service
└─4092 /usr/bin/rauc --mount=/run/rauc service
Oct 01 07:49:36 jetson-nano systemd[1]: Starting Rauc Update Service...
Oct 01 07:49:36 jetson-nano systemd[1]: Started Rauc Update Service.
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /slot.raucs: No such file or directory
Oct 01 07:49:48 jetson-nano rauc[4092]: mounting slot /dev/mmcblk0p13
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /run/rauc/rootfs.1/slot.raucs: No such file or directory
Oct 01 07:51:22 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4092]: rauc mark: marked slot rootfs.0 as good
和rauc status
returns:
(rauc:4195): rauc-WARNING **: 07:51:46.126: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Compatible: Jetson Nano
Variant:
Booted from: rootfs.0 (/dev/mmcblk0p1)
Activated: (null) ((null))
slot states:
rootfs.0: class=rootfs, device=/dev/mmcblk0p1, type=ext4, bootname=system0
state=booted, description=, parent=(none), mountpoint=/
boot status=bad
rootfs.1: class=rootfs, device=/dev/mmcblk0p13, type=ext4, bootname=system1
state=inactive, description=, parent=(none), mountpoint=(none)
boot status=bad
所以没有 /slot.raucs
文件并且找不到主引导槽。
之后,systemctl status rauc-mark-good
returns rootfs.0 slot最终被标记为good,但是systemctl status rauc
显示boot status为bad
我在这里错过了什么?
我将 uboot 脚本编辑为以下内容:
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "system0 system1"
test -n "${BOOT_system0_LEFT}" || setenv BOOT_system0_LEFT 3
test -n "${BOOT_system1_LEFT}" || setenv BOOT_system1_LEFT 3
setenv bootargs
for BOOT_SLOT in "${BOOT_ORDER}"; do
if test "x${bootargs}" != "x"; then
# skip remaining slots
elif test "x${BOOT_SLOT}" = "xsystem0"; then
if test ${BOOT_system0_LEFT} -gt 0; then
setexpr BOOT_system0_LEFT ${BOOT_system0_LEFT} - 1
echo "Found valid slot system0, ${BOOT_system0_LEFT} attempts remaining"
setenv distro_bootpart "1"
setenv boot_line "mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf"
fi
elif test "x${BOOT_SLOT}" = "xsystem1"; then
if test ${BOOT_system1_LEFT} -gt 0; then
setexpr BOOT_system1_LEFT ${BOOT_system1_LEFT} - 1
echo "Found valid slot system1, ${BOOT_system1_LEFT} attempts remaining"
setenv distro_bootpart "13"
setenv boot_line "mmc 1:D any ${scriptaddr} /boot/extlinux/extlinux.conf"
fi
fi
done
if test -n "${bootargs}"; then
saveenv
else
echo "No valid slot found, resetting tries to 3"
setenv BOOT_system0_LEFT 3
setenv BOOT_system1_LEFT 3
saveenv
reset
fi
sysboot ${boot_line}
它最终成功了。显然,uboot 脚本中的 BOOT_ORDER "system0 system1"
存在一些问题,与 RAUC system.conf 中的不一样。当我重新编写脚本时,没有任何问题,并且 RAUC 运行 很好。