[OpenWrt-Devel] [RFC] Fixing broke sysupgrade caused by r47878 (add mr18)

Christian Lamparter chunkeey at googlemail.com
Sat Dec 12 17:48:32 EST 2015

The patch "ar71xx: add support for Cisco's MR18" unfortunately
broke sysupgrade for non-nand ar71xx platforms. This is because
the merakinand.sh was added to the base-files for the ar71xx
platforms and it tries to load /lib/upgrade/nand.sh which is only
present if procd-nand is selected (which happens only for
ar71xx-nand devices)
For people affected by this:
just remove the /lib/upgrade/merakinand.sh file on the
platform. (You can do that on the router - you don't need it.)
I see two possible solutions ATM:

1. put . /lib/upgrade/nand.sh include into the merakinand_* functions

diff --git a/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh b/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
index fe78e9f..84f9ab5 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
@@ -7,7 +7,6 @@
 . /lib/ar71xx.sh
 . /lib/functions.sh
-. /lib/upgrade/nand.sh
 get_magic_at() {
 	local mtddev=$1
@@ -32,6 +31,8 @@ mr18_is_caldata_valid() {
 merakinand_copy_caldata() {
+	. /lib/upgrade/nand.sh
 	local cal_src=$1
 	local cal_dst=$2
 	local ubidev=$( nand_find_ubi $CI_UBIPART )
@@ -79,6 +80,8 @@ merakinand_copy_caldata() {
 merakinand_do_kernel_check() {
+	. /lib/upgrade/nand.sh
 	local board_name="$1"
 	local tar_file="$2"
 	local image_magic_word=`(tar xf $tar_file sysupgrade-$board_name/kernel -O 2>/dev/null | dd bs=1 count=4 skip=0 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"')`


2. move merakinand.sh to procd 
This should work like the nand case otherwise. See nand_do_kernel_check.

first move the helper scripts into the proc package
(git) mv target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh package/system/procd/files/

diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index cc5f91d..454886d 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -131,6 +131,7 @@ define Package/procd-nand/install
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
 	$(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
+	$(INSTALL_DATA) ./files/merakinand.sh $(1)/lib/upgrade/
 define Package/procd-nand-firstboot/install

I'm leaning for the second option, but if someone has 
a better recommendation or option, I'm all ears.

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list