From b400f345f096f17213b44b237dbe1febd9349422 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Thu, 26 Jan 2023 16:33:40 +0200 Subject: [PATCH] Load DTB from firmware on QEMU targets (riscv64) See more details in the patch comment. Signed-off-by: David Abdurachmanov --- ...se-QEMU-provided-DTB-on-QEMU-targets.patch | 55 +++++++++++++++++++ uboot-tools.spec | 8 ++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch diff --git a/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch b/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch new file mode 100644 index 0000000..3c3a7f1 --- /dev/null +++ b/0001-Use-QEMU-provided-DTB-on-QEMU-targets.patch @@ -0,0 +1,55 @@ +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 e05b604..0738a3e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -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 - 2023.01-2.2.riscv64 +- Load DTB from firmware on QEMU targets (riscv64) + * Thu Jan 26 2023 David Abdurachmanov - 2023.01-2.1.riscv64 - Rebuild with OpenSBI v1.2 -* Tue Jan 25 2023 David Abdurachmanov - 2023.01-2.0.riscv64 +* Wed Jan 25 2023 David Abdurachmanov - 2023.01-2.0.riscv64 - Add support for riscv64 * Sat Jan 21 2023 Fedora Release Engineering - 2023.01-2