[OE-core] [PATCH] initrdscripts: fix udevd path

Alex DAMIAN alexandru.damian at intel.com
Thu Nov 1 14:32:15 UTC 2012


From: Ross Burton <ross.burton at intel.com>

udevd moved location and isn't in $PATH anymore, so use an absolute path to
start it.

The control socket path moved too, so mkdir the directory it's in.

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   50 +++++++++++++++++---
 .../initrdscripts/initramfs-framework/udev         |    6 +--
 .../initrdscripts/initramfs-framework_1.0.bb       |    2 +
 .../initrdscripts/initramfs-live-boot_1.0.bb       |    2 +-
 4 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 5682fd1..fdea892 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -19,7 +19,8 @@ early_setup() {
     modprobe isofs 2> /dev/null
 
     mkdir -p /run
-    udevd --daemon
+    mkdir -p /var/run
+    /lib/udev/udevd --daemon
     udevadm trigger --action=add
 }
 
@@ -68,13 +69,49 @@ fatal() {
 
 early_setup
 
+# wait for the udevd to settle
+echo "Waiting for udev to settle..."
+sleep 3
+
 [ -z "$CONSOLE" ] && CONSOLE="/dev/console"
 
 read_args
 
-echo "Waiting for removable media..."
-while true
+# boot partiton menu, if one or more bootable partitions exist
+BOOTMENU=`ls /media/sd*/sbin/init 2>/dev/null | wc -l`
+if [ $BOOTMENU -gt 0 ]; then
+	choice=0
+	while [ $choice -le 0 ]; do
+		echo "1). boot live ramfs image"
+		count=2
+		for i in `ls /media/sd*/sbin/init 2>/dev/null | cut -d "/" -f 3`; do
+			echo $count"). boot /dev/"$i
+			choicecmd[$count]=$i
+			count=$(( count + 1))
+		done
+		echo
+		echo -n "Your choice: "
+		read choice
+	done
+	
+	if [ $choice -gt 1 ]; then 
+		#ROOT_MOUNT=/media/${choicecmd[${choice}]}
+		ROOT_MOUNT=none	#testing
+		echo "Booting local root ... $ROOT_MOUNT"
+		if [ -d $ROOT_MOUNT ]; then
+			boot_live_root
+		else
+			fatal "Rootfs partition not mounted"
+		fi
+	fi
+fi	
+
+echo -n "Waiting for removable media... "
+CNT=0
+while [ $CNT -le 3 ];
 do
+  echo -n "$CNT "
+  CNT=$(( $CNT + 1 ))
   for i in `ls /media 2>/dev/null`; do
       if [ -f /media/$i/$ROOT_IMAGE ] ; then
 		found="yes"
@@ -82,7 +119,7 @@ do
 	  elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
 		found="yes"
 		ISOLINUX="isolinux"
-		break	
+		break
       fi
   done
   if [ "$found" = "yes" ]; then
@@ -90,13 +127,14 @@ do
   fi
   sleep 1
 done
+if [ "$found" != "yes" ]; then
+	fatal "...could not mount removable media, drop to shell"
+fi
 
 case $label in
     boot)
 	mkdir $ROOT_MOUNT
 	mknod /dev/loop0 b 7 0 2>/dev/null
-
-	
 	if [ "$UNIONFS" = "yes" ]; then
 	    mkdir /rootfs-tmp
 
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
index 9ea8aa3..15a1d5b 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -3,8 +3,8 @@
 # Licensed on MIT
 
 udev_enabled() {
-	if [ ! -e /sbin/udevd ]; then
-		debug "/sbin/udev doesn't exist"
+	if [ ! -e /lib/udev/udevd ]; then
+		debug "/lib/udev/udev doesn't exist"
 		return 1
 	fi
 
@@ -14,7 +14,7 @@ udev_enabled() {
 udev_run() {
 	mkdir -p /run
 
-	udevd --daemon > /dev/null
+	/lib/udev/udevd --daemon > /dev/null
 	udevadm trigger --action=add
 	udevadm settle
 
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 58e41d4..45d6592 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -3,6 +3,8 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 RDEPENDS = "busybox"
 
+PR = "r1"
+
 inherit allarch
 
 SRC_URI = "file://init \
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
index 137a401..55a8600 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -5,7 +5,7 @@ RDEPENDS = "udev"
 DEPENDS = "virtual/kernel"
 SRC_URI = "file://init-live.sh"
 
-PR = "r10"
+PR = "r11"
 
 do_compile() {
 	#if grep -q "CONFIG_UNION_FS=y" ${STAGING_KERNEL_DIR}/.config; then
-- 
1.7.10.4





More information about the Openembedded-core mailing list