From patchwork Sat Dec 23 19:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Olivain X-Patchwork-Id: 1879906 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SyF1P43kGz20RL for ; Sun, 24 Dec 2023 06:42:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C17AA820E6; Sat, 23 Dec 2023 19:42:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C17AA820E6 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VdLBuHGOZbcX; Sat, 23 Dec 2023 19:42:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 10A0982110; Sat, 23 Dec 2023 19:42:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 10A0982110 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id DC5E71BF32A for ; Sat, 23 Dec 2023 19:42:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AC906415FE for ; Sat, 23 Dec 2023 19:42:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org AC906415FE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6TIWk_0Aisxq for ; Sat, 23 Dec 2023 19:42:09 +0000 (UTC) Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [IPv6:2a01:e0c:1:1599::12]) by smtp4.osuosl.org (Postfix) with ESMTPS id 20D20415FB for ; Sat, 23 Dec 2023 19:42:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 20D20415FB Received: from home.juju.sh (unknown [IPv6:2a01:e0a:485:b220:64fe:9015:874f:9d44]) (Authenticated sender: ju.o@free.fr) by smtp3-g21.free.fr (Postfix) with ESMTPSA id 479B413F8B9; Sat, 23 Dec 2023 20:42:02 +0100 (CET) From: Julien Olivain To: buildroot@buildroot.org Date: Sat, 23 Dec 2023 20:41:49 +0100 Message-ID: <20231223194150.1152752-1-ju.o@free.fr> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1703360525; bh=ZZzkhCYSeUfBqVwG0h2hTiDnMCjWJBFMsRjVULbCyrI=; h=From:To:Cc:Subject:Date:From; b=poQ/4KcMcHq0B1hEMmQ+8x6uwL4gDg6fBOl6VerHDL4yjVAbc2gaOc7tssATATyfV uVy1MY3DJU5U/pRpWcpjk7Fao0lE33Qu8ojyCGmuPWb2NOtebb1FJhdXWdx1+Y+c2s q4twXiSBM/CgVvBGf6/6LwF2m7K0ZgAapPXBSYmb6XSRA+f3lGHO72rRRo6E56g8X8 aYRtd6V0KYza/m1UD7/bQK3p14F2nACLyFFS77hfWShSJ1Zw8SLlSWJs2tquiSxN08 G8nisdIHnj0sG8FaBWduvEZO75TnRciIiUx793gND6iJHSd86LX0Wnbr8bV2mv31A4 bT8LttEMD4Lhw== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=free.fr header.i=@free.fr header.a=rsa-sha256 header.s=smtp-20201208 header.b=poQ/4KcM Subject: [Buildroot] [PATCH 1/2] boot/grub2: add RISC-V 64bit EFI support X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Julien Olivain , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Grub can be built as a RISC-V UEFI application since commit [1]. This commit was first included in grub version 2.04. This commit enables this support. [1] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3 Signed-off-by: Julien Olivain --- boot/grub2/Config.in | 10 ++++++++++ boot/grub2/grub2.mk | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in index f05f33ccc7..7c235e96f7 100644 --- a/boot/grub2/Config.in +++ b/boot/grub2/Config.in @@ -4,6 +4,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS default y if BR2_x86_64 default y if BR2_arm default y if BR2_aarch64 + default y if BR2_RISCV_64 depends on BR2_USE_MMU config BR2_TARGET_GRUB2 @@ -102,6 +103,15 @@ config BR2_TARGET_GRUB2_ARM64_EFI Aarch64 platform and you want to boot Grub 2 as an EFI application. +config BR2_TARGET_GRUB2_RISCV64_EFI + bool "riscv64-efi" + depends on BR2_RISCV_64 + select BR2_TARGET_GRUB2_HAS_EFI_BOOT + help + Select this option if the platform you're targetting is a + 64bit RISC-V platform and you want to boot Grub 2 as an EFI + application. + if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT comment "Options for the x86 legacy BIOS or ARM U-Boot support" diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk index b9be826885..679eac5f46 100644 --- a/boot/grub2/grub2.mk +++ b/boot/grub2/grub2.mk @@ -93,6 +93,15 @@ GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI) GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI) GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi +GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi +GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg +GRUB2_PREFIX_riscv64-efi = /EFI/BOOT +GRUB2_TARGET_riscv64-efi = riscv64 +GRUB2_PLATFORM_riscv64-efi = efi +GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI) +GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI) +GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi + # Grub2 is kind of special: it considers CC, LD and so on to be the # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS, # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.