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:47:24 +0100 |
commit | 78bacee0ac0248b3fb82873f281b1f9d8de74b68 (patch) | |
tree | 993cea969db711621610f19d52a623820b367fc8 /meta | |
parent | d0408029bae2e60eee08df8adffe3019730743a2 (diff) | |
download | poky-78bacee0ac0248b3fb82873f281b1f9d8de74b68.tar.gz |
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]
(From OE-Core rev: f51b050e0df6ceaea07fbda99f54dc4aeaab334c)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 | |||
164 | echo "Copying rootfs files..." | 164 | echo "Copying rootfs files..." |
165 | cp -a /src_root/* /tgt_root | 165 | cp -a /src_root/* /tgt_root |
166 | if [ -d /tgt_root/etc/ ] ; then | 166 | if [ -d /tgt_root/etc/ ] ; then |
167 | echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab | 167 | boot_uuid=$(blkid -o value -s UUID /dev/${device}1) |
168 | echo "$bootfs /boot vfat defaults 1 2" >> /tgt_root/etc/fstab | 168 | swap_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}3) |
169 | echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab | ||
170 | echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab | ||
169 | # We dont want udev to mount our root device while we're booting... | 171 | # We dont want udev to mount our root device while we're booting... |
170 | if [ -d /tgt_root/etc/udev/ ] ; then | 172 | if [ -d /tgt_root/etc/udev/ ] ; then |
171 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist | 173 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist |
@@ -184,6 +186,7 @@ mkdir -p $EFIDIR | |||
184 | cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR | 186 | cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR |
185 | 187 | ||
186 | if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then | 188 | if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then |
189 | root_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}2) | ||
187 | GRUBCFG="$EFIDIR/grub.cfg" | 190 | GRUBCFG="$EFIDIR/grub.cfg" |
188 | cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG | 191 | cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG |
189 | # Update grub config for the installed image | 192 | # Update grub config for the installed image |
@@ -196,7 +199,7 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then | |||
196 | # Delete any root= strings | 199 | # Delete any root= strings |
197 | sed -i "s/ root=[^ ]*/ /" $GRUBCFG | 200 | sed -i "s/ root=[^ ]*/ /" $GRUBCFG |
198 | # Add the root= and other standard boot options | 201 | # Add the root= and other standard boot options |
199 | sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG | 202 | sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG |
200 | fi | 203 | fi |
201 | 204 | ||
202 | if [ -d /run/media/$1/loader ]; then | 205 | if [ -d /run/media/$1/loader ]; then |
@@ -212,7 +215,7 @@ if [ -d /run/media/$1/loader ]; then | |||
212 | # delete any root= strings | 215 | # delete any root= strings |
213 | sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS | 216 | sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS |
214 | # add the root= and other standard boot options | 217 | # add the root= and other standard boot options |
215 | sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS | 218 | sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS |
216 | fi | 219 | fi |
217 | 220 | ||
218 | umount /tgt_root | 221 | umount /tgt_root |