Skip to content

Commit de96f66

Browse files
nehebrobimarko
authored andcommitted
ipq60xx: linksys: add partition selection
Instead of upgrading both kernels, allow support for selecting the partition during sysupgrade. Copy/Paste of Linux MX devices on the same target. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: openwrt/openwrt#22594 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent 2637511 commit de96f66

1 file changed

Lines changed: 40 additions & 11 deletions

File tree

  • target/linux/qualcommax/ipq60xx/base-files/lib/upgrade

target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,44 @@ tplink_do_upgrade() {
116116
nand_do_upgrade "$1"
117117
}
118118

119+
linksys_mr_pre_upgrade() {
120+
local setenv_script="/tmp/fw_env_upgrade"
121+
122+
CI_UBIPART="rootfs"
123+
boot_part="$(fw_printenv -n boot_part)"
124+
if [ -n "$UPGRADE_OPT_USE_CURR_PART" ]; then
125+
if [ "$boot_part" -eq "2" ]; then
126+
CI_KERNPART="alt_kernel"
127+
CI_UBIPART="alt_rootfs"
128+
fi
129+
else
130+
if [ "$boot_part" -eq "1" ]; then
131+
echo "boot_part 2" >> $setenv_script
132+
CI_KERNPART="alt_kernel"
133+
CI_UBIPART="alt_rootfs"
134+
else
135+
echo "boot_part 1" >> $setenv_script
136+
fi
137+
fi
138+
139+
boot_part_ready="$(fw_printenv -n boot_part_ready)"
140+
if [ "$boot_part_ready" -ne "3" ]; then
141+
echo "boot_part_ready 3" >> $setenv_script
142+
fi
143+
144+
auto_recovery="$(fw_printenv -n auto_recovery)"
145+
if [ "$auto_recovery" != "yes" ]; then
146+
echo "auto_recovery yes" >> $setenv_script
147+
fi
148+
149+
if [ -f "$setenv_script" ]; then
150+
fw_setenv -s $setenv_script || {
151+
echo "failed to update U-Boot environment"
152+
return 1
153+
}
154+
fi
155+
}
156+
119157
platform_check_image() {
120158
return 0;
121159
}
@@ -192,17 +230,8 @@ platform_do_upgrade() {
192230
;;
193231
linksys,mr7350|\
194232
linksys,mr7500)
195-
boot_part="$(fw_printenv -n boot_part)"
196-
if [ "$boot_part" -eq "1" ]; then
197-
fw_setenv boot_part 2
198-
CI_KERNPART="alt_kernel"
199-
CI_UBIPART="alt_rootfs"
200-
else
201-
fw_setenv boot_part 1
202-
CI_UBIPART="rootfs"
203-
fi
204-
fw_setenv boot_part_ready 3
205-
fw_setenv auto_recovery yes
233+
linksys_mr_pre_upgrade "$1"
234+
remove_oem_ubi_volume squashfs
206235
nand_do_upgrade "$1"
207236
;;
208237
tplink,eap610-outdoor|\

0 commit comments

Comments
 (0)