Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1loYB3-00063z-GT for mharc-grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loYB0-0005rT-4z for grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:22 -0400 Received: from mail-lf1-f46.google.com ([209.85.167.46]:36521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loYAy-00046o-DO for grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:21 -0400 Received: by mail-lf1-f46.google.com with SMTP id v22so4141349lfa.3 for ; Wed, 02 Jun 2021 14:13:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qBGEObyR2BoiBYup5nhWOog/RDApXiElSQ1Hl6Hxvy4=; b=nBI1WvHq9zOEH1tdC5Yl1RmCHN+UfwZjfvapR3lxQSB0+LFFmG2VfxTP61Ax8kCHZ7 i1tOzE1OV7wIieXngYPjulEVQllWtpiTEK4GmO82AQeWi3T9kr2cv84KfvNzzoj15G6+ dmJDtAqDFt6c/uT4+2ukPe5kiMWHUXvPkSdDFq0ULZYGDRwsfmNy126dqri2Xq43n0wc RiwQ4LS23N0gC4BjZZ3SREMJMCHN3x8uqBTltZCq0mIi719S5xjzjCksHQLoTJQQCqRD PeOZBxSr7G9WAQkPk+XK3LQQhL4B7CAKMGkR9IiMukkNHp7ZpogymVVG0syaJgJwcQYm RnnA== X-Gm-Message-State: AOAM5306HVThgQiZDeWnUkTK4Z1PdJDYmAkHGA7QGOSYJmmQGeFyw8r+ 1o64DePfAs/XED7A3SO61ZSwx9k1btaRICwY X-Google-Smtp-Source: ABdhPJy18sFLitgaBlkY2wPnMCgDxguH/sivVLpVhuxJNtunENBb2lXj9WAXUWv2sAr3/dXJdH81yw== X-Received: by 2002:ac2:5c03:: with SMTP id r3mr22849859lfp.504.1622668398649; Wed, 02 Jun 2021 14:13:18 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:811f:4a8d:2d8:61ff:fed1:d10a]) by smtp.gmail.com with ESMTPSA id p3sm101361lfa.116.2021.06.02.14.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 14:13:18 -0700 (PDT) From: Nikita Ermakov To: GRUB development mailing list Cc: Ard Biesheuvel , Atish Patra , Daniel Kiper , Heinrich Schuchardt , Leif Lindholm , Nikita Ermakov , Atish Patra Subject: [PATCH v2 5/7] loader: Move arm64 linux loader to common code Date: Thu, 3 Jun 2021 00:12:33 +0300 Message-Id: <20210602211235.377366-6-arei@altlinux.org> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210602211235.377366-1-arei@altlinux.org> References: <20210602211235.377366-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.167.46; envelope-from=coffe92@gmail.com; helo=mail-lf1-f46.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.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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: Wed, 02 Jun 2021 21:13:22 -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.29.3