diff mbox series

[1/9] efi: Rename armxx to arch

Message ID 20181106175837.9083-2-agraf@suse.de
State Superseded
Headers show
Series Add RISC-V support | expand

Commit Message

Alexander Graf Nov. 6, 2018, 5:58 p.m. UTC
Some architectures want to boot Linux as plain UEFI binary. Today that
really only encompasses ARM and AArch64, but going forward more
architectures may adopt that model.

So rename our internal API accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>

---
 grub-core/loader/arm64/linux.c    | 10 +++++-----
 grub-core/loader/arm64/xen_boot.c |  6 +++---
 include/grub/arm/linux.h          |  2 +-
 include/grub/arm64/linux.h        |  2 +-
 include/grub/efi/efi.h            |  4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.12.3


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

Comments

Leif Lindholm Nov. 7, 2018, 8 a.m. UTC | #1
On Tue, Nov 06, 2018 at 06:58:29PM +0100, Alexander Graf wrote:
> Some architectures want to boot Linux as plain UEFI binary. Today that

> really only encompasses ARM and AArch64, but going forward more

> architectures may adopt that model.

> 

> So rename our internal API accordingly.

> 

> Signed-off-by: Alexander Graf <agraf@suse.de>


Certainly no objection to this.
Only comment: if this is the way to go, perhaps linux.c should move to
loader/efi/linux-generic.c or something?

Anyway - Acked-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---

>  grub-core/loader/arm64/linux.c    | 10 +++++-----

>  grub-core/loader/arm64/xen_boot.c |  6 +++---

>  include/grub/arm/linux.h          |  2 +-

>  include/grub/arm64/linux.h        |  2 +-

>  include/grub/efi/efi.h            |  4 ++--

>  5 files changed, 12 insertions(+), 12 deletions(-)

> 

> diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c

> index 1f86229f8..bee9859aa 100644

> --- a/grub-core/loader/arm64/linux.c

> +++ b/grub-core/loader/arm64/linux.c

> @@ -48,7 +48,7 @@ static grub_addr_t initrd_start;

>  static grub_addr_t initrd_end;

>  

>  grub_err_t

> -grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh)

> +grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)

>  {

>    if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE)

>      return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");

> @@ -109,7 +109,7 @@ failure:

>  }

>  

>  grub_err_t

> -grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)

> +grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)

>  {

>    grub_efi_memory_mapped_device_path_t *mempath;

>    grub_efi_handle_t image_handle;

> @@ -172,7 +172,7 @@ grub_linux_boot (void)

>    if (finalize_params_linux () != GRUB_ERR_NONE)

>      return grub_errno;

>  

> -  return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr,

> +  return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,

>                                            kernel_size, linux_args));

>  }

>  

> @@ -286,7 +286,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

>  		int argc, char *argv[])

>  {

>    grub_file_t file = 0;

> -  struct linux_armxx_kernel_header lh;

> +  struct linux_arch_kernel_header lh;

>  

>    grub_dl_ref (my_mod);

>  

> @@ -305,7 +305,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

>    if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh))

>      return grub_errno;

>  

> -  if (grub_armxx_efi_linux_check_image (&lh) != GRUB_ERR_NONE)

> +  if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE)

>      goto fail;

>  

>    grub_loader_unset();

> diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c

> index 1003a0b99..fdf0a346a 100644

> --- a/grub-core/loader/arm64/xen_boot.c

> +++ b/grub-core/loader/arm64/xen_boot.c

> @@ -265,7 +265,7 @@ xen_boot (void)

>    if (err)

>      return err;

>  

> -  return grub_armxx_efi_linux_boot_image (xen_hypervisor->start,

> +  return grub_arch_efi_linux_boot_image (xen_hypervisor->start,

>  					  xen_hypervisor->size,

>  					  xen_hypervisor->cmdline);

>  }

> @@ -468,8 +468,8 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),

>  

>    if (grub_file_read (file, &sh, sizeof (sh)) != (long) sizeof (sh))

>      goto fail;

> -  if (grub_armxx_efi_linux_check_image

> -      ((struct linux_armxx_kernel_header *) &sh) != GRUB_ERR_NONE)

> +  if (grub_arch_efi_linux_check_image

> +      ((struct linux_arch_kernel_header *) &sh) != GRUB_ERR_NONE)

>      goto fail;

>    grub_file_seek (file, 0);

>  

> diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> index 712ba17b9..995800126 100644

> --- a/include/grub/arm/linux.h

> +++ b/include/grub/arm/linux.h

> @@ -36,7 +36,7 @@ struct linux_arm_kernel_header {

>  

>  #if defined(__arm__)

>  # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE

> -# define linux_armxx_kernel_header linux_arm_kernel_header

> +# define linux_arch_kernel_header linux_arm_kernel_header

>  #endif

>  

>  #if defined GRUB_MACHINE_UBOOT

> diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h

> index 8655067e0..4269adc6d 100644

> --- a/include/grub/arm64/linux.h

> +++ b/include/grub/arm64/linux.h

> @@ -38,7 +38,7 @@ struct linux_arm64_kernel_header

>  

>  #if defined(__aarch64__)

>  # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE

> -# define linux_armxx_kernel_header linux_arm64_kernel_header

> +# define linux_arch_kernel_header linux_arm64_kernel_header

>  #endif

>  

>  #endif /* ! GRUB_ARM64_LINUX_HEADER */

> diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h

> index 2c6648d46..ec44aef7e 100644

> --- a/include/grub/efi/efi.h

> +++ b/include/grub/efi/efi.h

> @@ -94,8 +94,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,

>  void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);

>  grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);

>  #include <grub/cpu/linux.h>

> -grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh);

> -grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,

> +grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);

> +grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,

>                                             char *args);

>  #endif

>  

> -- 

> 2.12.3

> 


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Alistair Francis Nov. 8, 2018, 10:43 p.m. UTC | #2
On Tue, 2018-11-06 at 18:58 +0100, Alexander Graf wrote:
> Some architectures want to boot Linux as plain UEFI binary. Today

> that

> really only encompasses ARM and AArch64, but going forward more

> architectures may adopt that model.

> 

> So rename our internal API accordingly.

> 

> Signed-off-by: Alexander Graf <agraf@suse.de>


Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Alistair

> ---

>  grub-core/loader/arm64/linux.c    | 10 +++++-----

>  grub-core/loader/arm64/xen_boot.c |  6 +++---

>  include/grub/arm/linux.h          |  2 +-

>  include/grub/arm64/linux.h        |  2 +-

>  include/grub/efi/efi.h            |  4 ++--

>  5 files changed, 12 insertions(+), 12 deletions(-)

> 

> diff --git a/grub-core/loader/arm64/linux.c b/grub-

> core/loader/arm64/linux.c

> index 1f86229f8..bee9859aa 100644

> --- a/grub-core/loader/arm64/linux.c

> +++ b/grub-core/loader/arm64/linux.c

> @@ -48,7 +48,7 @@ static grub_addr_t initrd_start;

>  static grub_addr_t initrd_end;

>  

>  grub_err_t

> -grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header *

> lh)

> +grub_arch_efi_linux_check_image (struct linux_arch_kernel_header *

> lh)

>  {

>    if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE)

>      return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");

> @@ -109,7 +109,7 @@ failure:

>  }

>  

>  grub_err_t

> -grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size,

> char *args)

> +grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size,

> char *args)

>  {

>    grub_efi_memory_mapped_device_path_t *mempath;

>    grub_efi_handle_t image_handle;

> @@ -172,7 +172,7 @@ grub_linux_boot (void)

>    if (finalize_params_linux () != GRUB_ERR_NONE)

>      return grub_errno;

>  

> -  return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr,

> +  return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,

>                                            kernel_size, linux_args));

>  }

>  

> @@ -286,7 +286,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__

> ((unused)),

>  		int argc, char *argv[])

>  {

>    grub_file_t file = 0;

> -  struct linux_armxx_kernel_header lh;

> +  struct linux_arch_kernel_header lh;

>  

>    grub_dl_ref (my_mod);

>  

> @@ -305,7 +305,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__

> ((unused)),

>    if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh))

>      return grub_errno;

>  

> -  if (grub_armxx_efi_linux_check_image (&lh) != GRUB_ERR_NONE)

> +  if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE)

>      goto fail;

>  

>    grub_loader_unset();

> diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-

> core/loader/arm64/xen_boot.c

> index 1003a0b99..fdf0a346a 100644

> --- a/grub-core/loader/arm64/xen_boot.c

> +++ b/grub-core/loader/arm64/xen_boot.c

> @@ -265,7 +265,7 @@ xen_boot (void)

>    if (err)

>      return err;

>  

> -  return grub_armxx_efi_linux_boot_image (xen_hypervisor->start,

> +  return grub_arch_efi_linux_boot_image (xen_hypervisor->start,

>  					  xen_hypervisor->size,

>  					  xen_hypervisor->cmdline);

>  }

> @@ -468,8 +468,8 @@ grub_cmd_xen_hypervisor (grub_command_t cmd

> __attribute__ ((unused)),

>  

>    if (grub_file_read (file, &sh, sizeof (sh)) != (long) sizeof (sh))

>      goto fail;

> -  if (grub_armxx_efi_linux_check_image

> -      ((struct linux_armxx_kernel_header *) &sh) != GRUB_ERR_NONE)

> +  if (grub_arch_efi_linux_check_image

> +      ((struct linux_arch_kernel_header *) &sh) != GRUB_ERR_NONE)

>      goto fail;

>    grub_file_seek (file, 0);

>  

> diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> index 712ba17b9..995800126 100644

> --- a/include/grub/arm/linux.h

> +++ b/include/grub/arm/linux.h

> @@ -36,7 +36,7 @@ struct linux_arm_kernel_header {

>  

>  #if defined(__arm__)

>  # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE

> GRUB_LINUX_ARM_MAGIC_SIGNATURE

> -# define linux_armxx_kernel_header linux_arm_kernel_header

> +# define linux_arch_kernel_header linux_arm_kernel_header

>  #endif

>  

>  #if defined GRUB_MACHINE_UBOOT

> diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h

> index 8655067e0..4269adc6d 100644

> --- a/include/grub/arm64/linux.h

> +++ b/include/grub/arm64/linux.h

> @@ -38,7 +38,7 @@ struct linux_arm64_kernel_header

>  

>  #if defined(__aarch64__)

>  # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE

> GRUB_LINUX_ARM64_MAGIC_SIGNATURE

> -# define linux_armxx_kernel_header linux_arm64_kernel_header

> +# define linux_arch_kernel_header linux_arm64_kernel_header

>  #endif

>  

>  #endif /* ! GRUB_ARM64_LINUX_HEADER */

> diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h

> index 2c6648d46..ec44aef7e 100644

> --- a/include/grub/efi/efi.h

> +++ b/include/grub/efi/efi.h

> @@ -94,8 +94,8 @@ extern void (*EXPORT_VAR(grub_efi_net_config))

> (grub_efi_handle_t hnd,

>  void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);

>  grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);

>  #include <grub/cpu/linux.h>

> -grub_err_t grub_armxx_efi_linux_check_image(struct

> linux_armxx_kernel_header *lh);

> -grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr,

> grub_size_t size,

> +grub_err_t grub_arch_efi_linux_check_image(struct

> linux_arch_kernel_header *lh);

> +grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr,

> grub_size_t size,

>                                             char *args);

>  #endif

>  

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

Patch

diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 1f86229f8..bee9859aa 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -48,7 +48,7 @@  static grub_addr_t initrd_start;
 static grub_addr_t initrd_end;
 
 grub_err_t
-grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh)
+grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
 {
   if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE)
     return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
@@ -109,7 +109,7 @@  failure:
 }
 
 grub_err_t
-grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
+grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
 {
   grub_efi_memory_mapped_device_path_t *mempath;
   grub_efi_handle_t image_handle;
@@ -172,7 +172,7 @@  grub_linux_boot (void)
   if (finalize_params_linux () != GRUB_ERR_NONE)
     return grub_errno;
 
-  return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr,
+  return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
                                           kernel_size, linux_args));
 }
 
@@ -286,7 +286,7 @@  grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 		int argc, char *argv[])
 {
   grub_file_t file = 0;
-  struct linux_armxx_kernel_header lh;
+  struct linux_arch_kernel_header lh;
 
   grub_dl_ref (my_mod);
 
@@ -305,7 +305,7 @@  grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh))
     return grub_errno;
 
-  if (grub_armxx_efi_linux_check_image (&lh) != GRUB_ERR_NONE)
+  if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE)
     goto fail;
 
   grub_loader_unset();
diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
index 1003a0b99..fdf0a346a 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -265,7 +265,7 @@  xen_boot (void)
   if (err)
     return err;
 
-  return grub_armxx_efi_linux_boot_image (xen_hypervisor->start,
+  return grub_arch_efi_linux_boot_image (xen_hypervisor->start,
 					  xen_hypervisor->size,
 					  xen_hypervisor->cmdline);
 }
@@ -468,8 +468,8 @@  grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
 
   if (grub_file_read (file, &sh, sizeof (sh)) != (long) sizeof (sh))
     goto fail;
-  if (grub_armxx_efi_linux_check_image
-      ((struct linux_armxx_kernel_header *) &sh) != GRUB_ERR_NONE)
+  if (grub_arch_efi_linux_check_image
+      ((struct linux_arch_kernel_header *) &sh) != GRUB_ERR_NONE)
     goto fail;
   grub_file_seek (file, 0);
 
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index 712ba17b9..995800126 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -36,7 +36,7 @@  struct linux_arm_kernel_header {
 
 #if defined(__arm__)
 # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
-# define linux_armxx_kernel_header linux_arm_kernel_header
+# define linux_arch_kernel_header linux_arm_kernel_header
 #endif
 
 #if defined GRUB_MACHINE_UBOOT
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
index 8655067e0..4269adc6d 100644
--- a/include/grub/arm64/linux.h
+++ b/include/grub/arm64/linux.h
@@ -38,7 +38,7 @@  struct linux_arm64_kernel_header
 
 #if defined(__aarch64__)
 # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
-# define linux_armxx_kernel_header linux_arm64_kernel_header
+# define linux_arch_kernel_header linux_arm64_kernel_header
 #endif
 
 #endif /* ! GRUB_ARM64_LINUX_HEADER */
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 2c6648d46..ec44aef7e 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -94,8 +94,8 @@  extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
 void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
 grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
 #include <grub/cpu/linux.h>
-grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh);
-grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
+grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
+grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
                                            char *args);
 #endif