Skip to contentSkip to conversation

Add board support for Star64

PATCH In review Thomas Bonnefille via buildroot 1 participant 5 messages Apr 3, 2024 – May 1, 2024

lore
Share & tools
lore
#0 lore raw

cover Add board support for Star64

This patch series adds all the requirement to build an image for the Star64 board made by Pine64.

As there is currently no proper support for this board in the mainline U-Boot, I used a custom U-Boot and a software given by Starfive (the SoC vendor) to add headers to the SPL.

This defconfig generates an SD card image running Linux using an extlinux.conf.

Thomas Bonnefille (2):
package/starfive_spltool: new package
configs/pine64-star64: new defconfig

 DEVELOPERS                                    |  5 +++
 board/pine64/star64/genimage.cfg              | 24 +++++++++++++
 .../overlay/boot/extlinux/extlinux.conf       |  4 +++
 board/pine64/star64/post-build.sh             |  9 +++++
 board/pine64/star64/readme.txt                | 32 +++++++++++++++++
 .../pine64/star64/star64-uboot-fit-image.its  | 29 +++++++++++++++
 configs/pine64_star64_defconfig               | 36 +++++++++++++++++++
 package/Config.in.host                        |  1 +
 package/starfive-spltool/Config.in.host       |  7 ++++
 .../starfive-spltool.hash                     |  2 ++
 package/starfive-spltool/starfive-spltool.mk  | 20 +++++++++++
 11 files changed, 169 insertions(+)
 create mode 100644 board/pine64/star64/genimage.cfg
 create mode 100644 board/pine64/star64/overlay/boot/extlinux/extlinux.conf
 create mode 100755 board/pine64/star64/post-build.sh
 create mode 100644 board/pine64/star64/readme.txt
 create mode 100644 board/pine64/star64/star64-uboot-fit-image.its
 create mode 100644 configs/pine64_star64_defconfig
 create mode 100644 package/starfive-spltool/Config.in.host
 create mode 100644 package/starfive-spltool/JH7110_VF2_515_v5.11.3/starfive-spltool.hash
 create mode 100644 package/starfive-spltool/starfive-spltool.mk

--
2.44.0

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

#1 lore raw

PATCH 1/2 package/starfive_spltool: new package

This patch adds a new package for the Starfive SPL tool. It is used to add header to the Secondary Program Loader for board based on the Starfive JH7110 SoC.

---
 DEVELOPERS                                    |  3 +++
 package/Config.in.host                        |  1 +
 package/starfive-spltool/Config.in.host       |  8 ++++++++
 .../starfive-spltool.hash                     |  2 ++
 package/starfive-spltool/starfive-spltool.mk  | 20 +++++++++++++++++++
 5 files changed, 34 insertions(+)
 create mode 100644 package/starfive-spltool/Config.in.host
 create mode 100644 package/starfive-spltool/JH7110_VF2_515_v5.11.3/starfive-spltool.hash
 create mode 100644 package/starfive-spltool/starfive-spltool.mk
DEVELOPERS +3 -0
index 6b38db0857..b8ec27f623 100644
@@ -2953,6 +2953,9 @@ N:	Thijs Vermeir <[email protected]>
 F:	package/ranger/
 F:	package/x265/
 
+N:	Thomas Bonnefille <[email protected]>
+F:	package/starfive-spltool/
+
 N:	Thomas Claveirole <[email protected]>
 F:	package/fcgiwrap/
 F:	package/openlayers/
package/Config.in.host +1 -0
index 9543a22ffc..986b2854d0 100644
@@ -107,6 +107,7 @@ menu "Host utilities"
 	source "package/sentry-cli/Config.in.host"
 	source "package/sloci-image/Config.in.host"
 	source "package/squashfs/Config.in.host"
+	source "package/starfive-spltool/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/swig/Config.in.host"
 	source "package/swugenerator/Config.in.host"
package/starfive-spltool/Config.in.host new file +8 -0
new file mode 100644
index 0000000000..afb2777ca6
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_STARFIVE_SPLTOOL
+	bool "host starfive-spltool"
+	depends on BR2_riscv
+	help
+	  Add header to the Secondary Program Loader with the 3rd party
+	  software given by Starfive-Tech for their SoCs.
+
+	  https://github.com/starfive-tech/soft_3rdpart/tree/JH7110_VisionFive2_devel/spl_tool
package/starfive-spltool/JH7110_VF2_515_v5.11.3/starfive-spltool.hash new file +2 -0
new file mode 100644
index 0000000000..55835de310
@@ -0,0 +1,2 @@
+# Locally computed
+sha256  f5466225021fbe4e983cc85f32ce11d92ad30689b18e0d1390d16f6bfab74477  starfive-spltool-JH7110_VF2_515_v5.11.3.tar.gz
package/starfive-spltool/starfive-spltool.mk new file +20 -0
new file mode 100644
index 0000000000..559df35074
@@ -0,0 +1,20 @@
+################################################################################
+#
+# starfive-spltool
+#
+################################################################################
+
+STARFIVE_SPLTOOL_VERSION = JH7110_VF2_515_v5.11.3
+STARFIVE_SPLTOOL_SITE = $(call github,starfive-tech,soft_3rdpart,$(STARFIVE_SPLTOOL_VERSION))
+STARFIVE_SPLTOOL_LICENSE = GPL-2.0+
+STARFIVE_SPLTOOL_FILES = spl_tool/LICENSE
+
+define HOST_STARFIVE_SPLTOOL_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D)/spl_tool
+endef
+
+define HOST_STARFIVE_SPLTOOL_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/spl_tool/spl_tool $(HOST_DIR)/bin/spl_tool
+endef
+
+$(eval $(host-generic-package))
Signature · 6 lines
2.44.0

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

Re: [Buildroot] [PATCH 1/2] package/starfive_spltool: new package

Quoted 5 lines · On Wed, 3 Apr 2024 11:14:39 +0200 Thomas Bonnefille via buildroot…

This patch adds a new package for the Starfive SPL tool. It is used to add header to the Secondary Program Loader for board based on the Starfive JH7110 SoC.

Quoted 10 lines
---
 DEVELOPERS                                    |  3 +++
 package/Config.in.host                        |  1 +
 package/starfive-spltool/Config.in.host       |  8 ++++++++
 .../starfive-spltool.hash                     |  2 ++
 package/starfive-spltool/starfive-spltool.mk  | 20 +++++++++++++++++++
 5 files changed, 34 insertions(+)
 create mode 100644 package/starfive-spltool/Config.in.host
 create mode 100644 package/starfive-spltool/JH7110_VF2_515_v5.11.3/starfive-spltool.hash
 create mode 100644 package/starfive-spltool/starfive-spltool.mk

Thanks, I've applied to master after:

- fixing the commit title starfive_spltool -> starfive-spltool

- moving the .hash file directly under package/starfive-spltool/, using a versioned directory is only useful for packages for which multiple versions are supported, which is not the case here

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH 2/2 configs/pine64-star64: new defconfig

In reply to Thomas Bonnefille via buildroot

This patch adds a new defconfig for the Star64 board made by Pine64. This board is based on the Starfive JH7110 RISC-V 64 bits SoC.
https://wiki.pine64.org/wiki/STAR64
This patch uses a custom Kernel and U-Boot made for this board. The SPL has to be signed with the Starfive SPL-Tool which is a software provided by the vendor to get the necessary headers on the SPL. The image configuration is based on the work done by Ivan Velickovic <[email protected]>.

---
 DEVELOPERS                                    |  2 ++
 board/pine64/star64/genimage.cfg              | 24 +++++++++++++
 .../overlay/boot/extlinux/extlinux.conf       |  4 +++
 board/pine64/star64/post-build.sh             |  9 +++++
 board/pine64/star64/readme.txt                | 32 +++++++++++++++++
 .../pine64/star64/star64-uboot-fit-image.its  | 29 +++++++++++++++
 configs/pine64_star64_defconfig               | 36 +++++++++++++++++++
 7 files changed, 136 insertions(+)
 create mode 100644 board/pine64/star64/genimage.cfg
 create mode 100644 board/pine64/star64/overlay/boot/extlinux/extlinux.conf
 create mode 100755 board/pine64/star64/post-build.sh
 create mode 100644 board/pine64/star64/readme.txt
 create mode 100644 board/pine64/star64/star64-uboot-fit-image.its
 create mode 100644 configs/pine64_star64_defconfig
DEVELOPERS +2 -0
index b8ec27f623..947aa58566 100644
@@ -2954,6 +2954,8 @@ F:	package/ranger/
 F:	package/x265/
 
 N:	Thomas Bonnefille <[email protected]>
+F:	board/pine64/star64
+F:	configs/pine64_star64_defconfig
 F:	package/starfive-spltool/
 
 N:	Thomas Claveirole <[email protected]>
board/pine64/star64/genimage.cfg new file +24 -0
new file mode 100644
index 0000000000..74940016f4
@@ -0,0 +1,24 @@
+# SD card image for the Pine64 Star64 board
+
+image sdcard.img {
+        hdimage {
+                partition-table-type = "gpt"
+        }
+
+        partition spl {
+                image = "u-boot-spl.bin.normal.out"
+                partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985
+                offset = 2M
+        }
+
+        partition uboot {
+                image = "opensbi_uboot_payload.img"
+                partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47
+                offset = 4M
+        }
+
+        partition rootfs {
+                image = "rootfs.ext4"
+                bootable = true
+        }
+}
board/pine64/star64/overlay/boot/extlinux/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..db7cfb7b8b
@@ -0,0 +1,4 @@
+label star64
+  kernel /boot/Image
+  devicetree /boot/jh7110-pine64-star64.dtb
+  append root=/dev/mmcblk1p3 earlycon=sbi
board/pine64/star64/post-build.sh new file +9 -0
new file mode 100755
index 0000000000..ed0a6ebd52
@@ -0,0 +1,9 @@
+#!/bin/bash
+BOARD_DIR="$CONFIG_DIR"/board/pine64/star64
+
+# Add header to the SPL
+"$HOST_DIR"/bin/spl_tool -c -f "$BINARIES_DIR"/u-boot-spl.bin
+
+# Create the u-boot FIT image
+cp "$BOARD_DIR"/star64-uboot-fit-image.its "$BINARIES_DIR"
+mkimage -f "$BINARIES_DIR"/star64-uboot-fit-image.its -A riscv -O u-boot -T firmware "$BINARIES_DIR"/opensbi_uboot_payload.img
board/pine64/star64/readme.txt new file +32 -0
new file mode 100644
index 0000000000..5e6ce25108
@@ -0,0 +1,32 @@
+Pine64 Star64
+=============
+
+The Star64 is a low-cost RISC-V 64-bit based platform, powered by a
+Starfive JH7110 processor.
+
+https://wiki.pine64.org/wiki/STAR64
+
+How to build
+============
+
+$ make pine64_star64_defconfig
+$ make
+
+How to write the SD card
+========================
+
+Once the build process is finished you will have an image called "sdcard.img"
+in the output/images/ directory.
+
+Copy the bootable "sdcard.img" onto an SD card with "dd":
+
+  $ sudo dd if=output/images/sdcard.img of=/dev/sdX conv=fdatasync
+
+Preparing the board
+===================
+
+Connect a TTL UART cable to pin 6 (GND), 8 (TX) and 10 (RX).
+
+Insert your SD card.
+
+Power-up the board using a 12V power supply.
board/pine64/star64/star64-uboot-fit-image.its new file +29 -0
new file mode 100644
index 0000000000..08f603163a
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/ {
+	description = "U-boot-spl FIT image for JH7110 Pine64 Star64";
+	#address-cells = <2>;
+
+	images {
+		firmware {
+			description = "u-boot";
+			data = /incbin/("fw_payload.bin");
+			type = "firmware";
+			arch = "riscv";
+			os = "u-boot";
+			load = <0x0 0x40000000>;
+			entry = <0x0 0x40000000>;
+			compression = "none";
+		};
+	};
+
+	configurations {
+		default = "config-1";
+
+		config-1 {
+			description = "U-boot-spl FIT config for JH7110 Pine64 Star64";
+			firmware = "firmware";
+		};
+	};
+};
+
configs/pine64_star64_defconfig new file +36 -0
new file mode 100644
index 0000000000..5d5eec508c
@@ -0,0 +1,36 @@
+BR2_riscv=y
+
+# Kernel configuration
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,Fishwaldo,Star64_linux,1456c984f15e21e28fb8a9ce96d0ca10e61a71c4)/linux-1456c984f15e21e28fb8a9ce96d0ca10e61a71c4.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="pine64_star64"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="starfive/jh7110-pine64-star64"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+
+# OpenSBI configuration
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_OPENSBI_PLAT="generic"
+
+# U-Boot configuration
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,Fishwaldo,u-boot,172b47f62039605d6806fa96bd403c21cda28996)/u-boot-172b47f62039605d6806fa96bd403c21cda28996.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="pine64_star64"
+BR2_TARGET_UBOOT_SPL=y
+
+# Misc
+BR2_ROOTFS_OVERLAY="board/pine64/star64/overlay/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
+BR2_PACKAGE_HOST_STARFIVE_SPLTOOL=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="100M"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pine64/star64/genimage.cfg"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/pine64/star64/post-build.sh"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 6 lines
2.44.0

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

Re: [Buildroot] [PATCH 2/2] configs/pine64-star64: new defconfig

Hello Thomas,

Quoted 10 lines · On Wed, 3 Apr 2024 11:14:40 +0200 Thomas Bonnefille via buildroot…

This patch adds a new defconfig for the Star64 board made by Pine64. This board is based on the Starfive JH7110 RISC-V 64 bits SoC.
https://wiki.pine64.org/wiki/STAR64
This patch uses a custom Kernel and U-Boot made for this board. The SPL has to be signed with the Starfive SPL-Tool which is a software provided by the vendor to get the necessary headers on the SPL. The image configuration is based on the work done by Ivan Velickovic <[email protected]>.

Thanks, I've applied after:

- adjusting the commit title pine64-star64 -> pine64_star64 (to match the name of the defconfig)

- adding the host-uboot-tools package with FIT support to the defconfig, so that it gets built. Otherwise the build fails at the end when the post-build script calls mkimage as mkimage is not available. Probably it was working on your machine because you had mkimage installed system-wide, but Buildroot shouldn't depend on this.

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot