Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bWDKe-0006gl-KN for mharc-grub-devel@gnu.org; Sat, 06 Aug 2016 21:56:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWDKX-0006dJ-U5 for grub-devel@gnu.org; Sat, 06 Aug 2016 21:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWDKT-0003gn-J8 for grub-devel@gnu.org; Sat, 06 Aug 2016 21:56:43 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:36747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWDKT-0003ga-8g for grub-devel@gnu.org; Sat, 06 Aug 2016 21:56:41 -0400 Received: by mail-pa0-x242.google.com with SMTP id ez1so21595840pab.3 for ; Sat, 06 Aug 2016 18:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BB1qlfxKlJR3Si4lvYTou4T/9pjdw4/XNDYepuUK6Bs=; b=F07xcsfxApC1eCQdQWEeIeieYqw58T+yb4zNONR7nrneQJ01JxpldNeoO5y2hftqHs AyLHq1MQFaGHd6inMHIUaEVl2aGt/c94yfU1/mUpOPBDTo2m2mPy2qLYzXhL10joOIqi q+89/7YuzouvzY/K3BzIkFrksPvNToiR5JE/NflZzjAMj091Pohg9c2HzG1MP/uvd9o6 Xvuyzv5BJqsJcspt3G+x38kzOAAC7S/ClxLkikL4bc4Vt/eCEhqiTGHXRxJ83066XWCt 918Q0rbeIHkbgThaeRfcVHh5J/SqbMNr5qpR0RNVtUVILWzaB13sjB0oC2uSlafmxWAs dsjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BB1qlfxKlJR3Si4lvYTou4T/9pjdw4/XNDYepuUK6Bs=; b=gsmDR+4twnH71GIV5NivGbmq2JvmVK+U5OSCvYJt7ru6FFpkx/A51Not+ci5p/7yek uFREtBmWMRBdH/PFDOIr/Xum/6MllYKdLdntls1++NVMjyMB0LiAHKgljXYz9V0/H9LD EFpOdxOQVUme95IBT376EMJJDkJgWErHHSwR6XySaB2TUSXtYAkqt6+lzYkE+BGkGs9Q UIENDR1vOH+PMOr7tpdZwgQwWd8/o1Id7SeNdu4XKtL1na3xNar5eylMKXndNs4JQ+4E 58ok8gYuPa4xsTYxaqgQVhf+pKC/UyISKlDG0LV4eeNZNjkPXhMZy9zusrhf4siKtfkE kjGw== X-Gm-Message-State: AEkoouumispwcQ/7vrCKsIPE2rVABBTrNXQGMt/0IY8k3Jdu2uYXn3sn8yPLAhv9QHZtew== X-Received: by 10.66.162.4 with SMTP id xw4mr148668532pab.97.1470535000361; Sat, 06 Aug 2016 18:56:40 -0700 (PDT) Received: from localhost.localdomain ([2601:602:9c00:cf41:a15c:1ca:cdf1:57a3]) by smtp.googlemail.com with ESMTPSA id 15sm37802061pfz.36.2016.08.06.18.56.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Aug 2016 18:56:39 -0700 (PDT) From: Nicholas Vinson To: grub-devel@gnu.org Cc: Nicholas Vinson Subject: [GRUB PARTUUID PATCH V2 2/2] Update grub script template files Date: Sat, 6 Aug 2016 18:56:32 -0700 Message-Id: <20160807015632.32562-3-nvinson234@gmail.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160807015632.32562-1-nvinson234@gmail.com> References: <20160807015632.32562-1-nvinson234@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::242 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2016 01:56:51 -0000 Update grub-mkconfig.in and 10_linux.in to support grub-probe's new partuuid target. Update grub.texi documenation. Signed-off-by: Nicholas Vinson --- docs/grub.texi | 13 +++++++++++++ util/grub-mkconfig.in | 3 +++ util/grub.d/10_linux.in | 13 +++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index 82f6fa4..1f312c6 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1405,6 +1405,19 @@ 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}. +@item GRUB_ENABLE_LINUX_PARTUUID +Normally, when @command{grub-mkconfig} sets the @samp{root=UUID=...} kernel +parameter, it selects a filesystem UUID. This works well for Linux systems that +boot using an initramfs as most implementations support mounting the root +filesystem this way. However for Linux systems that do not boot using an +initramfs, @command{grub-mkconfig} defaults to setting the @samp{root=...} +kernel parameter to the device name containing the root filesystem. Setting +this option to @samp{true} changes the behavior of @command{grub-mkconfig} so +that it identifies the device containing the root filesystem by the partition +UUID. In order to use the @samp{root=PARTUUID=...} kernel parameter, the Linux +kernel version must be at least 2.6.37 (3.10 for systems using the MSDOS +partition scheme). + @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 f8496d2..30ead59 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 de9044c..71675fa 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -220,8 +220,17 @@ while [ "x$list" != "x" ] ; do gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 elif test -z "${initramfs}" ; then # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's - # no initrd or builtin initramfs, it can't work here. - linux_root_device_thisversion=${GRUB_DEVICE} + # no initrd or builtin initramfs, it can't work here. However, if + # GRUB_DEVICE_PARTUUID is not empty we can use that here if + # GRUD_DISABLE_LINUX_UUID is not set to true and GRUB_ENABLE_LINUX_PARTUUID + # is set to true. + if [ "x${GRUB_DISABLE_LINUX_UUID}" != "xtrue" ] \ + && [ "x${GRUB_DEVICE_PARTUUID}" != "x" ] \ + && [ "x${GRUB_ENABLE_LINUX_PARTUUID}" = "xtrue" ] ; then + linux_root_device_thisversion="PARTUUID=${GRUB_DEVICE_PARTUUID}" + else + linux_root_device_thisversion=${GRUB_DEVICE} + fi fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then -- 2.9.2