summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorBrian Lloyd <blloyd@familyhonor.net>2014-06-28 10:48:24 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-10 17:38:33 +0100
commitba46e51717eb1fd94b9a0a71692dd0b5d5eda7e7 (patch)
tree5343183bc89f9bffc9b49f1fa58c3b7de040bde4 /meta/recipes-core
parent360171c8435242c6bfa87ca5b43a50737ae6d4d8 (diff)
downloadpoky-ba46e51717eb1fd94b9a0a71692dd0b5d5eda7e7.tar.gz
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). (From OE-Core rev: 2be3b2607fd164d18498299dbfc020ff17dd2ca9) Signed-off-by: Brian Lloyd <blloyd@familyhonor.net> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-live.sh10
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb4
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 28219641a4..d852c5737f 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"
8UMOUNT="/bin/umount" 8UMOUNT="/bin/umount"
9ISOLINUX="" 9ISOLINUX=""
10 10
11ROOT_DISK=""
12
11# Copied from initramfs-framework. The core of this script probably should be 13# Copied from initramfs-framework. The core of this script probably should be
12# turned into initramfs-framework modules to reduce duplication. 14# turned into initramfs-framework modules to reduce duplication.
13udev_daemon() { 15udev_daemon() {
@@ -80,6 +82,10 @@ boot_live_root() {
80 udevadm settle --timeout=3 --quiet 82 udevadm settle --timeout=3 --quiet
81 killall "${_UDEV_DAEMON##*/}" 2>/dev/null 83 killall "${_UDEV_DAEMON##*/}" 2>/dev/null
82 84
85 # Allow for identification of the real root even after boot
86 mkdir -p ${ROOT_MOUNT}/media/realroot
87 mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
88
83 # Move the mount points of some filesystems over to 89 # Move the mount points of some filesystems over to
84 # the corresponding directories under the real root filesystem. 90 # the corresponding directories under the real root filesystem.
85 for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do 91 for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
@@ -116,10 +122,12 @@ do
116 for i in `ls /run/media 2>/dev/null`; do 122 for i in `ls /run/media 2>/dev/null`; do
117 if [ -f /run/media/$i/$ROOT_IMAGE ] ; then 123 if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
118 found="yes" 124 found="yes"
125 ROOT_DISK="$i"
119 break 126 break
120 elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then 127 elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
121 found="yes" 128 found="yes"
122 ISOLINUX="isolinux" 129 ISOLINUX="isolinux"
130 ROOT_DISK="$i"
123 break 131 break
124 fi 132 fi
125 done 133 done
@@ -150,7 +158,7 @@ mount_and_boot() {
150 mkdir $ROOT_MOUNT 158 mkdir $ROOT_MOUNT
151 mknod /dev/loop0 b 7 0 2>/dev/null 159 mknod /dev/loop0 b 7 0 2>/dev/null
152 160
153 if ! mount -o rw,loop,noatime,nodiratime /run/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then 161 if ! mount -o rw,loop,noatime,nodiratime /run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
154 fatal "Could not mount rootfs image" 162 fatal "Could not mount rootfs image"
155 fi 163 fi
156 164
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 2d378e2101..ac54902415 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"
5RDEPENDS_${PN} = "udev udev-extraconf" 5RDEPENDS_${PN} = "udev udev-extraconf"
6SRC_URI = "file://init-live.sh" 6SRC_URI = "file://init-live.sh"
7 7
8PR = "r11" 8PR = "r12"
9 9
10do_install() { 10do_install() {
11 install -m 0755 ${WORKDIR}/init-live.sh ${D}/init 11 install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
@@ -13,5 +13,5 @@ do_install() {
13 13
14FILES_${PN} += " /init " 14FILES_${PN} += " /init "
15 15
16# Due to kernel depdendency 16# Due to kernel dependency
17PACKAGE_ARCH = "${MACHINE_ARCH}" 17PACKAGE_ARCH = "${MACHINE_ARCH}"