From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 04/10] init-install-efi: Implement UUID support
Date: Mon, 15 Jun 2015 19:10:41 +0300 [thread overview]
Message-ID: <1434384647-2901-5-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1434384647-2901-1-git-send-email-ed.bartosh@linux.intel.com>
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>
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 8dd2749..5fb4d4d 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
--
2.1.4
next prev parent reply other threads:[~2015-06-15 18:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 16:10 [PATCH 00/10] UUID support in installer (poky-contrib: ed/oe-core/uuid-init-install) Ed Bartosh
2015-06-15 16:10 ` [PATCH 01/10] image-live: Set syslinux timeout to 5s Ed Bartosh
2015-06-15 16:10 ` [PATCH 02/10] initramfs-live-install: Add blkid to initramfs Ed Bartosh
2015-06-15 16:10 ` [PATCH 03/10] busybox: Enable UUID-related options Ed Bartosh
2015-06-15 16:10 ` Ed Bartosh [this message]
2015-06-15 16:10 ` [PATCH 05/10] init-install: Use GPT table with GRUB 2 Ed Bartosh
2015-06-15 16:10 ` [PATCH 06/10] init-install: Implement UUID support Ed Bartosh
2015-06-15 16:10 ` [PATCH 07/10] init-install: Specify filesystem type in parted command line Ed Bartosh
2015-06-15 16:10 ` [PATCH 08/10] init-install: Specify partition name " Ed Bartosh
2015-06-15 16:10 ` [PATCH 09/10] init-install: code cleanup: Replace tabs with spaces Ed Bartosh
2015-06-15 16:10 ` [PATCH 10/10] init-install: code cleanup: replace /dev/$device -> $device Ed Bartosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434384647-2901-5-git-send-email-ed.bartosh@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox