Load DTB from firmware on QEMU targets (riscv64)

See more details in the patch comment.

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-01-26 16:33:40 +02:00
parent 0b81445810
commit b400f345f0
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
2 changed files with 61 additions and 2 deletions

View File

@ -0,0 +1,55 @@
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}}.1.riscv64%{?dist}
Release: 2%{?candidate:.%{candidate}}.2.riscv64%{?dist}
Summary: U-Boot utilities
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot
@ -38,6 +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
BuildRequires: bc
BuildRequires: bison
@ -255,10 +256,13 @@ 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.2.riscv64
- Load DTB from firmware on QEMU targets (riscv64)
* Thu Jan 26 2023 David Abdurachmanov <davidlt@rivosinc.com> - 2023.01-2.1.riscv64
- Rebuild with OpenSBI v1.2
* Tue Jan 25 2023 David Abdurachmanov <davidlt@rivosinc.com> - 2023.01-2.0.riscv64
* Wed Jan 25 2023 David Abdurachmanov <davidlt@rivosinc.com> - 2023.01-2.0.riscv64
- Add support for riscv64
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2023.01-2