grub.git
6 years agoFix symbols appearing in several modules in linux*.
Vladimir Serbinenko [Mon, 14 Aug 2017 12:09:30 +0000 (14:09 +0200)]
Fix symbols appearing in several modules in linux*.

If same symbol is provided by 2 modules its semantics are undefined.
Avoid this by depending rather than double-including files.

6 years agomultiboot: disentangle multiboot and multiboot2.
Vladimir Serbinenko [Mon, 14 Aug 2017 10:51:26 +0000 (12:51 +0200)]
multiboot: disentangle multiboot and multiboot2.

Previously we had multiboot and multiboot2 declaring the same symbols.
This can potentially lead to aliasing and strange behaviours when e.g.
module instead of module2 is used with multiboot2.

Bug: #51137

6 years agohdparm: Depend on hexdump rather than having a second copy of hexdump.
Vladimir Serbinenko [Mon, 14 Aug 2017 10:48:58 +0000 (12:48 +0200)]
hdparm: Depend on hexdump rather than having a second copy of hexdump.

6 years agogrub.texi: Fix typo
Vladimir Serbinenko [Mon, 14 Aug 2017 09:36:50 +0000 (11:36 +0200)]
grub.texi: Fix typo

Reported by:  Ori Avtalion <saltyhorse>

6 years agoio: add a GRUB_GZ prefix to gzio specific defines
Pete Batard [Mon, 7 Aug 2017 15:23:12 +0000 (16:23 +0100)]
io: add a GRUB_GZ prefix to gzio specific defines

* This is done to avoid a conflict with a PACKED define in the EDK2

6 years agocore: use GRUB_TERM_ definitions when handling term characters
Pete Batard [Mon, 7 Aug 2017 15:20:30 +0000 (16:20 +0100)]
core: use GRUB_TERM_ definitions when handling term characters

* Also use hex value for GRUB_TERM_ESC as '\e' is not in the C standard and is not understood by some compilers

6 years agoefi: change heap allocation type to GRUB_EFI_LOADER_CODE
Leif Lindholm [Thu, 3 Aug 2017 10:04:32 +0000 (11:04 +0100)]
efi: change heap allocation type to GRUB_EFI_LOADER_CODE

With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may
not return regions with execute ability. Since modules are loaded onto
the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in
order to permit execution on systems with this feature enabled.

Closes: 50420

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoarm64 linux loader: improve type portability
Leif Lindholm [Thu, 3 Aug 2017 10:04:26 +0000 (11:04 +0100)]
arm64 linux loader: improve type portability

In preparation for turning this into a common loader for 32-bit and 64-bit
platforms, ensure the code will compile cleanly for either.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoefi: Add GRUB_PE32_MAGIC definition
Leif Lindholm [Thu, 3 Aug 2017 10:04:25 +0000 (11:04 +0100)]
efi: Add GRUB_PE32_MAGIC definition

Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete
the existing one in arm64/linux.h.

Update arm64 Linux loader to use this new definition.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoefi: move fdt helper library
Leif Lindholm [Thu, 3 Aug 2017 10:04:24 +0000 (11:04 +0100)]
efi: move fdt helper library

There is nothing ARM64 (or even ARM) specific about the efi fdt helper
library, which is used for locating or overriding a firmware-provided
devicetree in a UEFI system - so move it to loader/efi for reuse.

Move the fdtload.h include file to grub/efi and update path to
efi/fdtload.h in source code referring to it.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoRemove grub_efi_allocate_pages.
Vladimir Serbinenko [Mon, 7 Aug 2017 16:33:29 +0000 (18:33 +0200)]
Remove grub_efi_allocate_pages.

grub_efi_allocate_pages Essentially does 2 unrelated things:
* Allocate at fixed address.
* Allocate at any address.

To switch between 2 different functions it uses address == 0 as magic
value which is wrong as 0 is a perfectly valid fixed adress to allocate at.

6 years agoefi: refactor grub_efi_allocate_pages
Leif Lindholm [Thu, 3 Aug 2017 10:04:23 +0000 (11:04 +0100)]
efi: refactor grub_efi_allocate_pages

Expose a new function, grub_efi_allocate_pages_real(), making it possible
to specify allocation type and memory type as supported by the UEFI
AllocatePages boot service.

Make grub_efi_allocate_pages() a consumer of the new function,
maintaining its old functionality.

Also delete some left-around #if 1/#else blocks in the affected
functions.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
6 years agoFail if xorriso failed.
Vladimir Serbinenko [Mon, 7 Aug 2017 16:08:39 +0000 (18:08 +0200)]
Fail if xorriso failed.

If xorriso failed most likely we didn't generate a meaningful image.

6 years agomkrescue: Check xorriso presence before doing anything else.
Vladimir Serbinenko [Mon, 7 Aug 2017 16:05:17 +0000 (18:05 +0200)]
mkrescue: Check xorriso presence before doing anything else.

mkrescue can't do anything useful without xorriso, so abort early if it's
not available.

6 years ago* grub-core/fs/udf.c: Add support for UUID
Pali Rohár [Thu, 22 Jun 2017 12:42:16 +0000 (14:42 +0200)]
* grub-core/fs/udf.c: Add support for UUID

Use same algorithm as in libblkid from util-linux v2.30.

1. Take first 16 bytes from UTF-8 encoded string of VolumeSetIdentifier
2. If all bytes are hexadecimal digits, convert to lowercase and use as UUID
3. If first 8 bytes are not all hexadecimal digits, convert those 8 bytes
   to their hexadecimal representation, resulting in 16 bytes for UUID
4. Otherwise, compose UUID from two parts:
   1. part: converted first 8 bytes (which are hexadecimal digits) to lowercase
   2. part: encoded following 4 bytes to their hexadecimal representation (16 bytes)

So UUID would always have 16 hexadecimal digits in lowercase variant.

According to UDF specification, first 16 Unicode characters of
VolumeSetIdentifier should be unique value and first 8 should be
hexadecimal characters.

In most cases all 16 characters are hexadecimal, but e.g. MS Windows
format.exe set only first 8 as hexadecimal and remaining as fixed
(non-unique) which violates specification.

6 years agoudf: Fix reading label, lvd.ident is dstring
Pali Rohár [Thu, 22 Jun 2017 12:33:17 +0000 (14:33 +0200)]
udf: Fix reading label, lvd.ident is dstring

UDF dstring has stored length in the last byte of buffer. Therefore last
byte is not part of recorded characters. And empty string in dstring is
encoded as empty buffer, including first byte (compression id).

6 years agozfs: remove size_t typedef and use grub_size_t instead
Pete Batard [Thu, 3 Aug 2017 14:46:15 +0000 (15:46 +0100)]
zfs: remove size_t typedef and use grub_size_t instead

* Prevents some toolchains from issuing a warning on size_t redef.

6 years agoFix a segfault in lsefi
Rob Clark [Wed, 19 Jul 2017 19:47:41 +0000 (15:47 -0400)]
Fix a segfault in lsefi

when protocols_per_handle returns error, we can't use the pointers we
passed to it, and that includes trusting num_protocols.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agofdt: silence clang warning.
Vladimir Serbinenko [Mon, 10 Jul 2017 01:34:22 +0000 (01:34 +0000)]
fdt: silence clang warning.

6 years agoarm-efi: Fix compilation
Vladimir Serbinenko [Sun, 9 Jul 2017 21:48:37 +0000 (21:48 +0000)]
arm-efi: Fix compilation

6 years agocrypto: Fix use after free.
AppChecker [Sun, 9 Jul 2017 19:57:35 +0000 (21:57 +0200)]
crypto: Fix use after free.

Reported by: AppChecker
Transformed to patch by: Satish Govindarajan

6 years agoehci: Fix compilation on i386
Vladimir Serbinenko [Sun, 9 Jul 2017 19:31:19 +0000 (21:31 +0200)]
ehci: Fix compilation on i386

6 years agocache: Fix compilation for ppc, sparc and arm64
phcoder [Sun, 9 Jul 2017 18:59:15 +0000 (20:59 +0200)]
cache: Fix compilation for ppc, sparc and arm64

6 years agoehci: Fix compilation for amd64
phcoder [Sun, 9 Jul 2017 18:58:31 +0000 (20:58 +0200)]
ehci: Fix compilation for amd64

6 years agoAllow GRUB to mount ext2/3/4 filesystems that have the encryption feature.
Eric Biggers [Thu, 29 Jun 2017 13:27:49 +0000 (13:27 +0000)]
Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature.

On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set.
For a regular file, this means its contents are encrypted; for a
directory, this means the filenames in its directory entries are
encrypted; and for a symlink, this means its target is encrypted.  Since
GRUB cannot decrypt encrypted contents or filenames, just issue an error
if it would need to do so.  This is sufficient to allow unencrypted boot
files to co-exist with encrypted files elsewhere on the filesystem.

(Note that encrypted regular files and symlinks will not normally be
encountered outside an encrypted directory; however, it's possible via
hard links, so they still need to be handled.)

Tested by booting from an ext4 /boot partition on which I had run
'tune2fs -O encrypt'.  I also verified that the expected error messages
are printed when trying to access encrypted directories, files, and
symlinks from the GRUB command line.  Also ran 'sudo ./grub-fs-tester
ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+.

Signed-off-by: Eric Biggers <ebiggers@google.com>
6 years agosparc64: Don't use devspec to determine the OBP path
Eric Snowberg [Thu, 18 May 2017 23:10:22 +0000 (17:10 -0600)]
sparc64: Don't use devspec to determine the OBP path

Don't use devspec to determine the OBP path on SPARC hardware.  Within all
versions of Linux on SPARC, the devspec returns one of three values:
"none", "vnet-port", or "vdisk".  Unlike on PPC, none of these values
are useful in determining the OBP path.

Before this patch grub-ofpathname always returned the wrong value
for a virtual disk. For example:

% grub-ofpathname /dev/vdiskc2
vdisk/disk@2:b

After this patch it now returns the correct value:

% grub-ofpathname /dev/vdiskc2
/virtual-devices@100/channel-devices@200/disk@2:b

Orabug: 24459765

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agoarm64: Update the introduction of Xen boot commands in docs/grub.texi
Fu Wei [Sun, 14 May 2017 07:43:47 +0000 (15:43 +0800)]
arm64: Update the introduction of Xen boot commands in docs/grub.texi

delete: xen_linux, xen_initrd, xen_xsm
add: xen_module

This update bases on
    commit 0edd750e50698854068358ea53528100a9192902
    Author: Vladimir Serbinenko <phcoder@gmail.com>
    Date:   Fri Jan 22 10:18:47 2016 +0100

        xen_boot: Remove obsolete module type distinctions.

Also bases on the module loading mechanism of Xen code:
488c2a8 docs/arm64: clarify the documention for loading XSM support
67831c4 docs/arm64: update the documentation for loading XSM support
ca32012 xen/arm64: check XSM Magic from the second unknown module.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agoutil/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64
Fu Wei [Sun, 14 May 2017 07:43:46 +0000 (15:43 +0800)]
util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64

This patch adds the support of xen_boot command for aarch64:
    xen_hypervisor
    xen_module
These two commands are only for aarch64, since it has its own protocol and
commands to boot xen hypervisor and Dom0, but not multiboot.

For other architectures, they are still using multiboot and module
commands.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agoarm64: Add "--nounzip" option support in xen_module command
Fu Wei [Sun, 14 May 2017 07:43:45 +0000 (15:43 +0800)]
arm64: Add "--nounzip" option support in xen_module command

This patch adds "--nounzip" option support in order to
be compatible with the module command of multiboot on other architecture,
by this way we can simplify grub-mkconfig support code.

This patch also allow us to use zip compressed module(like Linux kernel
for Dom0).

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agoarm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64
Julien Grall [Fri, 19 Feb 2016 16:28:52 +0000 (16:28 +0000)]
arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64

Xen is currently crashing because of malformed compatible property for
the boot module. This is because the property string is not
null-terminated as requested by the ePAR spec.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
6 years agosparc64: Close cdboot ihandle
Eric Snowberg [Fri, 12 May 2017 01:42:23 +0000 (18:42 -0700)]
sparc64: Close cdboot ihandle

The ihandle is left open with a cd-core image.  This will cause a delay
booting grub from a virtual cdrom in a LDOM.  It will also cause problems
as Linux boots, since it expects the ihandle to be closed during init.

Orabug: 25911275

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
7 years agoat_keyboard: Fix falco chromebook case.
Vladimir Serbinenko [Tue, 9 May 2017 12:27:52 +0000 (14:27 +0200)]
at_keyboard: Fix falco chromebook case.

EC is slow, so we need few delays for it to toggle the bits correctly.

Command to enable clock and keyboard were not sent.

7 years agocoreboot: Changed cbmemc to support updated console format from coreboot.
Julius Werner [Tue, 9 May 2017 07:03:02 +0000 (09:03 +0200)]
coreboot: Changed cbmemc to support updated console format from coreboot.

7 years agoMissing parts of previous commit
Vladimir Serbinenko [Tue, 9 May 2017 07:02:15 +0000 (09:02 +0200)]
Missing parts of previous commit

7 years agoarm_coreboot: Add Chromebook keyboard driver.
Vladimir Serbinenko [Tue, 9 May 2017 06:47:34 +0000 (08:47 +0200)]
arm_coreboot: Add Chromebook keyboard driver.

7 years agork3288_spi: Add SPI driver
Vladimir Serbinenko [Tue, 9 May 2017 06:42:14 +0000 (08:42 +0200)]
rk3288_spi: Add SPI driver

7 years agofdtbus: Add ability to send/receive messages on parent busses.
Vladimir Serbinenko [Tue, 9 May 2017 06:40:29 +0000 (08:40 +0200)]
fdtbus: Add ability to send/receive messages on parent busses.

7 years agoFix bug on FDT nodes with compatible property
Vladimir Serbinenko [Tue, 9 May 2017 06:39:40 +0000 (08:39 +0200)]
Fix bug on FDT nodes with compatible property

7 years agoarm_coreboot: Support EHCI.
Vladimir Serbinenko [Mon, 8 May 2017 20:14:28 +0000 (22:14 +0200)]
arm_coreboot: Support EHCI.

7 years agoehci: Split core code from PCI part.
Vladimir Serbinenko [Mon, 8 May 2017 20:10:26 +0000 (22:10 +0200)]
ehci: Split core  code from PCI part.

On ARM often EHCI is present without PCI and just declared in device
tree. So splitcore from PCI part.

7 years agoarm_coreboot: Support DMA.
Vladimir Serbinenko [Mon, 8 May 2017 20:06:04 +0000 (22:06 +0200)]
arm_coreboot: Support DMA.

This is needed to support USB and some other busses.

7 years agoarm_coreboot: Support loading linux images.
Vladimir Serbinenko [Mon, 8 May 2017 20:00:06 +0000 (22:00 +0200)]
arm_coreboot: Support loading linux images.

7 years agoarm_coreboot: Support grub-mkstandalone.
Vladimir Serbinenko [Mon, 8 May 2017 19:59:48 +0000 (21:59 +0200)]
arm_coreboot: Support grub-mkstandalone.

7 years agoarm_coreboot: Support keyboard for vexpress.
Vladimir Serbinenko [Mon, 8 May 2017 19:42:37 +0000 (21:42 +0200)]
arm_coreboot: Support keyboard for vexpress.

7 years agoat_keyboard: Split protocol from controller code.
Vladimir Serbinenko [Mon, 8 May 2017 19:41:22 +0000 (21:41 +0200)]
at_keyboard: Split protocol from controller code.

On vexpress controller is different but protocol is the same, so reuse the
code.

7 years agoarm-coreboot: Export FDT routines.
Vladimir Serbinenko [Mon, 8 May 2017 19:29:48 +0000 (21:29 +0200)]
arm-coreboot: Export FDT routines.

We need to use them from modules as well.

7 years agoarm-coreboot: Support for vexpress timer.
Vladimir Serbinenko [Mon, 8 May 2017 19:26:36 +0000 (21:26 +0200)]
arm-coreboot: Support for vexpress timer.

7 years agoAdd support for device-tree-based drivers.
Vladimir Serbinenko [Mon, 8 May 2017 19:19:59 +0000 (21:19 +0200)]
Add support for device-tree-based drivers.

7 years agoarm-coreboot: Start new port.
Vladimir Serbinenko [Mon, 8 May 2017 18:53:28 +0000 (20:53 +0200)]
arm-coreboot: Start new port.

7 years agoRename uboot/datetime to dummy/datetime.
Vladimir Serbinenko [Mon, 8 May 2017 17:37:29 +0000 (19:37 +0200)]
Rename uboot/datetime to dummy/datetime.

It's just a stub and is not UBoot-specific.

7 years agoRename uboot/halt.c to dummy/halt.c.
Vladimir Serbinenko [Mon, 8 May 2017 17:31:55 +0000 (19:31 +0200)]
Rename uboot/halt.c to dummy/halt.c.

It's not U-Boot specific and it's a stub.

7 years agocoreboot: Split parts that are platform-independent.
Vladimir Serbinenko [Mon, 8 May 2017 17:06:22 +0000 (19:06 +0200)]
coreboot: Split parts that are platform-independent.

We currently assume that coreboot is always i386, it's no longer the case,
so split i386-coreboot parts from generic coreboot code.

7 years agoRefactor arm-uboot code to make it genereic.
Vladimir Serbinenko [Mon, 8 May 2017 15:47:57 +0000 (17:47 +0200)]
Refactor arm-uboot code to make it genereic.

arm-coreboot startup code can be very similar to arm-uboot but current code has
U-Boot specific references. So split U-Boot part from generic part.

7 years agomkimage: Pass layout to mkimage_generate_elfXX rather than some fields.
Vladimir Serbinenko [Mon, 8 May 2017 15:32:15 +0000 (17:32 +0200)]
mkimage: Pass layout to mkimage_generate_elfXX rather than some fields.

This allows easier extension of this function without having too long of
arguments list.

7 years agoAdd Virtual LAN support.
Paulo Flabiano Smorigo [Mon, 23 Dec 2013 14:32:02 +0000 (12:32 -0200)]
Add Virtual LAN support.

This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
multiple VLANs in a bridged network to share the same physical network link
but maintain isolation:

http://en.wikipedia.org/wiki/IEEE_802.1Q

* grub-core/net/ethernet.c: Add check, get, and set vlan tag id.
* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs.
* grub-core/net/arp.c: Add check.
* grub-core/net/ip.c: Likewise.
* include/grub/net/arp.h: Add vlantag attribute.
* include/grub/net/ip.h: Likewise.

7 years agostrtoull: Fix behaviour on chars between '9' and 'a'.
Vladimir Serbinenko [Wed, 10 Aug 2016 15:49:42 +0000 (17:49 +0200)]
strtoull: Fix behaviour on chars between '9' and 'a'.

Reported by: Aaron Miller <aaronmiller@fb.com>

7 years agoAdd strtoull test.
Vladimir Serbinenko [Wed, 3 May 2017 10:58:15 +0000 (12:58 +0200)]
Add strtoull test.

7 years agoFix shebang for termux.
Vladimir Serbinenko [Sun, 22 Jan 2017 17:22:34 +0000 (20:22 +0300)]
Fix shebang for termux.

Termux doesn't have a /bin/sh. So we needto use $SHELL.
Keep /bin/sh as much as possible.

7 years agoAdd termux path to dict.
Vladimir Serbinenko [Mon, 23 Jan 2017 11:52:48 +0000 (14:52 +0300)]
Add termux path to dict.

7 years agopo: Use @SHELL@ rather than /bin/sh.
Vladimir Serbinenko [Mon, 23 Jan 2017 11:54:03 +0000 (14:54 +0300)]
po: Use @SHELL@ rather than /bin/sh.

/bin/sh might not exist.

7 years agoUse $(SHELL) rather than /bin/sh.
Vladimir Serbinenko [Sun, 22 Jan 2017 21:55:30 +0000 (00:55 +0300)]
Use $(SHELL) rather than /bin/sh.

/bin/sh doesn't exist under termux.

7 years agoSupport lseek64.
Vladimir Serbinenko [Mon, 23 Jan 2017 17:21:05 +0000 (20:21 +0300)]
Support lseek64.

Android doesn't have 64-bit off_t, so use off64_t instead.

7 years agoDon't retrieve fstime when it's not useful.
Vladimir Serbinenko [Mon, 23 Jan 2017 18:24:05 +0000 (21:24 +0300)]
Don't retrieve fstime when it's not useful.

7 years agosupport busybox date.
Vladimir Serbinenko [Mon, 23 Jan 2017 11:31:36 +0000 (14:31 +0300)]
support busybox date.

Busybox date doesn't understand weekdays in -d input,
so strip them beforehand.

7 years agofs-tester: make sh-compatible
Vladimir Serbinenko [Mon, 23 Jan 2017 11:35:59 +0000 (14:35 +0300)]
fs-tester: make sh-compatible

7 years agoRemove bashisms from tests.
Vladimir Serbinenko [Mon, 23 Jan 2017 00:47:13 +0000 (03:47 +0300)]
Remove bashisms from tests.

Those tests don't actually need bash. Just use common shebang.

7 years agoBump version to 2.03
Vladimir Serbinenko [Wed, 3 May 2017 09:55:52 +0000 (11:55 +0200)]
Bump version to 2.03

7 years agoIncrease version to 2.02.
Vladimir Serbinenko [Tue, 25 Apr 2017 14:23:16 +0000 (16:23 +0200)]
Increase version to 2.02.

7 years agoFix remaining cases of gcc 7 fallthrough warning.
Vladimir Serbinenko [Wed, 12 Apr 2017 01:42:38 +0000 (01:42 +0000)]
Fix remaining cases of gcc 7 fallthrough warning.

They are all intended, so just add the relevant comment.

7 years agoAdd gnulib-fix-gcc7-fallthrough.diff
Andrei Borzenkov [Tue, 4 Apr 2017 16:37:47 +0000 (19:37 +0300)]
Add gnulib-fix-gcc7-fallthrough.diff

As long as the code is not upstream, add it as explicit patch for the
case of gnulib refresh.

7 years agoi386, x86_64, ppc: fix switch fallthrough cases with GCC7
Andrei Borzenkov [Tue, 4 Apr 2017 16:23:55 +0000 (19:23 +0300)]
i386, x86_64, ppc: fix switch fallthrough cases with GCC7

In util/getroot and efidisk slightly modify exitsing comment to mostly
retain it but still make GCC7 compliant with respect to fall through
annotation.

In grub-core/lib/xzembed/xz_dec_lzma2.c it adds same comments as
upstream.

In grub-core/tests/setjmp_tets.c declare functions as "noreturn" to
suppress GCC7 warning.

In grub-core/gnulib/regexec.c use new __attribute__, because existing
annotation is not recognized by GCC7 parser (which requires that comment
immediately precedes case statement).

Otherwise add FALLTHROUGH comment.

Closes: 50598

7 years agobtrfs: avoid "used uninitialized" error with GCC7
Andrei Borzenkov [Tue, 4 Apr 2017 16:22:32 +0000 (19:22 +0300)]
btrfs: avoid "used uninitialized" error with GCC7

sblock was local and so considered new variable on every loop
iteration.

Closes: 50597

7 years agoacpi: add missing efi_call wrapper to acpi command
Andrei Borzenkov [Sun, 2 Apr 2017 11:47:20 +0000 (14:47 +0300)]
acpi: add missing efi_call wrapper to acpi command

Fixed loading of ACPI tables on EFI (side effect was apparent memory
corruption ranging from unpredictable behavior to system reset).

Reported by Nando Eva <nando4eva@ymail.com>

7 years agoIncrement version to GRUB 2.02~rc2.
Vladimir Serbinenko [Wed, 15 Mar 2017 08:20:29 +0000 (09:20 +0100)]
Increment version to GRUB 2.02~rc2.

7 years agoUse core2duo for bootcheck test on 64-bit EFI.
Vladimir Serbinenko [Wed, 15 Mar 2017 08:20:14 +0000 (09:20 +0100)]
Use core2duo for bootcheck test on 64-bit EFI.

Obviously pentium2 can't run efi64.

7 years agoefi: skip iPXE block device.
Andrei Borzenkov [Tue, 14 Mar 2017 04:12:32 +0000 (04:12 +0000)]
efi: skip iPXE block device.

iPXE adds Simple File System Protocol to loaded image handle, as side
effect it also adds Block IO protocol (according to comments, to work
around some bugs in EDK2). GRUB assumes that every device with Block IO
is disk and skips network initialization entirely. But iPXE Block IO
implementation is just a stub which always fails for every operation
so cannot be used. Attempt to detect and skip such devices.

We are using media ID which iPXE sets to "iPXE" and block IO size in
hope that no real device would announce 1B block ...

Closes: 50518

7 years agoxen: Fix wrong register in relocator.
phcoder [Sun, 5 Mar 2017 09:04:07 +0000 (10:04 +0100)]
xen: Fix wrong register in relocator.

This fixes chainloading of some GRUB variants.

7 years agovideo_fb: Fix blue collor if using unoptimized blitter.
Vladimir Serbinenko [Thu, 9 Feb 2017 01:22:24 +0000 (02:22 +0100)]
video_fb: Fix blue collor if using unoptimized blitter.

when unmapping the color what matters is the mode of source, not target.

7 years agolegacy_initrd: Strip any additional arguments to initrd.
Vladimir Serbinenko [Fri, 24 Feb 2017 21:23:09 +0000 (21:23 +0000)]
legacy_initrd: Strip any additional arguments to initrd.

7 years agogrub-fs-tester: improve squash4 tests
Andrei Borzenkov [Sun, 26 Feb 2017 11:38:04 +0000 (14:38 +0300)]
grub-fs-tester: improve squash4 tests

1. Make sure files are not multiple of block size. This will ensure tail packing
for squash4 and may also trigger more codes paths in other filesystems.

2. Call mksquashfs with -always-use-fragments to force tail packing.

7 years agoefi: strip off final NULL from File Path in grub_efi_get_filename
Andrei Borzenkov [Sat, 25 Feb 2017 05:39:38 +0000 (08:39 +0300)]
efi: strip off final NULL from File Path in grub_efi_get_filename

UEFI 2.6 9.3.6.4 File Path Media Device Path says that Path Name is
"A NULL-terminated Path string including directory and file names".

Strip final NULL from Path Name in each File Path node when constructing
full path. To be on safe side, strip all of them.

Fixes failure chainloading grub from grub, when loaded grub truncates
image path and does not find its grub.cfg.

https://bugzilla.opensuse.org/show_bug.cgi?id=1026344

This was triggered by commit ce95549cc54b5d6f494608a7c390dba3aab4fba7;
before it we built Path Name without trailing NULL, and apparently all
other bootloaders use single File Path node, thus not exposing this bug.

7 years agosquash4: fix handling of fragments and sparse files
Andrei Borzenkov [Fri, 24 Feb 2017 16:10:43 +0000 (19:10 +0300)]
squash4: fix handling of fragments and sparse files

1. Do not assume block list and fragment are mutually exclusive. Squash
can pack file tail as fragment (unless -no-fragments is specified); so
check read offset and read either from block list or from fragments as
appropriate.

2. Support sparse files with zero blocks.

3. Fix fragment read - frag.offset is absolute fragment position,
not offset relative to ino.chunk.

Reported and tested by Carlo Caione <carlo@endlessm.com>

7 years agoWhitelist sparc64-ieee1275 as having no video modules.
Vladimir Serbinenko [Wed, 22 Feb 2017 08:55:51 +0000 (09:55 +0100)]
Whitelist sparc64-ieee1275 as having no video modules.

ieee1275_fb is not built on sparc64 due to virtual address issues.

7 years agoscript: fix double free in lexer
Andrei Borzenkov [Sun, 12 Feb 2017 06:23:34 +0000 (09:23 +0300)]
script: fix double free in lexer

yylex_destroy() already frees scanner.

Found by: Coverity scan.
CID: 176636

7 years agoxen: Fix parsing of XZ kernel.
Vladimir Serbinenko [Mon, 6 Feb 2017 23:47:23 +0000 (00:47 +0100)]
xen: Fix parsing of XZ kernel.

In case of xz, the uncompressed size is appended to xz data which confuses
our xz decompressor. Trim it.

7 years agoxen: Fix handling of GRUB chainloading.
Vladimir Serbinenko [Mon, 6 Feb 2017 23:42:43 +0000 (00:42 +0100)]
xen: Fix handling of GRUB chainloading.

In case of GRUB we put remapper after domain pages and not at 0x0.
In this case we use max_addr to put remapper. Unfortunately we increment
max_addr as well in this case resulting in virt mapping mapping page
at old max_addr and trying to boot using new max_addr.

Closes 46014.

7 years agolinguas: Don't skip ko.po.
Vladimir Serbinenko [Fri, 3 Feb 2017 23:06:57 +0000 (00:06 +0100)]
linguas: Don't skip ko.po.

Translation project doesn't require copyright disclaimers. They're independant
from us. They're responsible for their copyright story.

7 years agoFix truncated checksum.h.
Vladimir Serbinenko [Fri, 3 Feb 2017 19:17:48 +0000 (20:17 +0100)]
Fix truncated checksum.h.

7 years agoRegenerate checksums.h
Vladimir Serbinenko [Fri, 3 Feb 2017 12:41:13 +0000 (13:41 +0100)]
Regenerate checksums.h

Screenshots contain version, so we need new checksums.

7 years agoRelease 2.02-rc1.
Vladimir Serbinenko [Fri, 3 Feb 2017 11:34:21 +0000 (12:34 +0100)]
Release 2.02-rc1.

7 years agoFix mingw compilation.
Vladimir Serbinenko [Fri, 3 Feb 2017 11:59:50 +0000 (12:59 +0100)]
Fix mingw compilation.

7 years agodocumentation: Clarify documentation for special environment variable "default".
Daniel Kahn Gillmor [Fri, 3 Feb 2017 11:32:25 +0000 (12:32 +0100)]
documentation: Clarify documentation for special environment variable "default".

The current documentation for the special environment variable
"default" is confusing and unclear.  This patch attempts to clean it
up.

In particular, the current documentation refers to the "number or
title", but then in the example it gives, the menu entries and
submenus all have numbers *in* their title; furthermore, there is no
example given about how to choose the number, or any indication about
whether counting is zero-indexed or 1-indexed.

Having a cleaner example and presenting all variants (numeric, title,
and id) should make it clearer to the user.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
7 years agoAvoid causing kernel oops in nilfs2 test.
Vladimir Serbinenko [Thu, 2 Feb 2017 23:34:07 +0000 (00:34 +0100)]
Avoid causing kernel oops in nilfs2 test.

1024-byte and 2048-byte blocks don't really work with some kernels, skip
them as we don't want any oops'es.

7 years agobtrfs: Shorten label by one character.
Vladimir Serbinenko [Thu, 2 Feb 2017 23:30:29 +0000 (00:30 +0100)]
btrfs: Shorten label by one character.

mkfs.btrfs imposes a slightly lower limit than would be possible in btrfs.

7 years agogrub-fs-tester: Fix mkudffs invocation.
Vladimir Serbinenko [Thu, 2 Feb 2017 22:32:38 +0000 (23:32 +0100)]
grub-fs-tester: Fix mkudffs invocation.

With current invocation order of arguments is wrong and path is hardcoded.

7 years agogrub-fs-tester: Fix fat test.
Vladimir Serbinenko [Thu, 2 Feb 2017 22:19:00 +0000 (23:19 +0100)]
grub-fs-tester: Fix fat test.

mkfs.vfat ignores -S when invoked on a disk, including loopback device,
so do an mkfs on underlying image.

7 years agoi386/relocator: Align stack in grub_relocator64_efi relocator
Daniel Kiper [Thu, 2 Feb 2017 14:19:18 +0000 (15:19 +0100)]
i386/relocator: Align stack in grub_relocator64_efi relocator

Unified Extensible Firmware Interface Specification, Version 2.6,
section 2.3.4, x64 Platforms, boot services, says among others:
The stack must be 16-byte aligned. So, do it. Otherwise OS may
boot only by chance as it happens right now.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
7 years agoi386-ieee1275: Add missing bootcheck target.
Vladimir Serbinenko [Thu, 2 Feb 2017 20:41:33 +0000 (21:41 +0100)]
i386-ieee1275: Add missing bootcheck target.

7 years agobootcheck-linux-i386: Use -cpu pentium2.
Vladimir Serbinenko [Thu, 2 Feb 2017 20:41:18 +0000 (21:41 +0100)]
bootcheck-linux-i386: Use -cpu pentium2.

Most modern kernels are compiled for i686, so use -cpu pentium2
to avoid spurious failures.

7 years agoUse -fPIC with arm64 with clang.
Vladimir Serbinenko [Thu, 2 Feb 2017 00:24:11 +0000 (01:24 +0100)]
Use -fPIC with arm64 with clang.

Currently it doesn't work either way but with -fPIC it should work once
clang bug is fixed.