[LEDE-DEV] [PATCH 2/2] x86: fix sysupgrade to work on mmcblk

Russell Senior russell at personaltelco.net
Sun May 22 13:27:49 PDT 2016


Reworks block device detection slightly and accomodates the different
partition naming scheme, e.g. mmcblk0p1 vs sda1

Signed-off-by: Russell Senior <russell at personaltelco.net>
---
 target/linux/x86/base-files/lib/upgrade/platform.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 29eac77..04508b7 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -17,11 +17,14 @@ platform_export_bootpart() {
 			PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
 				uuid="${disk#PARTUUID=}"
 				uuid="${uuid%-02}"
-				for disk in /dev/*; do
-					[ -b "$disk" ] || continue
+				for disk in $(find /dev -type b); do
 					set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
 					if [ "$4$3$2$1" = "$uuid" ]; then
-						export BOOTPART="${disk}1"
+						if echo $disk | grep -q mmc - ; then
+							export BOOTPART="${disk}p1
+						else
+							export BOOTPART="${disk}1"
+						fi
 						return 0
 					fi
 				done
-- 
2.8.2



-- 
Russell Senior, President
russell at personaltelco.net



More information about the Lede-dev mailing list