Skip to contentSkip to conversation

docs/platform: Update QEMU parameter for fw_payload

PATCH New Bin Meng 2 participants 6 messages Jun 26, 2020 – Jun 29, 2020 SiFive drivers

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/3 docs/platform: Update QEMU parameter for fw_payload

From: Bin Meng <[email protected]>

Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU.

---

(no changes since v1)

 docs/platform/qemu_virt.md | 12 ++++++------
 docs/platform/spike.md     |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
docs/platform/qemu_virt.md +6 -6
index 2196e5a..2777148 100644
@@ -28,7 +28,7 @@ make PLATFORM=generic
 Run:
 ```
 qemu-system-riscv64 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.bin
+	-bios build/platform/generic/firmware/fw_payload.bin
 ```
 
 **U-Boot Payload**
@@ -44,7 +44,7 @@ make PLATFORM=generic FW_PAYLOAD_PATH=<uboot_build_directory>/u-boot.bin
 Run:
 ```
 qemu-system-riscv64 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 or
 ```
@@ -66,7 +66,7 @@ make PLATFORM=generic FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Im
 Run:
 ```
 qemu-system-riscv64 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
 	-device virtio-blk-device,drive=hd0 \
 	-append "root=/dev/vda rw console=ttyS0"
@@ -95,7 +95,7 @@ make PLATFORM=generic PLATFORM_RISCV_XLEN=32
 Run:
 ```
 qemu-system-riscv32 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.bin
+	-bios build/platform/generic/firmware/fw_payload.bin
 ```
 
 **U-Boot Payload**
@@ -111,7 +111,7 @@ make PLATFORM=generic PLATFORM_RISCV_XLEN=32 FW_PAYLOAD_PATH=<uboot_build_direct
 Run:
 ```
 qemu-system-riscv32 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 or
 ```
@@ -133,7 +133,7 @@ make PLATFORM=generic PLATFORM_RISCV_XLEN=32 FW_PAYLOAD_PATH=<linux_build_direct
 Run:
 ```
 qemu-system-riscv32 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
 	-device virtio-blk-device,drive=hd0 \
 	-append "root=/dev/vda rw console=ttyS0"
docs/platform/spike.md +2 -2
index 8d6b422..79e2eb2 100644
@@ -59,7 +59,7 @@ make PLATFORM=generic
 Run:
 ```
 qemu-system-riscv64 -M spike -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 
 **Linux Kernel Payload**
@@ -75,7 +75,7 @@ make PLATFORM=generic FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Im
 Run:
 ```
 qemu-system-riscv64 -M spike -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-initrd <path_to_cpio_ramdisk> \
 	-append "root=/dev/ram rw console=hvc0 earlycon=sbi"
 ```
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 2/3 config.mk: Update QEMU run command for generic and sifive fu540 platforms

From: Bin Meng <[email protected]>

Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU.

---

(no changes since v1)

 platform/generic/config.mk      | 2 +-
 platform/sifive/fu540/config.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
platform/generic/config.mk +1 -1
index 8d63ece..8151974 100644
@@ -15,7 +15,7 @@ platform-ldflags-y =
 
 # Command for platform specific "make run"
 platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -m 256M \
-  -nographic -kernel $(build_dir)/platform/generic/firmware/fw_payload.elf
+  -nographic -bios $(build_dir)/platform/generic/firmware/fw_payload.elf
 
 # Blobs to build
 FW_TEXT_START=0x80000000
platform/sifive/fu540/config.mk +1 -1
index e76adcd..23169b1 100644
@@ -15,7 +15,7 @@ platform-ldflags-y =
 
 # Command for platform specific "make run"
 platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M sifive_u -m 256M \
-  -nographic -kernel $(build_dir)/platform/sifive/fu540/firmware/fw_payload.elf
+  -nographic -bios $(build_dir)/platform/sifive/fu540/firmware/fw_payload.elf
 
 # Blobs to build
 FW_TEXT_START=0x80000000
Signature · 1 line
2.7.4
Applied
#2 lore raw

PATCH v2 2/3 config.mk: Update QEMU run command for generic and sifive fu540 platforms

Quoted 63 lines

-----Original Message-----
From: opensbi <[email protected]> On Behalf Of Bin Meng
Sent: 26 June 2020 06:56
To: Atish Patra <[email protected]>; opensbi at lists.infradead.org
Cc: Bin Meng <[email protected]>
Subject: [PATCH v2 2/3] config.mk: Update QEMU run command for generic and sifive fu540 platforms

From: Bin Meng <[email protected]>

Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU.

---

(no changes since v1)

 platform/generic/config.mk      | 2 +-
 platform/sifive/fu540/config.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
platform/generic/config.mk index renamed from platform/generic/config.mk +0 -0

8d63ece..8151974 100644

platform/generic/config.mk +2 -1
@@ -15,7 +15,7 @@ platform-ldflags-y =
 
 # Command for platform specific "make run"
 platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -
 m 256M \
-  -nographic -kernel $(build_dir)/platform/generic/firmware/fw_payload.elf
+  -nographic -bios
+ $(build_dir)/platform/generic/firmware/fw_payload.elf
 
 # Blobs to build
 FW_TEXT_START=0x80000000
(quoted diff) +0 -0

b/platform/sifive/fu540/config.mk index e76adcd..23169b1 100644

platform/sifive/fu540/config.mk +0 -1
@@ -15,7 +15,7 @@ platform-ldflags-y =
 
 # Command for platform specific "make run"
 platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M
 sifive_u -m 256M \
-  -nographic -kernel

$(build_dir)/platform/sifive/fu540/firmware/fw_payload.elf
+ -nographic -bios
+ $(build_dir)/platform/sifive/fu540/firmware/fw_payload.elf

# Blobs to build
FW_TEXT_START=0x80000000
--
2.7.4

Quoted 4 lines

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

author
#3 lore raw

PATCH v2 3/3 docs/platform: sifive_fu540: Update U-Boot instructions

In reply to Bin Meng

From: Bin Meng <[email protected]>

U-Boot v2020.07 release adds SPL support to SiFive HiFive Unleashed. Update the doc to mention that detailed build instructions are in the U-Boot doc.

This also adds detailed command line description to show how to boot U-Boot v2020.07 S-mode payload in the QEMU chapter.

---

Changes in v2:
- fix the typo in the doc

 docs/platform/sifive_fu540.md | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
docs/platform/sifive_fu540.md +30 -5
index 9342846..1008432 100644
@@ -41,13 +41,14 @@ make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/bo
 **U-Boot Payload**
 
 The command-line example here assumes that U-Boot was compiled using the
-sifive_fu540_defconfig configuration and with U-Boot v2020.01 (or higher).
-
-The detailed U-Boot booting guide is avaialble at [U-Boot].
+sifive_fu540_defconfig configuration and with U-Boot v2020.01, and up to
+v2020.07-rc3.
 
 ```
 make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=<u-boot_build_dir>/u-boot-dtb.bin
 ```
+For U-Boot v2020.07-rc4 or later releases, SPL support was added in U-Boot.
+Please refer to the detailed U-Boot booting guide available at [U-Boot].
 
 Flashing the OpenSBI firmware binary to storage media:
 ------------------------------------------------------
@@ -155,13 +156,37 @@ Linux kernel.
 When U-Boot v2020.01 (or higher) is used as the payload, as the SiFive FU540
 DTB for the real hardware is embedded in U-Boot binary itself, due to the same
 reason above, we need to switch the U-Boot sifive_fu540_defconfig configuration
-from CONFIG_OF_SEPARATE to CONFIG_OF_PRIOR_STAGE so that U-Boot uses the DTB
-generated by QEMU, and u-boot.bin should be used as the payload image, like:
+from **CONFIG_OF_SEPARATE** to **CONFIG_OF_PRIOR_STAGE** so that U-Boot uses the
+DTB generated by QEMU, and u-boot.bin should be used as the payload image, like:
 
 ```
 make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=<u-boot_build_dir>/u-boot.bin
 ```
 
+U-Boot v2020.07 release added SPL support to SiFive HiFive Unleashed board,
+hence a build error will be seen after you switch to **CONFIG_OF_PRIOR_STAGE**.
+
+```
+./tools/mkimage: Can't open arch/riscv/dts/hifive-unleashed-a00.dtb: No such file or directory
+./tools/mkimage: failed to build FIT
+Makefile:1402: recipe for target 'u-boot.img' failed
+make: *** [u-boot.img] Error 1
+```
+
+The above errors can be safely ignored as we don't run U-Boot SPL under QEMU.
+
+Run:
+```
+qemu-system-riscv64 -M sifive_u -m 256M -nographic \
+	-bios build/platform/sifive/fu540/firmware/fw_payload.bin
+```
+or
+```
+qemu-system-riscv64 -M sifive_u -m 256M -nographic \
+	-bios build/platform/sifive/fu540/firmware/fw_jump.bin \
+	-kernel <uboot_build_dir>/u-boot.bin
+```
+
 While the real hardware operates at the 64-bit mode, it's possible for QEMU to
 test the 32-bit OpenSBI firmware. This can be helpful for testing 32-bit SiFive
 specific drivers.
Signature · 1 line
2.7.4
Applied
#4 lore raw

PATCH v2 3/3 docs/platform: sifive_fu540: Update U-Boot instructions

Quoted 108 lines

-----Original Message-----
From: opensbi <[email protected]> On Behalf Of Bin Meng
Sent: 26 June 2020 06:56
To: Atish Patra <[email protected]>; opensbi at lists.infradead.org
Cc: Bin Meng <[email protected]>
Subject: [PATCH v2 3/3] docs/platform: sifive_fu540: Update U-Boot instructions

From: Bin Meng <[email protected]>

U-Boot v2020.07 release adds SPL support to SiFive HiFive Unleashed. Update the doc to mention that detailed build instructions are in the U-Boot doc.

This also adds detailed command line description to show how to boot U- Boot v2020.07 S-mode payload in the QEMU chapter.

---

Changes in v2:
- fix the typo in the doc

 docs/platform/sifive_fu540.md | 35 ++++++++++++++++++++++++++++++-
----
 1 file changed, 30 insertions(+), 5 deletions(-)
docs/platform/sifive_fu540.md +0 -0
index 9342846..1008432 100644
@@ -41,13 +41,14 @@ make PLATFORM=sifive/fu540

FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/bo
**U-Boot Payload**

The command-line example here assumes that U-Boot was compiled using
the -sifive_fu540_defconfig configuration and with U-Boot v2020.01 (or higher).

docs/platform/sifive_fu540.md +2 -2
-
-The detailed U-Boot booting guide is avaialble at [U-Boot].
+sifive_fu540_defconfig configuration and with U-Boot v2020.01, and up
+to v2020.07-rc3.
 
 ```
 make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=<u-boot_build_dir>/u-

boot-dtb.bin
```

docs/platform/sifive_fu540.md +2 -0
+For U-Boot v2020.07-rc4 or later releases, SPL support was added in U-Boot.
+Please refer to the detailed U-Boot booting guide available at [U-Boot].
 
 Flashing the OpenSBI firmware binary to storage media:
 ------------------------------------------------------
@@ -155,13 +156,37 @@ Linux kernel.
 When U-Boot v2020.01 (or higher) is used as the payload, as the SiFive FU540

DTB for the real hardware is embedded in U-Boot binary itself, due to the same reason above, we need to switch the U-Boot sifive_fu540_defconfig configuration -from CONFIG_OF_SEPARATE to CONFIG_OF_PRIOR_STAGE so that U-Boot uses the DTB -generated by QEMU, and u-boot.bin should be used as the payload image, like:
+from **CONFIG_OF_SEPARATE** to **CONFIG_OF_PRIOR_STAGE** so that U-Boot
+uses the DTB generated by QEMU, and u-boot.bin should be used as the payload image, like:

 ```
 make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=<u-boot_build_dir>/u-
boot.bin
 ```
docs/platform/sifive_fu540.md +2 -0
+U-Boot v2020.07 release added SPL support to SiFive HiFive Unleashed
+board, hence a build error will be seen after you switch to

**CONFIG_OF_PRIOR_STAGE**.

docs/platform/sifive_fu540.md +10 -0
+
+```
+./tools/mkimage: Can't open arch/riscv/dts/hifive-unleashed-a00.dtb: No
+such file or directory
+./tools/mkimage: failed to build FIT
+Makefile:1402: recipe for target 'u-boot.img' failed
+make: *** [u-boot.img] Error 1
+```
+
+The above errors can be safely ignored as we don't run U-Boot SPL under

QEMU.

docs/platform/sifive_fu540.md +13 -0
+
+Run:
+```
+qemu-system-riscv64 -M sifive_u -m 256M -nographic \
+	-bios build/platform/sifive/fu540/firmware/fw_payload.bin
+```
+or
+```
+qemu-system-riscv64 -M sifive_u -m 256M -nographic \
+	-bios build/platform/sifive/fu540/firmware/fw_jump.bin \
+	-kernel <uboot_build_dir>/u-boot.bin
+```
+
 While the real hardware operates at the 64-bit mode, it's possible for QEMU

to test the 32-bit OpenSBI firmware. This can be helpful for testing 32-bit SiFive specific drivers.
--
2.7.4

Quoted 4 lines

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Applied
#5 lore raw

PATCH v2 1/3 docs/platform: Update QEMU parameter for fw_payload

In reply to Bin Meng
Quoted 117 lines

-----Original Message-----
From: opensbi <[email protected]> On Behalf Of Bin Meng
Sent: 26 June 2020 06:56
To: Atish Patra <[email protected]>; opensbi at lists.infradead.org
Cc: Bin Meng <[email protected]>
Subject: [PATCH v2 1/3] docs/platform: Update QEMU parameter for fw_payload

From: Bin Meng <[email protected]>

Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU.

---

(no changes since v1)

 docs/platform/qemu_virt.md | 12 ++++++------
 docs/platform/spike.md     |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
docs/platform/qemu_virt.md +1 -1
index 2196e5a..2777148 100644
@@ -28,7 +28,7 @@ make PLATFORM=generic
 Run:
 ```
 qemu-system-riscv64 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.bin
+	-bios build/platform/generic/firmware/fw_payload.bin
 ```
 
 **U-Boot Payload**
@@ -44,7 +44,7 @@ make PLATFORM=generic

FW_PAYLOAD_PATH=<uboot_build_directory>/u-boot.bin
Run:
```
qemu-system-riscv64 -M virt -m 256M -nographic \

docs/platform/qemu_virt.md +1 -1
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 or
 ```
@@ -66,7 +66,7 @@ make PLATFORM=generic

FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Im
Run:
```
qemu-system-riscv64 -M virt -m 256M -nographic \

docs/platform/qemu_virt.md +2 -2
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
 	-device virtio-blk-device,drive=hd0 \
 	-append "root=/dev/vda rw console=ttyS0"
@@ -95,7 +95,7 @@ make PLATFORM=generic PLATFORM_RISCV_XLEN=32
 Run:
 ```
 qemu-system-riscv32 -M virt -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.bin
+	-bios build/platform/generic/firmware/fw_payload.bin
 ```
 
 **U-Boot Payload**
@@ -111,7 +111,7 @@ make PLATFORM=generic

PLATFORM_RISCV_XLEN=32 FW_PAYLOAD_PATH=<uboot_build_direct
Run:
```
qemu-system-riscv32 -M virt -m 256M -nographic \

docs/platform/qemu_virt.md +1 -1
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 or
 ```
@@ -133,7 +133,7 @@ make PLATFORM=generic

PLATFORM_RISCV_XLEN=32 FW_PAYLOAD_PATH=<linux_build_direct
Run:
```
qemu-system-riscv32 -M virt -m 256M -nographic \

docs/platform/qemu_virt.md +1 -1
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
 	-device virtio-blk-device,drive=hd0 \
 	-append "root=/dev/vda rw console=ttyS0"
docs/platform/spike.md index renamed from docs/platform/spike.md +0 -0

8d6b422..79e2eb2 100644

docs/platform/spike.md +1 -1
@@ -59,7 +59,7 @@ make PLATFORM=generic
 Run:
 ```
 qemu-system-riscv64 -M spike -m 256M -nographic \
-	-kernel build/platform/generic/firmware/fw_payload.elf
+	-bios build/platform/generic/firmware/fw_payload.elf
 ```
 
 **Linux Kernel Payload**
@@ -75,7 +75,7 @@ make PLATFORM=generic

FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Im
Run:
```
qemu-system-riscv64 -M spike -m 256M -nographic \

docs/platform/spike.md +1 -2
-	-kernel build/platform/generic/firmware/fw_payload.elf \
+	-bios build/platform/generic/firmware/fw_payload.elf \
 	-initrd <path_to_cpio_ramdisk> \
 	-append "root=/dev/ram rw console=hvc0 earlycon=sbi"
 ```
--

2.7.4

Quoted 4 lines

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup