summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh')
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh40
1 files changed, 29 insertions, 11 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index d58826a24..441e25238 100644
--- a/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/import-layers/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -29,7 +29,13 @@ esac
echo "Searching for hard drives ..."
-for device in `ls /sys/block/`; do
+# Some eMMC devices have special sub devices such as mmcblk0boot0 etc
+# we're currently only interested in the root device so pick them wisely
+devices=`ls /sys/block/ | grep -v mmcblk` || true
+mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true
+devices="$devices $mmc_devices"
+
+for device in $devices; do
case $device in
loop*)
# skip loop device
@@ -78,17 +84,23 @@ for hdname in $hdnamelist; do
cat /sys/block/$hdname/device/uevent
fi
echo
- # Get user choice
- while true; do
- echo -n "Do you want to install this image there? [y/n] "
- read answer
- if [ "$answer" = "y" -o "$answer" = "n" ]; then
+done
+
+# Get user choice
+while true; do
+ echo "Please select an install target or press n to exit ($hdnamelist ): "
+ read answer
+ if [ "$answer" = "n" ]; then
+ echo "Installation manually aborted."
+ exit 1
+ fi
+ for hdname in $hdnamelist; do
+ if [ "$answer" = "$hdname" ]; then
+ TARGET_DEVICE_NAME=$answer
break
fi
- echo "Please answer y or n"
done
- if [ "$answer" = "y" ]; then
- TARGET_DEVICE_NAME=$hdname
+ if [ -n "$TARGET_DEVICE_NAME" ]; then
break
fi
done
@@ -116,8 +128,8 @@ umount ${device}* 2> /dev/null || /bin/true
mkdir -p /tmp
# Create /etc/mtab if not present
-if [ ! -e /etc/mtab ]; then
- cat /proc/mounts > /etc/mtab
+if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then
+ ln -sf /proc/mounts /etc/mtab
fi
disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
@@ -138,6 +150,12 @@ if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
+
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+ rootwait="rootwait"
+fi
+
bootfs=${device}${part_prefix}1
rootfs=${device}${part_prefix}2
swap=${device}${part_prefix}3
OpenPOWER on IntegriCloud