[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GRUB PARTUUID PATCH V5 3/3] Update grub script template files
From: |
Nicholas Vinson |
Subject: |
[GRUB PARTUUID PATCH V5 3/3] Update grub script template files |
Date: |
Sun, 4 Feb 2018 11:47:37 -0800 |
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new
partuuid target. Update grub.texi documenation.
---
docs/grub.texi | 9 +++++++++
util/grub-mkconfig.in | 3 +++
util/grub.d/10_linux.in | 12 +++++++++---
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index 137b894fa..cb6e62a93 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1405,6 +1405,15 @@ the Linux kernel, using a @samp{root=UUID=...} kernel
parameter. This is
usually more reliable, but in some cases it may not be appropriate. To
disable the use of UUIDs, set this option to @samp{true}.
address@hidden GRUB_ENABLE_LINUX_PARTUUID
+Setting this option to @samp{true} changes the behavior of
address@hidden so that it identifies the device containing the root
+filesystem by the partition UUID via the @samp{root=PARTUUID=...} kernel
+parameter. This is desirable for Linux systems where identifying the root
+filesystem by its filesystem UUID or device name is imappropriate. However,
+this option is only supported in Linux kernel versions least 2.6.37 (3.10 for
+systems using the MSDOS partition scheme) or newer.
+
@item GRUB_DISABLE_RECOVERY
If this option is set to @samp{true}, disable the generation of recovery
mode menu entries.
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index f8496d28b..30ead59e1 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -134,6 +134,7 @@ fi
# Device containing our userland. Typically used for root= parameter.
GRUB_DEVICE="`${grub_probe} --target=device /`"
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2>
/dev/null`" || true
+GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid
2> /dev/null`" || true
# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
@@ -182,6 +183,7 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then
GRUB_ACTUAL_DEFAULT="`"${grub
# override them.
export GRUB_DEVICE \
GRUB_DEVICE_UUID \
+ GRUB_DEVICE_PARTUUID \
GRUB_DEVICE_BOOT \
GRUB_DEVICE_BOOT_UUID \
GRUB_FS \
@@ -215,6 +217,7 @@ export GRUB_DEFAULT \
GRUB_TERMINAL_OUTPUT \
GRUB_SERIAL_COMMAND \
GRUB_DISABLE_LINUX_UUID \
+ GRUB_ENABLE_LINUX_PARTUUID \
GRUB_DISABLE_RECOVERY \
GRUB_VIDEO_BACKEND \
GRUB_GFXMODE \
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index de9044c7f..d4ee4ac69 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -45,12 +45,18 @@ esac
# btrfs may reside on multiple devices. We cannot pass them as value of root=
parameter
# and mounting btrfs requires user space scanning, so force UUID in this case.
-if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" =
"xtrue" ] \
- || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
+if [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
+ || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
+ || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
+ && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \
|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm );
then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
-else
+elif [ "x${GRUB_ENABLE_LINUX_PARTUUID}" != "xtrue" ] \
+ || [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
+ || ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}"; then
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
+else
+ LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
fi
case x"$GRUB_FS" in
--
2.15.1