From ae724e46f477a389096da077167114ea54affa7a Mon Sep 17 00:00:00 2001 From: Drew Moseley Date: Wed, 2 Jul 2014 18:09:29 -0400 Subject: 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. (From OE-Core rev: 3b1bae7ad8d36930aae840175c6a3433c1469772) Signed-off-by: Drew Moseley Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- .../initrdscripts/files/init-install-efi.sh | 47 ++++++++++++---------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'meta') diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index 8bd70251cd..34c2ae3066 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@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" -- cgit v1.2.3-54-g00ecf