Accepting request 365018 from home:algraf:arm-efi

This is another attempt at getting U-Boot EFI based boot support work
with grub2.

The major change to the last sr is that this time around I dropped the
patch to force uuid setting, since with newer u-boot code we don't need
that anymore :).

Thanks a lot for the review!

Alex

- Make mkconfig search for zImage on arm
  * grub2-mkconfig-arm.patch

- Add support to directly pass an EFI FDT table to a kernel on 32bit arm
  * 0001-arm64-Move-firmware-fdt-search-into-global-function.patch
  * 0002-arm-efi-Use-fdt-from-firmware-when-available.patch

OBS-URL: https://build.opensuse.org/request/show/365018
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=207
This commit is contained in:
Michael Chang 2016-03-04 02:44:35 +00:00 committed by Git OBS Bridge
parent 88e55c1dc5
commit 2e14e5acb8
5 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,106 @@
From 3750bd8d7cf8a7a7bbbda3354bea64f86cb34910 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 4 Jan 2016 22:00:04 +0100
Subject: [PATCH 1/2] arm64: Move firmware fdt search into global function
Searching for a device tree that EFI passes to us via configuration tables
is nothing architecture specific. Move it into generic code.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
grub-core/kern/efi/init.c | 22 ++++++++++++++++++++++
grub-core/loader/arm64/fdt.c | 24 +-----------------------
include/grub/efi/efi.h | 2 ++
3 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index e9c85de..fb90ecd 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -72,6 +72,28 @@ grub_machine_get_bootlocation (char **device, char **path)
}
}
+void *
+grub_efi_get_firmware_fdt (void)
+{
+ grub_efi_configuration_table_t *tables;
+ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+ void *firmware_fdt = NULL;
+ unsigned int i;
+
+ /* Look for FDT in UEFI config tables. */
+ tables = grub_efi_system_table->configuration_table;
+
+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+ if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+ {
+ firmware_fdt = tables[i].vendor_table;
+ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+ break;
+ }
+
+ return firmware_fdt;
+}
+
void
grub_efi_fini (void)
{
diff --git a/grub-core/loader/arm64/fdt.c b/grub-core/loader/arm64/fdt.c
index 5202c14..db49cf6 100644
--- a/grub-core/loader/arm64/fdt.c
+++ b/grub-core/loader/arm64/fdt.c
@@ -28,28 +28,6 @@
static void *loaded_fdt;
static void *fdt;
-static void *
-get_firmware_fdt (void)
-{
- grub_efi_configuration_table_t *tables;
- grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
- void *firmware_fdt = NULL;
- unsigned int i;
-
- /* Look for FDT in UEFI config tables. */
- tables = grub_efi_system_table->configuration_table;
-
- for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
- if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
- {
- firmware_fdt = tables[i].vendor_table;
- grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
- break;
- }
-
- return firmware_fdt;
-}
-
void *
grub_fdt_load (grub_size_t additional_size)
{
@@ -65,7 +43,7 @@ grub_fdt_load (grub_size_t additional_size)
if (loaded_fdt)
raw_fdt = loaded_fdt;
else
- raw_fdt = get_firmware_fdt();
+ raw_fdt = grub_efi_get_firmware_fdt();
size =
raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ;
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 0e6fd86..2acf85e 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -81,6 +81,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,
char **path);
+void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
+
grub_addr_t grub_efi_modules_addr (void);
void grub_efi_mm_init (void);
--
2.7.1

View File

@ -0,0 +1,33 @@
From 2a36cece32e4b967d164f974b5b5740cfa0375e1 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 4 Jan 2016 22:05:55 +0100
Subject: [PATCH 2/2] arm efi: Use fdt from firmware when available
If EFI is nice enough to pass us an FDT using configuration tables on 32bit
ARM, we should really try and make use of it.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
include/grub/arm/linux.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index 059dbba..a66caad 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -40,11 +40,7 @@
# define LINUX_PHYS_OFFSET (0x00008000)
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
-static inline grub_addr_t
-grub_arm_firmware_get_boot_data (void)
-{
- return 0;
-}
+# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
static inline grub_uint32_t
grub_arm_firmware_get_machine_type (void)
{
--
2.7.1

12
grub2-mkconfig-arm.patch Normal file
View File

@ -0,0 +1,12 @@
Index: grub-2.02~beta3/util/grub.d/10_linux.in
===================================================================
--- grub-2.02~beta3.orig/util/grub.d/10_linux.in
+++ grub-2.02~beta3/util/grub.d/10_linux.in
@@ -193,6 +193,7 @@ machine=`uname -m`
case "x$machine" in
xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;;
xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;;
+ xarm*) klist="/boot/zImage-* /zImage-* /boot/kernel-*" ;;
xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;;
*) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \
/boot/kernel-*" ;;

View File

@ -86,6 +86,19 @@ Tue Mar 1 18:53:17 UTC 2016 - arvidjaar@gmail.com
* drop workarounds for gdb_grub and grub.chrp, they are now installed under fixed name
* do not patch docs/Makefile.in, it is regenerated anyway
-------------------------------------------------------------------
Tue Mar 1 11:06:34 UTC 2016 - agraf@suse.com
- Make mkconfig search for zImage on arm
* grub2-mkconfig-arm.patch
-------------------------------------------------------------------
Sun Feb 28 23:10:06 UTC 2016 - agraf@suse.com
- Add support to directly pass an EFI FDT table to a kernel on 32bit arm
* 0001-arm64-Move-firmware-fdt-search-into-global-function.patch
* 0002-arm-efi-Use-fdt-from-firmware-when-available.patch
-------------------------------------------------------------------
Fri Jan 29 03:54:15 UTC 2016 - mchang@suse.com

View File

@ -186,6 +186,7 @@ Patch64: grub2-btrfs-workaround-grub2-once.patch
Patch65: grub2-mkconfig-aarch64.patch
Patch70: grub2-default-distributor.patch
Patch71: grub2-menu-unrestricted.patch
Patch72: grub2-mkconfig-arm.patch
# Btrfs snapshot booting related patches
Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
Patch102: grub2-btrfs-02-export-subvolume-envvars.patch
@ -197,6 +198,9 @@ Patch106: grub2-btrfs-06-subvol-mount.patch
Patch120: grub2-efi-xen-chainload.patch
Patch121: grub2-efi-chainloader-root.patch
Patch122: grub2-efi-xen-cmdline.patch
# 32bit ARM EFI FDT table pass-through support
Patch130: 0001-arm64-Move-firmware-fdt-search-into-global-function.patch
Patch131: 0002-arm-efi-Use-fdt-from-firmware-when-available.patch
# PPC64 LE support
Patch205: grub2-ppc64le-disable-video.patch
Patch207: grub2-ppc64le-memory-map.patch
@ -404,6 +408,7 @@ mv po/grub.pot po/%{name}.pot
%patch65 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
@ -413,6 +418,8 @@ mv po/grub.pot po/%{name}.pot
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch130 -p1
%patch131 -p1
%patch205 -p1
%patch207 -p1
%patch233 -p1