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 <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-01-26 18:30:29 +02:00
parent b400f345f0
commit 5d2b16cdd3
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
3 changed files with 54 additions and 57 deletions

View File

@ -0,0 +1,48 @@
From cdd5f60df368a8befdb36809f8fce7e7c3e760fa Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <davidlt@rivosinc.com>
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 <davidlt@rivosinc.com>
---
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

View File

@ -1,55 +0,0 @@
From 48fb0ffbe410feaaf4a122eab7ae3547092fbf35 Mon Sep 17 00:00:00 2001
From: David Abdurachmanov <davidlt@rivosinc.com>
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 <davidlt@rivosinc.com>
---
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

View File

@ -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 <davidlt@rivosinc.com> - 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 <davidlt@rivosinc.com> - 2023.01-2.2.riscv64
- Load DTB from firmware on QEMU targets (riscv64)