Skip to content

Commit e6d45bd

Browse files
committed
sysupgrade: point a kernel-volume NAND camera at ipctool nand-migrate
The first FIT NAND layout, with the kernel in a UBI volume of its own, was refused with only "reinstall it from U-Boot", which needs a serial console. Its U-Boot is a FIT NAND build that loads a kernel from UBIFS, so ipctool nand-migrate (OpenIPC/ipctool#243) moves it to the current layout in place: it rewrites the rootfs, switches bootcmd and drops the kernel volume, keeping U-Boot and the settings. Say so. A ubiblock camera on a SoC that moved keeps the reinstall message: its U-Boot predates FIT, and nand-migrate refuses it.
1 parent b912221 commit e6d45bd

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎.github/scripts/test_sysupgrade.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,8 +2194,9 @@ reset_env; ubi_setup ubifs-kvol
21942194
STUB_PIVOT_RC=0
21952195
run -z --kernel="$UFIT" --rootfs="$UFS"
21962196
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q "retired NAND layout with a separate kernel volume" &&
2197+
printf '%s' "$OUT" | grep -q "ipctool nand-migrate" &&
21972198
nothing_ubi && ! handed_off && ! rebooted; then
2198-
ok "ubifs-kvol: refused before anything is touched, reinstall link given"
2199+
ok "ubifs-kvol: refused before anything is touched, nand-migrate and reinstall link given"
21992200
else
22002201
bad "ubifs-kvol must be refused, rc=$RC log='$(cat "$SB/tmp/flash.log")' out='$OUT'"
22012202
fi
@@ -2728,7 +2729,9 @@ default_url_is "$F/openipc.ssc338q-nor-ultimate.tgz" ubi_setup ubiblock
27282729
reset_env; UBLOCK_SOC=gk7205v500 ubi_setup ubiblock
27292730
STUB_PIVOT_RC=0
27302731
run -z --kernel="$UK" --rootfs="$US"
2732+
# nand-migrate needs a FIT U-Boot, which a ubiblock camera does not have
27312733
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q "retired NAND layout with a separate kernel volume" &&
2734+
! printf '%s' "$OUT" | grep -q "nand-migrate" &&
27322735
nothing_ubi && ! handed_off && ! rebooted; then
27332736
ok "ubiblock on gk7205v500: refused before anything is touched, reinstall link given"
27342737
else

‎general/overlay/usr/sbin/sysupgrade‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# OpenIPC.org | 2025
3-
scr_version=1.0.71
3+
scr_version=1.0.72
44

55
args="$@"
66
LOCK_FILE=/tmp/sysupgrade.lock
@@ -2958,8 +2958,17 @@ fi
29582958
# that moved to the kernel-in-rootfs one: current images for them carry the
29592959
# kernel inside the UBIFS rootfs and size the volumes to it. ubiblock stays
29602960
# for the rest (nand_layout_moved).
2961+
#
2962+
# The first FIT layout (ubifs-kvol) can move over in place: its U-Boot is a
2963+
# FIT NAND build, which loads a kernel from UBIFS, so `ipctool nand-migrate`
2964+
# rewrites the rootfs, switches bootcmd and drops the kernel volume, with no
2965+
# serial console (OpenIPC/ipctool#243). A ubiblock camera's U-Boot predates
2966+
# FIT; that one is reinstalled from U-Boot.
2967+
if { [ "1" = "$update_kernel" ] || [ "1" = "$update_rootfs" ]; } && [ "$ubi_layout" = "ubifs-kvol" ]; then
2968+
die "This camera uses the retired NAND layout with a separate kernel volume; current images carry the kernel inside the rootfs. Move it over without a serial console: copy rootfs.ubifs.* from its -nand- package to /tmp and run 'ipctool nand-migrate /tmp/rootfs.ubifs.<soc>' (it keeps U-Boot and the settings, and reboots), or reinstall it from U-Boot: https://openipc.org/cameras/vendors/$vendor/socs/$model -- nothing was written."
2969+
fi
29612970
if { [ "1" = "$update_kernel" ] || [ "1" = "$update_rootfs" ]; } &&
2962-
{ [ "$ubi_layout" = "ubifs-kvol" ] || { [ "$ubi_layout" = "ubiblock" ] && nand_layout_moved; }; }; then
2971+
[ "$ubi_layout" = "ubiblock" ] && nand_layout_moved; then
29632972
die "This camera uses the retired NAND layout with a separate kernel volume; current images carry the kernel inside the rootfs. Reinstall it from U-Boot with the current NAND instructions: https://openipc.org/cameras/vendors/$vendor/socs/$model -- nothing was written."
29642973
fi
29652974
# On the ubifs layout the kernel is a file in the rootfs: there is no kernel

0 commit comments

Comments
 (0)