[oe-commits] Brian Lloyd : Move boot media to /media/ realroot for easy access after boot.

git at git.openembedded.org git at git.openembedded.org
Thu Jul 10 16:40:32 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 2be3b2607fd164d18498299dbfc020ff17dd2ca9
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=2be3b2607fd164d18498299dbfc020ff17dd2ca9

Author: Brian Lloyd <blloyd at familyhonor.net>
Date:   Sat Jun 28 10:48:24 2014 -0500

Move boot media to /media/realroot for easy access after boot.

There are cases where software after boot may need to know the
current boot disk.  Under the current system, it is not guaranteed
which disk is the boot.  While /media/sda is a good guess, it
isn't always right, nor is it a good assumption that only one boot
disk is in the system.  This gives a standard path to the original
boot disk mount which can be used to, for instance, update the
syslinux file on the boot media with a newer kernel, or updating
the boot parameters to add user options for future boots.  Knowing
which disk is the boot media keeps from updating the non-boot
disk when for instance multiple syslinux boot medias are plugged in
(ie ensure correct syslinux is updated when the booted system is
updated).

Signed-off-by: Brian Lloyd <blloyd at familyhonor.net>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 meta/recipes-core/initrdscripts/files/init-live.sh         | 10 +++++++++-
 meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb |  4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 2821964..d852c57 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -8,6 +8,8 @@ MOUNT="/bin/mount"
 UMOUNT="/bin/umount"
 ISOLINUX=""
 
+ROOT_DISK=""
+
 # Copied from initramfs-framework. The core of this script probably should be
 # turned into initramfs-framework modules to reduce duplication.
 udev_daemon() {
@@ -80,6 +82,10 @@ boot_live_root() {
     udevadm settle --timeout=3 --quiet
     killall "${_UDEV_DAEMON##*/}" 2>/dev/null
 
+    # Allow for identification of the real root even after boot
+    mkdir -p  ${ROOT_MOUNT}/media/realroot
+    mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
+
     # Move the mount points of some filesystems over to
     # the corresponding directories under the real root filesystem.
     for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
@@ -116,10 +122,12 @@ do
   for i in `ls /run/media 2>/dev/null`; do
       if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
 		found="yes"
+		ROOT_DISK="$i"
 		break
 	  elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
 		found="yes"
 		ISOLINUX="isolinux"
+		ROOT_DISK="$i"
 		break	
       fi
   done
@@ -150,7 +158,7 @@ mount_and_boot() {
     mkdir $ROOT_MOUNT
     mknod /dev/loop0 b 7 0 2>/dev/null
 
-    if ! mount -o rw,loop,noatime,nodiratime /run/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+    if ! mount -o rw,loop,noatime,nodiratime /run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
 	fatal "Could not mount rootfs image"
     fi
 
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 2d378e2..ac54902 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 @@ DEPENDS = "virtual/kernel"
 RDEPENDS_${PN} = "udev udev-extraconf"
 SRC_URI = "file://init-live.sh"
 
-PR = "r11"
+PR = "r12"
 
 do_install() {
         install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
@@ -13,5 +13,5 @@ do_install() {
 
 FILES_${PN} += " /init "
 
-# Due to kernel depdendency
+# Due to kernel dependency
 PACKAGE_ARCH = "${MACHINE_ARCH}"



More information about the Openembedded-commits mailing list