]> git.proxmox.com Git - grub2.git/log
grub2.git
5 years agoAdd %X to grub_vsnprintf_real and friends
Colin Watson [Mon, 11 Mar 2019 11:15:12 +0000 (11:15 +0000)]
Add %X to grub_vsnprintf_real and friends

This is needed for UEFI Boot* variables, which the standard says are
named using upper-case hexadecimal.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Bug-Debian: https://bugs.debian.org/891434
Forwarded: https://lists.gnu.org/archive/html/grub-devel/2019-03/msg00121.html
Last-Update: 2019-03-23

Patch-Name: vsnprintf-upper-case-hex.patch

5 years agoFix setup on Secure Boot systems where cryptodisk is in use
Hervé Werner [Mon, 28 Jan 2019 16:24:23 +0000 (17:24 +0100)]
Fix setup on Secure Boot systems where cryptodisk is in use

On full-encrypted systems, including /boot, the current code omits
cryptodisk commands needed to open the drives if Secure Boot is enabled.
This prevents grub2 from reading any further configuration residing on
the encrypted disk.
This patch fixes this issue by adding the needed "cryptomount" commands in
the load.cfg file that is then copied in the EFI partition.

Bug-Debian: https://bugs.debian.org/917117
Last-Update: 2019-02-10

Patch-Name: uefi-secure-boot-cryptomount.patch

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 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 agoIf we don't have writable grubenv and we're on EFI, always show the menu
Steve Langasek [Tue, 30 Oct 2018 22:04:16 +0000 (15:04 -0700)]
If we don't have writable grubenv and we're on EFI, always show the menu

If we don't have writable grubenv, recordfail doesn't work, which means our
quickboot behavior - with a timeout of 0 - leaves the user without a
reliable way to access the boot menu if they're on UEFI, because unlike
BIOS, UEFI does not support checking the state of modifier keys (i.e.
holding down shift at boot is not detectable).

Handle this corner case by always using a non-zero timeout on EFI when
save_env doesn't work.

Reuse GRUB_RECORDFAIL_TIMEOUT to avoid introducing another variable.

Signed-off-by: Steve Langasek <steve.langasek@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1800722
Last-Update: 2019-06-24

Patch-Name: quick-boot-lvm.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 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
Author: Colin Watson <cjwatson@ubuntu.com>
Author: Steve Langasek <steve.langasek@canonical.com>
Author: Linn Crosetto <linn@hpe.com>
Forwarded: no
Last-Update: 2019-06-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.orig.tar.xz
Colin Watson [Tue, 9 Jul 2019 10:42:31 +0000 (11:42 +0100)]
Import grub2_2.04.orig.tar.xz

5 years agoRelease 2.04
Daniel Kiper [Mon, 1 Jul 2019 11:19:25 +0000 (13:19 +0200)]
Release 2.04

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agodocs: Document workaround for grub-mkrescue with older MacBooks
Thomas Schmitt [Thu, 20 Jun 2019 08:36:42 +0000 (10:36 +0200)]
docs: Document workaround for grub-mkrescue with older MacBooks

Add a description of the workaround for firmware of older MacBooks
which stalls with a grub-mkrescue ISO image for x86_64-efi target
on an USB stick.

Signed-off-by: Thomas Schmitt <scdbackup@gmx.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agodocs: Bootstrap changes required for older distros
Eric Snowberg [Wed, 19 Jun 2019 23:13:23 +0000 (17:13 -0600)]
docs: Bootstrap changes required for older distros

Some older distros do not contain gettext 0.18. Document the workaround
to use the bootstrap utility on these systems.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoia64: build fix in cache.h
Leif Lindholm [Thu, 6 Jun 2019 09:13:00 +0000 (10:13 +0100)]
ia64: build fix in cache.h

Add IA64 to the architectures excluding a declaration for
grub_arch_sync_dma_caches().

IA64 does not include any of the source files that require the function,
but was overlooked for d8901e3ba115 ("cache: Fix compilation for ppc,
sparc and arm64").

Add it to the list of excluding architectures in order to not get
missing symbol errors when running grub-mkimage.

Reported-by: Alexander Graf <agraf@csgraf.de>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agohostfs: #undef open and close.
Vladimir 'phcoder' Serbinenko [Mon, 25 Mar 2019 15:24:50 +0000 (16:24 +0100)]
hostfs: #undef open and close.

Unlike in case of disks in this case it's just a single place, so it's easier
to just #undef

Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agof2fs: Disable gcc9 -Waddress-of-packed-member
John Paul Adrian Glaubitz [Wed, 29 May 2019 06:34:55 +0000 (08:34 +0200)]
f2fs: Disable gcc9 -Waddress-of-packed-member

Disable the -Wadress-of-packaed-member diagnostic for the grub_f2fs_label
function since the result is found to be false postive.

A pointer to the 'volume_name' member of 'struct grub_f2fs_superblock' is
guaranteed to be aligned as the offset of 'volume_name' within the struct
is dividable by the natural alignment on both 32- and 64-bit targets.

grub-core/fs/f2fs.c: In function ‘grub_f2fs_label’:
grub-core/fs/f2fs.c:1253:60: error: taking address of packed member of ‘struct grub_f2fs_superblock’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
 1253 |     *label = (char *) grub_f2fs_utf16_to_utf8 (data->sblock.volume_name);
      |                                                ~~~~~~~~~~~~^~~~~~~~~~~~
cc1: all warnings being treated as errors

Reported-by: Neil MacLeod <neil@nmacleod.com>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Tested-by: Neil MacLeod <neil@nmacleod.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agogrub-mkrescue: Fix error message about the wrong command having failed: mformat inste...
Vincent Legoll [Sat, 27 Apr 2019 23:21:49 +0000 (01:21 +0200)]
grub-mkrescue: Fix error message about the wrong command having failed: mformat instead of mcopy

Signed-off-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agovideo: skip 'text' gfxpayload if not supported, to fallback to default
Mathieu Trudel-Lapierre [Mon, 29 Apr 2019 17:57:02 +0000 (13:57 -0400)]
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.

Bug: https://savannah.gnu.org/bugs/index.php?56217

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agogrub-mkconfig: Use -c instead of --printf for stat
Ovidiu Panait [Tue, 14 May 2019 08:40:55 +0000 (11:40 +0300)]
grub-mkconfig: Use -c instead of --printf for stat

"--printf" only works with the stat variant provided by coreutils.

With busybox, stat will fail with the following error:
stat: unrecognized option '--printf=%T'

Usage: stat [OPTIONS] FILE...

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agof2fs: Fix gcc9 error -Werror=maybe-uninitialized
Michael Chang [Fri, 17 May 2019 09:00:19 +0000 (17:00 +0800)]
f2fs: Fix gcc9 error -Werror=maybe-uninitialized

The function grub_get_node_path() could return uninitialized offset with
level == 0 if the block is greater than direct_index + 2 * direct_blks +
2 * indirect_blks + dindirect_blks. The uninitialized offset is then used
by function grub_f2fs_get_block() because level == 0 is valid and
meaningful return to be processed.

The fix is to set level = -1 as return value by grub_get_node_path() to
signify an error that the input block cannot be handled. Any caller
should therefore check level is negative or not before processing the
output.

Reported-by: Neil MacLeod <neil@nmacleod.com>
Signed-off-by: Michael Chang <mchang@suse.com>
Tested-by: Neil MacLeod <neil@nmacleod.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
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 agoarm: Align section alignment with manual relocation offset code
Alexander Graf [Tue, 30 Apr 2019 20:43:57 +0000 (22:43 +0200)]
arm: Align section alignment with manual relocation offset code

The arm relocation code has a manual special case for EFI binaries to
add the natural alignment to its own relocation awareness.

Since commit a51f953f4ee87 ("mkimage: Align efi sections on 4k
boundary") we changed that alignment from 0x400 to 0x1000 bytes. Reflect
the change in that branch that we forgot as well.

This fixes running 32bit arm grub efi binaries for me again.

Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reported-by: Steve McIntyre <steve@einval.com>
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Tested-by: Julien ROBIN <julien.robin28@free.fr>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoarm: Move trampolines into code section
Alexander Graf [Tue, 30 Apr 2019 20:43:56 +0000 (22:43 +0200)]
arm: Move trampolines into code section

When creating T32->A32 transition jumps, the relocation code in grub
will generate trampolines. These trampolines live in the .data section
of our PE binary which means they are not marked as executable.

This misbehavior was unmasked by commit a51f953f4ee87 ("mkimage: Align
efi sections on 4k boundary") which made the X/NX boundary more obvious
because everything became page aligned.

To put things into proper order, let's move the arm trampolines into the
.text section instead. That way everyone knows they are executable.

Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary")
Reported-by: Julien ROBIN <julien.robin28@free.fr>
Reported-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Tested-by: Julien ROBIN <julien.robin28@free.fr>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoefi: Fix gcc9 error -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:09 +0000 (17:14 +0800)]
efi: Fix gcc9 error -Waddress-of-packed-member

The address of fp->path_name could be unaligned since seeking into the
device path buffer for a given node could end in byte boundary.

The fix is allocating aligned buffer by grub_malloc for holding the
UTF16 string copied from fp->path_name, and after using that buffer as
argument for grub_utf16_to_utf8 to convert it to UTF8 string.

[  255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_get_filename':
[  255s] ../../grub-core/kern/efi/efi.c:410:60: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  255s]   410 |    p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len);
[  255s]       |                                                          ~~^~~~~~~~~~~
[  255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_print_device_path':
[  255s] ../../grub-core/kern/efi/efi.c:900:33: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  255s]   900 |     *grub_utf16_to_utf8 (buf, fp->path_name,
[  255s]       |                               ~~^~~~~~~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agochainloader: Fix gcc9 error -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:08 +0000 (17:14 +0800)]
chainloader: Fix gcc9 error -Waddress-of-packed-member

The address of fp->path_name could be unaligned since seeking into the
device path buffer for a given node could end in byte boundary.

The fix is using aligned buffer allocated by grub_malloc for receiving
the converted UTF16 string by grub_utf8_to_utf16 and also the processing
after. The resulting string then gets copied to fp->path_name.

[  243s] ../../grub-core/loader/efi/chainloader.c: In function 'copy_file_path':
[  243s] ../../grub-core/loader/efi/chainloader.c:136:32: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  243s]   136 |   size = grub_utf8_to_utf16 (fp->path_name, len * GRUB_MAX_UTF16_PER_UTF8,
[  243s]       |                              ~~^~~~~~~~~~~
[  243s] ../../grub-core/loader/efi/chainloader.c:138:12: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  243s]   138 |   for (p = fp->path_name; p < fp->path_name + size; p++)
[  243s]       |            ^~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agousbtest: Disable gcc9 -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:07 +0000 (17:14 +0800)]
usbtest: Disable gcc9 -Waddress-of-packed-member

Disable the -Wadress-of-packaed-member diagnostic for the
grub_usb_get_string function since the result is false postive. The
descstrp->str is found to be aligned in the buffer allocated for 'struct
grub_usb_desc_str'.

[  229s] ../../grub-core/commands/usbtest.c: In function 'grub_usb_get_string':
[  229s] ../../grub-core/commands/usbtest.c:104:58: error: taking address of packed member of 'struct grub_usb_desc_str' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  229s]   104 |   *grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str,
[  229s]       |                                                  ~~~~~~~~^~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoacpi: Fix gcc9 error -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:06 +0000 (17:14 +0800)]
acpi: Fix gcc9 error -Waddress-of-packed-member

Simply adds the missing packed attribute to 'struct grub_acpi_madt'.

[  233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_xsdt_table':
[  233s] ../../grub-core/commands/lsacpi.c:201:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  233s]   201 |  disp_madt_table ((struct grub_acpi_madt *) t);
[  233s]       |                           ^~~~~~~~~~~~~~
[  233s] In file included from ../../grub-core/commands/lsacpi.c:23:
[  233s] ../../include/grub/acpi.h:50:8: note: defined here
[  233s]    50 | struct grub_acpi_table_header
[  233s]       |        ^~~~~~~~~~~~~~~~~~~~~~
[  233s] ../../include/grub/acpi.h:90:8: note: defined here
[  233s]    90 | struct grub_acpi_madt
[  233s]       |        ^~~~~~~~~~~~~~
[  233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_rsdt_table':
[  233s] ../../grub-core/commands/lsacpi.c:225:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  233s]   225 |  disp_madt_table ((struct grub_acpi_madt *) t);
[  233s]       |                           ^~~~~~~~~~~~~~
[  233s] In file included from ../../grub-core/commands/lsacpi.c:23:
[  233s] ../../include/grub/acpi.h:50:8: note: defined here
[  233s]    50 | struct grub_acpi_table_header
[  233s]       |        ^~~~~~~~~~~~~~~~~~~~~~
[  233s] ../../include/grub/acpi.h:90:8: note: defined here
[  233s]    90 | struct grub_acpi_madt
[  233s]       |        ^~~~~~~~~~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agohfsplus: Fix gcc9 error with -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:05 +0000 (17:14 +0800)]
hfsplus: Fix gcc9 error with -Waddress-of-packed-member

The catkey->name could be unaligned since the address of 'void* record'
is calculated as offset in bytes to a malloc buffer.

The fix is using aligned buffer allocated by grub_malloc for holding
the UTF16 string copied from catkey->name. And use that buffer as
argument for grub_utf16_to_utf8 to convert to UTF8 strings.

In addition, using a new copy of buffer rather than catkey->name itself
for processing the endianess conversion, we can also get rid of the hunk
restoring byte order of catkey->name to what it was previously.

[   59s] ../grub-core/fs/hfsplus.c: In function 'list_nodes':
[   59s] ../grub-core/fs/hfsplus.c:738:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]   738 |   *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name,
[   59s]       |                                                   ~~~~~~^~~~~~
[   59s] ../grub-core/fs/hfsplus.c: In function 'grub_hfsplus_label':
[   59s] ../grub-core/fs/hfsplus.c:1019:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]  1019 |   *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), catkey->name,
[   59s]       |                                                   ~~~~~~^~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agohfs: Fix gcc9 error -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:04 +0000 (17:14 +0800)]
hfs: Fix gcc9 error -Waddress-of-packed-member

Simply adds the missing packed attribute to 'struct grub_hfs_extent'.

[   83s] ../grub-core/fs/hfs.c: In function 'grub_hfs_iterate_records':
[   83s] ../grub-core/fs/hfs.c:699:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   83s]   699 |      ? (&data->sblock.catalog_recs)
[   83s]       |        ~^~~~~~~~~~~~~~~~~~~~~~~~~~~
[   83s] ../grub-core/fs/hfs.c:700:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   83s]   700 |      : (&data->sblock.extent_recs));
[   83s]       |        ~^~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agojfs: Disable gcc9 -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:03 +0000 (17:14 +0800)]
jfs: Disable gcc9 -Waddress-of-packed-member

Disable the -Wadress-of-packaed-member diagnostic for the
grub_jfs_getent function since the result is found to be false postive.

The leaf is read into memory as continous chunks in size of 32 bytes and
the pointer to its base is aligned, which also guarentee its member
leaf->namepart is aligned.

[   60s] ../grub-core/fs/jfs.c: In function 'grub_jfs_getent':
[   60s] ../grub-core/fs/jfs.c:557:44: error: taking address of packed member of 'struct grub_jfs_leaf_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   60s]   557 |   le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len
[   60s]       |                                        ~~~~^~~~~~~~~~
[   60s] ../grub-core/fs/jfs.c:570:48: error: taking address of packed member of 'struct grub_jfs_leaf_next_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   60s]   570 |  le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15);
[   60s]       |                                       ~~~~~~~~~^~~~~~~~~~
[   60s] cc1: all warnings being treated as errors

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agocpio: Disable gcc9 -Waddress-of-packed-member
Michael Chang [Thu, 11 Apr 2019 09:14:02 +0000 (17:14 +0800)]
cpio: Disable gcc9 -Waddress-of-packed-member

Disable the -Wadress-of-packaed-member diagnostic for the
grub_cpio_find_file function since the result is found to be false
postive. Any pointers to member of the 'struct head hd' is aligned even
if the structure is packed without paddings.

[   59s] In file included from ../grub-core/fs/cpio.c:51:
[   59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file':
[   59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    58 |   data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize));
[   59s]       |                             ~~^~~~~~~~~
[   59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    60 |     *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime));
[   59s]       |                           ~~^~~~~~
[   59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    61 |   modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode));
[   59s]       |                          ~~^~~~~
[   59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    62 |   namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize));
[   59s]       |                           ~~^~~~~~~~~
[   59s] In file included from ../grub-core/fs/cpio_be.c:51:
[   59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file':
[   59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    58 |   data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize));
[   59s]       |                             ~~^~~~~~~~~
[   59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    60 |     *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime));
[   59s]       |                           ~~^~~~~~
[   59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    61 |   modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode));
[   59s]       |                          ~~^~~~~
[   59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]    62 |   namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize));
[   59s]       |                           ~~^~~~~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agoefi: Avoid NULL dereference if FilePath is NULL
Heinrich Schuchardt [Wed, 17 Apr 2019 05:12:56 +0000 (07:12 +0200)]
efi: Avoid NULL dereference if FilePath is NULL

The UEFI specification allows LoadImage() to be called with a memory
location only and without a device path. In this case FilePath will not be
set in the EFI_LOADED_IMAGE_PROTOCOL.

So in function grub_efi_get_filename() the device path argument may be
NULL. As we cannot determine the device path in this case just return NULL
from the function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
5 years agox86/msr: Fix build with older GCC versions
Daniel Kiper [Fri, 12 Apr 2019 10:50:04 +0000 (12:50 +0200)]
x86/msr: Fix build with older GCC versions

Some older GCC versions produce following error when x86 MSR modules are build:

  In file included from commands/i386/rdmsr.c:29:0:
  ../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes]
   extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
                               ^
  cc1: all warnings being treated as errors

This happens due to lack of support for a such usage of extern keyword
in older GCCs. Additionally, this usage is not consistent with the rest
of codebase. So, replace it with static keyword.

Additionally, fix incorrect coding style.

Reported-by: Eric Snowberg <eric.snowberg@oracle.com>
Reported-by: adrian15 <adrian15sgd@gmail.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Reviewed-by: Eric Snowberg <eric.snowberg@oracle.com>
Tested-by: adrian15 <adrian15sgd@gmail.com>
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>