[OE-core] [PATCH] initrdscripts: handle mmc device as installer medium

Belal, Awais Awais_Belal at mentor.com
Mon Jul 13 00:23:49 UTC 2015


Hi folks,

Any objections on the below patch?

BR,
Awais

________________________________________
From: openembedded-core-bounces at lists.openembedded.org [openembedded-core-bounces at lists.openembedded.org] on behalf of Belal, Awais
Sent: Tuesday, July 07, 2015 12:43 PM
To: openembedded-core at lists.openembedded.org
Subject: [OE-core] [PATCH] initrdscripts: handle mmc device as installer        medium

Platforms which have the capability of using the MMC as an
installer medium will present the same MMC device as an
installation candidate. This happens because the MMC
devices appear as mmcblk<X> and the current script strips
up the <X> which is needed to identify an MMC device
uniqely.
This patch now updates the way device identifier stripping
is done and handles the exclusion of installer device from
installation candidates more generically.

Signed-off-by: Awais Belal <awais_belal at mentor.com>
---
 .../initrdscripts/files/init-install-efi.sh          | 20 ++++++++++++++++----
 .../recipes-core/initrdscripts/files/init-install.sh | 20 ++++++++++++++++----
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 14939ac..f339b30 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -18,7 +18,14 @@ swap_ratio=5
 hdnamelist=""
 live_dev_name=`cat /proc/mounts | grep ${1%/} | awk '{print $1}'`
 live_dev_name=${live_dev_name#\/dev/}
-live_dev_name=${live_dev_name%%[0-9]*}
+# Only strip the digit identifier if the device is not an mmc
+case $live_dev_name in
+    mmcblk*)
+    ;;
+    *)
+        live_dev_name=${live_dev_name%%[0-9]*}
+    ;;
+esac

 echo "Searching for hard drives ..."

@@ -36,9 +43,14 @@ for device in `ls /sys/block/`; do
         *)
             # skip the device LiveOS is on
             # Add valid hard drive name to the list
-            if [ $device != $live_dev_name -a -e /dev/$device ]; then
-                hdnamelist="$hdnamelist $device"
-            fi
+            case $device in
+                $live_dev_name*)
+                # skip the device we are running from
+                ;;
+                *)
+                    hdnamelist="$hdnamelist $device"
+                ;;
+            esac
             ;;
     esac
 done
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 7fccdde..f9e9768 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -17,7 +17,14 @@ swap_ratio=5
 hdnamelist=""
 live_dev_name=`cat /proc/mounts | grep ${1%/} | awk '{print $1}'`
 live_dev_name=${live_dev_name#\/dev/}
-live_dev_name=${live_dev_name%%[0-9]*}
+# Only strip the digit identifier if the device is not an mmc
+case $live_dev_name in
+    mmcblk*)
+    ;;
+    *)
+        live_dev_name=${live_dev_name%%[0-9]*}
+    ;;
+esac

 echo "Searching for hard drives ..."

@@ -35,9 +42,14 @@ for device in `ls /sys/block/`; do
         *)
             # skip the device LiveOS is on
             # Add valid hard drive name to the list
-            if [ $device != $live_dev_name -a -e /dev/$device ]; then
-                hdnamelist="$hdnamelist $device"
-            fi
+            case $device in
+                $live_dev_name*)
+                # skip the device we are running from
+                ;;
+                *)
+                    hdnamelist="$hdnamelist $device"
+                ;;
+            esac
             ;;
     esac
 done
--
1.9.1

--
_______________________________________________
Openembedded-core mailing list
Openembedded-core at lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list