Browse Source

Backport a few more sysupgrade packages

Improve error handling a bit, and fix upgrade for some (unsupported or
broken) targets.
Matthias Schiffer 6 years ago
parent
commit
4a75648658

+ 4 - 4
patches/lede/0012-procd-switch-to-latest-master.patch

@@ -1,9 +1,9 @@
 From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Sat, 8 Jul 2017 14:44:00 +0200
+Date: Thu, 13 Jul 2017 17:15:21 +0200
 Subject: procd: switch to latest master
 
 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
-index 70515958cd5002841fd9698b7a7f4aec01ddfb3b..2a1fed4e6e2388806ee4230af2872b4bcc8f1613 100644
+index 70515958cd5002841fd9698b7a7f4aec01ddfb3b..d78b4e0fe1b4cd12dd873ff55250ed833de50e05 100644
 --- a/package/system/procd/Makefile
 +++ b/package/system/procd/Makefile
 @@ -12,9 +12,9 @@ PKG_RELEASE:=1
@@ -14,8 +14,8 @@ index 70515958cd5002841fd9698b7a7f4aec01ddfb3b..2a1fed4e6e2388806ee4230af2872b4b
 -PKG_SOURCE_VERSION:=89918c8cb78e651ee0922f13a96b7f25fc2f285a
 -PKG_MIRROR_HASH:=fad1a37227f85070f6a49a37ea1e98c22c066c91f16ad26898152972eb0c6a91
 +PKG_SOURCE_DATE:=2017-07-13
-+PKG_SOURCE_VERSION:=d749b2a3507517ff0fe39f7dac69f44ce20c56a2
-+PKG_MIRROR_HASH:=388c9f8ac28c922bb8f7889d5bfe11d9afd1bee96243bb5b77897dd1a13b3a43
++PKG_SOURCE_VERSION:=76dcbee7fd3a90221619feb7e4c572e00b60af9b
++PKG_MIRROR_HASH:=61460e267fbc1e3269caac4b98d7d351c6ccfa0b4f3493b37dad83a6faad4b2e
  CMAKE_INSTALL:=1
  
  PKG_LICENSE:=GPL-2.0

+ 1 - 1
patches/lede/0016-procd-remove-procd-nand-package.patch

@@ -435,7 +435,7 @@ index 0000000000000000000000000000000000000000..6bd2005344c081df20e5a330a69e49e3
 +	nand_upgrade_stage1
 +}
 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
-index 2a1fed4e6e2388806ee4230af2872b4bcc8f1613..ac0e525aed8f72b52cac892b360b3be1edcd7e1d 100644
+index d78b4e0fe1b4cd12dd873ff55250ed833de50e05..98cac395f9f60f581a384a51a5b2a0f03f16df25 100644
 --- a/package/system/procd/Makefile
 +++ b/package/system/procd/Makefile
 @@ -22,11 +22,9 @@ PKG_LICENSE_FILES:=

+ 39 - 0
patches/lede/0033-bcm53xx-upgrade-fix-RAMFS_COPY_.patch

@@ -0,0 +1,39 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 10 Jun 2017 16:14:54 +0200
+Subject: bcm53xx: upgrade: fix RAMFS_COPY_*
+
+Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
+index 097ad63adfecdd70019acaa5b652d2056e774c3f..8cc8c8b34e9f349f1d1283ac00f9782b52ab01c1 100755
+--- a/package/base-files/files/lib/upgrade/stage2
++++ b/package/base-files/files/lib/upgrade/stage2
+@@ -48,7 +48,7 @@ switch_to_ramfs() {
+ 		/bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
+ 		/bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir	\
+ 		/bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
+-		/bin/mknod /bin/touch
++		/bin/mknod /bin/touch /bin/sed
+ 
+ 	install_bin /sbin/mtd
+ 	install_bin /sbin/mount_root
+diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+index eb6dc823e3890497389716c32ec7e4caf8d30c45..a90a58299dc293afbe15a0b491ef6898402deca4 100644
+--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
++++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+@@ -1,3 +1,5 @@
++RAMFS_COPY_BIN='/usr/bin/osafeloader /usr/bin/oseama'
++
+ PART_NAME=firmware
+ 
+ # $(1): file to read magic from
+@@ -260,8 +262,6 @@ platform_pre_upgrade_seama() {
+ }
+ 
+ platform_pre_upgrade() {
+-	export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/bin/osafeloader /usr/bin/oseama /bin/sed"
+-
+ 	local file_type=$(platform_identify "$1")
+ 
+ 	[ "$(platform_flash_type)" != "nand" ] && return

+ 68 - 0
patches/lede/0034-ipq806x-upgrade-fix-RAMFS_COPY_.patch

@@ -0,0 +1,68 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 10 Jul 2017 18:03:39 +0200
+Subject: ipq806x: upgrade: fix RAMFS_COPY_*
+
+RAMFS_COPY_* are moved to platform.sh toplevel. The unneeded
+linksys_preupgrade function is removed, and the nand_do_upgrade call is
+moved to platform_do_upgrade.
+
+Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
+index 12f25efdae87979e79a252237f735932cb66d42f..0234ce0a51a0a92dcd719102f83e19686442574a 100644
+--- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
++++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
+@@ -99,12 +99,3 @@ platform_do_upgrade_linksys() {
+ 		fi
+ 	}
+ }
+-
+-linksys_preupgrade() {
+-	export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
+-	export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
+-	export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
+-
+-}
+-
+-append sysupgrade_pre_upgrade linksys_preupgrade
+diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+index c3741f9ff242cddb3c185c2f638c7b4dff781e1b..6455b57cfb1346b7cc9e103065080d8ae92edc19 100644
+--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+@@ -3,11 +3,14 @@
+ PART_NAME=firmware
+ REQUIRE_IMAGE_METADATA=1
+ 
++RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
++RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
++
+ platform_check_image() {
+ 	return 0;
+ }
+ 
+-platform_pre_upgrade() {
++platform_do_upgrade() {
+ 	local board=$(ipq806x_board_name)
+ 
+ 	case "$board" in
+@@ -17,18 +20,8 @@ platform_pre_upgrade() {
+ 	r7500 |\
+ 	r7500v2 |\
+ 	r7800)
+-		nand_do_upgrade "$1"
+-		;;
+-	ea8500)
+-		linksys_preupgrade "$1"
++		nand_do_upgrade "$ARGV"
+ 		;;
+-	esac
+-}
+-
+-platform_do_upgrade() {
+-	local board=$(ipq806x_board_name)
+-
+-	case "$board" in
+ 	c2600)
+ 		PART_NAME="os-image:rootfs"
+ 		MTD_CONFIG_ARGS="-s 0x200000"

+ 60 - 0
patches/lede/0035-kirkwood-upgrade-fix-RAMFS_COPY_.patch

@@ -0,0 +1,60 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 10 Jul 2017 18:16:23 +0200
+Subject: kirkwood: upgrade: fix RAMFS_COPY_*
+
+RAMFS_COPY_* are moved to platform.sh toplevel. The nand_do_upgrade call is
+moved to platform_do_upgrade.
+
+Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+diff --git a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
+index 13a8f1cb554462acf39a59c9d5c1e6cd4ec222f5..dde3bd1b2190d68ce54e6c2883a45032d58599b2 100644
+--- a/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
++++ b/target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
+@@ -69,11 +69,3 @@ platform_do_upgrade_linksys() {
+ 		fi
+ 	}
+ }
+-
+-linksys_preupgrade() {
+-	export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
+-	export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
+-	export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
+-}
+-
+-append sysupgrade_pre_upgrade linksys_preupgrade
+diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
+index e7c6a1120a90147380f4fcf644eb7078c1bc1659..c8c66c1b9d67759305ee836f9d84b9a2968a9493 100644
+--- a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
++++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
+@@ -1,5 +1,8 @@
+ . /lib/kirkwood.sh
+ 
++RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
++RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
++
+ platform_check_image() {
+ 	[ "$#" -gt 1 ] && return 1
+ 	local board="$(kirkwood_board_name)"
+@@ -33,19 +36,7 @@ platform_do_upgrade() {
+ 		platform_do_upgrade_linksys "$ARGV"
+ 		;;
+ 	*)
+-		default_do_upgrade "$@"
+-		;;
+-	esac
+-}
+-
+-platform_pre_upgrade() {
+-	local board=$(kirkwood_board_name)
+-
+-	case "$board" in
+-	"linksys-audi"|\
+-	"linksys-viper") ;;
+-	*)
+-		nand_do_upgrade $1
++		nand_do_upgrade "$ARGV"
+ 		;;
+ 	esac
+ }