diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-06-10 17:49:32 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-23 11:38:14 +0100 |
commit | f51b050e0df6ceaea07fbda99f54dc4aeaab334c (patch) | |
tree | 1c82f5fcb5ee8b4f3467d16542b96dec89b5501d /meta/recipes-core | |
parent | f1a4b8e0b3fb065e3b63185f1b98481d4078a851 (diff) | |
download | openembedded-core-f51b050e0df6ceaea07fbda99f54dc4aeaab334c.tar.gz openembedded-core-f51b050e0df6ceaea07fbda99f54dc4aeaab334c.tar.bz2 openembedded-core-f51b050e0df6ceaea07fbda99f54dc4aeaab334c.zip |
init-install-efi: Implement UUID support
Using UUID in favor of device names is more reliable as
UUID names are persistent.
Device names can change as the order of adding device nodes
is arbitrary. This sometimes results in device names switching
on each boot, which can cause system fail to boot.
Persistent naming solves these issues.
Used partition UUID in kernel command line to specify root partition.
Used partition UUID in /etc/fstab to specify swap partition.
Used filesystem UUID in /etc/fstab to specify boot partition.
[YOCTO #6101]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install-efi.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index 8dd2749b5e..5fb4d4d05c 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh @@ -164,8 +164,10 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root echo "Copying rootfs files..." 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 + boot_uuid=$(blkid -o value -s UUID /dev/${device}1) + swap_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}3) + echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab + echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist @@ -184,6 +186,7 @@ mkdir -p $EFIDIR cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then + root_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}2) GRUBCFG="$EFIDIR/grub.cfg" cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG # Update grub config for the installed image @@ -196,7 +199,7 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then # Delete any root= strings sed -i "s/ root=[^ ]*/ /" $GRUBCFG # Add the root= and other standard boot options - sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG + sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG fi if [ -d /run/media/$1/loader ]; then @@ -212,7 +215,7 @@ if [ -d /run/media/$1/loader ]; then # delete any root= strings sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS # add the root= and other standard boot options - sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS + sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS fi umount /tgt_root |