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 boot and swap partitions. [YOCTO #6101] Signed-off-by: Ed Bartosh <ed.bart...@linux.intel.com> --- .../recipes-core/initrdscripts/files/init-install-efi.sh | 16 ++++++++++++---- 1 file changed, 12 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 8dd2749..d03d087 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh @@ -158,14 +158,22 @@ mkdir /tgt_root mkdir /src_root mkdir -p /boot +# Get partition UUIDs +get_partuuid() { + sgdisk -i$2 /dev/$1 | sed -n 's/Partition unique GUID: \(.*\)/\1/p' +} +bootuuid=$(get_partuuid $device 1) +rootuuid=$(get_partuuid $device 2) +swapuuid=$(get_partuuid $device 3) + # 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 /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 + echo "PARTUUID=$swapuuid swap swap defaults 0 0" >> /tgt_root/etc/fstab + echo "PARTUUID=$bootuuid /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 @@ -196,7 +204,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=$rootuuid rw $rootwait quiet @" $GRUBCFG fi if [ -d /run/media/$1/loader ]; then @@ -212,7 +220,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 -- 2.1.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core