]> git.proxmox.com Git - grub2.git/log
grub2.git
5 years agoat_keyboard: initialize keyboard in module init if keyboard is ready
Jeroen Dekkers [Sat, 12 Jan 2019 20:02:18 +0000 (21:02 +0100)]
at_keyboard: initialize keyboard in module init if keyboard is ready

The change in 0c62a5b2 caused at_keyboard to fail on some
machines. Immediately initializing the keyboard in the module init if
the keyboard is ready makes the problem go away.

Bug-Debian: https://bugs.debian.org/741464
Last-Update: 2019-02-09

Patch-Name: at_keyboard-module-init.patch

5 years agoDon't enforce Shim signature validation if Secure Boot is disabled
Matthew Garrett [Wed, 5 Dec 2018 23:07:21 +0000 (15:07 -0800)]
Don't enforce Shim signature validation if Secure Boot is disabled

The linuxefi command fails if used on a system without shim, even if
Secure Boot is disabled. There's no need to do the validation if we're
not in Secure Boot mode (an attacker could just boot a modified grub),
so skip this to make it easier to use the Linux EFI entry point even on
non-Secure Boot systems.

Last-Update: 2018-12-07

Patch-Name: linuxefi-skip-validation-without-secure-boot.patch

5 years agobash-completion: Drop "have" checks
Colin Watson [Fri, 16 Nov 2018 16:37:02 +0000 (16:37 +0000)]
bash-completion: Drop "have" checks

These don't work with and aren't needed by dynamically-loaded
completions.

Bug-Debian: https://bugs.debian.org/912852
Forwarded: no
Last-Update: 2018-11-16

Patch-Name: bash-completion-drop-have-checks.patch

5 years agoSkip flaky grub_cmd_set_date test
Colin Watson [Sun, 28 Oct 2018 19:45:56 +0000 (19:45 +0000)]
Skip flaky grub_cmd_set_date test

Bug-Debian: https://bugs.debian.org/906470
Last-Update: 2018-10-28

Patch-Name: skip-grub_cmd_set_date.patch

5 years agoDo not overwrite sentinel byte in boot_params, breaks lockdown
Luca Boccassi [Tue, 15 May 2018 10:36:46 +0000 (11:36 +0100)]
Do not overwrite sentinel byte in boot_params, breaks lockdown

grub currently copies the entire boot_params, which includes setting
sentinel byte to 0xff, which triggers sanitize_boot_params in the kernel
which in turn clears various boot_params variables, including the
indication that the bootloader chain is verified and thus the kernel
disables lockdown mode.  According to the information on the Fedora bug
tracker, only the information from byte 0x1f1 is necessary, so start
copying from there instead.

Author: Luca Boccassi <bluca@debian.org>
Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1418360
Forwarded: no

Patch-Name: fix-lockdown.patch

5 years agoefinet: Setting DNS server from UEFI protocol
Michael Chang [Thu, 27 Oct 2016 21:43:21 +0000 (17:43 -0400)]
efinet: Setting DNS server from UEFI protocol

In the URI device path node, any name rahter than address can be used for
looking up the resources so that DNS service become needed to get answer of the
name's address. Unfortunately the DNS is not defined in any of the device path
nodes so that we use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL
to obtain it.

These two protcols are defined the sections of UEFI specification.

 27.5 EFI IPv4 Configuration II Protocol
 27.7 EFI IPv6 Configuration Protocol

include/grub/efi/api.h:
Add new structure and protocol UUID of EFI_IP4_CONFIG2_PROTOCOL and
EFI_IP6_CONFIG_PROTOCOL.

grub-core/net/drivers/efi/efinet.c:
Use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL to obtain the list
of DNS server address for IPv4 and IPv6 respectively. The address of DNS
servers is structured into DHCPACK packet and feed into the same DHCP packet
processing functions to ensure the network interface is setting up the same way
it used to be.

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Patch-Name: efinet-set-dns-from-uefi-proto.patch

5 years agoefinet: Setting network from UEFI device path
Michael Chang [Thu, 27 Oct 2016 21:43:05 +0000 (17:43 -0400)]
efinet: Setting network from UEFI device path

The PXE Base Code protocol used to obtain cached PXE DHCPACK packet is no
longer provided for HTTP Boot. Instead, we have to get the HTTP boot
information from the device path nodes defined in following UEFI Specification
sections.

 9.3.5.12 IPv4 Device Path
 9.3.5.13 IPv6 Device Path
 9.3.5.23 Uniform Resource Identifiers (URI) Device Path

This patch basically does:

include/grub/efi/api.h:
Add new structure of Uniform Resource Identifiers (URI) Device Path

grub-core/net/drivers/efi/efinet.c:
Check if PXE Base Code is available, if not it will try to obtain the netboot
information from the device path where the image booted from. The DHCPACK
packet is recoverd from the information in device patch and feed into the same
DHCP packet processing functions to ensure the network interface is setting up
the same way it used to be.

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Patch-Name: efinet-set-network-from-uefi-devpath.patch

5 years agobootp: Add processing DHCPACK packet from HTTP Boot
Michael Chang [Thu, 27 Oct 2016 21:42:19 +0000 (17:42 -0400)]
bootp: Add processing DHCPACK packet from HTTP Boot

The vendor class identifier with the string "HTTPClient" is used to denote the
packet as responding to HTTP boot request. In DHCP4 config, the filename for
HTTP boot is the URL of the boot file while for PXE boot it is the path to the
boot file. As a consequence, the next-server becomes obseleted because the HTTP
URL already contains the server address for the boot file. For DHCP6 config,
there's no difference definition in existing config as dhcp6.bootfile-url can
be used to specify URL for both HTTP and PXE boot file.

This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK
packet by treating it as HTTP format, not as the PXE format.

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Patch-Name: bootp-process-dhcpack-http-boot.patch

5 years agoefinet: UEFI IPv6 PXE support
Michael Chang [Thu, 27 Oct 2016 21:41:21 +0000 (17:41 -0400)]
efinet: UEFI IPv6 PXE support

When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is
cached in firmware buffer which can be obtained by PXE Base Code protocol. The
network interface can be setup through the parameters in that obtained packet.

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Patch-Name: efinet-uefi-ipv6-pxe-support.patch

5 years agobootp: New net_bootp6 command
Michael Chang [Thu, 27 Oct 2016 21:41:04 +0000 (17:41 -0400)]
bootp: New net_bootp6 command

Implement new net_bootp6 command for IPv6 network auto configuration via the
DHCPv6 protocol (RFC3315).

Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
Patch-Name: bootp-new-net_bootp6-command.patch

5 years agonet: read bracketed ipv6 addrs and port numbers
Aaron Miller [Thu, 27 Oct 2016 21:39:49 +0000 (17:39 -0400)]
net: read bracketed ipv6 addrs and port numbers

Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses
to be recognized with brackets around them, which is required to specify a port
number

Patch-Name: net-read-bracketed-ipv6-addr.patch

5 years agoTell zpool to emit full device names
Chad MILLER [Thu, 27 Oct 2016 21:15:07 +0000 (17:15 -0400)]
Tell zpool to emit full device names

zfs-initramfs currently provides extraneous, undesired symlinks to
devices directly underneath /dev/ to satisfy zpool's historical output
of unqualified device names. By including this environment variable to
signal our intent to zpool, zfs-linux packages can drop the symlink
behavior when updating to its upstream or backported output behavior.

Bug: https://savannah.gnu.org/bugs/?43653
Bug-Debian: https://bugs.debian.org/824974
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1527727
Last-Update: 2016-11-01

Patch-Name: zpool-full-device-name.patch

5 years agoGenerate alternative init entries in advanced menu
Colin Watson [Sat, 3 Jan 2015 12:04:59 +0000 (12:04 +0000)]
Generate alternative init entries in advanced menu

Add fallback boot entries for alternative installed init systems.  Based
on patches from Michael Biebl and Didier Roche.

Bug-Debian: https://bugs.debian.org/757298
Bug-Debian: https://bugs.debian.org/773173
Forwarded: no
Last-Update: 2017-06-23

Patch-Name: mkconfig-other-inits.patch

5 years agoAdd support for forcing EFI installation to the removable media path
Steve McIntyre [Wed, 3 Dec 2014 01:25:12 +0000 (01:25 +0000)]
Add support for forcing EFI installation to the removable media path

Add an extra option to grub-install "--force-extra-removable". On EFI
platforms, this will cause an extra copy of the grub-efi image to be
written to the appropriate removable media patch
/boot/efi/EFI/BOOT/BOOT$ARCH.EFI as well. This will help with broken
UEFI implementations where the firmware does not work when configured
with new boot paths.

Signed-off-by: Steve McIntyre <93sam@debian.org>
Bug-Debian: https://bugs.debian.org/767037 https://bugs.debian.org/773092
Forwarded: Not yet
Last-Update: 2014-12-20

Patch-Name: grub-install-extra-removable.patch

5 years agoArrange to insmod xzio and lzopio when booting a kernel as a Xen guest
Ian Campbell [Sun, 30 Nov 2014 12:12:52 +0000 (12:12 +0000)]
Arrange to insmod xzio and lzopio when booting a kernel as a Xen guest

This is needed in case the Linux kernel is compiled with CONFIG_KERNEL_XZ or
CONFIG_KERNEL_LZO rather than CONFIG_KERNEL_GZ (gzio is already loaded by
grub.cfg today).

Signed-off-by: Ian Campbell <ijc@debian.org>
Bug-Debian: https://bugs.debian.org/755256
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2014-11/msg00091.html
Last-Update: 2014-11-30

Patch-Name: insmod-xzio-and-lzopio-on-xen.patch

5 years agogrub-install: Install PV Xen binaries into the upstream specified path
Ian Campbell [Sat, 6 Sep 2014 11:20:12 +0000 (12:20 +0100)]
grub-install: Install PV Xen binaries into the upstream specified path

Upstream have defined a specification for where guests ought to place their
xenpv grub binaries in order to facilitate chainloading from a stage 1 grub
loaded from dom0.

http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html

The spec calls for installation into /boot/xen/pvboot-i386.elf or
/boot/xen/pvboot-x86_64.elf.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Bug-Debian: https://bugs.debian.org/762307
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00041.html
Last-Update: 2014-10-24

Patch-Name: grub-install-pvxen-paths.patch

---
v2: Respect bootdir, create /boot/xen as needed.

5 years agoDisable VSX instruction
Paulo Flabiano Smorigo [Thu, 25 Sep 2014 22:33:39 +0000 (19:33 -0300)]
Disable VSX instruction

VSX bit is enabled by default for Power7 and Power8 CPU models,
so we need to disable them in order to avoid instruction exceptions.
Kernel will activate it when necessary.

* grub-core/kern/powerpc/ieee1275/startup.S: Disable VSX.

Also-By: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Also-By: Colin Watson <cjwatson@debian.org>
Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00078.html
Last-Update: 2015-01-27

Patch-Name: ppc64el-disable-vsx.patch

5 years agoInclude a text attribute reset in the clear command for ppc
Paulo Flabiano Smorigo [Thu, 25 Sep 2014 21:41:29 +0000 (18:41 -0300)]
Include a text attribute reset in the clear command for ppc

Always clear text attribute for clear command in order to avoid problems
after it boots.

* grub-core/term/terminfo.c: Add escape for text attribute reset

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1295255
Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00076.html
Last-Update: 2014-09-26

Patch-Name: ieee1275-clear-reset.patch

5 years agoPort yaboot logic for various powerpc machine types
Colin Watson [Tue, 28 Jan 2014 14:40:02 +0000 (14:40 +0000)]
Port yaboot logic for various powerpc machine types

Some powerpc machines require not updating the NVRAM.  This can be handled
by existing grub-install command-line options, but it's friendlier to detect
this automatically.

On chrp_ibm machines, use the nvram utility rather than nvsetenv.  (This
is possibly suitable for other machines too, but that needs to be
verified.)

Forwarded: no
Last-Update: 2014-10-15

Patch-Name: install-powerpc-machtypes.patch

5 years agoAdd GRUB_RECOVERY_TITLE option
Colin Watson [Mon, 13 Jan 2014 12:13:33 +0000 (12:13 +0000)]
Add GRUB_RECOVERY_TITLE option

This allows the controversial "recovery mode" text to be customised.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1240360
Forwarded: no
Last-Update: 2013-12-25

Patch-Name: mkconfig-recovery-title.patch

5 years agoIgnore functional test failures for now as they are broken
Colin Watson [Mon, 13 Jan 2014 12:13:32 +0000 (12:13 +0000)]
Ignore functional test failures for now as they are broken

See: https://lists.gnu.org/archive/html/grub-devel/2013-11/msg00242.html

Forwarded: not-needed
Last-Update: 2013-11-19

Patch-Name: ignore-grub_func_test-failures.patch

5 years agoProbe FusionIO devices
Colin Watson [Mon, 13 Jan 2014 12:13:31 +0000 (12:13 +0000)]
Probe FusionIO devices

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1237519
Forwarded: no
Last-Update: 2016-09-18

Patch-Name: probe-fusionio.patch

5 years agoAdd configure option to use vt.handoff=7
Colin Watson [Mon, 13 Jan 2014 12:13:30 +0000 (12:13 +0000)]
Add configure option to use vt.handoff=7

This is used for non-recovery Linux entries only; it enables
flicker-free booting if gfxpayload=keep is in use and a suitable kernel
is present.

Author: Andy Whitcroft <apw@canonical.com>
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: vt-handoff.patch

5 years agoAdd configure option to enable gfxpayload=keep dynamically
Evan Broder [Mon, 13 Jan 2014 12:13:29 +0000 (12:13 +0000)]
Add configure option to enable gfxpayload=keep dynamically

Set GRUB_GFXPAYLOAD_LINUX=keep unless it's known to be unsupported on
the current hardware.  See
https://blueprints.launchpad.net/ubuntu/+spec/packageselection-foundations-n-grub2-boot-framebuffer.

Author: Colin Watson <cjwatson@ubuntu.com>
Forwarded: no
Last-Update: 2019-05-25

Patch-Name: gfxpayload-dynamic.patch

5 years agoAdd configure option to bypass boot menu if possible
Colin Watson [Mon, 13 Jan 2014 12:13:28 +0000 (12:13 +0000)]
Add configure option to bypass boot menu if possible

If other operating systems are installed, then automatically unhide the
menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus if
available to check whether Shift is pressed.  If it is, show the menu,
otherwise boot immediately.  If keystatus is not available, then fall
back to a short delay interruptible with Escape.

This may or may not remain Ubuntu-specific, although it's not obviously
wanted upstream.  It implements a requirement of
https://wiki.ubuntu.com/DesktopExperienceTeam/KarmicBootExperienceDesignSpec#Bootloader.

If the previous boot failed (defined as failing to get to the end of one
of the normal runlevels), then show the boot menu regardless.

Author: Richard Laager <rlaager@wiktel.com>
Author: Robie Basak <robie.basak@ubuntu.com>
Forwarded: no
Last-Update: 2015-09-04

Patch-Name: quick-boot.patch

5 years agoCope with Kubuntu setting GRUB_DISTRIBUTOR
Colin Watson [Mon, 13 Jan 2014 12:13:27 +0000 (12:13 +0000)]
Cope with Kubuntu setting GRUB_DISTRIBUTOR

This is not a very good approach, and certainly not sanely upstreamable;
we probably need to split GRUB_DISTRIBUTOR into a couple of different
variables.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1242417
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: install-efi-ubuntu-flavours.patch

5 years agoAdd configure option to reduce visual clutter at boot time
Colin Watson [Mon, 13 Jan 2014 12:13:26 +0000 (12:13 +0000)]
Add configure option to reduce visual clutter at boot time

If this option is enabled, then do all of the following:

Don't display introductory message about line editing unless we're
actually offering a shell prompt.  (This is believed to be a workaround
for a different bug.  We'll go with this for now, but will drop this in
favour of a better fix upstream if somebody figures out what that is.)

Don't clear the screen just before booting if we never drew the menu in
the first place.

Remove verbose messages printed before reading configuration.  In some
ways this is awkward because it makes debugging harder, but it's a
requirement for a smooth-looking boot process; we may be able to do
better in future.  Upstream doesn't want this, though.

Disable the cursor as well, for similar reasons of tidiness.

Suppress kernel/initrd progress messages, except in recovery mode.

Suppress "GRUB loading" message unless Shift is held down.  Upstream
doesn't want this, as it makes debugging harder.  Ubuntu wants it to
provide a cleaner boot experience.

Author: Will Thompson <will@willthompson.co.uk>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/386922
Bug-Ubuntu: https://bugs.launchpad.net/bugs/861048
Forwarded: (partial) http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00056.html
Last-Update: 2019-06-24

Patch-Name: maybe-quiet.patch

5 years agoSkip Windows os-prober entries on Wubi systems
Colin Watson [Mon, 13 Jan 2014 12:13:24 +0000 (12:13 +0000)]
Skip Windows os-prober entries on Wubi systems

Since we're already being booted from the Windows boot loader, including
entries that take us back to it mostly just causes confusion, and stops
us from being able to hide the menu if there are no other OSes
installed.

https://blueprints.launchpad.net/ubuntu/+spec/foundations-o-wubi

Forwarded: not-needed
Last-Update: 2013-11-26

Patch-Name: wubi-no-windows.patch

5 years agoAllow Shift to interrupt 'sleep --interruptible'
Colin Watson [Mon, 13 Jan 2014 12:13:23 +0000 (12:13 +0000)]
Allow Shift to interrupt 'sleep --interruptible'

Upstream would like to consider this at more length. See
http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00718.html, and
the rest of the thread for context.

Forwarded: http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00694.html
Last-Update: 2013-12-04

Patch-Name: sleep-shift.patch

5 years agoInstall signed images if UEFI Secure Boot is enabled
Colin Watson [Mon, 13 Jan 2014 12:13:22 +0000 (12:13 +0000)]
Install signed images if UEFI Secure Boot is enabled

Author: Stéphane Graber <stgraber@ubuntu.com>
Author: Steve Langasek <steve.langasek@ubuntu.com>
Author: Linn Crosetto <linn@hpe.com>
Author: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
Forwarded: no
Last-Update: 2016-11-01

Patch-Name: install-signed.patch

5 years agoGenerate configuration for signed UEFI kernels if available
Colin Watson [Mon, 13 Jan 2014 12:13:21 +0000 (12:13 +0000)]
Generate configuration for signed UEFI kernels if available

Forwarded: no
Last-Update: 2013-12-25

Patch-Name: mkconfig-signed-kernel.patch

5 years agoIf running under UEFI secure boot, use linuxefi loader
Colin Watson [Mon, 13 Jan 2014 12:13:20 +0000 (12:13 +0000)]
If running under UEFI secure boot, use linuxefi loader

If linuxefi fails to verify the kernel's signature, then refuse to boot.

Author: Steve Langasek <steve.langasek@canonical.com>
Author: Linn Crosetto <linn@hpe.com>
Forwarded: no
Last-Update: 2019-05-24

Patch-Name: linuxefi-use-if-secure-boot.patch

5 years agoAdd "linuxefi" loader which avoids ExitBootServices
Matthew Garrett [Mon, 13 Jan 2014 12:13:15 +0000 (12:13 +0000)]
Add "linuxefi" loader which avoids ExitBootServices

Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub2-linuxefi.patch
Forwarded: no
Last-Update: 2019-05-26

Patch-Name: linuxefi.patch

5 years agoRemove GNU/Linux from default distributor string for Ubuntu
Mario Limonciello [Mon, 13 Jan 2014 12:13:14 +0000 (12:13 +0000)]
Remove GNU/Linux from default distributor string for Ubuntu

Ubuntu is called "Ubuntu", not "Ubuntu GNU/Linux".

Author: Colin Watson <cjwatson@debian.org>
Author: Harald Sitter <apachelogger@kubuntu.org>
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: mkconfig-ubuntu-distributor.patch

5 years agoOutput a menu entry for firmware setup on UEFI FastBoot systems
Steve Langasek [Mon, 13 Jan 2014 12:13:12 +0000 (12:13 +0000)]
Output a menu entry for firmware setup on UEFI FastBoot systems

Forwarded: no
Last-Update: 2015-09-04

Patch-Name: uefi-firmware-setup.patch

5 years agoBlacklist 1440x900x32 from VBE preferred mode handling
Colin Watson [Mon, 13 Jan 2014 12:13:11 +0000 (12:13 +0000)]
Blacklist 1440x900x32 from VBE preferred mode handling

Bug-Ubuntu: https://bugs.launchpad.net/bugs/701111
Forwarded: no
Last-Update: 2013-11-14

Patch-Name: blacklist-1440x900x32.patch

5 years agoRead /etc/default/grub.d/*.cfg after /etc/default/grub
Colin Watson [Mon, 13 Jan 2014 12:13:10 +0000 (12:13 +0000)]
Read /etc/default/grub.d/*.cfg after /etc/default/grub

Bug-Ubuntu: https://bugs.launchpad.net/bugs/901600
Forwarded: no
Last-Update: 2014-01-28

Patch-Name: default-grub-d.patch

5 years agoDon't permit loading modules on UEFI secure boot
Matthew Garrett [Mon, 13 Jan 2014 12:13:09 +0000 (12:13 +0000)]
Don't permit loading modules on UEFI secure boot

Author: Colin Watson <cjwatson@ubuntu.com>
Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub-2.00-no-insmod-on-sb.patch
Forwarded: no
Last-Update: 2013-12-25

Patch-Name: no-insmod-on-sb.patch

5 years agoAvoid getting confused by inaccessible loop device backing paths
Colin Watson [Mon, 13 Jan 2014 12:13:08 +0000 (12:13 +0000)]
Avoid getting confused by inaccessible loop device backing paths

Bug-Ubuntu: https://bugs.launchpad.net/bugs/938724
Forwarded: no
Last-Update: 2013-12-20

Patch-Name: mkconfig-nonexistent-loopback.patch

5 years agoPrefer translations from Ubuntu language packs if available
Colin Watson [Mon, 13 Jan 2014 12:13:07 +0000 (12:13 +0000)]
Prefer translations from Ubuntu language packs if available

Bug-Ubuntu: https://bugs.launchpad.net/bugs/537998
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: install-locale-langpack.patch

5 years ago"single" -> "recovery" when friendly-recovery is installed
Colin Watson [Mon, 13 Jan 2014 12:13:06 +0000 (12:13 +0000)]
"single" -> "recovery" when friendly-recovery is installed

If configured with --enable-ubuntu-recovery, also set nomodeset for
recovery mode, and disable 'set gfxpayload=keep' even if the system
normally supports it.  See
https://launchpad.net/ubuntu/+spec/desktop-o-xorg-tools-and-processes.

Author: Stéphane Graber <stgraber@ubuntu.com>
Forwarded: no
Last-Update: 2013-12-25

Patch-Name: mkconfig-ubuntu-recovery.patch

5 years agoFall back to non-EFI if booted using EFI but -efi is missing
Colin Watson [Mon, 13 Jan 2014 12:13:05 +0000 (12:13 +0000)]
Fall back to non-EFI if booted using EFI but -efi is missing

It may be possible, particularly in recovery situations, to be booted
using EFI on x86 when only the i386-pc target is installed, or on ARM
when only the arm-uboot target is installed.  There's nothing actually
stopping us installing i386-pc or arm-uboot from an EFI environment, and
it's better than returning a confusing error.

Author: Steve McIntyre <93sam@debian.org>
Forwarded: no
Last-Update: 2019-05-24

Patch-Name: install-efi-fallback.patch

5 years agoBail out if trying to run grub-mkconfig during upgrade to 2.00
Colin Watson [Mon, 13 Jan 2014 12:13:03 +0000 (12:13 +0000)]
Bail out if trying to run grub-mkconfig during upgrade to 2.00

Since files in /etc/grub.d/ are conffiles, they are not put in place
until grub-common is configured, meaning that they may be out of sync
with the parts of grub-mkconfig that reside in /usr/.  In GRUB 1.99,
/etc/grub.d/00_header contained a reference to ${GRUB_PREFIX}/video.lst.
This and other code from 1.99 breaks with 2.00's grub-mkconfig.
Deferring this to when grub-PLATFORM.postinst eventually runs is safe
and avoids this problem.

Forwarded: no
Last-Update: 2013-12-25

Patch-Name: mkconfig-mid-upgrade.patch

5 years agoSilence error messages when translations are unavailable
Colin Watson [Mon, 13 Jan 2014 12:13:02 +0000 (12:13 +0000)]
Silence error messages when translations are unavailable

Bug: https://savannah.gnu.org/bugs/?35880
Forwarded: https://savannah.gnu.org/bugs/?35880
Last-Update: 2013-11-14

Patch-Name: gettext-quiet.patch

5 years agoRestore grub-mkdevicemap
Colin Watson [Mon, 13 Jan 2014 12:13:01 +0000 (12:13 +0000)]
Restore grub-mkdevicemap

This is kind of a mess, requiring lots of OS-specific code to iterate
over all possible devices.  However, we use it in a number of scripts to
discover devices and reimplementing those in terms of something else
would be very complicated.

Author: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Forwarded: no
Last-Update: 2019-05-25

Patch-Name: restore-mkdevicemap.patch

5 years agoHandle filesystems loop-mounted on file images
Colin Watson [Mon, 13 Jan 2014 12:13:00 +0000 (12:13 +0000)]
Handle filesystems loop-mounted on file images

Improve prepare_grub_to_access_device to emit appropriate commands for
such filesystems, and ignore them in Linux grub.d scripts.

This is needed for Ubuntu's Wubi installation method.

This patch isn't inherently Debian/Ubuntu-specific.  losetup and
/proc/mounts are Linux-specific, though, so we might need to refine this
before sending it upstream.  The changes to the Linux grub.d scripts
might be better handled by integrating 10_lupin properly instead.

Patch-Name: mkconfig-loopback.patch

5 years agoBuild vfat into EFI boot images
Mario Limonciello [Mon, 13 Jan 2014 12:12:59 +0000 (12:12 +0000)]
Build vfat into EFI boot images

Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/677758
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-01/msg00028.html
Last-Update: 2016-09-18

Patch-Name: mkrescue-efi-modules.patch

5 years agoIf GRUB Legacy is still around, tell packaging to ignore it
Colin Watson [Mon, 13 Jan 2014 12:12:58 +0000 (12:12 +0000)]
If GRUB Legacy is still around, tell packaging to ignore it

Bug-Debian: http://bugs.debian.org/586143
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: install-stage2-confusion.patch

5 years agoDisable gfxpayload=keep by default
Colin Watson [Mon, 13 Jan 2014 12:12:57 +0000 (12:12 +0000)]
Disable gfxpayload=keep by default

Setting gfxpayload=keep has been known to cause efifb to be
inappropriately enabled.  In any case, with the current Linux kernel the
result of this option is that early kernelspace will be unable to print
anything to the console, so (for example) if boot fails and you end up
dumped to an initramfs prompt, you won't be able to see anything on the
screen.  As such it shouldn't be enabled by default in Debian, no matter
what kernel options are enabled.

gfxpayload=keep is a good idea but rather ahead of its time ...

Bug-Debian: http://bugs.debian.org/567245
Forwarded: no
Last-Update: 2013-12-25

Patch-Name: gfxpayload-keep-default.patch

5 years agoMake grub.cfg world-readable if it contains no passwords
Colin Watson [Mon, 13 Jan 2014 12:12:55 +0000 (12:12 +0000)]
Make grub.cfg world-readable if it contains no passwords

Patch-Name: grub.cfg-400.patch

5 years agoDisable use of floppy devices
Colin Watson [Mon, 13 Jan 2014 12:12:54 +0000 (12:12 +0000)]
Disable use of floppy devices

An ugly kludge.  Should this be merged upstream?

Author: Robert Millan

Patch-Name: disable-floppies.patch

5 years agoSupport running grub-probe in grub-legacy's update-grub
Robert Millan [Mon, 13 Jan 2014 12:12:53 +0000 (12:12 +0000)]
Support running grub-probe in grub-legacy's update-grub

Author: Colin Watson <cjwatson@debian.org>
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: grub-legacy-0-based-partitions.patch

5 years agoImprove handling of Debian kernel version numbers
Robert Millan [Mon, 13 Jan 2014 12:12:52 +0000 (12:12 +0000)]
Improve handling of Debian kernel version numbers

Forwarded: not-needed
Last-Update: 2013-12-20

Patch-Name: dpkg-version-comparison.patch

5 years agoWrite marker if core.img was written to filesystem
Colin Watson [Mon, 13 Jan 2014 12:12:51 +0000 (12:12 +0000)]
Write marker if core.img was written to filesystem

The Debian bug reporting script includes a warning in this case.

Patch-Name: core-in-fs.patch

5 years agoHack prefix for OLPC
Colin Watson [Mon, 13 Jan 2014 12:12:50 +0000 (12:12 +0000)]
Hack prefix for OLPC

This sucks, but it's better than what OFW was giving us.

Patch-Name: olpc-prefix-hack.patch

5 years agoImport grub2_2.04~rc1.orig.tar.xz
Colin Watson [Tue, 14 May 2019 09:20:03 +0000 (10:20 +0100)]
Import grub2_2.04~rc1.orig.tar.xz

5 years agoRelease 2.04~rc1
Vladimir Serbinenko [Mon, 8 Apr 2019 05:30:56 +0000 (07:30 +0200)]
Release 2.04~rc1

5 years agoChange fs functions to add fs_ prefix
Vladimir Serbinenko [Mon, 8 Apr 2019 05:24:24 +0000 (07:24 +0200)]
Change fs functions to add fs_ prefix

This avoid conflict with gnulib

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoA workaround for clang problem assembling startup_raw.S
Vladimir Serbinenko [Tue, 26 Mar 2019 13:56:59 +0000 (14:56 +0100)]
A workaround for clang problem assembling startup_raw.S

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoieee1275: NULL pointer dereference in grub_ieee1275_encode_devname()
Eric Snowberg [Tue, 2 Apr 2019 16:40:31 +0000 (09:40 -0700)]
ieee1275: NULL pointer dereference in grub_ieee1275_encode_devname()

Function grub_strndup() may return NULL, this is called from
function grub_ieee1275_get_devname() which is then called from
function grub_ieee1275_encode_devname() to set device. The device
variable could then be used with a NULL pointer.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agodocs/grub-dev: Change comments rules
Daniel Kiper [Fri, 29 Mar 2019 15:11:04 +0000 (16:11 +0100)]
docs/grub-dev: Change comments rules

Current comments forms are annoying, so, some of them are disallowed
starting from now. New rules are more flexible and mostly aligned
with, e.g., Linux kernel comments rules.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoloader/i386/linux: Calculate the setup_header length
Andrew Jeddeloh [Fri, 29 Mar 2019 15:09:54 +0000 (16:09 +0100)]
loader/i386/linux: Calculate the setup_header length

Previously the setup_header length was just assumed to be the size of the
linux_kernel_params struct. The linux x86 32-bit boot protocol says that the
end of the linux_i386_kernel_header is at 0x202 + the byte value at 0x201 in
the linux_i386_kernel_header. So, calculate the size of the header using the
end of the linux_i386_kernel_header, rather than assume it is the size of the
linux_kernel_params struct.

Additionally, add some required members to the linux_kernel_params
struct and align the content of linux_i386_kernel_header struct with
it. New members naming was taken directly from Linux kernel source.

linux_kernel_params and linux_i386_kernel_header structs require more
cleanup. However, this is not urgent, so, let's do this after release.
Just in case...

Signed-off-by: Andrew Jeddeloh <andrew.jeddeloh@coreos.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agoefidisk: NULL pointer dereference in grub_efidisk_get_device_name()
Eric Snowberg [Thu, 28 Mar 2019 21:26:37 +0000 (15:26 -0600)]
efidisk: NULL pointer dereference in grub_efidisk_get_device_name()

Function grub_efi_find_last_device_path() may return NULL when called
from grub_efidisk_get_device_name().

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoefidisk: NULL pointer dereference in is_child()
Eric Snowberg [Thu, 28 Mar 2019 21:26:36 +0000 (15:26 -0600)]
efidisk: NULL pointer dereference in is_child()

Function grub_efi_find_last_device() path may return NULL when called
from is_child().

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoefidisk: Write to NULL pointer ldp
Eric Snowberg [Thu, 28 Mar 2019 20:32:31 +0000 (14:32 -0600)]
efidisk: Write to NULL pointer ldp

Function grub_efi_find_last_device_path() may return constant NULL when
called from find_parent_device().

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoclang: Pair -Qn with -Qunused-arguments.
Vladimir Serbinenko [Mon, 25 Mar 2019 16:43:18 +0000 (17:43 +0100)]
clang: Pair -Qn with -Qunused-arguments.

When assembling module wirh clang -Qn ends up on command line but later ignored
To avoid it breaking the compile, add -Qunused-arguments.

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoieee1275: Fix path reference in comment of sparc64 boot loader code
John Paul Adrian Glaubitz [Tue, 26 Mar 2019 10:21:56 +0000 (11:21 +0100)]
ieee1275: Fix path reference in comment of sparc64 boot loader code

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoieee1275: Include a.out header in assembly of sparc64 boot loader
John Paul Adrian Glaubitz [Tue, 26 Mar 2019 09:47:16 +0000 (10:47 +0100)]
ieee1275: Include a.out header in assembly of sparc64 boot loader

Recent versions of binutils dropped support for the a.out and COFF
formats on sparc64 targets. Since the boot loader on sparc64 is
supposed to be an a.out binary and the a.out header entries are
rather simple to calculate in our case, we just write the header
ourselves instead of relying on external tools to do that.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoPropagate GNU_PRINTF from gnulib vfprintf
Vladimir Serbinenko [Fri, 22 Mar 2019 15:13:11 +0000 (16:13 +0100)]
Propagate GNU_PRINTF from gnulib vfprintf

gnulib now replaces vfprintf and hence its format becomes GNU_PRINTF format

This also fixes matching definitions to always use GNU format

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoefi/tpm.c: Add missing casts
Vladimir Serbinenko [Fri, 22 Mar 2019 15:07:47 +0000 (16:07 +0100)]
efi/tpm.c: Add missing casts

Without those casts we get a warning about implicit conversion of pointer
to integer.

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoPOTFILES: Don't include gnulib in grub.pot
Vladimir Serbinenko [Fri, 22 Mar 2019 15:06:18 +0000 (16:06 +0100)]
POTFILES: Don't include gnulib in grub.pot

They're translated as a separate project, so we
don't want to submit them again.

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoconfigure.ac: Use nostdlib when checking for nostdinc
Vladimir Serbinenko [Mon, 25 Mar 2019 15:09:04 +0000 (16:09 +0100)]
configure.ac: Use nostdlib when checking for nostdinc

With clang nostdinc behaviour is influenced by nostdlib. Since we
always add nostdlib, add it in test as well

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoefi/tpm.h: Fix hash_log_extend_event definition.
Vladimir Serbinenko [Fri, 22 Mar 2019 16:12:57 +0000 (17:12 +0100)]
efi/tpm.h: Fix hash_log_extend_event definition.

I didn't check the spec but pointer to address doesn't make much sense
and doesn't match the code.

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoRename grub_disk members
Vladimir Serbinenko [Fri, 22 Mar 2019 16:07:00 +0000 (17:07 +0100)]
Rename grub_disk members

Otherwise it horribly clashes with gnulib when it's
replacing open/write/read/close

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agogrub-mkimagexx: Fix RISCV error message
Vladimir Serbinenko [Fri, 22 Mar 2019 16:11:14 +0000 (17:11 +0100)]
grub-mkimagexx: Fix RISCV error message

Outputting a raw pointer doesn't match the format and is
also useless. Output offset instead.

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agokern/emu/misc.c: Don't include config-util.h when running as GRUB_BUILD
Vladimir Serbinenko [Fri, 22 Mar 2019 16:19:38 +0000 (17:19 +0100)]
kern/emu/misc.c: Don't include config-util.h when running as GRUB_BUILD

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agoSupport R_PPC_PLTREL24
Vladimir Serbinenko [Fri, 22 Mar 2019 20:24:24 +0000 (21:24 +0100)]
Support R_PPC_PLTREL24

It's emitted by clang 7. It's the same as R_PPC_REL24.

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
5 years agosparc: Enable __clzsi2() and __clzdi2()
Daniel Kiper [Tue, 19 Mar 2019 09:51:01 +0000 (10:51 +0100)]
sparc: Enable __clzsi2() and __clzdi2()

This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers
for clz) but for SPARC target.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agomips: Enable __clzsi2()
Daniel Kiper [Mon, 18 Mar 2019 12:19:05 +0000 (13:19 +0100)]
mips: Enable __clzsi2()

This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers
for clz) but for MIPS target.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agoverifiers: MIPS fallout cleanup
Daniel Kiper [Mon, 18 Mar 2019 12:09:22 +0000 (13:09 +0100)]
verifiers: MIPS fallout cleanup

MIPS fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility
to verify kernel and modules command lines).

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agoverifiers: PowerPC fallout cleanup
Daniel Kiper [Thu, 14 Mar 2019 18:45:17 +0000 (19:45 +0100)]
verifiers: PowerPC fallout cleanup

PowerPC fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility
to verify kernel and modules command lines) and ca0a4f689 (verifiers: File
type for fine-grained signature-verification controlling).

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agoverifiers: IA-64 fallout cleanup
Daniel Kiper [Thu, 14 Mar 2019 15:18:31 +0000 (16:18 +0100)]
verifiers: IA-64 fallout cleanup

IA-64 fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility
to verify kernel and modules command lines).

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
5 years agoposix_wrap: Flesh out posix_wrap/limits.h a little more
Colin Watson [Tue, 19 Mar 2019 10:26:18 +0000 (10:26 +0000)]
posix_wrap: Flesh out posix_wrap/limits.h a little more

In addition to what was already there, Gnulib's <intprops.h> needs SCHAR_MIN,
SCHAR_MAX, SHRT_MIN, INT_MIN, LONG_MIN, and LONG_MAX. Fixes build on CentOS 7.

Reported-by: "Chen, Farrah" <farrah.chen@intel.com>
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoxen: Look for Xen notes in section headers too
Marek Marczykowski-Górecki [Thu, 14 Mar 2019 01:57:08 +0000 (02:57 +0100)]
xen: Look for Xen notes in section headers too

Mirror behaviour of ELF loader in libxc: first look for Xen notes in
PT_NOTE segment, then in SHT_NOTE section and only then fallback to
a section with __xen_guest name. This fixes loading PV kernels that
Xen note have outside of PT_NOTE. While this may be result of a buggy
linker script, loading such kernel directly works fine, so make it work
with GRUB too. Specifically, this applies to binaries built from Unikraft.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agogetroot: Save/restore CWD more reliably on Unix
Colin Watson [Sat, 9 Mar 2019 14:37:17 +0000 (14:37 +0000)]
getroot: Save/restore CWD more reliably on Unix

Various GRUB utilities fail if the current directory doesn't exist,
because grub_find_device() chdirs to a different directory and then
fails when trying to chdir back.  Gnulib's save-cwd module uses fchdir()
instead when it can, avoiding this category of problem.

Fixes Debian bug #918700.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Add explicit net_dhcp command
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:16 +0000 (15:14 +0000)]
net/dhcp: Add explicit net_dhcp command

Mostly for cosmetic reasons, we add a "net_dhcp" command, which is (at the
moment) identical to the existing "net_bootp" command. Both actually trigger
a DHCP handshake now, and both should be able to deal with pure BOOTP servers.
We could think about dropping the DHCP options from the initial DISCOVER packet
when the user issues the net_bootp command, but it's unclear whether this is
really useful, as both protocols should be able to coexist.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Actually send out DHCPv4 DISCOVER and REQUEST messages
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:15 +0000 (15:14 +0000)]
net/dhcp: Actually send out DHCPv4 DISCOVER and REQUEST messages

Even though we were parsing some DHCP options sent by the server, so far
we are only using the BOOTP 2-way handshake, even when talking to a DHCP
server.

Change this by actually sending out DHCP DISCOVER packets instead of the
generic (mostly empty) BOOTP BOOTREQUEST packets.

A pure BOOTP server would ignore the extra DHCP options in the DISCOVER
packet and would just reply with a BOOTREPLY packet, which we also
handle in the code.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Allow receiving DHCP OFFER and ACK packets
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:14 +0000 (15:14 +0000)]
net/dhcp: Allow receiving DHCP OFFER and ACK packets

In respone to a BOOTREQUEST packet a BOOTP server would answer with a BOOTREPLY
packet, which ends the conversation for good. DHCP uses a 4-way handshake,
where the initial server respone is an OFFER, which has to be answered with
REQUEST by the client again, only to be completed by an ACKNOWLEDGE packet
from the server.

Teach the grub_net_process_dhcp() function to deal with OFFER packets,
and treat ACK packets the same es BOOTREPLY packets.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Use DHCP options for name and bootfile
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:13 +0000 (15:14 +0000)]
net/dhcp: Use DHCP options for name and bootfile

The BOOTP RFC describes the boot file name and the server name as being part
of the integral BOOTP data structure, with some limits on the size of them.
DHCP extends this by allowing them to be separate DHCP options, which is more
flexible.

Teach the code dealing with those fields to check for those DHCP options first
and use this information, if provided. We fall back to using the BOOTP
information if those options are not used.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Introduce per-interface timeout
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:12 +0000 (15:14 +0000)]
net/dhcp: Introduce per-interface timeout

Currently we have a global timeout for all network cards in the BOOTP/DHCP
discovery process.

Make this timeout a per-interface one, so better accommodate the upcoming
4-way DHCP handshake and to also cover the lease time limit a DHCP offer
will come with.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Make grub_net_process_dhcp() take an interface
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:11 +0000 (15:14 +0000)]
net/dhcp: Make grub_net_process_dhcp() take an interface

Change the interface of the function dealing with incoming BOOTP packets
to take an interface instead of a card, to allow more fine per-interface
state (timeout, handshake state) later on.

Use the opportunity to clean up the code a bit.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Refactor DHCP packet transmission into separate function
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:10 +0000 (15:14 +0000)]
net/dhcp: Refactor DHCP packet transmission into separate function

In contrast to BOOTP, DHCP uses a 4-way handshake, so requires to send
packets more often.

Refactor the generation and sending of the BOOTREQUEST packet into
a separate function, so that future code can more easily reuse this.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Allow overloading legacy bootfile and name field
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:09 +0000 (15:14 +0000)]
net/dhcp: Allow overloading legacy bootfile and name field

DHCP specifies a special dummy option OVERLOAD, to allow DHCP options to
spill over into the (legacy) BOOTFILE and SNAME fields.

Parse and handle this option properly.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Replace parse_dhcp_vendor() with find_dhcp_option()
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:08 +0000 (15:14 +0000)]
net/dhcp: Replace parse_dhcp_vendor() with find_dhcp_option()

For proper DHCP support we will need to parse DHCP options from a packet
more often and at various places.

Refactor the option parsing into a new function, which will scan a packet to
find *a particular* option field. Use that new function in places where we
were dealing with DHCP options before.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agonet/dhcp: Remove dead code
Andrei Borzenkov [Thu, 7 Mar 2019 15:14:07 +0000 (15:14 +0000)]
net/dhcp: Remove dead code

The comment is right, the "giaddr" fields holds the IP address of the BOOTP
relay, not a general purpose router address. Just remove the commented code,
archeologists can find it in the git history.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agomsr: Add new MSR modules (rdmsr/wrmsr)
Jesús Diéguez Fernández [Fri, 8 Mar 2019 00:26:37 +0000 (01:26 +0100)]
msr: Add new MSR modules (rdmsr/wrmsr)

In order to be able to read from and write to model-specific registers,
two new modules are added. They are i386 specific, as the cpuid module.

rdmsr module registers the command rdmsr that allows reading from a MSR.
wrmsr module registers the command wrmsr that allows writing to a MSR.

wrmsr module is disabled if UEFI secure boot is enabled.

Please note that on SMP systems, interacting with a MSR that has a scope
per hardware thread, implies that the value only applies to the
particular cpu/core/thread that ran the command.

Also, if you specify a reserved or unimplemented MSR address, it will
cause a general protection exception (which is not currently being
handled) and the system will reboot.

Signed-off-by: Jesús Diéguez Fernández <jesusdf@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoasm: Replace "__asm__ __volatile__" with "asm volatile"
Jesús Diéguez Fernández [Fri, 8 Mar 2019 00:26:36 +0000 (01:26 +0100)]
asm: Replace "__asm__ __volatile__" with "asm volatile"

In order to maintain the coding style consistency, it was requested to
replace the methods that use "__asm__ __volatile__" with "asm volatile".

Signed-off-by: Jesús Diéguez Fernández <jesusdf@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agosparc64: Add bios boot partition support
Eric Snowberg [Tue, 5 Mar 2019 01:34:01 +0000 (17:34 -0800)]
sparc64: Add bios boot partition support

Add BIOS Boot Partition support for sparc64 platforms.  This will work a
little different than x86.  With GPT, both the OBP "load" and "boot" commands
are partition aware and neither command can see the partition table.  Therefore
the entire boot-loader is stored within the BIOS Boot Partition and nothing
is stored within the bootstrap code area of MBR.

To use it, the end user will issue the boot command with the path pointing to
the BIOS Boot Partition.

For example with the disk below:

Model: Unknown (unknown)
Disk /dev/nvme1n1: 1600GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
1      1049kB  1075MB  1074MB   ext3
2      1075MB  1076MB  1049kB                     bios_grub
3      1076MB  1600GB  1599GB                     lvm

To boot grub2 from OBP, you would use:

boot /pci@302/pci@1/pci@0/pci@13/nvme@0/disk@1:b

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoieee1275: obdisk driver
Eric Snowberg [Tue, 5 Mar 2019 01:27:39 +0000 (17:27 -0800)]
ieee1275: obdisk driver

Add a new disk driver called obdisk for IEEE1275 platforms.  Currently
the only platform using this disk driver is SPARC, however other IEEE1275
platforms could start using it if they so choose.  While the functionality
within the current IEEE1275 ofdisk driver may be suitable for PPC and x86, it
presented too many problems on SPARC hardware.

Within the old ofdisk, there is not a way to determine the true canonical
name for the disk.  Within Open Boot, the same disk can have multiple names
but all reference the same disk.  For example the same disk can be referenced
by its SAS WWN, using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@w5000cca02f037d6d,0

It can also be referenced by its PHY identifier using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@p0

It can also be referenced by its Target identifier using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@0

Also, when the LUN=0, it is legal to omit the ,0 from the device name.  So with
the disk above, before taking into account the device aliases, there are 6 ways
to reference the same disk.

Then it is possible to have 0 .. n device aliases all representing the same disk.
Within this new driver the true canonical name is determined using the the
IEEE1275 encode-unit and decode-unit commands when address_cells == 4.  This
will determine the true single canonical name for the device so multiple ihandles
are not opened for the same device.  This is what frequently happens with the old
ofdisk driver.  With some devices when they are opened multiple times it causes
the entire system to hang.

Another problem solved with this driver is devices that do not have a device
alias can be booted and used within GRUB. Within the old ofdisk, this was not
possible, unless it was the original boot device.  All devices behind a SAS
or SCSI parent can be found.   Within the old ofdisk, finding these disks
relied on there being an alias defined.  The alias requirement is not
necessary with this new driver.  It can also find devices behind a parent
after they have been hot-plugged.  This is something that is not possible
with the old ofdisk driver.

The old ofdisk driver also incorrectly assumes that the device pointing to by a
device alias is in its true canonical form. This assumption is never made with
this new driver.

Another issue solved with this driver is that it properly caches the ihandle
for all open devices.  The old ofdisk tries to do this by caching the last
opened ihandle.  However this does not work properly because the layer above
does not use a consistent device name for the same disk when calling into the
driver.  This is because the upper layer uses the bootpath value returned within
/chosen, other times it uses the device alias, and other times it uses the
value within grub.cfg.  It does not have a way to figure out that these devices
are the same disk.  This is not a problem with this new driver.

Due to the way GRUB repeatedly opens and closes the same disk. Caching the
ihandle is important on SPARC.  Without caching, some SAS devices can take
15 - 20 minutes to get to the GRUB menu. This ihandle caching is not possible
without correctly having the canonical disk name.

When available, this driver also tries to use the deblocker #blocks and
a way of determining the disk size.

Finally and probably most importantly, this new driver is also capable of
seeing all partitions on a GPT disk.  With the old driver, the GPT
partition table can not be read and only the first partition on the disk
can be seen.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoMakefile: Allow to set file systems modules for default_payload.elf
Paul Menzel [Thu, 7 Mar 2019 11:16:06 +0000 (12:16 +0100)]
Makefile: Allow to set file systems modules for default_payload.elf

By default all file system modules are added to the GRUB coreboot
payload `default_payload.elf`. This makes the image quite big,
especially as often not all modules are needed.

Introduce the variable `FS_PAYLOAD_MODULES`, which can be used to
explicitly set file systems modules to be added.

    $ make default_payload.elf
    test -f default_payload.elf && rm default_payload.elf || true
    pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu affs afs bfs btrfs cbfs cpio cpio_be exfat ext2 f2fs fat hfs hfsplus iso9660 jfs minix minix2 minix2_be minix3 minix3_be minix_be newc nilfs2 ntfs odc procfs reiserfs romfs sfs squash4 tar udf ufs1 ufs1_be ufs2 xfs zfs password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg
    $ ls -l default_payload.elf
    -rw-rw---- 1 joey joey 1199568 Mar  6 13:58 default_payload.elf

    $ make default_payload.elf FS_PAYLOAD_MODULES="" # ext2 already in `--modules`
    test -f default_payload.elf && rm default_payload.elf || true
    pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu  password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg
    $ ls -l default_payload.elf
    -rw-rw---- 1 joey joey 832976 Mar  7 12:13 default_payload.elf

So, the resulting payload size is around 370 kB smaller. (Adding it to
the CBFS, it will be compressed, so the effective size difference will
be smaller.)

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>