All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Ermakov <arei@altlinux.org>
To: GRUB development mailing list <grub-devel@gnu.org>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Atish Patra <Atish.Patra@wdc.com>,
	Daniel Kiper <dkiper@net-space.pl>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Nikita Ermakov <arei@altlinux.org>,
	Atish Patra <atish.patra@wdc.com>
Subject: [PATCH 5/8] loader: Move arm64 linux loader to common code
Date: Fri, 28 May 2021 16:04:54 +0300	[thread overview]
Message-ID: <20210528130457.13501-6-arei@altlinux.org> (raw)
In-Reply-To: <20210528130457.13501-1-arei@altlinux.org>

From: Atish Patra <atish.patra@wdc.com>

ARM64 linux loader code is written in such a way that it can be reused
across different architectures without much change. Move it to common
code so that RISC-V doesn't have to define a separate loader.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 grub-core/Makefile.core.def             | 4 ++--
 grub-core/loader/{arm64 => efi}/linux.c | 2 +-
 include/grub/arm/linux.h                | 2 +-
 include/grub/arm64/linux.h              | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
 rename grub-core/loader/{arm64 => efi}/linux.c (99%)

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 8022e1c0a..b36cf663a 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1806,9 +1806,9 @@ module = {
   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
   ia64_efi = loader/ia64/efi/linux.c;
   arm_coreboot = loader/arm/linux.c;
-  arm_efi = loader/arm64/linux.c;
+  arm_efi = loader/efi/linux.c;
   arm_uboot = loader/arm/linux.c;
-  arm64 = loader/arm64/linux.c;
+  arm64 = loader/efi/linux.c;
   riscv32 = loader/riscv/linux.c;
   riscv64 = loader/riscv/linux.c;
   common = loader/linux.c;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/efi/linux.c
similarity index 99%
rename from grub-core/loader/arm64/linux.c
rename to grub-core/loader/efi/linux.c
index 9e282b666..7c71d0336 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -58,7 +58,7 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
   struct grub_pe32_coff_header *coff_header;
   struct grub_pe32_optional_header *optional_header;
 
-  if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE)
+  if (lh->magic != GRUB_LINUX_ARCH_MAGIC_SIGNATURE)
     return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
 
   if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index bcd5a7eb1..8c13978d2 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -35,7 +35,7 @@ struct linux_arm_kernel_header {
 };
 
 #if defined(__arm__)
-# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
+# define GRUB_LINUX_ARCH_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
 # define linux_arch_kernel_header linux_arm_kernel_header
 #endif
 
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
index 7e22b4ab6..effd870ef 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -39,7 +39,7 @@ struct linux_arm64_kernel_header
 };
 
 #if defined(__aarch64__)
-# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
+# define GRUB_LINUX_ARCH_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
 # define linux_arch_kernel_header linux_arm64_kernel_header
 #endif
 
-- 
2.31.1



  parent reply	other threads:[~2021-05-28 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 13:04 [PATCH 0/8] Add LoadFile2 and riscv Linux loader Nikita Ermakov
2021-05-28 13:04 ` [PATCH 1/8] loader/linux: permit NULL argument for argv[] in grub_initrd_load() Nikita Ermakov
2021-05-28 19:17   ` Heinrich Schuchardt
2021-05-28 13:04 ` [PATCH 2/8] efi: add definition of LoadFile2 protocol Nikita Ermakov
2021-05-28 19:27   ` Heinrich Schuchardt
2021-05-28 13:04 ` [PATCH 3/8] efi: implemented LoadFile2 initrd loading protocol for Linux Nikita Ermakov
2021-05-28 19:49   ` Heinrich Schuchardt
2021-05-28 13:04 ` [PATCH 4/8] linux: ignore FDT unless we need to modify it Nikita Ermakov
2021-05-28 13:04 ` Nikita Ermakov [this message]
2021-05-28 13:04 ` [PATCH 6/8] RISC-V: Update image header Nikita Ermakov
2021-05-28 13:04 ` [PATCH 7/8] RISC-V: Use common linux loader Nikita Ermakov
2021-05-28 13:04 ` [PATCH 8/8] linux: Make load_file2_guid and device_path_guid static Nikita Ermakov
2021-05-28 19:54   ` Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528130457.13501-6-arei@altlinux.org \
    --to=arei@altlinux.org \
    --cc=Atish.Patra@wdc.com \
    --cc=ard.biesheuvel@arm.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    --cc=leif.lindholm@linaro.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.