On Tue, Jul 8, 2025 at 11:43 AM Frediano Ziglio
<frediano.zig...@cloud.com> wrote:
>
> Compile for x86_64 EFI architecture.
> Do not fill device tree, not present for this architecture.
>
> Signed-off-by: Frediano Ziglio <frediano.zig...@cloud.com>
> ---
>  grub-core/Makefile.core.def       |  2 ++
>  grub-core/loader/arm64/xen_boot.c | 13 +++++++++++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 24e8c8437..bb091e549 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -1848,7 +1848,9 @@ module = {
>  module = {
>    name = xen_boot;
>    arm64 = loader/arm64/xen_boot.c;
> +  x86_64_efi = loader/arm64/xen_boot.c;

Note that in case this series is accepted the file would be better
moved out of "arm64" directory.

>    enable = arm64;
> +  enable = x86_64_efi;
>  };
>
>  module = {
> diff --git a/grub-core/loader/arm64/xen_boot.c 
> b/grub-core/loader/arm64/xen_boot.c
> index 0d53bc7fe..2975a546e 100644
> --- a/grub-core/loader/arm64/xen_boot.c
> +++ b/grub-core/loader/arm64/xen_boot.c
> @@ -46,6 +46,11 @@ GRUB_MOD_LICENSE ("GPLv3+");
>   */
>  #define FDT_NODE_NAME_MAX_SIZE  (49)
>
> +#undef USE_DEVICE_TREE
> +#if defined (__aarch64__) || defined (__arm__)
> +#define USE_DEVICE_TREE 1
> +#endif
> +
>  struct compat_string_struct
>  {
>    grub_size_t size;
> @@ -90,6 +95,7 @@ xen_boot_address_align (grub_addr_t start, grub_size_t 
> align)
>    return (align ? (ALIGN_UP (start, align)) : start);
>  }
>
> +#ifdef USE_DEVICE_TREE
>  static grub_err_t
>  prepare_xen_hypervisor_params (void *xen_boot_fdt)
>  {
> @@ -185,10 +191,12 @@ prepare_xen_module_params (struct xen_boot_binary 
> *module, void *xen_boot_fdt)
>
>    return GRUB_ERR_NONE;
>  }
> +#endif
>
>  static grub_err_t
>  finalize_params_xen_boot (void)
>  {
> +#ifdef USE_DEVICE_TREE
>    struct xen_boot_binary *module;
>    void *xen_boot_fdt;
>    grub_size_t additional_size = 0x1000;
> @@ -241,6 +249,9 @@ fail:
>    grub_fdt_unload ();
>
>    return grub_error (GRUB_ERR_IO, "failed to install/update FDT");
> +#else
> +  return GRUB_ERR_NONE;
> +#endif
>  }
>
>
> @@ -310,7 +321,9 @@ xen_unload (void)
>  {
>    loaded = false;
>    all_binaries_unload ();
> +#ifdef USE_DEVICE_TREE
>    grub_fdt_unload ();
> +#endif
>    grub_dl_unref (my_mod);
>
>    return GRUB_ERR_NONE;

Frediano

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

Reply via email to