[LEDE-DEV] [PATCHv2 2/2] x86: accomodate mmc devices in sysupgrade for apu2
Russell Senior
russell at personaltelco.net
Mon May 23 00:05:52 PDT 2016
also adds /usr/bin/find to the ramdisk during flashing. find is
busybox, so the space consequences should be tiny.
Signed-off-by: Russell Senior <russell at personaltelco.net>
---
package/base-files/files/lib/upgrade/common.sh | 1 +
target/linux/x86/base-files/lib/upgrade/platform.sh | 16 ++++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 0383d25..08f7d43 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -55,6 +55,7 @@ run_ramfs() { # <command> [...]
/bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
/bin/rm /usr/bin/basename /bin/kill /bin/chmod
+ install_bin /usr/bin/find
install_bin /bin/uclient-fetch /bin/wget
install_bin /sbin/mtd
install_bin /sbin/mount_root
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 29eac77..12c7340 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -17,11 +17,15 @@ 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 partdelim="p"
+ else
+ export partdelim=""
+ fi
+ export BOOTPART="${disk}${partdelim}1"
return 0
fi
done
@@ -88,7 +92,7 @@ get_partitions() { # <device> <filename>
platform_do_upgrade() {
platform_export_bootpart
- disk="${BOOTPART%[0-9]}"
+ disk="${BOOTPART%${partdelim}[0-9]}"
if [ -b "$disk" ]; then
sync
@@ -120,8 +124,8 @@ platform_do_upgrade() {
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
- echo "Writing image to $disk$part..."
- get_image "$@" | dd of="$disk$part" ibs="$ibs" obs=1M skip="$start" count="$size" conv=fsync
+ echo "Writing image to ${disk}${partdelim}${part}..."
+ get_image "$@" | dd of="${disk}${partdelim}${part}" ibs="$ibs" obs=1M skip="$start" count="$size" conv=fsync
done < /tmp/partmap.image
#copy partition uuid
--
2.8.2
--
Russell Senior, President
russell at personaltelco.net
More information about the Lede-dev
mailing list