[oe-commits] Drew Moseley : init-install-efi.sh: fix to handle the boot partition correctly

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: 3b1bae7ad8d36930aae840175c6a3433c1469772
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=3b1bae7ad8d36930aae840175c6a3433c1469772

Author: Drew Moseley <drew_moseley at mentor.com>
Date:   Wed Jul  2 18:09:29 2014 -0400

init-install-efi.sh: fix to handle the boot partition correctly

(This patch was originally done against init-install.sh in
OE-Core rev aa67b1333b4774e1845f562085f7048df65a644f)

Previously, the boot partition was created for the target hard drive
but there was no corresponding entry for it in /etc/fstab. Besides,
even if the boot partition was mounted, it would just result in odd
directory hierarchy like /boot/boot/grub. However, what we really need
is /boot/grub. This patch fixes this problem.

Besides, for future maintance work, this patch also renames some of the
intermediate directories. It uses more descriptive names like /tgt_root
and /src_root. The name of /ssd is dropped.

Signed-off-by: Drew Moseley <drew_moseley at mentor.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 .../initrdscripts/files/init-install-efi.sh        | 47 ++++++++++++----------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 8bd7025..34c2ae3 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -123,34 +123,32 @@ mkfs.ext3 $rootfs
 echo "Formatting swap partition...($swap)"
 mkswap $swap
 
-mkdir /ssd
-mkdir /rootmnt
-mkdir /bootmnt
-
-mount $rootfs /ssd
-mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /rootmnt
+mkdir /tgt_root
+mkdir /src_root
+mkdir -p /boot
 
+# Handling of the target root partition
+mount $rootfs /tgt_root
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
 echo "Copying rootfs files..."
-cp -a /rootmnt/* /ssd
-
-if [ -d /ssd/etc/ ] ; then
-    echo "$swap                swap             swap       defaults              0  0" >> /ssd/etc/fstab
-
+cp -a /src_root/* /tgt_root
+if [ -d /tgt_root/etc/ ] ; then
+    echo "$swap                swap             swap       defaults              0  0" >> /tgt_root/etc/fstab
+    echo "$bootfs              /boot            vfat       defaults              1  2" >> /tgt_root/etc/fstab
     # We dont want udev to mount our root device while we're booting...
-    if [ -d /ssd/etc/udev/ ] ; then
-        echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist
+    if [ -d /tgt_root/etc/udev/ ] ; then
+	echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
     fi
 fi
 
-umount /ssd
-umount /rootmnt
+umount /src_root
 
+# Handling of the target boot partition
+mount $bootfs /boot
 echo "Preparing boot partition..."
-mount $bootfs /ssd
 
-EFIDIR="/ssd/EFI/BOOT"
+EFIDIR="/boot/EFI/BOOT"
 mkdir -p $EFIDIR
-cp /run/media/$1/vmlinuz /ssd
 # Copy the efi loader
 cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
 
@@ -171,11 +169,11 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
 fi
 
 if [ -d /run/media/$1/loader ]; then
-    GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
+    GUMMIBOOT_CFGS="/tgt_root/loader/entries/*.conf"
     # copy config files for gummiboot
-    cp -dr /run/media/$1/loader /ssd
+    cp -dr /run/media/$1/loader /tgt_root
     # delete the install entry
-    rm -f /ssd/loader/entries/install.conf
+    rm -f /tgt_root/loader/entries/install.conf
     # delete the initrd lines
     sed -i "/initrd /d" $GUMMIBOOT_CFGS
     # delete any LABEL= strings
@@ -186,7 +184,12 @@ if [ -d /run/media/$1/loader ]; then
     sed -i "s at options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
 fi
 
-umount /ssd
+umount /tgt_root
+
+cp /run/media/$1/vmlinuz /boot
+
+umount /boot
+
 sync
 
 echo "Remove your installation media, and press ENTER"



More information about the Openembedded-commits mailing list