[v3,4/6] arm/efi: switch to arm64 linux loader

Message ID 20180627171720.27028-5-leif.lindholm@linaro.org
State Superseded
Headers show
Series
  • efi: arm linux loader unification and correctness
Related show

Commit Message

Leif Lindholm June 27, 2018, 5:17 p.m.
Switch over to the EFI-stub aware arm64 loader for 32-bit ARM platforms.

This *WILL* stop non-efistub Linux kernels from booting on arm-efi.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 grub-core/Makefile.core.def | 7 ++++---
 grub-core/kern/efi/mm.c     | 2 +-
 include/grub/arm/linux.h    | 5 +++++
 include/grub/efi/efi.h      | 2 --
 4 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Daniel Kiper July 6, 2018, 3:48 p.m. | #1
On Wed, Jun 27, 2018 at 06:17:18PM +0100, Leif Lindholm wrote:
> Switch over to the EFI-stub aware arm64 loader for 32-bit ARM platforms.


Hmmm... Does it mean that ARM64 EFI stub can work on 32-bit ARM platforms?

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Leif Lindholm July 6, 2018, 4:30 p.m. | #2
On Fri, Jul 06, 2018 at 05:48:21PM +0200, Daniel Kiper wrote:
> On Wed, Jun 27, 2018 at 06:17:18PM +0100, Leif Lindholm wrote:

> > Switch over to the EFI-stub aware arm64 loader for 32-bit ARM platforms.

> 

> Hmmm... Does it mean that ARM64 EFI stub can work on 32-bit ARM platforms?


No, the architecture explicitly prevents it.

But they share much of the code in the kernel, so the linux loader can
share most of the code in grub.

/
    Leif


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Daniel Kiper July 6, 2018, 5 p.m. | #3
On Fri, Jul 06, 2018 at 05:30:59PM +0100, Leif Lindholm wrote:
> On Fri, Jul 06, 2018 at 05:48:21PM +0200, Daniel Kiper wrote:

> > On Wed, Jun 27, 2018 at 06:17:18PM +0100, Leif Lindholm wrote:

> > > Switch over to the EFI-stub aware arm64 loader for 32-bit ARM platforms.

> >

> > Hmmm... Does it mean that ARM64 EFI stub can work on 32-bit ARM platforms?

>

> No, the architecture explicitly prevents it.

>

> But they share much of the code in the kernel, so the linux loader can

> share most of the code in grub.


Ahhh... OK then. However, please tell us this in the commit message
because at first sight it is not clear.

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Patch

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index fc4767f19..9590e87d9 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -229,7 +229,6 @@  kernel = {
   ia64_efi = kern/ia64/cache.c;
 
   arm_efi = kern/arm/efi/init.c;
-  arm_efi = kern/arm/efi/misc.c;
   arm_efi = kern/efi/fdt.c;
 
   arm64_efi = kern/arm64/efi/init.c;
@@ -1693,7 +1692,9 @@  module = {
   powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
   ia64_efi = loader/ia64/efi/linux.c;
-  arm = loader/arm/linux.c;
+  arm_coreboot = loader/arm/linux.c;
+  arm_efi = loader/arm64/linux.c;
+  arm_uboot = loader/arm/linux.c;
   arm64 = loader/arm64/linux.c;
   common = loader/linux.c;
   common = lib/cmdline.c;
@@ -1702,7 +1703,7 @@  module = {
 
 module = {
   name = fdt;
-  arm64 = loader/efi/fdt.c;
+  efi = loader/efi/fdt.c;
   common = lib/fdt.c;
   enable = fdt;
 };
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index 10ffa2c9b..b6a3f40f7 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -630,7 +630,7 @@  grub_efi_mm_init (void)
 		       2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
 }
 
-#if defined (__aarch64__)
+#if defined (__aarch64__) || defined (__arm__)
 grub_err_t
 grub_efi_get_ram_base(grub_addr_t *base_addr)
 {
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index cceb9c4a9..54658af1b 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -34,6 +34,11 @@  struct linux_arm_kernel_header {
   grub_uint32_t hdr_offset;
 };
 
+#if defined(__arm__)
+# define LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
+# define linux_armxx_kernel_header linux_arm_kernel_header
+#endif
+
 #if defined GRUB_MACHINE_UBOOT
 # include <grub/uboot/uboot.h>
 # define LINUX_ADDRESS        (start_of_ram + 0x8000)
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 5888bf6ac..e75c730c0 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -92,8 +92,6 @@  extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
 
 #if defined(__arm__) || defined(__aarch64__)
 void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
-#endif
-#if defined(__aarch64__)
 grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
 #include <grub/cpu/linux.h>
 grub_err_t grub_efi_linux_check_image(struct linux_armxx_kernel_header *lh);