A bunch of RISC-V build fixes and some cleanups
- Add riscv64 support to grub.macros and RISC-V build fixes (davidlt) - blscfg: Always use the root variable to search for BLS snippets - bootstrap.conf: Force autogen.sh to use python3 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
b888fb3a32
commit
fbe5a8c26a
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
Date: Thu, 16 Jan 2020 13:10:10 +0100
|
||||
Subject: [PATCH] Also define GRUB_EFI_MAX_ALLOCATION_ADDRESS for RISC-V
|
||||
|
||||
The commit "Try to pick better locations for kernel and initrd" missed to
|
||||
define this macro for the RISC-V (riscv64) architecture, so add it there.
|
||||
|
||||
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
---
|
||||
include/grub/riscv64/efi/memory.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h
|
||||
index c6cb3241714..acb61dca44b 100644
|
||||
--- a/include/grub/riscv64/efi/memory.h
|
||||
+++ b/include/grub/riscv64/efi/memory.h
|
||||
@@ -2,5 +2,6 @@
|
||||
#include <grub/efi/memory.h>
|
||||
|
||||
#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffULL
|
||||
+#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS
|
||||
|
||||
#endif /* ! GRUB_MEMORY_CPU_HEADER */
|
31
0193-chainloader-Define-machine-types-for-RISC-V.patch
Normal file
31
0193-chainloader-Define-machine-types-for-RISC-V.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
Date: Sat, 9 Nov 2019 18:06:32 +0000
|
||||
Subject: [PATCH] chainloader: Define machine types for RISC-V
|
||||
|
||||
The commit "Add secureboot support on efi chainloader" didn't add machine
|
||||
types for RISC-V, so this patch adds them.
|
||||
|
||||
Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not
|
||||
supported yet. This patch might need a new revision once that's the case.
|
||||
|
||||
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index f4ddbeda687..2c529f71471 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -316,6 +316,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) =
|
||||
GRUB_PE32_MACHINE_I386;
|
||||
#elif defined(__ia64__)
|
||||
GRUB_PE32_MACHINE_IA64;
|
||||
+#elif defined(__riscv) && (__riscv_xlen == 32)
|
||||
+ GRUB_PE32_MACHINE_RISCV32;
|
||||
+#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
+ GRUB_PE32_MACHINE_RISCV64;
|
||||
#else
|
||||
#error this architecture is not supported by grub2
|
||||
#endif
|
28
0194-Add-start-symbol-for-RISC-V.patch
Normal file
28
0194-Add-start-symbol-for-RISC-V.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
Date: Sat, 9 Nov 2019 19:51:57 +0000
|
||||
Subject: [PATCH] Add start symbol for RISC-V
|
||||
|
||||
All other architectures have start symbol.
|
||||
|
||||
Hopefully this resolves:
|
||||
|
||||
BUILDSTDERR: ././grub-mkimage: error: undefined symbol start.
|
||||
|
||||
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
|
||||
---
|
||||
grub-core/kern/riscv/efi/startup.S | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S
|
||||
index f2a7b2b1ede..781773136e8 100644
|
||||
--- a/grub-core/kern/riscv/efi/startup.S
|
||||
+++ b/grub-core/kern/riscv/efi/startup.S
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
.file "startup.S"
|
||||
.text
|
||||
+FUNCTION(start)
|
||||
FUNCTION(_start)
|
||||
/*
|
||||
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in a1/a0.
|
43
0195-RISC-V-Add-__clzdi2-symbol.patch
Normal file
43
0195-RISC-V-Add-__clzdi2-symbol.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Thu, 19 Sep 2019 09:39:04 +0200
|
||||
Subject: [PATCH] RISC-V: Add __clzdi2 symbol
|
||||
|
||||
This is needed for the zstd module build for riscv64-emu.
|
||||
|
||||
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
include/grub/compiler-rt-emu.h | 5 +++++
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5076d635c57..eff160b6931 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1444,7 +1444,7 @@ fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
if test x"$platform" = xemu; then
|
||||
-AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
|
||||
+AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
|
||||
fi
|
||||
|
||||
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||
diff --git a/include/grub/compiler-rt-emu.h b/include/grub/compiler-rt-emu.h
|
||||
index b21425d9eb8..fde620ac186 100644
|
||||
--- a/include/grub/compiler-rt-emu.h
|
||||
+++ b/include/grub/compiler-rt-emu.h
|
||||
@@ -74,6 +74,11 @@ unsigned
|
||||
EXPORT_FUNC (__ctzsi2) (grub_uint32_t x);
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE___CLZDI2
|
||||
+int
|
||||
+EXPORT_FUNC (__clzdi2) (grub_uint64_t x);
|
||||
+#endif
|
||||
+
|
||||
#ifdef HAVE___AEABI_UIDIV
|
||||
grub_uint32_t
|
||||
EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b);
|
31
0196-grub-install-Define-default-platform-for-RISC-V.patch
Normal file
31
0196-grub-install-Define-default-platform-for-RISC-V.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Thu, 15 Aug 2019 16:55:13 +0200
|
||||
Subject: [PATCH] grub-install: Define default platform for RISC-V
|
||||
|
||||
Signed-off-by: Andreas Schwab <schwab@suse.de>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Alexander Graf <agraf@csgraf.de>
|
||||
---
|
||||
util/grub-install.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index 37fcdac12cc..8b6a037903e 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -324,6 +324,14 @@ get_default_platform (void)
|
||||
return "arm64-efi";
|
||||
#elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__)
|
||||
return grub_install_get_default_x86_platform ();
|
||||
+#elif defined (__riscv)
|
||||
+#if __riscv_xlen == 32
|
||||
+ return "riscv32-efi";
|
||||
+#elif __riscv_xlen == 64
|
||||
+ return "riscv64-efi";
|
||||
+#else
|
||||
+ return NULL;
|
||||
+#endif
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 14 Jan 2020 17:41:29 +0100
|
||||
Subject: [PATCH] blscfg: Always use the root variable to search for BLS
|
||||
snippets
|
||||
|
||||
The boot and root variables are set by grub2-mkconfig to tell GRUB what
|
||||
are the devices and partitions used as the EFI System Partition (ESP)
|
||||
and to store the /boot directory (or used as the /boot mount point).
|
||||
|
||||
But the boot variable is not needed anymore, this was added because the
|
||||
blscfg module used to search for the BLS snippets in the ESP, but was
|
||||
later changed to always search for the BLS files in /boot even for EFI.
|
||||
|
||||
When doing that change, the logic was made backwards and so the boot
|
||||
variable is wrongly used for legacy BIOS. This only works because this
|
||||
is set to the same value as the root variable.
|
||||
|
||||
So the correct thing to do is to always use the root variable to search
|
||||
the BLS snippets, since that is set to the partition that stores them.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grub-core/commands/blscfg.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
||||
index 069db721bec..24e35a40f24 100644
|
||||
--- a/grub-core/commands/blscfg.c
|
||||
+++ b/grub-core/commands/blscfg.c
|
||||
@@ -1018,14 +1018,12 @@ bls_load_entries (const char *path)
|
||||
if (!devid) {
|
||||
#ifdef GRUB_MACHINE_EMU
|
||||
devid = "host";
|
||||
-#elif defined(GRUB_MACHINE_EFI)
|
||||
+#else
|
||||
devid = grub_env_get ("root");
|
||||
-#else
|
||||
- devid = grub_env_get ("boot");
|
||||
#endif
|
||||
if (!devid)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
- N_("variable `%s' isn't set"), "boot");
|
||||
+ N_("variable `%s' isn't set"), "root");
|
||||
}
|
||||
|
||||
grub_dprintf ("blscfg", "opening %s\n", devid);
|
33
0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch
Normal file
33
0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 15 Jan 2020 12:47:46 +0100
|
||||
Subject: [PATCH] bootstrap.conf: Force autogen.sh to use python3
|
||||
|
||||
The python-unversioned-command package is not installed in the buildroot,
|
||||
but the bootstrap script expects the python command to be present if one
|
||||
is not defined. So building the package leads to the following error:
|
||||
|
||||
./autogen.sh: line 20: python: command not found
|
||||
|
||||
This is harmless since gnulib is included as a source anyways, because the
|
||||
builders can't download. But still the issue should be fixed by forcing to
|
||||
use python3 that's the default in Fedora now.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
bootstrap.conf | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bootstrap.conf b/bootstrap.conf
|
||||
index 274c55a5568..5665c83351d 100644
|
||||
--- a/bootstrap.conf
|
||||
+++ b/bootstrap.conf
|
||||
@@ -84,7 +84,7 @@ cp -a INSTALL INSTALL.grub
|
||||
|
||||
bootstrap_post_import_hook () {
|
||||
set -e
|
||||
- FROM_BOOTSTRAP=1 ./autogen.sh
|
||||
+ PYTHON=python3 FROM_BOOTSTRAP=1 ./autogen.sh
|
||||
set +e # bootstrap expects this
|
||||
}
|
||||
|
@ -189,3 +189,10 @@ Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch
|
||||
Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch
|
||||
Patch0190: 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch
|
||||
Patch0191: 0191-Fix-savedefault-with-blscfg.patch
|
||||
Patch0192: 0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch
|
||||
Patch0193: 0193-chainloader-Define-machine-types-for-RISC-V.patch
|
||||
Patch0194: 0194-Add-start-symbol-for-RISC-V.patch
|
||||
Patch0195: 0195-RISC-V-Add-__clzdi2-symbol.patch
|
||||
Patch0196: 0196-grub-install-Define-default-platform-for-RISC-V.patch
|
||||
Patch0197: 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch
|
||||
Patch0198: 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch
|
||||
|
@ -9,7 +9,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.04
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -512,6 +512,11 @@ rm -r /boot/grub2.tmp/ || :
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jan 16 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-9
|
||||
- Add riscv64 support to grub.macros and RISC-V build fixes (davidlt)
|
||||
- blscfg: Always use the root variable to search for BLS snippets
|
||||
- bootstrap.conf: Force autogen.sh to use python3
|
||||
|
||||
* Mon Jan 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-8
|
||||
- Make the blscfg module honour the GRUB_SAVEDEFAULT option (fritz)
|
||||
Resolves: rhbz#1704926
|
||||
|
Loading…
Reference in New Issue
Block a user