Skip to contentSkip to conversation

Support for the BeagleV platform

PATCH Superseded Thomas Petazzoni 5 participants 32 messages May 2, 2021 – May 3, 2021 RISC-V

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support for the BeagleV platform

Hello,

Here is a new version of the patch series adding support for the BeagleV in Buildroot.

Here are the changes compared the first version:

- Dropped the first two patches, as they have been merged upstream.

- In the OpenSBI patch adding options to enable/disable image installation, take into account the reviews from Bin Meng how the ordering of options + a typo in the fw_jump option prompt.

- In the beaglev_defconfig patch itself, use .out instead of .flash for the ready-to-be-flashed OpenSBI/U-Boot image, to be consistent with the extension documented by upstream, and also used by other firmware files for this platform.

- In the beaglev_defconfig patch itself, fix the post-build script to work in out-of-tree situation, as pointed out by Frank Hunleth.

- Fix the naming of the platform to BeagleV and the naming of the SoC to JH7100.

- Add support for building the other firmware files that are used in the boot process of the BeagleV: secondboot and ddrinit. To keep the patch series easier to merge, this is done as a separate step from the main defconfig addition. Building those two firmware files requires a bare-metal RISC-V 64-bit toolchain, so a host package is created for that.

The branch at:

https://github.com/tpetazzoni/buildroot/commits/beaglev

has been updated accordingly.

Best regards,

Thomas Petazzoni

Thomas Petazzoni (6):
boot/opensbi: add options to enable/disable image installation configs/beaglev_defconfig: new defconfig package/riscv64-elf-toolchain: new package boot/beaglev-ddrinit: new package boot/beaglev-secondboot: new package configs/beaglev: enable building of low-level firmware

 DEVELOPERS                                    |   5 +
 board/beaglev/extlinux.conf                   |   4 +
 board/beaglev/genimage.cfg                    |  12 ++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch |  39 ++++++
 board/beaglev/post-build.sh                   |  17 +++
 board/beaglev/readme.txt                      | 122 ++++++++++++++++++
 boot/Config.in                                |   2 +
 boot/beaglev-ddrinit/Config.in                |   9 ++
 boot/beaglev-ddrinit/beaglev-ddrinit.mk       |  29 +++++
 boot/beaglev-secondboot/Config.in             |   9 ++
 boot/beaglev-secondboot/beaglev-secondboot.mk |  29 +++++
 boot/opensbi/Config.in                        |  20 +++
 boot/opensbi/opensbi.mk                       |  16 ++-
 configs/beaglev_defconfig                     |  37 ++++++
 .../riscv64-elf-toolchain.mk                  |  25 ++++
 15 files changed, 369 insertions(+), 6 deletions(-)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 boot/beaglev-ddrinit/Config.in
 create mode 100644 boot/beaglev-ddrinit/beaglev-ddrinit.mk
 create mode 100644 boot/beaglev-secondboot/Config.in
 create mode 100644 boot/beaglev-secondboot/beaglev-secondboot.mk
 create mode 100644 configs/beaglev_defconfig
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/6 boot/opensbi: add options to enable/disable image installation

Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified, opensbi.mk was assuming that both fw_jump and fw_dynamic would be produced. However, this is not the case: the OpenSBI per-platform config.mk can decide which image to build.

As an example, the config.mk for VIC7100-based BeagleV only enables producing the fw_payload image.

This commit adds three options to enable the installation of images:
one for fw_jump, one for fw_dynamic, one for fw_payload.

The options for fw_jump and fw_dynamic are "default y" when BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.

The option for fw_payload is forcefully selected when either Linux or U-Boot are selected as payloads.

---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)
boot/opensbi/Config.in +20 -0
index 236bf74a90..55a644506f 100644
@@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
 	  the platform specific static library libplatsbi.a and firmware
 	  examples are built.
 
+config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
+	bool "Install fw_dynamic image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_dynamic image.
+
+config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
+	bool "Install fw_jump image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_jump image.
+
+config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
+	bool "Install fw_payload image"
+	help
+	  This option enables the installation of the fw_paylaod
+	  image.
+
 config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
 	bool "Include Linux as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_LINUX_KERNEL_IMAGE
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the Linux kernel as a Payload.
 
@@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
 	bool "Include U-Boot as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_TARGET_UBOOT
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the U-Boot as a Payload.
 
boot/opensbi/opensbi.mk +10 -6
index 8ebe4566fd..f8cbbb8fcc 100644
@@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
 
-ifneq ($(OPENSBI_PLAT),)
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
 OPENSBI_INSTALL_IMAGES = YES
-OPENSBI_FW_IMAGES += jump dynamic
-ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
-OPENSBI_FW_IMAGES += payload
+OPENSBI_FW_IMAGES += dynamic
 endif
-ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
-OPENSBI_FW_IMAGES = payload
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += jump
 endif
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += payload
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
Signature · 1 line
2.30.2
#2 lore raw

PATCH v2 1/6 boot/opensbi: add options to enable/disable image installation

Quoted 12 lines · Thomas Petazzoni

Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified, opensbi.mk was assuming that both fw_jump and fw_dynamic would be produced. However, this is not the case: the OpenSBI per-platform config.mk can decide which image to build.

As an example, the config.mk for VIC7100-based BeagleV only enables producing the fw_payload image.

This commit adds three options to enable the installation of images:
one for fw_jump, one for fw_dynamic, one for fw_payload.

Quoted 7 lines

The options for fw_jump and fw_dynamic are "default y" when BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.

The option for fw_payload is forcefully selected when either Linux or U-Boot are selected as payloads.

Alistair

Quoted 85 lines
---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)
boot/opensbi/Config.in +20 -0
index 236bf74a90..55a644506f 100644
@@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
          the platform specific static library libplatsbi.a and firmware
          examples are built.
 
+config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
+       bool "Install fw_dynamic image"
+       default y if BR2_TARGET_OPENSBI_PLAT != ""
+       help
+         This installs the fw_dynamic image.
+
+config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
+       bool "Install fw_jump image"
+       default y if BR2_TARGET_OPENSBI_PLAT != ""
+       help
+         This installs the fw_jump image.
+
+config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
+       bool "Install fw_payload image"
+       help
+         This option enables the installation of the fw_paylaod
+         image.
+
 config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
        bool "Include Linux as OpenSBI Payload"
        depends on BR2_TARGET_OPENSBI_PLAT != ""
        depends on BR2_LINUX_KERNEL
        depends on BR2_LINUX_KERNEL_IMAGE
+       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
        help
          Build OpenSBI with the Linux kernel as a Payload.
 
@@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
        bool "Include U-Boot as OpenSBI Payload"
        depends on BR2_TARGET_OPENSBI_PLAT != ""
        depends on BR2_TARGET_UBOOT
+       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
        help
          Build OpenSBI with the U-Boot as a Payload.
 
boot/opensbi/opensbi.mk +10 -7
index 8ebe4566fd..f8cbbb8fcc 100644
@@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
 
-ifneq ($(OPENSBI_PLAT),)
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
 OPENSBI_INSTALL_IMAGES = YES
-OPENSBI_FW_IMAGES += jump dynamic
-ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
-OPENSBI_FW_IMAGES += payload
+OPENSBI_FW_IMAGES += dynamic
 endif
-ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
-OPENSBI_FW_IMAGES = payload
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += jump
 endif
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += payload
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
--

2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH v2 1/6 boot/opensbi: add options to enable/disable image installation

In reply to Thomas Petazzoni
Quoted 39 lines · Thomas Petazzoni

Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified, opensbi.mk was assuming that both fw_jump and fw_dynamic would be produced. However, this is not the case: the OpenSBI per-platform config.mk can decide which image to build.

As an example, the config.mk for VIC7100-based BeagleV only enables producing the fw_payload image.

This commit adds three options to enable the installation of images:
one for fw_jump, one for fw_dynamic, one for fw_payload.

The options for fw_jump and fw_dynamic are "default y" when BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.

The option for fw_payload is forcefully selected when either Linux or U-Boot are selected as payloads.

---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)
boot/opensbi/Config.in +7 -0
index 236bf74a90..55a644506f 100644
@@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
          the platform specific static library libplatsbi.a and firmware
          examples are built.
 
+config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
+       bool "Install fw_dynamic image"
+       default y if BR2_TARGET_OPENSBI_PLAT != ""
+       help
+         This installs the fw_dynamic image.
+
+config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG

boot/opensbi/Config.in config BR2_TARGET_OPENSBI_PLAT · line 93

Quoted 10 lines
boot/opensbi/Config.in +10 -0
+       bool "Install fw_jump image"
+       default y if BR2_TARGET_OPENSBI_PLAT != ""
+       help
+         This installs the fw_jump image.
+
+config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
+       bool "Install fw_payload image"
+       help
+         This option enables the installation of the fw_paylaod
+         image.

nits: this help message should be in consistent with the other 2

Quoted 39 lines
boot/opensbi/Config.in +3 -0
+
 config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
        bool "Include Linux as OpenSBI Payload"
        depends on BR2_TARGET_OPENSBI_PLAT != ""
        depends on BR2_LINUX_KERNEL
        depends on BR2_LINUX_KERNEL_IMAGE
+       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
        help
          Build OpenSBI with the Linux kernel as a Payload.
 
@@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
        bool "Include U-Boot as OpenSBI Payload"
        depends on BR2_TARGET_OPENSBI_PLAT != ""
        depends on BR2_TARGET_UBOOT
+       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
        help
          Build OpenSBI with the U-Boot as a Payload.
 
boot/opensbi/opensbi.mk +5 -6
index 8ebe4566fd..f8cbbb8fcc 100644
@@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
 
-ifneq ($(OPENSBI_PLAT),)
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
 OPENSBI_INSTALL_IMAGES = YES
-OPENSBI_FW_IMAGES += jump dynamic
-ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
-OPENSBI_FW_IMAGES += payload
+OPENSBI_FW_IMAGES += dynamic
 endif
-ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
-OPENSBI_FW_IMAGES = payload
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES

boot/opensbi/opensbi.mk define OPENSBI_BUILD_CMDS

Quoted 10 lines
boot/opensbi/opensbi.mk +5 -1
+OPENSBI_FW_IMAGES += jump
 endif
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += payload
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
--

Otherwise LGTM:

#4 lore raw

PATCH v2 1/6 boot/opensbi: add options to enable/disable image installation

In reply to Thomas Petazzoni

Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified, opensbi.mk was assuming that both fw_jump and fw_dynamic would be produced. However, this is not the case: the OpenSBI per-platform config.mk can decide which image to build.

As an example, the config.mk for VIC7100-based BeagleV only enables producing the fw_payload image.

This commit adds three options to enable the installation of images:
one for fw_jump, one for fw_dynamic, one for fw_payload.

The options for fw_jump and fw_dynamic are "default y" when BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.

The option for fw_payload is forcefully selected when either Linux or U-Boot are selected as payloads.

---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)
boot/opensbi/Config.in +20 -0
index 236bf74a90..55a644506f 100644
@@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
 	  the platform specific static library libplatsbi.a and firmware
 	  examples are built.
 
+config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
+	bool "Install fw_dynamic image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_dynamic image.
+
+config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
+	bool "Install fw_jump image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_jump image.
+
+config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
+	bool "Install fw_payload image"
+	help
+	  This option enables the installation of the fw_paylaod
+	  image.
+
 config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
 	bool "Include Linux as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_LINUX_KERNEL_IMAGE
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the Linux kernel as a Payload.
 
@@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
 	bool "Include U-Boot as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_TARGET_UBOOT
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the U-Boot as a Payload.
 
boot/opensbi/opensbi.mk +10 -6
index 8ebe4566fd..f8cbbb8fcc 100644
@@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
 
-ifneq ($(OPENSBI_PLAT),)
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
 OPENSBI_INSTALL_IMAGES = YES
-OPENSBI_FW_IMAGES += jump dynamic
-ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
-OPENSBI_FW_IMAGES += payload
+OPENSBI_FW_IMAGES += dynamic
 endif
-ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
-OPENSBI_FW_IMAGES = payload
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += jump
 endif
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += payload
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
Signature · 1 line
2.30.2
#5 lore raw

PATCH v2 2/6 configs/beaglev_defconfig: new defconfig

In reply to Thomas Petazzoni

This commit introduces support for the RISC-V based BeagleV platform, which uses a Starfive JH7100.

---
 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 ++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 88 +++++++++++++++++++
 configs/beaglev_defconfig                     | 35 ++++++++
 7 files changed, 197 insertions(+)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig
DEVELOPERS +2 -0
index 573d8d84de..cec63a3715 100644
@@ -2602,10 +2602,12 @@ F:	package/xorcurses/
 
 N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
+F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
+F:	configs/beaglev_defconfig
 F:	configs/stm32mp157c_dk2_defconfig
 F:	package/android-tools/
 F:	package/b43-firmware/
board/beaglev/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..c5444d094c
@@ -0,0 +1,4 @@
+label linux
+  kernel /boot/Image
+  devicetree /boot/starfive_vic7100_beagle_v.dtb
+  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
board/beaglev/genimage.cfg new file +12 -0
new file mode 100644
index 0000000000..f38bb7f86c
@@ -0,0 +1,12 @@
+image sdcard.img {
+  hdimage {
+    gpt = true
+  }
+
+  partition rootfs {
+    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
+    bootable = "true"
+    image = "rootfs.ext4"
+  }
+}
board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch new file +39 -0
new file mode 100644
index 0000000000..74d70f2721
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 28 Apr 2021 22:58:45 +0200
+Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
+
+The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
+boots. Using 0x90000000 works fine.
+
+Since it would overlap with the kernel_comp_addr_r area, this one is
+moved 16 MB further, at 0x91000000.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ include/configs/starfive-vic7100.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
+index 8c5915a73c..7150a23873 100644
+--- a/include/configs/starfive-vic7100.h
++++ b/include/configs/starfive-vic7100.h
+@@ -111,13 +111,13 @@
+ 	"fdt_high=0xffffffffffffffff\0" \
+ 	"initrd_high=0xffffffffffffffff\0" \
+ 	"kernel_addr_r=0x84000000\0" \
+-	"fdt_addr_r=0x88000000\0" \
++	"fdt_addr_r=0x90000000\0" \
+ 	"scriptaddr=0x88100000\0" \
+ 	"script_offset_f=0x1fff000\0" \
+ 	"script_size_f=0x1000\0" \
+ 	"pxefile_addr_r=0x88200000\0" \
+ 	"ramdisk_addr_r=0x88300000\0" \
+-	"kernel_comp_addr_r=0x90000000\0" \
++	"kernel_comp_addr_r=0x91000000\0" \
+ 	"kernel_comp_size=0x10000000\0" \
+ 	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+ 	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+-- 
+2.30.2
+
board/beaglev/post-build.sh new file +17 -0
new file mode 100755
index 0000000000..04153cb3b6
@@ -0,0 +1,17 @@
+#!/bin/sh
+BOARD_DIR=$(dirname $0)
+
+# The DTB to use is provided within the U-Boot source tree, so we grab
+# it from there, and install it to TARGET_DIR/boot/.
+UBOOT_DIR=$(make -C${O} --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
+install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
+	${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
+
+# Bring the extlinux.conf file in.
+install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
+	${TARGET_DIR}/boot/extlinux/extlinux.conf
+
+# To be reflashed through Xmodem, the bootloader needs to be prepended
+# with a 4-byte header that contains the total size of the file.
+perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.out
+cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.out
board/beaglev/readme.txt new file +88 -0

88 lines not on this page · raw message

configs/beaglev_defconfig new file +35 -0
new file mode 100644
index 0000000000..2320e2ca83
@@ -0,0 +1,35 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVF=y
+BR2_RISCV_ISA_CUSTOM_RVD=y
+BR2_RISCV_ISA_CUSTOM_RVC=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
+BR2_LINUX_KERNEL_INSTALL_TARGET=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_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"
+BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
+# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.30.2
#6 lore raw

PATCH v2 2/6 configs/beaglev_defconfig: new defconfig

Quoted 5 lines · Thomas Petazzoni

This commit introduces support for the RISC-V based BeagleV platform, which uses a Starfive JH7100.

Alistair

Quoted 271 lines
---
 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 ++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 88 +++++++++++++++++++
 configs/beaglev_defconfig                     | 35 ++++++++
 7 files changed, 197 insertions(+)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig
DEVELOPERS +2 -0
index 573d8d84de..cec63a3715 100644
@@ -2602,10 +2602,12 @@ F:      package/xorcurses/
 
 N:     Thomas Petazzoni <[email protected]>
 F:     arch/Config.in.arm
+F:     board/beaglev/
 F:     board/stmicroelectronics/stm32mp157c-dk2/
 F:     boot/boot-wrapper-aarch64/
 F:     boot/grub2/
 F:     boot/gummiboot/
+F:     configs/beaglev_defconfig
 F:     configs/stm32mp157c_dk2_defconfig
 F:     package/android-tools/
 F:     package/b43-firmware/
board/beaglev/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..c5444d094c
@@ -0,0 +1,4 @@
+label linux
+  kernel /boot/Image
+  devicetree /boot/starfive_vic7100_beagle_v.dtb
+  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
board/beaglev/genimage.cfg new file +12 -0
new file mode 100644
index 0000000000..f38bb7f86c
@@ -0,0 +1,12 @@
+image sdcard.img {
+  hdimage {
+    gpt = true
+  }
+
+  partition rootfs {
+    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
+    bootable = "true"
+    image = "rootfs.ext4"
+  }
+}
board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch new file +39 -0
new file mode 100644
index 0000000000..74d70f2721
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 28 Apr 2021 22:58:45 +0200
+Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
+
+The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
+boots. Using 0x90000000 works fine.
+
+Since it would overlap with the kernel_comp_addr_r area, this one is
+moved 16 MB further, at 0x91000000.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ include/configs/starfive-vic7100.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
+index 8c5915a73c..7150a23873 100644
+--- a/include/configs/starfive-vic7100.h
++++ b/include/configs/starfive-vic7100.h
+@@ -111,13 +111,13 @@
+       "fdt_high=0xffffffffffffffff\0" \
+       "initrd_high=0xffffffffffffffff\0" \
+       "kernel_addr_r=0x84000000\0" \
+-      "fdt_addr_r=0x88000000\0" \
++      "fdt_addr_r=0x90000000\0" \
+       "scriptaddr=0x88100000\0" \
+       "script_offset_f=0x1fff000\0" \
+       "script_size_f=0x1000\0" \
+       "pxefile_addr_r=0x88200000\0" \
+       "ramdisk_addr_r=0x88300000\0" \
+-      "kernel_comp_addr_r=0x90000000\0" \
++      "kernel_comp_addr_r=0x91000000\0" \
+       "kernel_comp_size=0x10000000\0" \
+       "type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+       "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+--
+2.30.2
+
board/beaglev/post-build.sh new file +17 -0
new file mode 100755
index 0000000000..04153cb3b6
@@ -0,0 +1,17 @@
+#!/bin/sh
+BOARD_DIR=$(dirname $0)
+
+# The DTB to use is provided within the U-Boot source tree, so we grab
+# it from there, and install it to TARGET_DIR/boot/.
+UBOOT_DIR=$(make -C${O} --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
+install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
+       ${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
+
+# Bring the extlinux.conf file in.
+install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
+       ${TARGET_DIR}/boot/extlinux/extlinux.conf
+
+# To be reflashed through Xmodem, the bootloader needs to be prepended
+# with a 4-byte header that contains the total size of the file.
+perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.out
+cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.out
board/beaglev/readme.txt new file +88 -0
new file mode 100644
index 0000000000..d8511d3fd1
@@ -0,0 +1,88 @@
+BeagleV
+=======
+
+BeagleV is a low-cost RISC-V 64-bit based platform, powered by a
+Starfive JH7100 processor. The current defconfig in Buildroot has been
+tested with the JH7100 chip used on the beta version of the BeagleV
+board.
+
+How to build
+============
+
+$ make beaglev_defconfig
+$ make
+
+Build results
+=============
+
+After building, output/images contains:
+
++ Image
++ fw_payload.bin
++ fw_payload.bin.out
++ fw_payload.elf
++ rootfs.ext2
++ rootfs.ext4
++ sdcard.img
++ u-boot.bin
+
+The two important files are:
+
+ - fw_payload.bin.out, which is the bootloader image, containing
+   both OpenSBI and U-Boot.
+
+ - sdcard.img, the SD card image, which contains the root filesystem,
+   kernel image and Device Tree.
+
+Flashing the SD card image
+==========================
+
+$ sudo dd if=output/images/sdcard.img of=/dev/sdX
+
+Preparing the board
+===================
+
+Connect the Beagle-V fan to the 5V supply (pin 2 or 4 of the GPIO
+connector) and GND (pin 6 of the GPIO connector).
+
+Connect a TTL UART cable to pin 8 (TX), 10 (RX) and 14 (GND).
+
+Insert your SD card.
+
+Power-up the board using an USB-C cable.
+
+Flashing the bootloader
+=======================
+
+The bootloader pre-flashed on the Beagle-V has a non-working
+fdt_addr_r environment variable value, so it won't work
+as-is. Reflashing the bootloader with the bootloader image produced by
+Buildroot is necessary.
+
+When the board starts up, a pre-loader shows a count down of 2
+seconds, interrupt by pressing any key. You should reach a menu like
+this:
+
+--------8<----------
+
+bootloader version:210209-4547a8d
+ddr 0x00000000, 1M test
+ddr 0x00100000, 2M test
+DDR clk 2133M,Version: 210302-5aea32f
+0
+***************************************************
+*************** FLASH PROGRAMMING *****************
+***************************************************
+
+0:update uboot
+1:quit
+select the function:
+
+--------8<----------
+
+Press 0 and Enter. You will now see "C" characters being
+displayed. Ask your serial port communication program to send
+fw_payload.bin.out using the Xmodem protocol.
+
+After reflashing is complete, restart the board, it will automatically
+start the system from the SD card, and reach the login prompt.
configs/beaglev_defconfig new file +35 -1
new file mode 100644
index 0000000000..2320e2ca83
@@ -0,0 +1,35 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVF=y
+BR2_RISCV_ISA_CUSTOM_RVD=y
+BR2_RISCV_ISA_CUSTOM_RVC=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
+BR2_LINUX_KERNEL_INSTALL_TARGET=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_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"
+BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
+# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
+BR2_PACKAGE_HOST_GENIMAGE=y
--

2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH v2 2/6 configs/beaglev_defconfig: new defconfig

In reply to Thomas Petazzoni
Quoted 239 lines · Thomas Petazzoni

This commit introduces support for the RISC-V based BeagleV platform, which uses a Starfive JH7100.

---
 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 ++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 88 +++++++++++++++++++
 configs/beaglev_defconfig                     | 35 ++++++++
 7 files changed, 197 insertions(+)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig
DEVELOPERS +2 -0
index 573d8d84de..cec63a3715 100644
@@ -2602,10 +2602,12 @@ F:      package/xorcurses/
 
 N:     Thomas Petazzoni <[email protected]>
 F:     arch/Config.in.arm
+F:     board/beaglev/
 F:     board/stmicroelectronics/stm32mp157c-dk2/
 F:     boot/boot-wrapper-aarch64/
 F:     boot/grub2/
 F:     boot/gummiboot/
+F:     configs/beaglev_defconfig
 F:     configs/stm32mp157c_dk2_defconfig
 F:     package/android-tools/
 F:     package/b43-firmware/
board/beaglev/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..c5444d094c
@@ -0,0 +1,4 @@
+label linux
+  kernel /boot/Image
+  devicetree /boot/starfive_vic7100_beagle_v.dtb
+  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
board/beaglev/genimage.cfg new file +12 -0
new file mode 100644
index 0000000000..f38bb7f86c
@@ -0,0 +1,12 @@
+image sdcard.img {
+  hdimage {
+    gpt = true
+  }
+
+  partition rootfs {
+    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
+    bootable = "true"
+    image = "rootfs.ext4"
+  }
+}
board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch new file +39 -0
new file mode 100644
index 0000000000..74d70f2721
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 28 Apr 2021 22:58:45 +0200
+Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
+
+The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
+boots. Using 0x90000000 works fine.
+
+Since it would overlap with the kernel_comp_addr_r area, this one is
+moved 16 MB further, at 0x91000000.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ include/configs/starfive-vic7100.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
+index 8c5915a73c..7150a23873 100644
+--- a/include/configs/starfive-vic7100.h
++++ b/include/configs/starfive-vic7100.h
+@@ -111,13 +111,13 @@
+       "fdt_high=0xffffffffffffffff\0" \
+       "initrd_high=0xffffffffffffffff\0" \
+       "kernel_addr_r=0x84000000\0" \
+-      "fdt_addr_r=0x88000000\0" \
++      "fdt_addr_r=0x90000000\0" \
+       "scriptaddr=0x88100000\0" \
+       "script_offset_f=0x1fff000\0" \
+       "script_size_f=0x1000\0" \
+       "pxefile_addr_r=0x88200000\0" \
+       "ramdisk_addr_r=0x88300000\0" \
+-      "kernel_comp_addr_r=0x90000000\0" \
++      "kernel_comp_addr_r=0x91000000\0" \
+       "kernel_comp_size=0x10000000\0" \
+       "type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+       "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+--
+2.30.2
+
board/beaglev/post-build.sh new file +17 -0
new file mode 100755
index 0000000000..04153cb3b6
@@ -0,0 +1,17 @@
+#!/bin/sh
+BOARD_DIR=$(dirname $0)
+
+# The DTB to use is provided within the U-Boot source tree, so we grab
+# it from there, and install it to TARGET_DIR/boot/.
+UBOOT_DIR=$(make -C${O} --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
+install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
+       ${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
+
+# Bring the extlinux.conf file in.
+install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
+       ${TARGET_DIR}/boot/extlinux/extlinux.conf
+
+# To be reflashed through Xmodem, the bootloader needs to be prepended
+# with a 4-byte header that contains the total size of the file.
+perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.out
+cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.out
board/beaglev/readme.txt new file +88 -0
new file mode 100644
index 0000000000..d8511d3fd1
@@ -0,0 +1,88 @@
+BeagleV
+=======
+
+BeagleV is a low-cost RISC-V 64-bit based platform, powered by a
+Starfive JH7100 processor. The current defconfig in Buildroot has been
+tested with the JH7100 chip used on the beta version of the BeagleV
+board.
+
+How to build
+============
+
+$ make beaglev_defconfig
+$ make
+
+Build results
+=============
+
+After building, output/images contains:
+
++ Image
++ fw_payload.bin
++ fw_payload.bin.out
++ fw_payload.elf
++ rootfs.ext2
++ rootfs.ext4
++ sdcard.img
++ u-boot.bin
+
+The two important files are:
+
+ - fw_payload.bin.out, which is the bootloader image, containing
+   both OpenSBI and U-Boot.
+
+ - sdcard.img, the SD card image, which contains the root filesystem,
+   kernel image and Device Tree.
+
+Flashing the SD card image
+==========================
+
+$ sudo dd if=output/images/sdcard.img of=/dev/sdX
+
+Preparing the board
+===================
+
+Connect the Beagle-V fan to the 5V supply (pin 2 or 4 of the GPIO
+connector) and GND (pin 6 of the GPIO connector).
+
+Connect a TTL UART cable to pin 8 (TX), 10 (RX) and 14 (GND).
+
+Insert your SD card.
+
+Power-up the board using an USB-C cable.
+
+Flashing the bootloader
+=======================
+
+The bootloader pre-flashed on the Beagle-V has a non-working
+fdt_addr_r environment variable value, so it won't work
+as-is. Reflashing the bootloader with the bootloader image produced by
+Buildroot is necessary.
+
+When the board starts up, a pre-loader shows a count down of 2
+seconds, interrupt by pressing any key. You should reach a menu like
+this:
+
+--------8<----------
+
+bootloader version:210209-4547a8d
+ddr 0x00000000, 1M test
+ddr 0x00100000, 2M test
+DDR clk 2133M,Version: 210302-5aea32f
+0
+***************************************************
+*************** FLASH PROGRAMMING *****************
+***************************************************
+
+0:update uboot
+1:quit
+select the function:
+
+--------8<----------
+
+Press 0 and Enter. You will now see "C" characters being
+displayed. Ask your serial port communication program to send
+fw_payload.bin.out using the Xmodem protocol.
+
+After reflashing is complete, restart the board, it will automatically
+start the system from the SD card, and reach the login prompt.
configs/beaglev_defconfig new file +5 -0
new file mode 100644
index 0000000000..2320e2ca83
@@ -0,0 +1,35 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVF=y
+BR2_RISCV_ISA_CUSTOM_RVD=y

configs/beaglev_defconfig line 15

Quoted 10 lines
configs/beaglev_defconfig new file +10 -0
+BR2_RISCV_ISA_CUSTOM_RVC=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"

They have renamed this repo to: https://github.com/starfive-tech/linux

configs/beaglev_defconfig line 24

Quoted 9 lines
configs/beaglev_defconfig new file +9 -0
+BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
+BR2_LINUX_KERNEL_INSTALL_TARGET=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_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"

Sam here, https://github.com/starfive-tech/opensbi

configs/beaglev_defconfig line 33

Quoted 9 lines
configs/beaglev_defconfig new file +9 -0
+BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
+# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"

The same here, this is now just https://github.com/starfive-tech/u-boot

Alistair

Quoted 9 lines
configs/beaglev_defconfig new file +2 -1
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
+BR2_PACKAGE_HOST_GENIMAGE=y
--

2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#8 lore raw

PATCH v2 2/6 configs/beaglev_defconfig: new defconfig

In reply to Thomas Petazzoni

This commit introduces support for the RISC-V based BeagleV platform, which uses a Starfive JH7100.

---
 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 ++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 88 +++++++++++++++++++
 configs/beaglev_defconfig                     | 35 ++++++++
 7 files changed, 197 insertions(+)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig
DEVELOPERS +2 -0
index 573d8d84de..cec63a3715 100644
@@ -2602,10 +2602,12 @@ F:	package/xorcurses/
 
 N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
+F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
+F:	configs/beaglev_defconfig
 F:	configs/stm32mp157c_dk2_defconfig
 F:	package/android-tools/
 F:	package/b43-firmware/
board/beaglev/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..c5444d094c
@@ -0,0 +1,4 @@
+label linux
+  kernel /boot/Image
+  devicetree /boot/starfive_vic7100_beagle_v.dtb
+  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
board/beaglev/genimage.cfg new file +12 -0
new file mode 100644
index 0000000000..f38bb7f86c
@@ -0,0 +1,12 @@
+image sdcard.img {
+  hdimage {
+    gpt = true
+  }
+
+  partition rootfs {
+    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
+    bootable = "true"
+    image = "rootfs.ext4"
+  }
+}
board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch new file +39 -0
new file mode 100644
index 0000000000..74d70f2721
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 28 Apr 2021 22:58:45 +0200
+Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
+
+The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
+boots. Using 0x90000000 works fine.
+
+Since it would overlap with the kernel_comp_addr_r area, this one is
+moved 16 MB further, at 0x91000000.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ include/configs/starfive-vic7100.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
+index 8c5915a73c..7150a23873 100644
+--- a/include/configs/starfive-vic7100.h
++++ b/include/configs/starfive-vic7100.h
+@@ -111,13 +111,13 @@
+ 	"fdt_high=0xffffffffffffffff\0" \
+ 	"initrd_high=0xffffffffffffffff\0" \
+ 	"kernel_addr_r=0x84000000\0" \
+-	"fdt_addr_r=0x88000000\0" \
++	"fdt_addr_r=0x90000000\0" \
+ 	"scriptaddr=0x88100000\0" \
+ 	"script_offset_f=0x1fff000\0" \
+ 	"script_size_f=0x1000\0" \
+ 	"pxefile_addr_r=0x88200000\0" \
+ 	"ramdisk_addr_r=0x88300000\0" \
+-	"kernel_comp_addr_r=0x90000000\0" \
++	"kernel_comp_addr_r=0x91000000\0" \
+ 	"kernel_comp_size=0x10000000\0" \
+ 	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+ 	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+-- 
+2.30.2
+
board/beaglev/post-build.sh new file +17 -0
new file mode 100755
index 0000000000..04153cb3b6
@@ -0,0 +1,17 @@
+#!/bin/sh
+BOARD_DIR=$(dirname $0)
+
+# The DTB to use is provided within the U-Boot source tree, so we grab
+# it from there, and install it to TARGET_DIR/boot/.
+UBOOT_DIR=$(make -C${O} --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
+install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
+	${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
+
+# Bring the extlinux.conf file in.
+install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
+	${TARGET_DIR}/boot/extlinux/extlinux.conf
+
+# To be reflashed through Xmodem, the bootloader needs to be prepended
+# with a 4-byte header that contains the total size of the file.
+perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.out
+cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.out
board/beaglev/readme.txt new file +88 -0

88 lines not on this page · raw message

configs/beaglev_defconfig new file +35 -0
new file mode 100644
index 0000000000..2320e2ca83
@@ -0,0 +1,35 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVF=y
+BR2_RISCV_ISA_CUSTOM_RVD=y
+BR2_RISCV_ISA_CUSTOM_RVC=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
+BR2_LINUX_KERNEL_INSTALL_TARGET=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_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"
+BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
+# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.30.2
#9 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

In reply to Thomas Petazzoni

This commit adds a new package for a prebuilt bare-metal toolchain for RISC-V 64-bit. Indeed, some bootloader/firmware for the BeagleV (and potentially later for other platforms?) do not build with a Linux-capable toolchain.

This uses a pre-built toolchain from SiFive, precompiled for x86-64, so all packages using this toolchain must have the appropriate BR2_HOSTARCH dependency.

This package is modeled after package/arm-gnu-a-toolchain/, which package a pre-built ARM32 bare-metal toolchain.

---
 DEVELOPERS                                    |  1 +
 .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
DEVELOPERS +1 -0
index cec63a3715..7ce78742fc 100644
@@ -2651,6 +2651,7 @@ F:	package/python3/
 F:	package/python-mad/
 F:	package/python-serial/
 F:	package/qextserialport/
+F:	package/riscv64-elf-toolchain/
 F:	package/rpcbind/
 F:	package/rt-tests/
 F:	package/rtc-tools/
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +25 -0
new file mode 100644
index 0000000000..9b08ee0fec
@@ -0,0 +1,25 @@
+################################################################################
+#
+# riscv64-elf-toolchain
+#
+################################################################################
+
+RISCV64_ELF_TOOLCHAIN_VERSION = 2020.12.8
+RISCV64_ELF_TOOLCHAIN_SITE = https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12
+RISCV64_ELF_TOOLCHAIN_SOURCE = riscv64-unknown-elf-toolchain-10.2.0-$(RISCV64_ELF_TOOLCHAIN_VERSION)-x86_64-linux-centos6.tar.gz
+
+HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/riscv64-elf
+
+define HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_CMDS
+	rm -rf $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+	mkdir -p $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+	cp -rf $(@D)/* $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)/
+
+	mkdir -p $(HOST_DIR)/bin
+	cd $(HOST_DIR)/bin && \
+	for i in ../opt/riscv64-elf/bin/*; do \
+		ln -sf $$i; \
+	done
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.30.2
#10 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

In reply to Thomas Petazzoni

This commit adds a new package for a prebuilt bare-metal toolchain for RISC-V 64-bit. Indeed, some bootloader/firmware for the BeagleV (and potentially later for other platforms?) do not build with a Linux-capable toolchain.

This uses a pre-built toolchain from SiFive, precompiled for x86-64, so all packages using this toolchain must have the appropriate BR2_HOSTARCH dependency.

This package is modeled after package/arm-gnu-a-toolchain/, which package a pre-built ARM32 bare-metal toolchain.

---
 DEVELOPERS                                    |  1 +
 .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
DEVELOPERS +1 -0
index cec63a3715..7ce78742fc 100644
@@ -2651,6 +2651,7 @@ F:	package/python3/
 F:	package/python-mad/
 F:	package/python-serial/
 F:	package/qextserialport/
+F:	package/riscv64-elf-toolchain/
 F:	package/rpcbind/
 F:	package/rt-tests/
 F:	package/rtc-tools/
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +25 -0
new file mode 100644
index 0000000000..9b08ee0fec
@@ -0,0 +1,25 @@
+################################################################################
+#
+# riscv64-elf-toolchain
+#
+################################################################################
+
+RISCV64_ELF_TOOLCHAIN_VERSION = 2020.12.8
+RISCV64_ELF_TOOLCHAIN_SITE = https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12
+RISCV64_ELF_TOOLCHAIN_SOURCE = riscv64-unknown-elf-toolchain-10.2.0-$(RISCV64_ELF_TOOLCHAIN_VERSION)-x86_64-linux-centos6.tar.gz
+
+HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/riscv64-elf
+
+define HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_CMDS
+	rm -rf $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+	mkdir -p $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+	cp -rf $(@D)/* $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)/
+
+	mkdir -p $(HOST_DIR)/bin
+	cd $(HOST_DIR)/bin && \
+	for i in ../opt/riscv64-elf/bin/*; do \
+		ln -sf $$i; \
+	done
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.30.2
#11 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Quoted 38 lines · Thomas Petazzoni

This commit adds a new package for a prebuilt bare-metal toolchain for RISC-V 64-bit. Indeed, some bootloader/firmware for the BeagleV (and potentially later for other platforms?) do not build with a Linux-capable toolchain.

This uses a pre-built toolchain from SiFive, precompiled for x86-64, so all packages using this toolchain must have the appropriate BR2_HOSTARCH dependency.

This package is modeled after package/arm-gnu-a-toolchain/, which package a pre-built ARM32 bare-metal toolchain.

---
 DEVELOPERS                                    |  1 +
 .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
DEVELOPERS +1 -0
index cec63a3715..7ce78742fc 100644
@@ -2651,6 +2651,7 @@ F:        package/python3/
 F:     package/python-mad/
 F:     package/python-serial/
 F:     package/qextserialport/
+F:     package/riscv64-elf-toolchain/
 F:     package/rpcbind/
 F:     package/rt-tests/
 F:     package/rtc-tools/
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +0 -0
new file mode 100644
index 0000000000..9b08ee0fec

package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk line 8

Quoted 8 lines
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +8 -0
@@ -0,0 +1,25 @@
+################################################################################
+#
+# riscv64-elf-toolchain
+#
+################################################################################
+
+RISCV64_ELF_TOOLCHAIN_VERSION = 2020.12.8
+RISCV64_ELF_TOOLCHAIN_SITE = https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12

Could we not get an official GCC build instead of SiFives custom toolchain?

Alistair

Quoted 24 lines
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +17 -1
+RISCV64_ELF_TOOLCHAIN_SOURCE = riscv64-unknown-elf-toolchain-10.2.0-$(RISCV64_ELF_TOOLCHAIN_VERSION)-x86_64-linux-centos6.tar.gz
+
+HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/riscv64-elf
+
+define HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_CMDS
+       rm -rf $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+       mkdir -p $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)
+       cp -rf $(@D)/* $(HOST_RISCV64_ELF_TOOLCHAIN_INSTALL_DIR)/
+
+       mkdir -p $(HOST_DIR)/bin
+       cd $(HOST_DIR)/bin && \
+       for i in ../opt/riscv64-elf/bin/*; do \
+               ln -sf $$i; \
+       done
+endef
+
+$(eval $(host-generic-package))
--

2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#12 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Hello,

Quoted 4 lines · On Mon, 3 May 2021 10:14:38 +1000 Alistair Francis <[email protected]> wrote:

package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk line 8

Quoted 2 lines
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +2 -0
+RISCV64_ELF_TOOLCHAIN_VERSION = 2020.12.8
+RISCV64_ELF_TOOLCHAIN_SITE = https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12  

Could we not get an official GCC build instead of SiFives custom toolchain?

What do you call an "official GCC build" ? A toolchain built by Buildroot from source ? Buildroot can only build a single toolchain, which is Linux capable. Buildroot does not know how to build a separate bare-metal toolchain, which is why in such situations we use an existing pre-compiled toolchain.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#13 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · On Mon, 3 May 2021 10:14:38 +1000 Alistair Francis <[email protected]> wrote:

package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk line 8

Quoted 2 lines
package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk new file +2 -0
+RISCV64_ELF_TOOLCHAIN_VERSION = 2020.12.8
+RISCV64_ELF_TOOLCHAIN_SITE = https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12

Could we not get an official GCC build instead of SiFives custom toolchain?

Quoted 5 lines

What do you call an "official GCC build" ? A toolchain built by Buildroot from source ? Buildroot can only build a single toolchain, which is Linux capable. Buildroot does not know how to build a separate bare-metal toolchain, which is why in such situations we use an existing pre-compiled toolchain.

I just meant something from upstream GCC and not a vendor.

Alistair

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#14 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Quoted 7 lines · On Mon, 3 May 2021 17:11:09 +1000 Alistair Francis <[email protected]> wrote:
Quoted 5 lines

What do you call an "official GCC build" ? A toolchain built by Buildroot from source ? Buildroot can only build a single toolchain, which is Linux capable. Buildroot does not know how to build a separate bare-metal toolchain, which is why in such situations we use an existing pre-compiled toolchain.

I just meant something from upstream GCC and not a vendor.

But where is "upstream GCC" providing pre-compiled bare-metal toolchains?

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#15 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Quoted 10 lines · Thomas Petazzoni
Quoted 6 lines · On Mon, 3 May 2021 17:11:09 +1000 Alistair Francis <[email protected]> wrote:
Quoted 5 lines

What do you call an "official GCC build" ? A toolchain built by Buildroot from source ? Buildroot can only build a single toolchain, which is Linux capable. Buildroot does not know how to build a separate bare-metal toolchain, which is why in such situations we use an existing pre-compiled toolchain.

Quoted 3 lines
Quoted 1 line

I just meant something from upstream GCC and not a vendor.

But where is "upstream GCC" providing pre-compiled bare-metal toolchains?

Argh, I thought there was somewhere but I can't find anywhere.

Alistair

Quoted 6 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#16 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

In reply to Thomas Petazzoni
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

This commit adds a new package for a prebuilt bare-metal toolchain for RISC-V 64-bit. Indeed, some bootloader/firmware for the BeagleV (and potentially later for other platforms?) do not build with a Linux-capable toolchain.

Out of interest, why is that? For the ARM32 case it was a question of 32bit / 64bit, but that does not seem to be the issue here?

Just crappy firmware or are there any deeper differences between a bare metal and Linux toolchain on riscv64?

Signature · 1 line
Bye, Peter Korsgaard
#17 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Hello,

Quoted 5 lines · On Mon, 03 May 2021 08:17:33 +0200 Peter Korsgaard <[email protected]> wrote:

Out of interest, why is that? For the ARM32 case it was a question of 32bit / 64bit, but that does not seem to be the issue here?

Just crappy firmware or are there any deeper differences between a bare metal and Linux toolchain on riscv64?

It is not yet 100% sure what's going on. The firmware clearly doesn't build with a Linux toolchain. I've done a bit of work to try to get it to build, by adding -ffrestanding -nostdinc, but it does include a few standard headers (stdint.h for example). Once this was fixed, the build system of the firmware uses a specific gcc spec file, called nano.spec, which isn't available except in their bare-metal toolchain.

So for now, I opened a bug report at
https://github.com/starfive-tech/beagle_ddrlnit/issues/4, and decided to go on with building this with the recommended bare-metal toolchain.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#18 lore raw

PATCH v2 3/6 package/riscv64-elf-toolchain: new package

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 5 lines · On Mon, 03 May 2021 08:17:33 +0200 Peter Korsgaard <[email protected]> wrote:

Out of interest, why is that? For the ARM32 case it was a question of 32bit / 64bit, but that does not seem to be the issue here?

Just crappy firmware or are there any deeper differences between a bare metal and Linux toolchain on riscv64?

It is not yet 100% sure what's going on. The firmware clearly doesn't build with a Linux toolchain. I've done a bit of work to try to get it to build, by adding -ffrestanding -nostdinc, but it does include a few standard headers (stdint.h for example). Once this was fixed, the build system of the firmware uses a specific gcc spec file, called nano.spec, which isn't available except in their bare-metal toolchain.

Quoted 3 lines

So for now, I opened a bug report at
https://github.com/starfive-tech/beagle_ddrlnit/issues/4, and decided to go on with building this with the recommended bare-metal toolchain.

Ok, thanks for the description.

Signature · 1 line
Bye, Peter Korsgaard
#19 lore raw

v2 cover Support for the BeagleV platform

In reply to Thomas Petazzoni

Hello,

Here is a new version of the patch series adding support for the BeagleV in Buildroot.

Here are the changes compared the first version:

- Dropped the first two patches, as they have been merged upstream.

- In the OpenSBI patch adding options to enable/disable image installation, take into account the reviews from Bin Meng how the ordering of options + a typo in the fw_jump option prompt.

- In the beaglev_defconfig patch itself, use .out instead of .flash for the ready-to-be-flashed OpenSBI/U-Boot image, to be consistent with the extension documented by upstream, and also used by other firmware files for this platform.

- In the beaglev_defconfig patch itself, fix the post-build script to work in out-of-tree situation, as pointed out by Frank Hunleth.

- Fix the naming of the platform to BeagleV and the naming of the SoC to JH7100.

- Add support for building the other firmware files that are used in the boot process of the BeagleV: secondboot and ddrinit. To keep the patch series easier to merge, this is done as a separate step from the main defconfig addition. Building those two firmware files requires a bare-metal RISC-V 64-bit toolchain, so a host package is created for that.

The branch at:

https://github.com/tpetazzoni/buildroot/commits/beaglev

has been updated accordingly.

Best regards,

Thomas Petazzoni

Thomas Petazzoni (6):
boot/opensbi: add options to enable/disable image installation configs/beaglev_defconfig: new defconfig package/riscv64-elf-toolchain: new package boot/beaglev-ddrinit: new package boot/beaglev-secondboot: new package configs/beaglev: enable building of low-level firmware

 DEVELOPERS                                    |   5 +
 board/beaglev/extlinux.conf                   |   4 +
 board/beaglev/genimage.cfg                    |  12 ++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch |  39 ++++++
 board/beaglev/post-build.sh                   |  17 +++
 board/beaglev/readme.txt                      | 122 ++++++++++++++++++
 boot/Config.in                                |   2 +
 boot/beaglev-ddrinit/Config.in                |   9 ++
 boot/beaglev-ddrinit/beaglev-ddrinit.mk       |  29 +++++
 boot/beaglev-secondboot/Config.in             |   9 ++
 boot/beaglev-secondboot/beaglev-secondboot.mk |  29 +++++
 boot/opensbi/Config.in                        |  20 +++
 boot/opensbi/opensbi.mk                       |  16 ++-
 configs/beaglev_defconfig                     |  37 ++++++
 .../riscv64-elf-toolchain.mk                  |  25 ++++
 15 files changed, 369 insertions(+), 6 deletions(-)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 boot/beaglev-ddrinit/Config.in
 create mode 100644 boot/beaglev-ddrinit/beaglev-ddrinit.mk
 create mode 100644 boot/beaglev-secondboot/Config.in
 create mode 100644 boot/beaglev-secondboot/beaglev-secondboot.mk
 create mode 100644 configs/beaglev_defconfig
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
Signature · 1 line
2.30.2
#20 lore raw

PATCH v2 4/6 boot/beaglev-ddrinit: new package

In reply to Thomas Petazzoni

This commit adds a package for the DDR initialization code used on the BeagleV platform.

---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/beaglev-ddrinit/Config.in          |  9 ++++++++
 boot/beaglev-ddrinit/beaglev-ddrinit.mk | 29 +++++++++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-ddrinit/Config.in
 create mode 100644 boot/beaglev-ddrinit/beaglev-ddrinit.mk
DEVELOPERS +1 -0
index 7ce78742fc..39bc71ea34 100644
@@ -2604,6 +2604,7 @@ N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
 F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
+F:	boot/beaglev-ddrinit/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
boot/Config.in +1 -0
index b3adbfc8bc..f581205c6c 100644
@@ -6,6 +6,7 @@ source "boot/at91bootstrap3/Config.in"
 source "boot/at91dataflashboot/Config.in"
 source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
+source "boot/beaglev-ddrinit/Config.in"
 source "boot/binaries-marvell/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub2/Config.in"
boot/beaglev-ddrinit/Config.in new file +9 -0
new file mode 100644
index 0000000000..5392f49088
@@ -0,0 +1,9 @@
+config BR2_TARGET_BEAGLEV_DDRINIT
+	bool "beaglev-ddrinit"
+	depends on BR2_riscv
+	depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
+	help
+	  This package builds the DDRinit firmware used on the BeagleV
+	  platform.
+
+	  https://github.com/starfive-tech/beagle_ddrlnit
boot/beaglev-ddrinit/beaglev-ddrinit.mk new file +29 -0
new file mode 100644
index 0000000000..72e6aea965
@@ -0,0 +1,29 @@
+################################################################################
+#
+# beaglev-ddrinit
+#
+################################################################################
+
+# HEAD of the starfive branch
+BEAGLEV_DDRINIT_VERSION = 15b80de81263996affb2a29332aa681925709983
+BEAGLEV_DDRINIT_SITE = $(call github,starfive-tech,beagle_ddrlnit,$(BEAGLEV_DDRINIT_VERSION))
+BEAGLEV_DDRINIT_INSTALL_TARGET = NO
+BEAGLEV_DDRINIT_INSTALL_IMAGES = YES
+BEAGLEV_DDRINIT_DEPENDENCIES = host-riscv64-elf-toolchain
+# unfortunately, no real license file, but several sources files are
+# under GPL-2.0+, making the whole work GPL-2.0+
+BEAGLEV_DDRINIT_LICENSE = GPL-2.0+
+
+define BEAGLEV_DDRINIT_BUILD_CMDS
+	$(MAKE) -C $(@D)/build \
+		CROSSCOMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
+		SUFFIX=buildroot \
+		GIT_VERSION=$(BEAGLEV_DDRINIT_VERSION)
+endef
+
+define BEAGLEV_DDRINIT_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/build/ddrinit-2133-buildroot.bin.out \
+		$(BINARIES_DIR)/ddrinit-2133-buildroot.bin.out
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.30.2
#21 lore raw

PATCH v2 4/6 boot/beaglev-ddrinit: new package

Quoted 5 lines · Thomas Petazzoni

This commit adds a package for the DDR initialization code used on the BeagleV platform.

Quoted 9 lines
---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/beaglev-ddrinit/Config.in          |  9 ++++++++
 boot/beaglev-ddrinit/beaglev-ddrinit.mk | 29 +++++++++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-ddrinit/Config.in
 create mode 100644 boot/beaglev-ddrinit/beaglev-ddrinit.mk

nits: please put secondBoot first in this patch series

I expect the ddrInit firmware is no longer necessary when upstream U-Boot supports SPL for this target. For the time being, this patch looks good.

#22 lore raw

PATCH v2 4/6 boot/beaglev-ddrinit: new package

Hello,

Quoted 1 line · On Mon, 3 May 2021 19:30:13 +0800 Bin Meng <[email protected]> wrote:

nits: please put secondBoot first in this patch series

The only reason why beaglev-ddrinit appears before beaglev-secondboot in this series is because beaglev-ddrinit sorts before beaglev-secondboot by alphabetic ordering.

Quoted 3 lines

I expect the ddrInit firmware is no longer necessary when upstream U-Boot supports SPL for this target. For the time being, this patch looks good.

Yes, indeed.

Thanks for the review!

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#23 lore raw

PATCH v2 4/6 boot/beaglev-ddrinit: new package

In reply to Thomas Petazzoni

This commit adds a package for the DDR initialization code used on the BeagleV platform.

---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/beaglev-ddrinit/Config.in          |  9 ++++++++
 boot/beaglev-ddrinit/beaglev-ddrinit.mk | 29 +++++++++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-ddrinit/Config.in
 create mode 100644 boot/beaglev-ddrinit/beaglev-ddrinit.mk
DEVELOPERS +1 -0
index 7ce78742fc..39bc71ea34 100644
@@ -2604,6 +2604,7 @@ N:	Thomas Petazzoni <[email protected]>
 F:	arch/Config.in.arm
 F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
+F:	boot/beaglev-ddrinit/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
boot/Config.in +1 -0
index b3adbfc8bc..f581205c6c 100644
@@ -6,6 +6,7 @@ source "boot/at91bootstrap3/Config.in"
 source "boot/at91dataflashboot/Config.in"
 source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
+source "boot/beaglev-ddrinit/Config.in"
 source "boot/binaries-marvell/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub2/Config.in"
boot/beaglev-ddrinit/Config.in new file +9 -0
new file mode 100644
index 0000000000..5392f49088
@@ -0,0 +1,9 @@
+config BR2_TARGET_BEAGLEV_DDRINIT
+	bool "beaglev-ddrinit"
+	depends on BR2_riscv
+	depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
+	help
+	  This package builds the DDRinit firmware used on the BeagleV
+	  platform.
+
+	  https://github.com/starfive-tech/beagle_ddrlnit
boot/beaglev-ddrinit/beaglev-ddrinit.mk new file +29 -0
new file mode 100644
index 0000000000..72e6aea965
@@ -0,0 +1,29 @@
+################################################################################
+#
+# beaglev-ddrinit
+#
+################################################################################
+
+# HEAD of the starfive branch
+BEAGLEV_DDRINIT_VERSION = 15b80de81263996affb2a29332aa681925709983
+BEAGLEV_DDRINIT_SITE = $(call github,starfive-tech,beagle_ddrlnit,$(BEAGLEV_DDRINIT_VERSION))
+BEAGLEV_DDRINIT_INSTALL_TARGET = NO
+BEAGLEV_DDRINIT_INSTALL_IMAGES = YES
+BEAGLEV_DDRINIT_DEPENDENCIES = host-riscv64-elf-toolchain
+# unfortunately, no real license file, but several sources files are
+# under GPL-2.0+, making the whole work GPL-2.0+
+BEAGLEV_DDRINIT_LICENSE = GPL-2.0+
+
+define BEAGLEV_DDRINIT_BUILD_CMDS
+	$(MAKE) -C $(@D)/build \
+		CROSSCOMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
+		SUFFIX=buildroot \
+		GIT_VERSION=$(BEAGLEV_DDRINIT_VERSION)
+endef
+
+define BEAGLEV_DDRINIT_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/build/ddrinit-2133-buildroot.bin.out \
+		$(BINARIES_DIR)/ddrinit-2133-buildroot.bin.out
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.30.2
#24 lore raw

PATCH v2 5/6 boot/beaglev-secondboot: new package

In reply to Thomas Petazzoni

This packages allows to build the first stage bootloader used on the BeagleV, which is used even before the DDR initialization and OpenSBI/U-Boot. Yes, "secondboot" is strange for what is the first stage bootloader, but that's the upstream name.

---
 DEVELOPERS                                    |  1 +
 boot/Config.in                                |  1 +
 boot/beaglev-secondboot/Config.in             |  9 ++++++
 boot/beaglev-secondboot/beaglev-secondboot.mk | 29 +++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-secondboot/Config.in
 create mode 100644 boot/beaglev-secondboot/beaglev-secondboot.mk
DEVELOPERS +1 -0
index 39bc71ea34..1d786b6ffa 100644
@@ -2605,6 +2605,7 @@ F:	arch/Config.in.arm
 F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
 F:	boot/beaglev-ddrinit/
+F:	boot/beaglev-secondboot/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
boot/Config.in +1 -0
index f581205c6c..08d9ac06b2 100644
@@ -7,6 +7,7 @@ source "boot/at91dataflashboot/Config.in"
 source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
 source "boot/beaglev-ddrinit/Config.in"
+source "boot/beaglev-secondboot/Config.in"
 source "boot/binaries-marvell/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub2/Config.in"
boot/beaglev-secondboot/Config.in new file +9 -0
new file mode 100644
index 0000000000..a9695fc138
@@ -0,0 +1,9 @@
+config BR2_TARGET_BEAGLEV_SECONDBOOT
+	bool "beaglev-secondboot"
+	depends on BR2_riscv
+	depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
+	help
+	  This package builds the SecondBoot firmware used on the
+	  BeagleV platform.
+
+	  https://github.com/starfive-tech/beagle_secondBoot
boot/beaglev-secondboot/beaglev-secondboot.mk new file +29 -0
new file mode 100644
index 0000000000..f3b255fb0c
@@ -0,0 +1,29 @@
+################################################################################
+#
+# beaglev-secondboot
+#
+################################################################################
+
+# HEAD of the starfive branch
+BEAGLEV_SECONDBOOT_VERSION = a4f0b4307f877890f998b3216cffcc9f27a5f993
+BEAGLEV_SECONDBOOT_SITE = $(call github,starfive-tech,beagle_secondBoot,$(BEAGLEV_SECONDBOOT_VERSION))
+BEAGLEV_SECONDBOOT_INSTALL_TARGET = NO
+BEAGLEV_SECONDBOOT_INSTALL_IMAGES = YES
+BEAGLEV_SECONDBOOT_DEPENDENCIES = host-riscv64-elf-toolchain
+# unfortunately, no real license file, but several sources files are
+# under GPL-2.0+, making the whole work GPL-2.0+
+BEAGLEV_SECONDBOOT_LICENSE = GPL-2.0+
+
+define BEAGLEV_SECONDBOOT_BUILD_CMDS
+	$(MAKE) -C $(@D)/build \
+		CROSSCOMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
+		SUFFIX=buildroot \
+		GIT_VERSION=$(BEAGLEV_SECONDBOOT_VERSION)
+endef
+
+define BEAGLEV_SECONDBOOT_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/build/bootloader-BEAGLEV-buildroot.bin.out \
+		$(BINARIES_DIR)/bootloader-BEAGLEV-buildroot.bin.out
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.30.2
#25 lore raw

PATCH v2 5/6 boot/beaglev-secondboot: new package

Quoted 7 lines · Thomas Petazzoni

This packages allows to build the first stage bootloader used on the BeagleV, which is used even before the DDR initialization and OpenSBI/U-Boot. Yes, "secondboot" is strange for what is the first stage bootloader, but that's the upstream name.

Quoted 9 lines
---
 DEVELOPERS                                    |  1 +
 boot/Config.in                                |  1 +
 boot/beaglev-secondboot/Config.in             |  9 ++++++
 boot/beaglev-secondboot/beaglev-secondboot.mk | 29 +++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-secondboot/Config.in
 create mode 100644 boot/beaglev-secondboot/beaglev-secondboot.mk
#26 lore raw

PATCH v2 5/6 boot/beaglev-secondboot: new package

In reply to Thomas Petazzoni

This packages allows to build the first stage bootloader used on the BeagleV, which is used even before the DDR initialization and OpenSBI/U-Boot. Yes, "secondboot" is strange for what is the first stage bootloader, but that's the upstream name.

---
 DEVELOPERS                                    |  1 +
 boot/Config.in                                |  1 +
 boot/beaglev-secondboot/Config.in             |  9 ++++++
 boot/beaglev-secondboot/beaglev-secondboot.mk | 29 +++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 boot/beaglev-secondboot/Config.in
 create mode 100644 boot/beaglev-secondboot/beaglev-secondboot.mk
DEVELOPERS +1 -0
index 39bc71ea34..1d786b6ffa 100644
@@ -2605,6 +2605,7 @@ F:	arch/Config.in.arm
 F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
 F:	boot/beaglev-ddrinit/
+F:	boot/beaglev-secondboot/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
boot/Config.in +1 -0
index f581205c6c..08d9ac06b2 100644
@@ -7,6 +7,7 @@ source "boot/at91dataflashboot/Config.in"
 source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
 source "boot/beaglev-ddrinit/Config.in"
+source "boot/beaglev-secondboot/Config.in"
 source "boot/binaries-marvell/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
 source "boot/grub2/Config.in"
boot/beaglev-secondboot/Config.in new file +9 -0
new file mode 100644
index 0000000000..a9695fc138
@@ -0,0 +1,9 @@
+config BR2_TARGET_BEAGLEV_SECONDBOOT
+	bool "beaglev-secondboot"
+	depends on BR2_riscv
+	depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
+	help
+	  This package builds the SecondBoot firmware used on the
+	  BeagleV platform.
+
+	  https://github.com/starfive-tech/beagle_secondBoot
boot/beaglev-secondboot/beaglev-secondboot.mk new file +29 -0
new file mode 100644
index 0000000000..f3b255fb0c
@@ -0,0 +1,29 @@
+################################################################################
+#
+# beaglev-secondboot
+#
+################################################################################
+
+# HEAD of the starfive branch
+BEAGLEV_SECONDBOOT_VERSION = a4f0b4307f877890f998b3216cffcc9f27a5f993
+BEAGLEV_SECONDBOOT_SITE = $(call github,starfive-tech,beagle_secondBoot,$(BEAGLEV_SECONDBOOT_VERSION))
+BEAGLEV_SECONDBOOT_INSTALL_TARGET = NO
+BEAGLEV_SECONDBOOT_INSTALL_IMAGES = YES
+BEAGLEV_SECONDBOOT_DEPENDENCIES = host-riscv64-elf-toolchain
+# unfortunately, no real license file, but several sources files are
+# under GPL-2.0+, making the whole work GPL-2.0+
+BEAGLEV_SECONDBOOT_LICENSE = GPL-2.0+
+
+define BEAGLEV_SECONDBOOT_BUILD_CMDS
+	$(MAKE) -C $(@D)/build \
+		CROSSCOMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
+		SUFFIX=buildroot \
+		GIT_VERSION=$(BEAGLEV_SECONDBOOT_VERSION)
+endef
+
+define BEAGLEV_SECONDBOOT_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/build/bootloader-BEAGLEV-buildroot.bin.out \
+		$(BINARIES_DIR)/bootloader-BEAGLEV-buildroot.bin.out
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.30.2
#27 lore raw

PATCH v2 6/6 configs/beaglev: enable building of low-level firmware

In reply to Thomas Petazzoni

This commit extends the beaglev_defconfig and its documentation to build the low-level firmware, and explain how to reflash it.

---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)
board/beaglev/readme.txt +36 -2
index d8511d3fd1..a3adaba3ae 100644
@@ -17,6 +17,8 @@ Build results
 
 After building, output/images contains:
 
++ bootloader-BEAGLEV-buildroot.bin.out
++ ddrinit-2133-buildroot.bin.out
 + Image
 + fw_payload.bin
 + fw_payload.bin.out
@@ -26,7 +28,11 @@ After building, output/images contains:
 + sdcard.img
 + u-boot.bin
 
-The two important files are:
+The four important files are:
+
+ - bootloader-BEAGLEV-buildroot.bin.out, the first stage bootloader
+
+ - ddrinit-2133-buildroot.bin.out, the DDR initialization firmware
 
  - fw_payload.bin.out, which is the bootloader image, containing
    both OpenSBI and U-Boot.
@@ -51,7 +57,7 @@ Insert your SD card.
 
 Power-up the board using an USB-C cable.
 
-Flashing the bootloader
+Flashing OpenSBI/U-Boot
 =======================
 
 The bootloader pre-flashed on the Beagle-V has a non-working
@@ -86,3 +92,31 @@ fw_payload.bin.out using the Xmodem protocol.
 
 After reflashing is complete, restart the board, it will automatically
 start the system from the SD card, and reach the login prompt.
+
+Flashing low-level bootloaders
+==============================
+
+The BeagleV comes pre-flashed with functional low-level bootloaders
+(called "secondboot" and "ddrinit"). Re-flashing them is not necessary
+to use this Buildroot defconfig. However, for the sake of
+completeness, Buildroot builds and provides those low-level bootloader
+images.
+
+You can flash them as follows:
+
+ - In the same "pre-loader" menu as the one used above, instead of
+   entering 0 or 1, enter the magic "root at s5t" string. This enters the
+   "expert" features.
+
+ - Then, press 0 and send over X-modem the
+   bootloader-BEAGLEV-buildroot.bin.out file.
+
+ - Then, press 1 and send over X-modem the
+   ddrinit-2133-buildroot.bin.out.
+
+Note that the reflashing mechanism itself relies on those low-level
+bootloaders, so if you flash non-working versions, you'll have to go
+through a recovery process. This requires wiring up to a separate
+debug UART, whose pins are located near the HDMI connector. See
+https://wiki.seeedstudio.com/BeagleV-Update-bootloader-ddr-init-boot-uboot-Recover-bootloader/
+section "Recover the bootloader" for more details.
configs/beaglev_defconfig +2 -0
index 2320e2ca83..3efcab8d61 100644
@@ -18,6 +18,8 @@ BR2_LINUX_KERNEL_INSTALL_TARGET=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 # BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_BEAGLEV_DDRINIT=y
+BR2_TARGET_BEAGLEV_SECONDBOOT=y
 BR2_TARGET_OPENSBI=y
 BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
 # HEAD of the Fedora branch
Signature · 1 line
2.30.2
#28 lore raw

PATCH v2 6/6 configs/beaglev: enable building of low-level firmware

Quoted 10 lines · Thomas Petazzoni

This commit extends the beaglev_defconfig and its documentation to build the low-level firmware, and explain how to reflash it.

---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)
#29 lore raw

PATCH v2 6/6 configs/beaglev: enable building of low-level firmware

In reply to Thomas Petazzoni

This commit extends the beaglev_defconfig and its documentation to build the low-level firmware, and explain how to reflash it.

---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)
board/beaglev/readme.txt +36 -2
index d8511d3fd1..a3adaba3ae 100644
@@ -17,6 +17,8 @@ Build results
 
 After building, output/images contains:
 
++ bootloader-BEAGLEV-buildroot.bin.out
++ ddrinit-2133-buildroot.bin.out
 + Image
 + fw_payload.bin
 + fw_payload.bin.out
@@ -26,7 +28,11 @@ After building, output/images contains:
 + sdcard.img
 + u-boot.bin
 
-The two important files are:
+The four important files are:
+
+ - bootloader-BEAGLEV-buildroot.bin.out, the first stage bootloader
+
+ - ddrinit-2133-buildroot.bin.out, the DDR initialization firmware
 
  - fw_payload.bin.out, which is the bootloader image, containing
    both OpenSBI and U-Boot.
@@ -51,7 +57,7 @@ Insert your SD card.
 
 Power-up the board using an USB-C cable.
 
-Flashing the bootloader
+Flashing OpenSBI/U-Boot
 =======================
 
 The bootloader pre-flashed on the Beagle-V has a non-working
@@ -86,3 +92,31 @@ fw_payload.bin.out using the Xmodem protocol.
 
 After reflashing is complete, restart the board, it will automatically
 start the system from the SD card, and reach the login prompt.
+
+Flashing low-level bootloaders
+==============================
+
+The BeagleV comes pre-flashed with functional low-level bootloaders
+(called "secondboot" and "ddrinit"). Re-flashing them is not necessary
+to use this Buildroot defconfig. However, for the sake of
+completeness, Buildroot builds and provides those low-level bootloader
+images.
+
+You can flash them as follows:
+
+ - In the same "pre-loader" menu as the one used above, instead of
+   entering 0 or 1, enter the magic "root at s5t" string. This enters the
+   "expert" features.
+
+ - Then, press 0 and send over X-modem the
+   bootloader-BEAGLEV-buildroot.bin.out file.
+
+ - Then, press 1 and send over X-modem the
+   ddrinit-2133-buildroot.bin.out.
+
+Note that the reflashing mechanism itself relies on those low-level
+bootloaders, so if you flash non-working versions, you'll have to go
+through a recovery process. This requires wiring up to a separate
+debug UART, whose pins are located near the HDMI connector. See
+https://wiki.seeedstudio.com/BeagleV-Update-bootloader-ddr-init-boot-uboot-Recover-bootloader/
+section "Recover the bootloader" for more details.
configs/beaglev_defconfig +2 -0
index 2320e2ca83..3efcab8d61 100644
@@ -18,6 +18,8 @@ BR2_LINUX_KERNEL_INSTALL_TARGET=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 # BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_BEAGLEV_DDRINIT=y
+BR2_TARGET_BEAGLEV_SECONDBOOT=y
 BR2_TARGET_OPENSBI=y
 BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
 # HEAD of the Fedora branch
Signature · 1 line
2.30.2
#30 lore raw

PATCH v2 6/6 configs/beaglev: enable building of low-level firmware

Quoted 66 lines · Thomas Petazzoni

This commit extends the beaglev_defconfig and its documentation to build the low-level firmware, and explain how to reflash it.

---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)
board/beaglev/readme.txt +26 -2
index d8511d3fd1..a3adaba3ae 100644
@@ -17,6 +17,8 @@ Build results
 
 After building, output/images contains:
 
++ bootloader-BEAGLEV-buildroot.bin.out
++ ddrinit-2133-buildroot.bin.out
 + Image
 + fw_payload.bin
 + fw_payload.bin.out
@@ -26,7 +28,11 @@ After building, output/images contains:
 + sdcard.img
 + u-boot.bin
 
-The two important files are:
+The four important files are:
+
+ - bootloader-BEAGLEV-buildroot.bin.out, the first stage bootloader
+
+ - ddrinit-2133-buildroot.bin.out, the DDR initialization firmware
 
  - fw_payload.bin.out, which is the bootloader image, containing
    both OpenSBI and U-Boot.
@@ -51,7 +57,7 @@ Insert your SD card.
 
 Power-up the board using an USB-C cable.
 
-Flashing the bootloader
+Flashing OpenSBI/U-Boot
 =======================
 
 The bootloader pre-flashed on the Beagle-V has a non-working
@@ -86,3 +92,31 @@ fw_payload.bin.out using the Xmodem protocol.
 
 After reflashing is complete, restart the board, it will automatically
 start the system from the SD card, and reach the login prompt.
+
+Flashing low-level bootloaders
+==============================
+
+The BeagleV comes pre-flashed with functional low-level bootloaders
+(called "secondboot" and "ddrinit"). Re-flashing them is not necessary
+to use this Buildroot defconfig. However, for the sake of
+completeness, Buildroot builds and provides those low-level bootloader
+images.
+
+You can flash them as follows:
+
+ - In the same "pre-loader" menu as the one used above, instead of
+   entering 0 or 1, enter the magic "root at s5t" string. This enters the
+   "expert" features.
+
+ - Then, press 0 and send over X-modem the
+   bootloader-BEAGLEV-buildroot.bin.out file.

board/beaglev/readme.txt fw_payload.bin.out using the Xmodem protocol. · line 122

Quoted 10 lines
board/beaglev/readme.txt +10 -0
+
+ - Then, press 1 and send over X-modem the
+   ddrinit-2133-buildroot.bin.out.
+
+Note that the reflashing mechanism itself relies on those low-level
+bootloaders, so if you flash non-working versions, you'll have to go
+through a recovery process. This requires wiring up to a separate
+debug UART, whose pins are located near the HDMI connector. See
+https://wiki.seeedstudio.com/BeagleV-Update-bootloader-ddr-init-boot-uboot-Recover-bootloader/
+section "Recover the bootloader" for more details.

This is not something that needs to be noted in the patch, but I wanted to make people aware that the instructions currently recommed using SecureCRT as the terminal emulator. I know many including myself would not want to use a trial version of commercial software.

The author of the guide, Lakshantha, told me that he could not transfer the vic_second_boot.boot.bin using xmodem in minicom when connected via the debug header. After he uploaded the file using minicom, he would type "do 0x18000000", but there would be no response. It did however work ok in SecureCRT.

Lakshantha will be back on May 6 but in the meantime I would welcome any suggestions. I figure there must be some difference in the default behavior of securecrt vs minicom.

thanks,
drew

#31 lore raw

PATCH v2 6/6 configs/beaglev: enable building of low-level firmware

Hello Drew,

Quoted 18 lines · On Mon, 3 May 2021 00:18:32 -0700 Drew Fustini <[email protected]> wrote:

board/beaglev/readme.txt fw_payload.bin.out using the Xmodem protocol. · line 122

Quoted 6 lines
board/beaglev/readme.txt +6 -0
+Note that the reflashing mechanism itself relies on those low-level
+bootloaders, so if you flash non-working versions, you'll have to go
+through a recovery process. This requires wiring up to a separate
+debug UART, whose pins are located near the HDMI connector. See
+https://wiki.seeedstudio.com/BeagleV-Update-bootloader-ddr-init-boot-uboot-Recover-bootloader/
+section "Recover the bootloader" for more details.  

This is not something that needs to be noted in the patch, but I wanted to make people aware that the instructions currently recommed using SecureCRT as the terminal emulator. I know many including myself would not want to use a trial version of commercial software.

The author of the guide, Lakshantha, told me that he could not transfer the vic_second_boot.boot.bin using xmodem in minicom when connected via the debug header. After he uploaded the file using minicom, he would type "do 0x18000000", but there would be no response. It did however work ok in SecureCRT.

Quoted 3 lines

Lakshantha will be back on May 6 but in the meantime I would welcome any suggestions. I figure there must be some difference in the default behavior of securecrt vs minicom.

Thanks for the additional detail. I indeed missed that the recovery mechanism seems to not work with terminal emulator others than this commercial software.

I have been lucky that for me the secondBoot and ddrInit just worked, so I was able to reflash them using the normal flashing solution (from the standard UART).

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com