All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform
@ 2021-05-02 21:21 Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
                   ` (12 more replies)
  0 siblings, 13 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

-- 
2.30.2

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

* [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03  0:08   ` Alistair Francis
  2021-05-03 11:26   ` Bin Meng
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index 236bf74a90..55a644506f 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -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.
 
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index 8ebe4566fd..f8cbbb8fcc 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -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

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

* [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03  0:12   ` Alistair Francis
  2021-05-03  1:14   ` Alistair Francis
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 573d8d84de..cec63a3715 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2602,10 +2602,12 @@ F:	package/xorcurses/
 
 N:	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 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/
diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
new file mode 100644
index 0000000000..c5444d094c
--- /dev/null
+++ b/board/beaglev/extlinux.conf
@@ -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
diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
new file mode 100644
index 0000000000..f38bb7f86c
--- /dev/null
+++ b/board/beaglev/genimage.cfg
@@ -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"
+  }
+}
diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
new file mode 100644
index 0000000000..74d70f2721
--- /dev/null
+++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+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 <thomas.petazzoni@bootlin.com>
+---
+ 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
+
diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
new file mode 100755
index 0000000000..04153cb3b6
--- /dev/null
+++ b/board/beaglev/post-build.sh
@@ -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
diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
new file mode 100644
index 0000000000..d8511d3fd1
--- /dev/null
+++ b/board/beaglev/readme.txt
@@ -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.
diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
new file mode 100644
index 0000000000..2320e2ca83
--- /dev/null
+++ b/configs/beaglev_defconfig
@@ -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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  1 +
 .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index cec63a3715..7ce78742fc 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
new file mode 100644
index 0000000000..9b08ee0fec
--- /dev/null
+++ b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03 11:30   ` Bin Meng
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 7ce78742fc..39bc71ea34 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2604,6 +2604,7 @@ N:	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 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/
diff --git a/boot/Config.in b/boot/Config.in
index b3adbfc8bc..f581205c6c 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -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"
diff --git a/boot/beaglev-ddrinit/Config.in b/boot/beaglev-ddrinit/Config.in
new file mode 100644
index 0000000000..5392f49088
--- /dev/null
+++ b/boot/beaglev-ddrinit/Config.in
@@ -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
diff --git a/boot/beaglev-ddrinit/beaglev-ddrinit.mk b/boot/beaglev-ddrinit/beaglev-ddrinit.mk
new file mode 100644
index 0000000000..72e6aea965
--- /dev/null
+++ b/boot/beaglev-ddrinit/beaglev-ddrinit.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03 11:31   ` Bin Meng
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 39bc71ea34..1d786b6ffa 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/boot/Config.in b/boot/Config.in
index f581205c6c..08d9ac06b2 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -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"
diff --git a/boot/beaglev-secondboot/Config.in b/boot/beaglev-secondboot/Config.in
new file mode 100644
index 0000000000..a9695fc138
--- /dev/null
+++ b/boot/beaglev-secondboot/Config.in
@@ -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
diff --git a/boot/beaglev-secondboot/beaglev-secondboot.mk b/boot/beaglev-secondboot/beaglev-secondboot.mk
new file mode 100644
index 0000000000..f3b255fb0c
--- /dev/null
+++ b/boot/beaglev-secondboot/beaglev-secondboot.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03 11:33   ` Bin Meng
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
index d8511d3fd1..a3adaba3ae 100644
--- a/board/beaglev/readme.txt
+++ b/board/beaglev/readme.txt
@@ -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.
diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
index 2320e2ca83..3efcab8d61 100644
--- a/configs/beaglev_defconfig
+++ b/configs/beaglev_defconfig
@@ -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
-- 
2.30.2

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

* [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

-- 
2.30.2

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

* [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index 236bf74a90..55a644506f 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -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.
 
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index 8ebe4566fd..f8cbbb8fcc 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -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

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

* [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 573d8d84de..cec63a3715 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2602,10 +2602,12 @@ F:	package/xorcurses/
 
 N:	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 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/
diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
new file mode 100644
index 0000000000..c5444d094c
--- /dev/null
+++ b/board/beaglev/extlinux.conf
@@ -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
diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
new file mode 100644
index 0000000000..f38bb7f86c
--- /dev/null
+++ b/board/beaglev/genimage.cfg
@@ -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"
+  }
+}
diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
new file mode 100644
index 0000000000..74d70f2721
--- /dev/null
+++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+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 <thomas.petazzoni@bootlin.com>
+---
+ 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
+
diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
new file mode 100755
index 0000000000..04153cb3b6
--- /dev/null
+++ b/board/beaglev/post-build.sh
@@ -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
diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
new file mode 100644
index 0000000000..d8511d3fd1
--- /dev/null
+++ b/board/beaglev/readme.txt
@@ -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.
diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
new file mode 100644
index 0000000000..2320e2ca83
--- /dev/null
+++ b/configs/beaglev_defconfig
@@ -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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03  0:14   ` Alistair Francis
  2021-05-03  6:17   ` Peter Korsgaard
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
                   ` (2 subsequent siblings)
  12 siblings, 2 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  1 +
 .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index cec63a3715..7ce78742fc 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
new file mode 100644
index 0000000000..9b08ee0fec
--- /dev/null
+++ b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 7ce78742fc..39bc71ea34 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2604,6 +2604,7 @@ N:	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 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/
diff --git a/boot/Config.in b/boot/Config.in
index b3adbfc8bc..f581205c6c 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -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"
diff --git a/boot/beaglev-ddrinit/Config.in b/boot/beaglev-ddrinit/Config.in
new file mode 100644
index 0000000000..5392f49088
--- /dev/null
+++ b/boot/beaglev-ddrinit/Config.in
@@ -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
diff --git a/boot/beaglev-ddrinit/beaglev-ddrinit.mk b/boot/beaglev-ddrinit/beaglev-ddrinit.mk
new file mode 100644
index 0000000000..72e6aea965
--- /dev/null
+++ b/boot/beaglev-ddrinit/beaglev-ddrinit.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: new package
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (10 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
  12 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 39bc71ea34..1d786b6ffa 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/boot/Config.in b/boot/Config.in
index f581205c6c..08d9ac06b2 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -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"
diff --git a/boot/beaglev-secondboot/Config.in b/boot/beaglev-secondboot/Config.in
new file mode 100644
index 0000000000..a9695fc138
--- /dev/null
+++ b/boot/beaglev-secondboot/Config.in
@@ -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
diff --git a/boot/beaglev-secondboot/beaglev-secondboot.mk b/boot/beaglev-secondboot/beaglev-secondboot.mk
new file mode 100644
index 0000000000..f3b255fb0c
--- /dev/null
+++ b/boot/beaglev-secondboot/beaglev-secondboot.mk
@@ -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))
-- 
2.30.2

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

* [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware
  2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
                   ` (11 preceding siblings ...)
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
@ 2021-05-02 21:21 ` Thomas Petazzoni
  2021-05-03  7:18   ` Drew Fustini
  12 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-02 21:21 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
 configs/beaglev_defconfig |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
index d8511d3fd1..a3adaba3ae 100644
--- a/board/beaglev/readme.txt
+++ b/board/beaglev/readme.txt
@@ -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.
diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
index 2320e2ca83..3efcab8d61 100644
--- a/configs/beaglev_defconfig
+++ b/configs/beaglev_defconfig
@@ -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
-- 
2.30.2

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

* [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
@ 2021-05-03  0:08   ` Alistair Francis
  2021-05-03 11:26   ` Bin Meng
  1 sibling, 0 replies; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  0:08 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 7:23 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> 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.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  boot/opensbi/Config.in  | 20 ++++++++++++++++++++
>  boot/opensbi/opensbi.mk | 16 ++++++++++------
>  2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
> index 236bf74a90..55a644506f 100644
> --- a/boot/opensbi/Config.in
> +++ b/boot/opensbi/Config.in
> @@ -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.
>
> diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
> index 8ebe4566fd..f8cbbb8fcc 100644
> --- a/boot/opensbi/opensbi.mk
> +++ b/boot/opensbi/opensbi.mk
> @@ -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

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

* [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
@ 2021-05-03  0:12   ` Alistair Francis
  2021-05-03  1:14   ` Alistair Francis
  1 sibling, 0 replies; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  0:12 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 7:22 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit introduces support for the RISC-V based BeagleV platform,
> which uses a Starfive JH7100.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  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
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 573d8d84de..cec63a3715 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2602,10 +2602,12 @@ F:      package/xorcurses/
>
>  N:     Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  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/
> diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
> new file mode 100644
> index 0000000000..c5444d094c
> --- /dev/null
> +++ b/board/beaglev/extlinux.conf
> @@ -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
> diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
> new file mode 100644
> index 0000000000..f38bb7f86c
> --- /dev/null
> +++ b/board/beaglev/genimage.cfg
> @@ -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"
> +  }
> +}
> diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> new file mode 100644
> index 0000000000..74d70f2721
> --- /dev/null
> +++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> @@ -0,0 +1,39 @@
> +From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +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 <thomas.petazzoni@bootlin.com>
> +---
> + 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
> +
> diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
> new file mode 100755
> index 0000000000..04153cb3b6
> --- /dev/null
> +++ b/board/beaglev/post-build.sh
> @@ -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
> diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
> new file mode 100644
> index 0000000000..d8511d3fd1
> --- /dev/null
> +++ b/board/beaglev/readme.txt
> @@ -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.
> diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
> new file mode 100644
> index 0000000000..2320e2ca83
> --- /dev/null
> +++ b/configs/beaglev_defconfig
> @@ -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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
@ 2021-05-03  0:14   ` Alistair Francis
  2021-05-03  6:54     ` Thomas Petazzoni
  2021-05-03  6:17   ` Peter Korsgaard
  1 sibling, 1 reply; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  0:14 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 7:24 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> 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.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  DEVELOPERS                                    |  1 +
>  .../riscv64-elf-toolchain.mk                  | 25 +++++++++++++++++++
>  2 files changed, 26 insertions(+)
>  create mode 100644 package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index cec63a3715..7ce78742fc 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -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/
> diff --git a/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
> new file mode 100644
> index 0000000000..9b08ee0fec
> --- /dev/null
> +++ b/package/riscv64-elf-toolchain/riscv64-elf-toolchain.mk
> @@ -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

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

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

* [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
  2021-05-03  0:12   ` Alistair Francis
@ 2021-05-03  1:14   ` Alistair Francis
  1 sibling, 0 replies; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  1:14 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 7:22 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit introduces support for the RISC-V based BeagleV platform,
> which uses a Starfive JH7100.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  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
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 573d8d84de..cec63a3715 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2602,10 +2602,12 @@ F:      package/xorcurses/
>
>  N:     Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  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/
> diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
> new file mode 100644
> index 0000000000..c5444d094c
> --- /dev/null
> +++ b/board/beaglev/extlinux.conf
> @@ -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
> diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
> new file mode 100644
> index 0000000000..f38bb7f86c
> --- /dev/null
> +++ b/board/beaglev/genimage.cfg
> @@ -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"
> +  }
> +}
> diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> new file mode 100644
> index 0000000000..74d70f2721
> --- /dev/null
> +++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> @@ -0,0 +1,39 @@
> +From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +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 <thomas.petazzoni@bootlin.com>
> +---
> + 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
> +
> diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
> new file mode 100755
> index 0000000000..04153cb3b6
> --- /dev/null
> +++ b/board/beaglev/post-build.sh
> @@ -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
> diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
> new file mode 100644
> index 0000000000..d8511d3fd1
> --- /dev/null
> +++ b/board/beaglev/readme.txt
> @@ -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.
> diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
> new file mode 100644
> index 0000000000..2320e2ca83
> --- /dev/null
> +++ b/configs/beaglev_defconfig
> @@ -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"

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

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

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

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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
  2021-05-03  0:14   ` Alistair Francis
@ 2021-05-03  6:17   ` Peter Korsgaard
  2021-05-03  6:57     ` Thomas Petazzoni
  1 sibling, 1 reply; 32+ messages in thread
From: Peter Korsgaard @ 2021-05-03  6:17 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> 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?

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  0:14   ` Alistair Francis
@ 2021-05-03  6:54     ` Thomas Petazzoni
  2021-05-03  7:11       ` Alistair Francis
  0 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-03  6:54 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 3 May 2021 10:14:38 +1000
Alistair Francis <alistair23@gmail.com> wrote:

> > +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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  6:17   ` Peter Korsgaard
@ 2021-05-03  6:57     ` Thomas Petazzoni
  2021-05-03  7:09       ` Peter Korsgaard
  0 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-03  6:57 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 03 May 2021 08:17:33 +0200
Peter Korsgaard <peter@korsgaard.com> 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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  6:57     ` Thomas Petazzoni
@ 2021-05-03  7:09       ` Peter Korsgaard
  0 siblings, 0 replies; 32+ messages in thread
From: Peter Korsgaard @ 2021-05-03  7:09 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > Hello,
 > On Mon, 03 May 2021 08:17:33 +0200
 > Peter Korsgaard <peter@korsgaard.com> 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.

Ok, thanks for the description.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  6:54     ` Thomas Petazzoni
@ 2021-05-03  7:11       ` Alistair Francis
  2021-05-03  7:13         ` Thomas Petazzoni
  0 siblings, 1 reply; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  7:11 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 4:54 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Mon, 3 May 2021 10:14:38 +1000
> Alistair Francis <alistair23@gmail.com> wrote:
>
> > > +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.

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

Alistair

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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  7:11       ` Alistair Francis
@ 2021-05-03  7:13         ` Thomas Petazzoni
  2021-05-03  7:29           ` Alistair Francis
  0 siblings, 1 reply; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-03  7:13 UTC (permalink / raw)
  To: buildroot

On Mon, 3 May 2021 17:11:09 +1000
Alistair Francis <alistair23@gmail.com> wrote:

> > 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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
@ 2021-05-03  7:18   ` Drew Fustini
  2021-05-03  7:32     ` Thomas Petazzoni
  0 siblings, 1 reply; 32+ messages in thread
From: Drew Fustini @ 2021-05-03  7:18 UTC (permalink / raw)
  To: buildroot

On Sun, May 02, 2021 at 11:21:41PM +0200, Thomas Petazzoni wrote:
> This commit extends the beaglev_defconfig and its documentation to
> build the low-level firmware, and explain how to reflash it.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
>  configs/beaglev_defconfig |  2 ++
>  2 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
> index d8511d3fd1..a3adaba3ae 100644
> --- a/board/beaglev/readme.txt
> +++ b/board/beaglev/readme.txt
> @@ -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.

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

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

* [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package
  2021-05-03  7:13         ` Thomas Petazzoni
@ 2021-05-03  7:29           ` Alistair Francis
  0 siblings, 0 replies; 32+ messages in thread
From: Alistair Francis @ 2021-05-03  7:29 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 5:13 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Mon, 3 May 2021 17:11:09 +1000
> Alistair Francis <alistair23@gmail.com> wrote:
>
> > > 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?

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

Alistair

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

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

* [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware
  2021-05-03  7:18   ` Drew Fustini
@ 2021-05-03  7:32     ` Thomas Petazzoni
  0 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-03  7:32 UTC (permalink / raw)
  To: buildroot

Hello Drew,

On Mon, 3 May 2021 00:18:32 -0700
Drew Fustini <drew@beagleboard.org> wrote:

> > +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 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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
  2021-05-03  0:08   ` Alistair Francis
@ 2021-05-03 11:26   ` Bin Meng
  1 sibling, 0 replies; 32+ messages in thread
From: Bin Meng @ 2021-05-03 11:26 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 5:21 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> 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.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  boot/opensbi/Config.in  | 20 ++++++++++++++++++++
>  boot/opensbi/opensbi.mk | 16 ++++++++++------
>  2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
> index 236bf74a90..55a644506f 100644
> --- a/boot/opensbi/Config.in
> +++ b/boot/opensbi/Config.in
> @@ -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.

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

> +
>  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.
>
> diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
> index 8ebe4566fd..f8cbbb8fcc 100644
> --- a/boot/opensbi/opensbi.mk
> +++ b/boot/opensbi/opensbi.mk
> @@ -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
> --

Otherwise LGTM:
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

* [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: new package
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
@ 2021-05-03 11:30   ` Bin Meng
  2021-05-03 11:53     ` Thomas Petazzoni
  0 siblings, 1 reply; 32+ messages in thread
From: Bin Meng @ 2021-05-03 11:30 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 5:21 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit adds a package for the DDR initialization code used on the
> BeagleV platform.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  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.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

* [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: new package
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
@ 2021-05-03 11:31   ` Bin Meng
  0 siblings, 0 replies; 32+ messages in thread
From: Bin Meng @ 2021-05-03 11:31 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 5:21 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> 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.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  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
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

* [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware
  2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
@ 2021-05-03 11:33   ` Bin Meng
  0 siblings, 0 replies; 32+ messages in thread
From: Bin Meng @ 2021-05-03 11:33 UTC (permalink / raw)
  To: buildroot

On Mon, May 3, 2021 at 5:21 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit extends the beaglev_defconfig and its documentation to
> build the low-level firmware, and explain how to reflash it.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  board/beaglev/readme.txt  | 38 ++++++++++++++++++++++++++++++++++++--
>  configs/beaglev_defconfig |  2 ++
>  2 files changed, 38 insertions(+), 2 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

* [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: new package
  2021-05-03 11:30   ` Bin Meng
@ 2021-05-03 11:53     ` Thomas Petazzoni
  0 siblings, 0 replies; 32+ messages in thread
From: Thomas Petazzoni @ 2021-05-03 11:53 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 3 May 2021 19:30:13 +0800
Bin Meng <bmeng.cn@gmail.com> 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.

> 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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2021-05-03 11:53 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02 21:21 [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
2021-05-03  0:08   ` Alistair Francis
2021-05-03 11:26   ` Bin Meng
2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
2021-05-03  0:12   ` Alistair Francis
2021-05-03  1:14   ` Alistair Francis
2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
2021-05-03 11:30   ` Bin Meng
2021-05-03 11:53     ` Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
2021-05-03 11:31   ` Bin Meng
2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
2021-05-03 11:33   ` Bin Meng
2021-05-02 21:21 ` [Buildroot] [PATCH v2 0/6] Support for the BeagleV platform Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 1/6] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 2/6] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 3/6] package/riscv64-elf-toolchain: new package Thomas Petazzoni
2021-05-03  0:14   ` Alistair Francis
2021-05-03  6:54     ` Thomas Petazzoni
2021-05-03  7:11       ` Alistair Francis
2021-05-03  7:13         ` Thomas Petazzoni
2021-05-03  7:29           ` Alistair Francis
2021-05-03  6:17   ` Peter Korsgaard
2021-05-03  6:57     ` Thomas Petazzoni
2021-05-03  7:09       ` Peter Korsgaard
2021-05-02 21:21 ` [Buildroot] [PATCH v2 4/6] boot/beaglev-ddrinit: " Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 5/6] boot/beaglev-secondboot: " Thomas Petazzoni
2021-05-02 21:21 ` [Buildroot] [PATCH v2 6/6] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
2021-05-03  7:18   ` Drew Fustini
2021-05-03  7:32     ` Thomas Petazzoni

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