All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/2] board/visionfive2: enable u-boot
@ 2024-02-08 21:15 Lukasz Tekieli
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path Lukasz Tekieli
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot Lukasz Tekieli
  0 siblings, 2 replies; 9+ messages in thread
From: Lukasz Tekieli @ 2024-02-08 21:15 UTC (permalink / raw)
  To: buildroot; +Cc: Lukasz Tekieli, Francois Dugast, Thomas Petazzoni

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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path
  2024-02-08 21:15 [Buildroot] [PATCH v2 0/2] board/visionfive2: enable u-boot Lukasz Tekieli
@ 2024-02-08 21:15 ` Lukasz Tekieli
  2024-03-23 20:22   ` Peter Korsgaard
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot Lukasz Tekieli
  1 sibling, 1 reply; 9+ messages in thread
From: Lukasz Tekieli @ 2024-02-08 21:15 UTC (permalink / raw)
  To: buildroot; +Cc: Lukasz Tekieli, Francois Dugast, Thomas Petazzoni

Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.

Signed-off-by: Lukasz Tekieli <tekieli.lukasz@gmail.com>
---
Changes for v2:
- fix extracted to a separate commit

---
 configs/visionfive2_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/visionfive2_defconfig b/configs/visionfive2_defconfig
index dc086953a0..3a1a4f527c 100644
--- a/configs/visionfive2_defconfig
+++ b/configs/visionfive2_defconfig
@@ -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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot
  2024-02-08 21:15 [Buildroot] [PATCH v2 0/2] board/visionfive2: enable u-boot Lukasz Tekieli
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path Lukasz Tekieli
@ 2024-02-08 21:15 ` Lukasz Tekieli
  2024-03-23 20:25   ` Peter Korsgaard
  1 sibling, 1 reply; 9+ messages in thread
From: Lukasz Tekieli @ 2024-02-08 21:15 UTC (permalink / raw)
  To: buildroot; +Cc: Lukasz Tekieli, Francois Dugast, Thomas Petazzoni

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.

Signed-off-by: Lukasz Tekieli <tekieli.lukasz@gmail.com>
---
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(-)

diff --git a/board/visionfive2/genimage.cfg b/board/visionfive2/genimage.cfg
index c221b49c7b..8133e740c0 100644
--- a/board/visionfive2/genimage.cfg
+++ b/board/visionfive2/genimage.cfg
@@ -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"
 	}
 }
diff --git a/configs/visionfive2_defconfig b/configs/visionfive2_defconfig
index 3a1a4f527c..c8576a35a7 100644
--- a/configs/visionfive2_defconfig
+++ b/configs/visionfive2_defconfig
@@ -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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path Lukasz Tekieli
@ 2024-03-23 20:22   ` Peter Korsgaard
  2024-03-25  7:57     ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2024-03-23 20:22 UTC (permalink / raw)
  To: Lukasz Tekieli; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

>>>>> "Lukasz" == Lukasz Tekieli <tekieli.lukasz@gmail.com> writes:

 > Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.
 > Signed-off-by: Lukasz Tekieli <tekieli.lukasz@gmail.com>
 > ---
 > Changes for v2:
 > - fix extracted to a separate commit

Committed, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot
  2024-02-08 21:15 ` [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot Lukasz Tekieli
@ 2024-03-23 20:25   ` Peter Korsgaard
  2024-03-24  7:35     ` Łukasz Tekieli
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2024-03-23 20:25 UTC (permalink / raw)
  To: Lukasz Tekieli; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

>>>>> "Lukasz" == Lukasz Tekieli <tekieli.lukasz@gmail.com> 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

 > 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.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot
  2024-03-23 20:25   ` Peter Korsgaard
@ 2024-03-24  7:35     ` Łukasz Tekieli
  2024-03-24  7:58       ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Łukasz Tekieli @ 2024-03-24  7:35 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

Hello,

On Sat, Mar 23, 2024 at 9:25 PM Peter Korsgaard <peter@korsgaard.com> wrote:
>
> 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.

> 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.

>  > 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!


-- 
Łukasz Tekieli
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot
  2024-03-24  7:35     ` Łukasz Tekieli
@ 2024-03-24  7:58       ` Peter Korsgaard
  2024-03-24  8:19         ` Łukasz Tekieli
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2024-03-24  7:58 UTC (permalink / raw)
  To: Łukasz Tekieli; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

>>>>> "Łukasz" == Łukasz Tekieli <tekieli.lukasz@gmail.com> writes:

 > Hello,
 > On Sat, Mar 23, 2024 at 9:25 PM Peter Korsgaard <peter@korsgaard.com> wrote:
 >> 
 >> 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.

 >> 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.

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

 >> > 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.

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!

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot
  2024-03-24  7:58       ` Peter Korsgaard
@ 2024-03-24  8:19         ` Łukasz Tekieli
  0 siblings, 0 replies; 9+ messages in thread
From: Łukasz Tekieli @ 2024-03-24  8:19 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

Hello,

On Sun, Mar 24, 2024 at 8:58 AM Peter Korsgaard <peter@korsgaard.com> wrote:

> 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.

> 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!



-- 
Łukasz Tekieli
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path
  2024-03-23 20:22   ` Peter Korsgaard
@ 2024-03-25  7:57     ` Peter Korsgaard
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2024-03-25  7:57 UTC (permalink / raw)
  To: Lukasz Tekieli; +Cc: Francois Dugast, Thomas Petazzoni, buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>> "Lukasz" == Lukasz Tekieli <tekieli.lukasz@gmail.com> writes:
 >> Set correct directory for the BR2_ROOTFS_POST_SCRIPT_ARGS.
 >> Signed-off-by: Lukasz Tekieli <tekieli.lukasz@gmail.com>
 >> ---
 >> Changes for v2:
 >> - fix extracted to a separate commit

 > Committed, thanks.

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

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-25  7:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 21:15 [Buildroot] [PATCH v2 0/2] board/visionfive2: enable u-boot Lukasz Tekieli
2024-02-08 21:15 ` [Buildroot] [PATCH v2 1/2] board/visionfive2: fix genimage.cfg path Lukasz Tekieli
2024-03-23 20:22   ` Peter Korsgaard
2024-03-25  7:57     ` Peter Korsgaard
2024-02-08 21:15 ` [Buildroot] [PATCH v2 2/2] board/visionfive2: enable u-boot Lukasz Tekieli
2024-03-23 20:25   ` Peter Korsgaard
2024-03-24  7:35     ` Łukasz Tekieli
2024-03-24  7:58       ` Peter Korsgaard
2024-03-24  8:19         ` Łukasz Tekieli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.