From 5d2b16cdd3fed8c95f38cdb7aace76c9635fc13e Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Thu, 26 Jan 2023 18:30:29 +0200 Subject: [PATCH] Alternative approach to previous patch The approach in the previous patch works on Unmatched (and used to work in the past on QEMU), but no longer. [..] ERROR: fdt fixup event failed: -22 [..] We used to copy it many years ago. Let's try that. Also re-enable FDT and initrd relocation. Signed-off-by: David Abdurachmanov --- ...n-and-use-firmware-FDT-for-QEMU-targ.patch | 48 ++++++++++++++++ ...se-QEMU-provided-DTB-on-QEMU-targets.patch | 55 ------------------- uboot-tools.spec | 8 ++- 3 files changed, 54 insertions(+), 57 deletions(-) create mode 100644 0001-Enable-relocation-and-use-firmware-FDT-for-QEMU-targ.patch delete mode 100644 0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch diff --git a/0001-Enable-relocation-and-use-firmware-FDT-for-QEMU-targ.patch b/0001-Enable-relocation-and-use-firmware-FDT-for-QEMU-targ.patch new file mode 100644 index 0000000..04caf0d --- /dev/null +++ b/0001-Enable-relocation-and-use-firmware-FDT-for-QEMU-targ.patch @@ -0,0 +1,48 @@ +From cdd5f60df368a8befdb36809f8fce7e7c3e760fa Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Thu, 26 Jan 2023 18:28:07 +0200 +Subject: [PATCH] Enable relocation and use firmware FDT for QEMU targets + +Signed-off-by: David Abdurachmanov +--- + configs/qemu-riscv64_defconfig | 2 ++ + configs/qemu-riscv64_spl_defconfig | 2 ++ + include/configs/qemu-riscv.h | 2 -- + 3 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig +index 611d5eb3..b55e521b 100644 +--- a/configs/qemu-riscv64_defconfig ++++ b/configs/qemu-riscv64_defconfig +@@ -26,3 +26,5 @@ CONFIG_SYSRESET=y + CONFIG_SYSRESET_SBI=y + CONFIG_CMD_POWEROFF=y + CONFIG_SYSRESET_CMD_POWEROFF=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x20000;" +diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig +index 68b16f0a..9e9f5b13 100644 +--- a/configs/qemu-riscv64_spl_defconfig ++++ b/configs/qemu-riscv64_spl_defconfig +@@ -26,3 +26,5 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_DM_MTD=y + CONFIG_SYS_MAX_FLASH_BANKS=2 + # CONFIG_BINMAN_FDT is not set ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x20000;" +diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h +index d81e5d6c..e392dbb0 100644 +--- a/include/configs/qemu-riscv.h ++++ b/include/configs/qemu-riscv.h +@@ -37,8 +37,6 @@ + "qemu " + + #define CONFIG_EXTRA_ENV_SETTINGS \ +- "fdt_high=0xffffffffffffffff\0" \ +- "initrd_high=0xffffffffffffffff\0" \ + "kernel_addr_r=0x84000000\0" \ + "kernel_comp_addr_r=0x88000000\0" \ + "kernel_comp_size=0x4000000\0" \ +-- +2.37.1 + diff --git a/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch b/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch deleted file mode 100644 index 3c3a7f1..0000000 --- a/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 48fb0ffbe410feaaf4a122eab7ae3547092fbf35 Mon Sep 17 00:00:00 2001 -From: David Abdurachmanov -Date: Thu, 26 Jan 2023 16:24:47 +0200 -Subject: [PATCH] Use QEMU provided DTB on QEMU targets - -This is already available for Unleashed/Unmatched boards. Typically we -use DTB built and provided by the kernel package in Fedora. For the QEMU -we can get DTB via: - - qemu-system-riscv64 -nographic -smp 8 -m 2G -machine virt,dumpdtb=qemu-riscv.dtb - -Then this needs to be placed (in /boot partition): - - /dtb-6.0.10-300.0.riscv64.fc37.riscv64 - -In that case EXTLINUX will use fdtdir + machine/vendor information to -locate it. - -QEMU DTS is not shipped part of the kernel tree. - -If fdtdir is removed from extlinux.conf it should just assume that DTB -is available and loaded from the firmware. - -QEMU or U-Boot firmware provided DTB is located at fdtcontroladdr. Let's -set fdt_addr to it. - -Signed-off-by: David Abdurachmanov ---- - configs/qemu-riscv64_defconfig | 2 ++ - configs/qemu-riscv64_spl_defconfig | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig -index 611d5eb3..8df45b2b 100644 ---- a/configs/qemu-riscv64_defconfig -+++ b/configs/qemu-riscv64_defconfig -@@ -26,3 +26,5 @@ CONFIG_SYSRESET=y - CONFIG_SYSRESET_SBI=y - CONFIG_CMD_POWEROFF=y - CONFIG_SYSRESET_CMD_POWEROFF=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" -diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig -index 68b16f0a..28e8b3ef 100644 ---- a/configs/qemu-riscv64_spl_defconfig -+++ b/configs/qemu-riscv64_spl_defconfig -@@ -26,3 +26,5 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_DM_MTD=y - CONFIG_SYS_MAX_FLASH_BANKS=2 - # CONFIG_BINMAN_FDT is not set -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" --- -2.37.1 - diff --git a/uboot-tools.spec b/uboot-tools.spec index 0738a3e..88962f3 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -10,7 +10,7 @@ Name: uboot-tools Version: 2023.01 -Release: 2%{?candidate:.%{candidate}}.2.riscv64%{?dist} +Release: 2%{?candidate:.%{candidate}}.3.riscv64%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -38,7 +38,7 @@ Patch7: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch Patch20: 0001-board-sifive-spl-Initialized-the-PWM-setting-in-the-.patch Patch21: 0002-board-sifive-spl-Set-remote-thermal-of-TMP451-to-85-.patch Patch22: 0003-Enable-sbi-command-and-SBI-sysreset.patch -Patch23: 0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch +Patch23: 0001-Enable-relocation-and-use-firmware-FDT-for-QEMU-targ.patch BuildRequires: bc BuildRequires: bison @@ -256,6 +256,10 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Thu Jan 26 2023 David Abdurachmanov - 2023.01-2.3.riscv64 +- Enable FDT and initrd relocation for QEMU targets (riscv64) +- Copy FDT from fdtcontroladdr (firmware) to fdt_addr_r for QEMU targets (riscv64) + * Thu Jan 26 2023 David Abdurachmanov - 2023.01-2.2.riscv64 - Load DTB from firmware on QEMU targets (riscv64)