From 5884c94b1f92c00406d137c9f308c098e5268a59 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Tue, 13 Jul 2021 19:47:04 +0200 Subject: Initial commit --- .../files/grub-2.06-add-boot-hartid-to-fdt.patch | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch (limited to 'sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch') diff --git a/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch b/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch new file mode 100644 index 0000000..3b6b464 --- /dev/null +++ b/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch @@ -0,0 +1,35 @@ +diff -Naur grub-2.06/grub-core/loader/riscv64/linux.c grub-2.06-mod/grub-core/loader/riscv64/linux.c +--- grub-2.06/grub-core/loader/riscv64/linux.c 2021-07-03 19:45:08.797409969 +0200 ++++ grub-2.06-mod/grub-core/loader/riscv64/linux.c 2021-07-03 19:43:54.673239976 +0200 +@@ -48,6 +48,13 @@ + static grub_addr_t initrd_start; + static grub_addr_t initrd_end; + ++#define get_hartid(__v) \ ++{ \ ++ __asm__ __volatile__ ("mv %0, tp" \ ++ : "=r" (__v) : \ ++ : "memory"); \ ++} ++ + grub_err_t + grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh) + { +@@ -68,6 +75,7 @@ + finalize_params_linux (void) + { + int node, retval; ++ int hartid; + + void *fdt; + +@@ -83,6 +91,9 @@ + if (node < 1) + goto failure; + ++ get_hartid(hartid); ++ grub_fdt_set_prop32 (fdt, node, "boot-hartid", hartid); ++ + /* Set initrd info */ + if (initrd_start && initrd_end > initrd_start) + { -- cgit v1.2.3