Skip to contentSkip to conversation

qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

PATCH New David Abdurachmanov 4 participants 10 messages Aug 21, 2019 – Feb 4, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

---
 configs/qemu-riscv64_smode_defconfig | 2 ++
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu-riscv64_smode_defconfig +2 -0
index 74743a5ebe..2e1f7fa91f 100644
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
include/configs/sifive-fu540.h +0 -4
index 858b7a7da1..ba4aa0652c 100644
@@ -40,8 +40,4 @@
 	"ramdisk_addr_r=0x88300000\0" \
 	BOOTENV
 
-#define CONFIG_PREBOOT \
-	"setenv fdt_addr ${fdtcontroladdr};" \
-	"fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Hi David,

Quoted 4 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

I think you need add a "Reported-By" tag instead of writing this in the commit message.

And a "Fixes: commit-id ("commit title") format as well.

Please describe the commit title using something like:

riscv: fix extlinux (define preboot)

as it impacts more than one target.

Quoted 7 lines

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

---
 configs/qemu-riscv64_smode_defconfig | 2 ++

What about other QEMU RISC-V targets?

Quoted 9 lines
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu-riscv64_smode_defconfig +0 -0
index 74743a5ebe..2e1f7fa91f 100644

configs/qemu-riscv64_smode_defconfig CONFIG_DISPLAY_CPUINFO=y · line 13

Quoted 5 lines
configs/qemu-riscv64_smode_defconfig +2 -0
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"

Please insert the config option to the correct place, eg: you can run it like this:

$ make savedefconfig
$ cp defconfig configs/qemu-riscv64_smode_defconfig
Quoted 15 lines
configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
include/configs/sifive-fu540.h +0 -0
index 858b7a7da1..ba4aa0652c 100644

include/configs/sifive-fu540.h

Quoted 9 lines
include/configs/sifive-fu540.h +0 -5
@@ -40,8 +40,4 @@
        "ramdisk_addr_r=0x88300000\0" \
        BOOTENV
 
-#define CONFIG_PREBOOT \
-       "setenv fdt_addr ${fdtcontroladdr};" \
-       "fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */
--

Regards,
Bin

#2 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Quoted 6 lines · Bin Meng

Hi David,

Quoted 1 line · David Abdurachmanov
Quoted 6 lines
Quoted 3 lines

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

I think you need add a "Reported-By" tag instead of writing this in the commit message.

Yes. I rushed to send the patch. There should also be Tested-By from him.

Quoted 2 lines

And a "Fixes: commit-id ("commit title") format as well.

Okay. Basically same as for kernel patches.

Quoted 6 lines

Please describe the commit title using something like:

riscv: fix extlinux (define preboot)

as it impacts more than one target.

I can only test two targets.
That's also the main (only?) used targets by Fedora/RISCV users. I don't want to modify targets that I (or users) can test.

Quoted 10 lines
Quoted 8 lines

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

---
 configs/qemu-riscv64_smode_defconfig | 2 ++

What about other QEMU RISC-V targets?

That's the only two targets which I can test.
Also the only two targets that had this enabled.

Quoted 19 lines
Quoted 10 lines
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu-riscv64_smode_defconfig +0 -0
index 74743a5ebe..2e1f7fa91f 100644

configs/qemu-riscv64_smode_defconfig CONFIG_DISPLAY_CPUINFO=y · line 13

Quoted 5 lines
configs/qemu-riscv64_smode_defconfig +2 -0
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"

Please insert the config option to the correct place, eg: you can run it like this:

Quoted 2 lines
$ make savedefconfig
$ cp defconfig configs/qemu-riscv64_smode_defconfig

Will do.

Quoted 28 lines
Quoted 16 lines
configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
include/configs/sifive-fu540.h +0 -0
index 858b7a7da1..ba4aa0652c 100644

include/configs/sifive-fu540.h

Quoted 9 lines
include/configs/sifive-fu540.h +0 -5
@@ -40,8 +40,4 @@
        "ramdisk_addr_r=0x88300000\0" \
        BOOTENV
 
-#define CONFIG_PREBOOT \
-       "setenv fdt_addr ${fdtcontroladdr};" \
-       "fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */
--

Regards,
Bin

#3 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

In reply to David Abdurachmanov
Quoted 44 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

---
 configs/qemu-riscv64_smode_defconfig | 2 ++
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu- renamed from configs/qemu-riscv64_smode_defconfig +0 -0

riscv64_smode_defconfig
index 74743a5ebe..2e1f7fa91f 100644

configs/qemu-riscv64_smode_defconfig +2 -0
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr

${fdtcontroladdr};"

configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr

${fdtcontroladdr};"

include/configs/sifive- renamed from include/configs/sifive-fu540.h +0 -0

fu540.h
index 858b7a7da1..ba4aa0652c 100644

include/configs/sifive-fu540.h line 46

Quoted 7 lines
include/configs/sifive-fu540.h +0 -4
@@ -40,8 +40,4 @@
 	"ramdisk_addr_r=0x88300000\0" \
 	BOOTENV
 
-#define CONFIG_PREBOOT \
-	"setenv fdt_addr ${fdtcontroladdr};" \
-	"fdt addr ${fdtcontroladdr};"
-

As per the README, fdt_addr should be flash location. Why it was done in the first place ?

Additionally, fdtcontroladdr is set what gdt->fdt_blob is set. On latest U-boot in HiFive Unleashed, it is set to 0xff76e470. Not sure the reasong. May be after relocation ?

However, 5.3 kernel possibly ovewriting that address resulting in boot failures. Using fdt_addr_r works fine though.

As per following patch, we should do a tftpboot dtb to fdt_addr_r or just using fdt_addr_r will also work as fdt_addr_r is set to the address where OpenSBI keeps the DT.

Quoted 1 line
include/configs/sifive-fu540.h +0 -0
 #endif /* __CONFIG_H */
Signature · 2 lines
Regards,
Atish
#4 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

In reply to David Abdurachmanov
Quoted 6 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

live well,
vagrant

Quoted 32 lines
---
 configs/qemu-riscv64_smode_defconfig | 2 ++
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu-riscv64_smode_defconfig +2 -0
index 74743a5ebe..2e1f7fa91f 100644
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
include/configs/sifive-fu540.h +0 -0
index 858b7a7da1..ba4aa0652c 100644

include/configs/sifive-fu540.h line 43

Quoted 8 lines
include/configs/sifive-fu540.h +0 -4
@@ -40,8 +40,4 @@
 	"ramdisk_addr_r=0x88300000\0" \
 	BOOTENV
 
-#define CONFIG_PREBOOT \
-	"setenv fdt_addr ${fdtcontroladdr};" \
-	"fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190925/74669c55/attachment.sig>

#5 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Quoted 5 lines · Vagrant Cascadian
Quoted 4 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

Quoted 8 lines
Quoted 2 lines

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

This patch, or something like it, is still needed with u-boot v2020.01-rc5 for extlinux support to load the device-tree from the boot firmware.

Is there a new approach in the works, or any chance to see something like this get merged soon?

Thanks!

live well,
vagrant

Quoted 35 lines
Quoted 35 lines
---
 configs/qemu-riscv64_smode_defconfig | 2 ++
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)
configs/qemu-riscv64_smode_defconfig +2 -0
index 74743a5ebe..2e1f7fa91f 100644
@@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
configs/sifive_fu540_defconfig +2 -0
index 48865e5f11..a852579309 100644
@@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
include/configs/sifive-fu540.h +0 -0
index 858b7a7da1..ba4aa0652c 100644
@@ -40,8 +40,4 @@
 	"ramdisk_addr_r=0x88300000\0" \
 	BOOTENV
 
Quoted 5 lines

include/configs/sifive-fu540.h line 43

Quoted 5 lines
include/configs/sifive-fu540.h +0 -4
-#define CONFIG_PREBOOT \
-	"setenv fdt_addr ${fdtcontroladdr};" \
-	"fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191217/651713fc/attachment.sig>

#6 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Quoted 14 lines · Vagrant Cascadian
Quoted 12 lines · Vagrant Cascadian
Quoted 6 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

Quoted 8 lines
Quoted 1 line

This patch, or something like it, is still needed with u-boot v2020.01-rc5 for extlinux support to load the device-tree from the boot firmware.

Is there a new approach in the works, or any chance to see something like this get merged soon?

I do carry several experiment patches in Fedora/RISCV, which I didn't yet sent for a review.
Basically that allows me to boot a single Fedora/RISCV disk image on QEMU virt machine
and SiFive Unleashed.

See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36

Note some of the patches were merged in rc5.

You would want the following two patches:
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

If you could review them I could send them out.

david

#7 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Quoted 30 lines · David Abdurachmanov
Quoted 14 lines · Vagrant Cascadian
Quoted 12 lines · Vagrant Cascadian
Quoted 6 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

Quoted 8 lines
Quoted 1 line

This patch, or something like it, is still needed with u-boot v2020.01-rc5 for extlinux support to load the device-tree from the boot firmware.

Is there a new approach in the works, or any chance to see something like this get merged soon?

I do carry several experiment patches in Fedora/RISCV, which I didn't yet sent for a review.
Basically that allows me to boot a single Fedora/RISCV disk image on QEMU virt machine
and SiFive Unleashed.

Quoted 3 lines

See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36

Note some of the patches were merged in rc5.

Thanks! I'll give your patches some testing when I get a chance.

Some potentially quite naive questions:

Quoted 2 lines

You would want the following two patches:
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch

Why does it need fdt_addr=0x88000000 need to be set (and to the same value as fdt_addr_r)? According to README fdt_addr is for the flash media, which I don't think is used in the qemu case, at least. Is fdt_addr being (ab)used for some other purpose? I guess the README also gives free reign to use the variables for other purposes... but it would be good to know why that is needed vs. just using fdt_addr_r as documented.

Quoted 1 line

http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"

What does cp.l do?

Do you need to force setting the console in CONFIG_BOOTARGS? It seemed to autodetect the console on the installations I have running, possibly getting the chosen console from device-tree?

live well,
vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191218/1acaeeea/attachment.sig>

#8 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Quoted 44 lines · Vagrant Cascadian
Quoted 30 lines · David Abdurachmanov
Quoted 14 lines · Vagrant Cascadian
Quoted 12 lines · Vagrant Cascadian
Quoted 6 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

Quoted 8 lines
Quoted 1 line

This patch, or something like it, is still needed with u-boot v2020.01-rc5 for extlinux support to load the device-tree from the boot firmware.

Is there a new approach in the works, or any chance to see something like this get merged soon?

I do carry several experiment patches in Fedora/RISCV, which I didn't yet sent for a review.
Basically that allows me to boot a single Fedora/RISCV disk image on QEMU virt machine
and SiFive Unleashed.

Quoted 3 lines

See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36

Note some of the patches were merged in rc5.

Thanks! I'll give your patches some testing when I get a chance.

Some potentially quite naive questions:

Quoted 2 lines

You would want the following two patches:
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch

Quoted 7 lines

Why does it need fdt_addr=0x88000000 need to be set (and to the same value as fdt_addr_r)? According to README fdt_addr is for the flash media, which I don't think is used in the qemu case, at least. Is fdt_addr being (ab)used for some other purpose? I guess the README also gives free reign to use the variables for other purposes... but it would be good to know why that is needed vs. just using fdt_addr_r as documented.

The comments in uboot-tools.spec explain it.
This is only needed if you use EXTLINUX to boot your image. IIRC EXTLINUX will assume DTB blob is available at fdt_addr or you can load one via fdt/fdtdir label in extlinux.conf (never tried).
If you are booting in some other way you probably don't care about it.

Quoted 5 lines
Quoted 3 lines

http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"

This used to solve memory corruption for DTB in v5.3 kernel IIRC. That was fixed in v5.4 kernel thus should be removed (I will test later).

Quoted 6 lines

What does cp.l do?

Do you need to force setting the console in CONFIG_BOOTARGS? It seemed to autodetect the console on the installations I have running, possibly getting the chosen console from device-tree?

It doesn't detect it for me. Well it does on QEMU, but not on SiFive Unleashed. Both use different console (ttyS0 vs ttySIF0). I think the kernel doesn't look into chosen console expect powerpc IIRC.

I can retest since this was added:
https://github.com/torvalds/linux/commit/2993c9b04e616df0848b655d7202a707a70fc876

I am updating kernel in Fedora/RISCV to 5.5-rc2 now thus I can re-check various patches again.

david

Quoted 4 lines

live well,
vagrant

#9 lore raw

PATCH 1/1 qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Hi,

Quoted 80 lines · David Abdurachmanov
Quoted 44 lines · Vagrant Cascadian
Quoted 30 lines · David Abdurachmanov
Quoted 14 lines · Vagrant Cascadian
Quoted 12 lines · Vagrant Cascadian
Quoted 6 lines · David Abdurachmanov

Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot commands in RISC-V targets and broke extlinux support as reported by Fu Wei <[email protected]>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

Quoted 8 lines
Quoted 1 line

This patch, or something like it, is still needed with u-boot v2020.01-rc5 for extlinux support to load the device-tree from the boot firmware.

Is there a new approach in the works, or any chance to see something like this get merged soon?

I do carry several experiment patches in Fedora/RISCV, which I didn't yet sent for a review.
Basically that allows me to boot a single Fedora/RISCV disk image on QEMU virt machine
and SiFive Unleashed.

Quoted 3 lines

See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36

Note some of the patches were merged in rc5.

Thanks! I'll give your patches some testing when I get a chance.

Some potentially quite naive questions:

Quoted 2 lines

You would want the following two patches:
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch

Quoted 7 lines

Why does it need fdt_addr=0x88000000 need to be set (and to the same value as fdt_addr_r)? According to README fdt_addr is for the flash media, which I don't think is used in the qemu case, at least. Is fdt_addr being (ab)used for some other purpose? I guess the README also gives free reign to use the variables for other purposes... but it would be good to know why that is needed vs. just using fdt_addr_r as documented.

The comments in uboot-tools.spec explain it.
This is only needed if you use EXTLINUX to boot your image. IIRC EXTLINUX will assume DTB blob is available at fdt_addr or you can load one via fdt/fdtdir label in extlinux.conf (never tried).
If you are booting in some other way you probably don't care about it.

Quoted 5 lines
Quoted 3 lines

http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"

This used to solve memory corruption for DTB in v5.3 kernel IIRC. That was fixed in v5.4 kernel thus should be removed (I will test later).

Quoted 6 lines

What does cp.l do?

Do you need to force setting the console in CONFIG_BOOTARGS? It seemed to autodetect the console on the installations I have running, possibly getting the chosen console from device-tree?

It doesn't detect it for me. Well it does on QEMU, but not on SiFive Unleashed. Both use different console (ttyS0 vs ttySIF0). I think the kernel doesn't look into chosen console expect powerpc IIRC.

Quoted 6 lines

I can retest since this was added:
https://github.com/torvalds/linux/commit/2993c9b04e616df0848b655d7202a707a70fc876

I am updating kernel in Fedora/RISCV to 5.5-rc2 now thus I can re-check various patches again.

What's the status of this patch?

Regards,
Bin