[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add knobs to allow non-initrd boot config
From: |
Paul Menzel |
Subject: |
[PATCH] Add knobs to allow non-initrd boot config |
Date: |
Fri, 15 Feb 2019 12:07:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
Date: Thu, 10 Nov 2016 13:44:25 -0500
Add GRUB_FORCE_PARTUUID and GRUB_DISABLE_INITRD configuration knobs to allow
users to generate GRUB menu entries booting directly to the kernel, without
using an initramfs.
Signed-off-by: Mathieu Trudel-Lapierre <address@hidden>
[1. Upstream patch from Ubuntu repository
https://code.launchpad.net/ubuntu/+source/grub2
2. Fix typo s/Then/When/]
Signed-off-by: Paul Menzel <address@hidden>
---
docs/grub.texi | 13 +++++++++++++
util/grub-mkconfig.in | 4 +++-
util/grub.d/10_linux.in | 11 +++++++++--
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index ecaba9d5c..6520d9f87 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1522,6 +1522,19 @@ This option may be set to a list of GRUB module names
separated by spaces.
Each module will be loaded as early as possible, at the start of
@file{grub.cfg}.
address@hidden GRUB_FORCE_PARTUUID
+This option forces the root disk entry to be the specified PARTUUID instead
+of whatever would be used instead. This is useful when you control the
+partitioning of the disk but cannot guarantee what the actual hardware will
+be, for example in virtual machine images.
+Setting this option to @samp{12345678-01} will produce:
+root=PARTUUID=12345678-01
+
address@hidden GRUB_DISABLE_INITRD
+When set to @samp{true}, this option prevents an initrd to be used at boot
+time, regardless of whether one is detected or not. @command{grub-mkconfig}
+will therefore not generate any initrd lines.
+
@end table
The following options are still accepted for compatibility with existing
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 33332360e..265cf959b 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -238,7 +238,9 @@ export GRUB_DEFAULT \
GRUB_ENABLE_CRYPTODISK \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
- GRUB_DISABLE_SUBMENU
+ GRUB_DISABLE_SUBMENU \
+ GRUB_FORCE_PARTUUID \
+ GRUB_DISABLE_INITRD
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 4532266be..d4498f106 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -139,11 +139,18 @@ linux_entry ()
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
message="$(gettext_printf "Loading Linux %s ..." ${version})"
- sed "s/^/$submenu_indentation/" << EOF
+ if [ x"$GRUB_FORCE_PARTUUID" = x ]; then
+ sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename}
root=${linux_root_device_thisversion} ro ${args}
EOF
- if test -n "${initrd}" ; then
+ else
+ sed "s/^/$submenu_indentation/" << EOF
+ echo '$(echo "$message" | grub_quote)'
+ linux ${rel_dirname}/${basename}
root=$PARTUUID=${GRUB_FORCE_PARTUUID} ro ${args}
+EOF
+ fi
+ if test -n "${initrd}" && [ x"$GRUB_DISABLE_INITRD" != xtrue ]; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
initrd_path=
--
2.20.0
smime.p7s
Description: S/MIME Cryptographic Signature
- [PATCH] Add knobs to allow non-initrd boot config,
Paul Menzel <=