@@ -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
@@ -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
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@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(-)