Merge ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback-cleanup into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Steve Langasek
Status: Rejected
Rejected by: Mathieu Trudel-Lapierre
Proposed branch: ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback-cleanup
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 454 lines (+263/-27)
15 files modified
Makefile.am (+3/-0)
configure.ac (+10/-0)
debian/.git-dpm (+2/-2)
debian/changelog (+7/-0)
debian/control (+1/-0)
debian/grub-common.install.linux.in (+1/-0)
debian/patches/add-initrd-less-boot-fallback.patch (+158/-0)
debian/patches/series (+1/-0)
debian/rules (+1/-1)
docs/grub.info (+0/-5)
docs/grub.texi (+0/-5)
grub-initrd-fallback.service (+13/-0)
util/grub-mkconfig.in (+1/-2)
util/grub.d/00_header.in (+27/-0)
util/grub.d/10_linux.in (+38/-12)
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Needs Fixing
Chris Glass (community) Approve
Review via email: mp+341272@code.launchpad.net

Description of the change

Support for automatically trying to boot Linux without an initramfs, and automatically falling back to a boot with initramfs, in cases that we can detect that the kernel may not need an initramfs in order to resolve the root disk name.

To post a comment you must log in.
Revision history for this message
Chris Glass (tribaal) wrote :

Looks good. +1

(This was pair programmed between vorlon and I during a sprint "coding day" last week)

review: Approve
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

As mentioned on IRC, this is broken, looks like the original support_initrdless_ patch was mangled in the process -- merge shows 'GRUB_DISABLE_INITRD' dropped, but the patch itself seems unchanged in the tree.

review: Needs Fixing
Revision history for this message
Ɓukasz Zemczak (sil2100) wrote :
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Marking superseded.

Unmerged commits

c1aa0eb... by Steve Langasek

merge patched-feature/initrd-less-boot-with-fallback into feature/initrd-less-boot-with-fallback

4f00c0e... by Chris Glass

Added initrd-less boot capabilities.

In case the kernel fails to boot without an initrd, grub will fallback
to trying to boot the kernel with an initrd.

Signed-off-by: Steve Langasek <email address hidden>

Patch-Name: add-initrd-less-boot-fallback.patch

0765223... by Steve Langasek

use dh_systemd to enable the initrd fallback handling unit

440d191... by Steve Langasek

Install our new systemd unit in grub-common.

0784830... by phcoder

yylex: Explicilty cast fprintf to void.

It's needed to avoid warning on recent GCC.

Patch-Name: yylex-explicitly_cast_fprintf_to_void.patch

bc78a6b... by Mathieu Trudel-Lapierre

video: skip 'text' gfxpayload if not supported, to fallback to default

On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec
with it, which will obviously fail. Fortunately, whatever gfxpayload is set,
we still still have the 'auto' default to fall back to. Allow getting to this
fallback by not trying to parse 'text' as a modespec.

This is because 'text' correctly doesn't parse as a modespec, and ought to have
been ignored before we got to that point, just like it is immediately picked if
we're running on a system where 'text' is a supported video mode.

Signed-off-by: Mathieu Trudel-Lapierre <email address hidden>

Patch-Name: skip_text_gfxpayload_where_not_supported.patch

f66f180... by Julian Andres Klode

Show only upstream version, hide rest in package_version variable

The complete package version can get a bit long, so only show the
upstream version in the menu and on the top of the console, and
hide the complete version in a package_version variable.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1723434
Last-Updated: 2018-02-08

Patch-Name: shorter_version_info.patch

29e9d76... by Steve Langasek

Don't use arbitrary file sizes as block sizes in bufio

When grub_bufio_open() is called with a buffer size greater than the size
of the file being buffered, it clamps the buffer size to the file size.
This seems sensible on the surface to avoid over-allocating memory, but
grub_bufio_read() also assumes that ~(block_size-1) gives a sensible
mask value... which is only true for power of 2 block sizes, not for
random file sizes.
If the file we're buffering is on tftp, we get particularly pathological
results because we wind up seeking backwards which requires re-requesting
the file from the tftp server - even though the whole file fit in a single
udp packet much smaller than the default buffer size.

Signed-off-by: Mathieu Trudel-Lapierre <email address hidden>

Author: Steve Langasek <email address hidden>
Forwarded: no
Last-Update: 2016-11-01
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1743249
Patch-Name: bufio_sensible_block_sizes.patch

d80aabd... by David Box

tsc: Change default tsc calibration method to pmtimer on EFI systems

On efi systems, make pmtimer based tsc calibration the default over the
pit. This prevents Grub from hanging on Intel SoC systems that power gate
the pit.

Signed-off-by: David E. Box <email address hidden>
Reviewed-by: Daniel Kiper <email address hidden>

Origin: upstream, https://git.savannah.gnu.org/cgit/grub.git/commit/?id=446794de8da4329ea532cbee4ca877bcafd0e534
Bug-Debian: https://bugs.debian.org/883193
Last-Update: 2017-12-01

Patch-Name: tsc_efi_default_to_pmtimer.patch

6b8dd59... by Mathieu Trudel-Lapierre

Don't fail build on some warnings we know might show up building linuxefi

Specifically:
  -Wno-error=format=
  -Wno-error=cast-align
  -Wno-error=int-to-pointer-cast
  -Wno-error=pointer-to-int-cast
  -Wno-error=unused-parameter

There are a few cases where we legitimately cast to memory that is bigger
than we need when building on one arch, because on a different arch it will
be just right. For example, grub_status_t can be int32 or int64, depending
on the size of void*.

Signed-off-by: Mathieu Trudel-Lapierre <email address hidden>

Forwarded: no
Last-Updated: 2017-11-01
Patch-Name: dont-fail-efi-warnings.patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/Makefile.am b/Makefile.am
index f0ab1ad..aaf2bbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -472,4 +472,7 @@ ChangeLog: FORCE
472 touch $@; \472 touch $@; \
473 fi473 fi
474474
475systemdsystemunit_DATA = \
476 grub-initrd-fallback.service
477
475EXTRA_DIST += ChangeLog ChangeLog-2015478EXTRA_DIST += ChangeLog ChangeLog-2015
diff --git a/configure.ac b/configure.ac
index cd1f498..e3a951c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,6 +287,16 @@ AC_SUBST(grubdirname)
287AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",287AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
288 [Default grub directory name])288 [Default grub directory name])
289289
290##### systemd unit files
291AC_ARG_WITH([systemdsystemunitdir],
292 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
293 [],
294 [with_systemdsystemunitdir=/usr/lib/systemd/system],
295 [with_systemdsystemunitdir=no])
296if test "x$with_systemdsystemunitdir" != xno; then
297 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
298fi
299
290#300#
291# Checks for build programs.301# Checks for build programs.
292#302#
diff --git a/debian/.git-dpm b/debian/.git-dpm
index a6e25a6..c468c72 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,6 +1,6 @@
1# see git-dpm(1) from git-dpm package1# see git-dpm(1) from git-dpm package
24a2879d2ea9e6179ac0f45d7196b9d905fcab0f624f00c0e8a2e97169a1b83cdc294cea26f135cf04
34a2879d2ea9e6179ac0f45d7196b9d905fcab0f634f00c0e8a2e97169a1b83cdc294cea26f135cf04
40992ffbac6a1b4c97c350d12e5301e0067daa0d640992ffbac6a1b4c97c350d12e5301e0067daa0d6
50992ffbac6a1b4c97c350d12e5301e0067daa0d650992ffbac6a1b4c97c350d12e5301e0067daa0d6
6grub2_2.02.orig.tar.xz6grub2_2.02.orig.tar.xz
diff --git a/debian/changelog b/debian/changelog
index 2e7a56d..80e2c87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1grub2 (2.02-2ubuntu9) UNRELEASED; urgency=medium
2
3 * Add support for initrd-less boot, with fallback to "normal" boot in case
4 initrd-less boot failed.
5
6 -- Christopher Glass (Canonical) <christopher.glass@canonical.com> Thu, 08 Mar 2018 16:18:48 +0100
7
1grub2 (2.02-2ubuntu8) bionic; urgency=medium8grub2 (2.02-2ubuntu8) bionic; urgency=medium
29
3 * Drop debian/patches/mkconfig_keep_native_term_active.patch, which can10 * Drop debian/patches/mkconfig_keep_native_term_active.patch, which can
diff --git a/debian/control b/debian/control
index 0cd1001..59323d0 100644
--- a/debian/control
+++ b/debian/control
@@ -7,6 +7,7 @@ Uploaders: Felix Zielcke <fzielcke@z-51.de>, Jordi Mallach <jordi@debian.org>, C
7Build-Depends: debhelper (>= 7.4.2~),7Build-Depends: debhelper (>= 7.4.2~),
8 patchutils,8 patchutils,
9 dh-autoreconf,9 dh-autoreconf,
10 dh-systemd,
10 automake,11 automake,
11 python,12 python,
12 flex,13 flex,
diff --git a/debian/grub-common.install.linux.in b/debian/grub-common.install.linux.in
index a1fc71c..9c28f46 100644
--- a/debian/grub-common.install.linux.in
+++ b/debian/grub-common.install.linux.in
@@ -1,2 +1,3 @@
1usr/bin/grub-mount1usr/bin/grub-mount
2usr/share/man/man1/grub-mount.12usr/share/man/man1/grub-mount.1
3usr/lib/systemd/system/grub-initrd-fallback.service /lib/systemd/system
diff --git a/debian/patches/add-initrd-less-boot-fallback.patch b/debian/patches/add-initrd-less-boot-fallback.patch
3new file mode 1006444new file mode 100644
index 0000000..465a84e
--- /dev/null
+++ b/debian/patches/add-initrd-less-boot-fallback.patch
@@ -0,0 +1,158 @@
1From cd2faacd63595b746ece084aa17d054a843a4ff8 Mon Sep 17 00:00:00 2001
2From: Chris Glass <chris.glass@canonical.com>
3Date: Thu, 8 Mar 2018 16:16:55 +0100
4Subject: Added initrd-less boot capabilities.
5
6In case the kernel fails to boot without an initrd, grub will fallback
7to trying to boot the kernel with an initrd.
8
9Patch-Name: add-initrd-less-boot-fallback.patch
10---
11 grub-common.grub-initrd-fallback.service | 13 ++++++++
12 util/grub.d/00_header.in | 27 ++++++++++++++++
13 util/grub.d/10_linux.in | 53 +++++++++++++++++++++++---------
14 3 files changed, 79 insertions(+), 14 deletions(-)
15 create mode 100644 grub-common.grub-initrd-fallback.service
16
17diff --git a/grub-common.grub-initrd-fallback.service b/grub-common.grub-initrd-fallback.service
18new file mode 100644
19index 000000000..258853800
20--- /dev/null
21+++ b/grub-common.grub-initrd-fallback.service
22@@ -0,0 +1,13 @@
23+[Unit]
24+Description=GRUB failed boot detection
25+DefaultDependencies=no
26+After=local-fs.target
27+
28+[Service]
29+Type=oneshot
30+ExecStart=/usr/bin/grub-editenv /boot/grub/grubenv unset initrdfail
31+ExecStart=/usr/bin/grub-editenv /boot/grub/grubenv unset prev_entry
32+TimeoutSec=0
33+
34+[Install]
35+WantedBy=sysinit.target
36diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
37index 674a76140..23322458a 100644
38--- a/util/grub.d/00_header.in
39+++ b/util/grub.d/00_header.in
40@@ -50,6 +50,18 @@ if [ -s \$prefix/grubenv ]; then
41 load_env
42 fi
43 EOF
44+cat <<EOF
45+if [ "\${initrdfail}" = 2 ]; then
46+ set initrdfail=
47+elif [ "\${initrdfail}" = 1 ]; then
48+ set next_entry="\${prev_entry}"
49+ set prev_entry=
50+ save_env prev_entry
51+ if [ "\${next_entry}" ]; then
52+ set initrdfail=2
53+ fi
54+fi
55+EOF
56 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
57 cat <<EOF
58 if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
59@@ -101,6 +113,21 @@ function savedefault {
60 }
61 EOF
62
63+cat <<"EOF"
64+function initrdfail {
65+ if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then
66+ if [ -z "${initrdfail}" ]; then
67+ set initrdfail=1
68+ if [ -n "${boot_once}" ]; then
69+ set prev_entry="${default}"
70+ save_env prev_entry
71+ fi
72+ fi
73+ save_env initrdfail
74+ fi; fi
75+}
76+EOF
77+
78 if [ "$quick_boot" = 1 ]; then
79 cat <<EOF
80 function recordfail {
81diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
82index 76d4f31bf..8590704a3 100644
83--- a/util/grub.d/10_linux.in
84+++ b/util/grub.d/10_linux.in
85@@ -104,6 +104,10 @@ if [ "$vt_handoff" = 1 ]; then
86 done
87 fi
88
89+if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
90+ echo "set partuuid=${GRUB_FORCE_PARTUUID}"
91+fi
92+
93 linux_entry ()
94 {
95 os="$1"
96@@ -179,27 +183,48 @@ EOF
97 linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
98 EOF
99 else
100- if [ x"$GRUB_FORCE_PARTUUID" = x ]; then
101+ # We have initrd and PARTUUID is set - we try to boot without initrd, and fallback to using it
102+ # if it fails.
103+ # "panic=-1" means "on panic reboot immediately". "panic=0" disables the reboot behavior.
104+ if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
105+ linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
106+ fi
107+ if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
108 sed "s/^/$submenu_indentation/" << EOF
109- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
110+ if [ "\${initrdfail}" = 1 ]; then
111+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
112+EOF
113+ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
114+ message="$(gettext_printf "Loading initial ramdisk ...")"
115+ echo " ${message}"
116+ fi
117+
118+ sed "s/^/$submenu_indentation/" << EOF
119+ initrd ${rel_dirname}/${initrd}
120+ else
121+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
122+ fi
123+ initrdfail
124 EOF
125 else
126+ # We don't have initrd or we don't want to set PARTUUID. Don't try initrd-less boot with fallback.
127 sed "s/^/$submenu_indentation/" << EOF
128- linux ${rel_dirname}/${basename} root=PARTUUID=${GRUB_FORCE_PARTUUID} ro ${args}
129+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
130 EOF
131- fi
132- fi
133- if test -n "${initrd}" && [ x"$GRUB_DISABLE_INITRD" != xtrue ]; then
134- # TRANSLATORS: ramdisk isn't identifier. Should be translated.
135- if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
136- message="$(gettext_printf "Loading initial ramdisk ...")"
137- sed "s/^/$submenu_indentation/" << EOF
138- echo '$(echo "$message" | grub_quote)'
139+ if test -n "${initrd}"; then
140+ # We do have initrd - let's use it at boot.
141+ # TRANSLATORS: ramdisk isn't identifier. Should be translated.
142+ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
143+ message="$(gettext_printf "Loading initial ramdisk ...")"
144+ sed "s/^/$submenu_indentation/" << EOF
145+ echo '$(echo "$message" | grub_quote)'
146 EOF
147- fi
148- sed "s/^/$submenu_indentation/" << EOF
149- initrd ${rel_dirname}/${initrd}
150+ fi
151+ sed "s/^/$submenu_indentation/" << EOF
152+ initrd ${rel_dirname}/${initrd}
153 EOF
154+ fi
155+ fi
156 fi
157 sed "s/^/$submenu_indentation/" << EOF
158 }
diff --git a/debian/patches/series b/debian/patches/series
index 47ad08d..29e74ae 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -75,3 +75,4 @@ bufio_sensible_block_sizes.patch
75shorter_version_info.patch75shorter_version_info.patch
76skip_text_gfxpayload_where_not_supported.patch76skip_text_gfxpayload_where_not_supported.patch
77yylex-explicitly_cast_fprintf_to_void.patch77yylex-explicitly_cast_fprintf_to_void.patch
78add-initrd-less-boot-fallback.patch
diff --git a/debian/rules b/debian/rules
index 8c73042..683425e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -114,7 +114,7 @@ endif
114endif114endif
115115
116%:116%:
117 dh $@ --parallel117 dh $@ --parallel --with systemd
118118
119override_dh_auto_configure: $(patsubst %,configure/%,$(BUILD_PACKAGES))119override_dh_auto_configure: $(patsubst %,configure/%,$(BUILD_PACKAGES))
120120
diff --git a/docs/grub.info b/docs/grub.info
index b850016..5ec19fa 100644
--- a/docs/grub.info
+++ b/docs/grub.info
@@ -1412,11 +1412,6 @@ it must be quoted. For example:
1412 Setting this option to '12345678-01' will produce:1412 Setting this option to '12345678-01' will produce:
1413 root=PARTUUID=12345678-011413 root=PARTUUID=12345678-01
14141414
1415'GRUB_DISABLE_INITRD'
1416 Then set to 'true', this option prevents an initrd to be used at
1417 boot time, regardless of whether one is detected or not.
1418 grub-mkconfig will therefore not generate any initrd lines.
1419
1420 The following options are still accepted for compatibility with1415 The following options are still accepted for compatibility with
1421existing configurations, but have better replacements:1416existing configurations, but have better replacements:
14221417
diff --git a/docs/grub.texi b/docs/grub.texi
index e5dbc63..3bb83ac 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1517,11 +1517,6 @@ will be, for example in virtual machine images.
1517Setting this option to @samp{12345678-01} will produce:1517Setting this option to @samp{12345678-01} will produce:
1518root=PARTUUID=12345678-011518root=PARTUUID=12345678-01
15191519
1520@item GRUB_DISABLE_INITRD
1521Then set to @samp{true}, this option prevents an initrd to be used at boot
1522time, regardless of whether one is detected or not. @command{grub-mkconfig}
1523will therefore not generate any initrd lines.
1524
1525@end table1520@end table
15261521
1527The following options are still accepted for compatibility with existing1522The following options are still accepted for compatibility with existing
diff --git a/grub-initrd-fallback.service b/grub-initrd-fallback.service
1528new file mode 1006441523new file mode 100644
index 0000000..2588538
--- /dev/null
+++ b/grub-initrd-fallback.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=GRUB failed boot detection
3DefaultDependencies=no
4After=local-fs.target
5
6[Service]
7Type=oneshot
8ExecStart=/usr/bin/grub-editenv /boot/grub/grubenv unset initrdfail
9ExecStart=/usr/bin/grub-editenv /boot/grub/grubenv unset prev_entry
10TimeoutSec=0
11
12[Install]
13WantedBy=sysinit.target
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 9fca8cd..c88c46f 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -246,8 +246,7 @@ export GRUB_DEFAULT \
246 GRUB_DISABLE_SUBMENU \246 GRUB_DISABLE_SUBMENU \
247 GRUB_RECORDFAIL_TIMEOUT \247 GRUB_RECORDFAIL_TIMEOUT \
248 GRUB_RECOVERY_TITLE \248 GRUB_RECOVERY_TITLE \
249 GRUB_FORCE_PARTUUID \249 GRUB_FORCE_PARTUUID
250 GRUB_DISABLE_INITRD
251250
252if test "x${grub_cfg}" != "x"; then251if test "x${grub_cfg}" != "x"; then
253 rm -f "${grub_cfg}.new"252 rm -f "${grub_cfg}.new"
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 674a761..2332245 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -50,6 +50,18 @@ if [ -s \$prefix/grubenv ]; then
50 load_env50 load_env
51fi51fi
52EOF52EOF
53cat <<EOF
54if [ "\${initrdfail}" = 2 ]; then
55 set initrdfail=
56elif [ "\${initrdfail}" = 1 ]; then
57 set next_entry="\${prev_entry}"
58 set prev_entry=
59 save_env prev_entry
60 if [ "\${next_entry}" ]; then
61 set initrdfail=2
62 fi
63fi
64EOF
53if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then65if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
54 cat <<EOF66 cat <<EOF
55if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then67if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
@@ -101,6 +113,21 @@ function savedefault {
101}113}
102EOF114EOF
103115
116cat <<"EOF"
117function initrdfail {
118 if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then
119 if [ -z "${initrdfail}" ]; then
120 set initrdfail=1
121 if [ -n "${boot_once}" ]; then
122 set prev_entry="${default}"
123 save_env prev_entry
124 fi
125 fi
126 save_env initrdfail
127 fi; fi
128}
129EOF
130
104if [ "$quick_boot" = 1 ]; then131if [ "$quick_boot" = 1 ]; then
105 cat <<EOF132 cat <<EOF
106function recordfail {133function recordfail {
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 76d4f31..01d96f5 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -104,6 +104,10 @@ if [ "$vt_handoff" = 1 ]; then
104 done104 done
105fi105fi
106106
107if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
108 echo "set partuuid=${GRUB_FORCE_PARTUUID}"
109fi
110
107linux_entry ()111linux_entry ()
108{112{
109 os="$1"113 os="$1"
@@ -179,27 +183,49 @@ EOF
179 linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}183 linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
180EOF184EOF
181 else185 else
182 if [ x"$GRUB_FORCE_PARTUUID" = x ]; then186 # We have initrd and PARTUUID is set - we try to boot without initrd, and fallback to using it
187 # if it fails.
188 # "panic=-1" means "on panic reboot immediately". "panic=0" disables the reboot behavior.
189 if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
190 linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
191 fi
192 message="$(gettext_printf "Loading initial ramdisk ...")"
193 if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
194 sed "s/^/$submenu_indentation/" << EOF
195 if [ "\${initrdfail}" = 1 ]; then
196 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
197EOF
198 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
199 sed "s/^/$submenu_indentation/" << EOF
200 echo '$(echo "$message" | grub_quote)'
201EOF
202 fi
203
183 sed "s/^/$submenu_indentation/" << EOF204 sed "s/^/$submenu_indentation/" << EOF
184 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}205 initrd ${rel_dirname}/${initrd}
206 else
207 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
208 fi
209 initrdfail
185EOF210EOF
186 else211 else
212 # We don't have initrd or we don't want to set PARTUUID. Don't try initrd-less boot with fallback.
187 sed "s/^/$submenu_indentation/" << EOF213 sed "s/^/$submenu_indentation/" << EOF
188 linux ${rel_dirname}/${basename} root=PARTUUID=${GRUB_FORCE_PARTUUID} ro ${args}214 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
189EOF215EOF
190 fi216 if test -n "${initrd}"; then
191 fi217 # We do have initrd - let's use it at boot.
192 if test -n "${initrd}" && [ x"$GRUB_DISABLE_INITRD" != xtrue ]; then218 # TRANSLATORS: ramdisk isn't identifier. Should be translated.
193 # TRANSLATORS: ramdisk isn't identifier. Should be translated.219 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
194 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then220 sed "s/^/$submenu_indentation/" << EOF
195 message="$(gettext_printf "Loading initial ramdisk ...")"
196 sed "s/^/$submenu_indentation/" << EOF
197 echo '$(echo "$message" | grub_quote)'221 echo '$(echo "$message" | grub_quote)'
198EOF222EOF
199 fi223 fi
200 sed "s/^/$submenu_indentation/" << EOF224 sed "s/^/$submenu_indentation/" << EOF
201 initrd ${rel_dirname}/${initrd}225 initrd ${rel_dirname}/${initrd}
202EOF226EOF
227 fi
228 fi
203 fi229 fi
204 sed "s/^/$submenu_indentation/" << EOF230 sed "s/^/$submenu_indentation/" << EOF
205}231}

Subscribers

People subscribed via source and target branches