Skip to contentSkip to conversation

board/visionfive2: enable u-boot

PATCH In review Lukasz Tekieli 2 participants 9 messages Feb 8, 2024 – Mar 25, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover board/visionfive2: enable u-boot

This series adds support for U-Boot deployment in SD card image.

Lukasz Tekieli (2):
board/visionfive2: fix genimage.cfg path
board/visionfive2: enable u-boot

 board/visionfive2/genimage.cfg | 16 +++++++++-------
 configs/visionfive2_defconfig  | 21 ++++++++++++++++++++-
 2 files changed, 29 insertions(+), 8 deletions(-)

--
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

PATCH v2 1/2 board/visionfive2: fix genimage.cfg path

Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.

---
Changes for v2:
- fix extracted to a separate commit

---
 configs/visionfive2_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/visionfive2_defconfig +1 -1
index dc086953a0..3a1a4f527c 100644
@@ -3,7 +3,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
 BR2_SYSTEM_DHCP="eth0"
 BR2_ROOTFS_OVERLAY="board/visionfive2/overlay"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
-BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/visionfive/genimage.cfg"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/visionfive2/genimage.cfg"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
 BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,linux,05533e9c31d6f0da20efc2d436a3b0f6d516ed4b)/linux-05533e9c31d6f0da20efc2d436a3b0f6d516ed4b.tar.gz"

--
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Re: [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Lukasz" == Lukasz Tekieli <[email protected]> writes:

Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.

---
Changes for v2:
- fix extracted to a separate commit

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Lukasz" == Lukasz Tekieli <[email protected]> writes:

Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.

---
Changes for v2:
- fix extracted to a separate commit

Committed, thanks.

Committed to 2024.02.x, 2023.02.x and 2023.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH v2 2/2 board/visionfive2: enable u-boot

In reply to Lukasz Tekieli

Enables U-Boot and required OpenSBI builds for the VisionFive2. Changes the sdcard.img to use GPT and adds the SPL and U-Boot to partitons specified in U-Boot's documentation for the board.

U-Boot config uses BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME with value "u-boot.itb". Using BR2_TARGET_UBOOT_FORMAT_ITB fails, because the build does not support u-boot.itb make target.

---
Changes for v2:
- added fixed U-Boot version
- added fixed OpenSBI version

---
 board/visionfive2/genimage.cfg | 16 +++++++++-------
 configs/visionfive2_defconfig  | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 7 deletions(-)
board/visionfive2/genimage.cfg +9 -7
index c221b49c7b..8133e740c0 100644
@@ -2,20 +2,22 @@
 
 image sdcard.img {
 	hdimage {
+		partition-table-type = "gpt"
 	}
 
-	# u-boot is hard coded to look at 3rd partition
-	partition dummy1 {
-		size = 512
+	partition spl {
+		partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985
+		image = "u-boot-spl.bin.normal.out"
 	}
 
-	partition dummy2 {
-		size = 512
+	partition uboot {
+		partition-type-uuid = BC13C2FF-59E6-4262-A352-B275FD6F7172
+		image = "u-boot.itb"
 	}
 
 	partition rootfs {
-		partition-type = 0x83
+		partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4
+		bootable = true
 		image = "rootfs.ext4"
-		bootable = "true"
 	}
 }
configs/visionfive2_defconfig +19 -0
index 3a1a4f527c..c8576a35a7 100644
@@ -15,4 +15,23 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 # BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_CUSTOM_VERSION=y
+BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE="1.4"
+BR2_TARGET_OPENSBI_PLAT="generic"
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES="FW_TEXT_START=0x40000000 FW_OPTIONS=0"
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.01"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_visionfive2"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
+BR2_TARGET_UBOOT_NEEDS_OPENSBI=y
+# BR2_TARGET_UBOOT_FORMAT_BIN is not set
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin.normal.out"
 BR2_PACKAGE_HOST_GENIMAGE=y

--
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Lukasz" == Lukasz Tekieli <[email protected]> writes:

Enables U-Boot and required OpenSBI builds for the VisionFive2. Changes the sdcard.img to use GPT and adds the SPL and U-Boot to partitons specified in U-Boot's documentation for the board.

Hmm, so to use that we need to change the boot mode to SD, otherwise the SBI/U-Boot in the SPI flash will still be used - So we should add a note about that.

I gave it a quick try here and it does boot, but USB is broken in U-Boot and Linux, is that a known issue?

[    8.728592] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.735301] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.743495] usb usb2-port2: couldn't allocate usb_device
[    8.748984] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.755660] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.763686] usb usb1-port1: couldn't allocate usb_device
Quoted 3 lines

U-Boot config uses BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME with value "u-boot.itb". Using BR2_TARGET_UBOOT_FORMAT_ITB fails, because the build does not support u-boot.itb make target.

Hmm, odd.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hello,

Quoted 4 lines · Peter Korsgaard

Hmm, so to use that we need to change the boot mode to SD, otherwise the SBI/U-Boot in the SPI flash will still be used - So we should add a note about that.

Yes, SD mode is required to use this. I have a patch that builds also the SPI flash image, but didn't submit yet.
I'll add a note in the board readme.

Quoted 9 lines

I gave it a quick try here and it does boot, but USB is broken in U-Boot and Linux, is that a known issue?

[    8.728592] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.735301] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.743495] usb usb2-port2: couldn't allocate usb_device
[    8.748984] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.755660] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.763686] usb usb1-port1: couldn't allocate usb_device

I've already fixed emac0 problems in upstream u-boot. I noticed that the changes between StarFive forks and upstream are quite extensive and they definately missed some parts.
I'll take a look at this.

Quoted 5 lines
Quoted 3 lines

U-Boot config uses BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME with value "u-boot.itb". Using BR2_TARGET_UBOOT_FORMAT_ITB fails, because the build does not support u-boot.itb make target.

Hmm, odd.

Yes, there are other boards that use this approach as well:

rock64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" andes_ae350_45_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" rockpro64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" pine64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" roc_pc_rk3399_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" friendlyarm_nanopi_r2s_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" pine64_sopine_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" hifive_unleashed_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"

Might be also worth fixing this in u-boot.

Thanks!

Signature · 5 lines
Łukasz Tekieli
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Łukasz" == Łukasz Tekieli <[email protected]> writes:

Hello,

Quoted 4 lines · Peter Korsgaard

Hmm, so to use that we need to change the boot mode to SD, otherwise the SBI/U-Boot in the SPI flash will still be used - So we should add a note about that.

Yes, SD mode is required to use this. I have a patch that builds also the SPI flash image, but didn't submit yet.
I'll add a note in the board readme.

Quoted 9 lines

I gave it a quick try here and it does boot, but USB is broken in U-Boot and Linux, is that a known issue?

[    8.728592] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.735301] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.743495] usb usb2-port2: couldn't allocate usb_device
[    8.748984] xhci_hcd 0000:01:00.0: Error while assigning device slot ID
[    8.755660] xhci_hcd 0000:01:00.0: Max number of devices this xHCI host supports is 32.
[    8.763686] usb usb1-port1: couldn't allocate usb_device
Quoted 4 lines

I've already fixed emac0 problems in upstream u-boot. I noticed that the changes between StarFive forks and upstream are quite extensive and they definately missed some parts.
I'll take a look at this.

Possibly we need to bump the Linux kernel. How is the mainline support situation by now? Ideally we would use mainline Linux as well.

Quoted 17 lines
Quoted 5 lines
Quoted 3 lines

U-Boot config uses BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME with value "u-boot.itb". Using BR2_TARGET_UBOOT_FORMAT_ITB fails, because the build does not support u-boot.itb make target.

Hmm, odd.

Yes, there are other boards that use this approach as well:

rock64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" andes_ae350_45_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" rockpro64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" pine64_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" roc_pc_rk3399_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" friendlyarm_nanopi_r2s_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" pine64_sopine_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" hifive_unleashed_defconfig:BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"

Quoted 1 line

Might be also worth fixing this in u-boot.

Possibly, yes - But we need to verify that it doesn't break the existing users:

git grep BR2_TARGET_UBOOT_FORMAT_ITB zynqmp_kria_kd240_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y zynqmp_kria_kr260_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y zynqmp_kria_kv260_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y zynqmp_zcu102_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y zynqmp_zcu104_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y zynqmp_zcu106_defconfig:BR2_TARGET_UBOOT_FORMAT_ITB=y

I finally ended up applying this patch after all, as it moves us in the right direction. I did the following changes:

- Added note about changing the boot mode pins in the board readme and linked to
https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/boot_mode_settings.html

- Added a link to the U-Boot documentation which describes the boot flow in the commit message

Thanks!

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Hello,

Quoted 2 lines · Peter Korsgaard

Possibly we need to bump the Linux kernel. How is the mainline support situation by now? Ideally we would use mainline Linux as well.

I had some success with the mainline kernel, but I had to apply the defconfig from the StarFive fork, otherwise I had troubles with the boot. It's still WIP.

Quoted 9 lines

I finally ended up applying this patch after all, as it moves us in the right direction. I did the following changes:

- Added note about changing the boot mode pins in the board readme and linked to
https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/boot_mode_settings.html

- Added a link to the U-Boot documentation which describes the boot flow in the commit message

Thank you!

Signature · 5 lines
Łukasz Tekieli
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot