From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mgC5G-0006gD-Jq for mharc-grub-devel@gnu.org; Thu, 28 Oct 2021 16:33:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgC54-0006VN-QN for grub-devel@gnu.org; Thu, 28 Oct 2021 16:32:59 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:38675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgC51-0004WG-C6 for grub-devel@gnu.org; Thu, 28 Oct 2021 16:32:58 -0400 Received: by mail-lj1-f176.google.com with SMTP id n7so12809250ljp.5 for ; Thu, 28 Oct 2021 13:32:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z3TRiD5oAKAQRkL8fR57U7rr9sKgJ7F6FpkWbt5NOog=; b=whIynj1R20E2X9NQpvn7MfmGcdW+wEdetqLf1dTfJxLFN+nxTktabwKU/NoknDphtV AIY0VHSoNE59Xq2W4ExkTpz93hbBPOkOzoV8ZCp/i6x5+hpnvRj2YiHmpsDdE5CfXtGc jGlmGtM8Z3KmFlwfKJae2ESlMzfVTBjO8+25goX/OySIaET8vcGJf4JEAB7JFqx+zo2x nlygDxaWpR15UpMbcGnQIb4EoKduoQVyJCvP/s9F4n4lgBZYmr5jL4pp1VFXmKHtKks6 GWP8zjpAZQ1BQAHPxLWKr2TCBbMFm4m3Rc7FmlSbzI6SbCxoEsuwmJxNCQQuCnLVywdT fxww== X-Gm-Message-State: AOAM532bS87adf/skpclfB0JvQUjAmJe6tXrmLZ8dEO9e58n6iNlMr8g bcAQ6ekhBGfiVUR4dUeo9zJizkzI/rnY0J/s X-Google-Smtp-Source: ABdhPJwP1gqi8NcX45Et87ikwGUycg08Xjx6z5D8pVj5Ej7oaujeH19KPnIygVd/KQv4mVL37/PGeg== X-Received: by 2002:a05:651c:1799:: with SMTP id bn25mr7069272ljb.516.1635453170916; Thu, 28 Oct 2021 13:32:50 -0700 (PDT) Received: from amanita.localdomain ([2a00:1370:811f:5cd1:1618:c3ff:fe69:39f3]) by smtp.gmail.com with ESMTPSA id v22sm291719lfr.175.2021.10.28.13.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 13:32:50 -0700 (PDT) From: Nikita Ermakov To: GRUB development mailing list Cc: Ard Biesheuvel , Atish Patra , Daniel Kiper , Heinrich Schuchardt , Leif Lindholm , Fu Wei , Atish Patra Subject: [PATCH v3 5/7] loader: Move arm64 linux loader to common code Date: Thu, 28 Oct 2021 23:31:18 +0300 Message-Id: <20211028203118.7908-6-arei@altlinux.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211028203118.7908-1-arei@altlinux.org> References: <20211028203118.7908-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.208.176; envelope-from=coffe92@gmail.com; helo=mail-lj1-f176.google.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2021 20:32:59 -0000 From: Atish Patra 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 --- 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 65f1275fb..60f0fa264 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/efi/linux.c @@ -60,7 +60,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.33.1