Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead
@ 2024-02-11 12:08 Kilian Zinnecker via buildroot
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package Kilian Zinnecker via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kilian Zinnecker via buildroot @ 2024-02-11 12:08 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Robert Nelson, Kilian Zinnecker, Thomas Petazzoni

This patch series adds board support for the BeagleV-Ahead.

This patch series introduces a package which fetches binaries for the
SoC, i.e., one binary blob for an on-chip FPGA and one binary blob for
audio. Currently they are not used, but are intended to be used in the
future.

This board support generates an image suitable for SD card. The boot
command for uboot to boot the kernel could not easily be changed. It
seemed that a default boot command was persisent and any change to it
by normal means (e.g., uboot config parameters like
CONFIG_BOOT_COMMAND) did not have any effect. Hence a patch for the
custom u-boot is introduced for now, to insert the proper boot
command.

v2 -> v3:

  - Added brief description what the xuantie bin binaries are for
  - Unrolled loop in XUANTIE_BINS_INSTALL_IMAGES_CMDS of
    package/xuantie-bins/xuantie-bins.mk
  - Added a second product page link to board's readme.txt
  - Added URL to the product page to git commit message
  - Dropped "_CUSTOM" from all "BR2_RISCV_ISA_*" in the board's
    defconfig
  - Add description to the board's readme.txt and defconfig  why GCC
    v13 is chosen
  - Added BR2_PACKAGE_HOST_DOSFSTOOLS to board's defconfig

v1 -> v2:

  - Added hash file for xuantie-bins package
  - Now uses uEnv.txt for actual boot commands
  - Removed extlinux.conf
  - Removed superflous comments inside config files


Kilian Zinnecker (2):
  package/xuantie-bins: new package
  configs/beaglev_ahead: new defconfig

 DEVELOPERS                                    |  3 +
 board/beaglev-ahead/genimage.cfg              | 62 +++++++++++++++
 board/beaglev-ahead/linux.fragment            |  2 +
 .../0001-Overwrite-bootcmd-by-force.patch     | 30 +++++++
 board/beaglev-ahead/post-image.sh             |  6 ++
 board/beaglev-ahead/readme.txt                | 78 +++++++++++++++++++
 board/beaglev-ahead/uEnv.txt                  |  4 +
 board/beaglev-ahead/uboot.fragment            |  2 +
 configs/beaglev_ahead_defconfig               | 46 +++++++++++
 package/Config.in                             |  1 +
 package/xuantie-bins/Config.in                |  8 ++
 package/xuantie-bins/xuantie-bins.hash        |  1 +
 package/xuantie-bins/xuantie-bins.mk          | 23 ++++++
 13 files changed, 266 insertions(+)
 create mode 100644 board/beaglev-ahead/genimage.cfg
 create mode 100644 board/beaglev-ahead/linux.fragment
 create mode 100644 board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
 create mode 100755 board/beaglev-ahead/post-image.sh
 create mode 100644 board/beaglev-ahead/readme.txt
 create mode 100644 board/beaglev-ahead/uEnv.txt
 create mode 100644 board/beaglev-ahead/uboot.fragment
 create mode 100644 configs/beaglev_ahead_defconfig
 create mode 100644 package/xuantie-bins/Config.in
 create mode 100644 package/xuantie-bins/xuantie-bins.hash
 create mode 100644 package/xuantie-bins/xuantie-bins.mk

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package
  2024-02-11 12:08 [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Kilian Zinnecker via buildroot
@ 2024-02-11 12:08 ` Kilian Zinnecker via buildroot
  2024-02-13 17:49   ` Giulio Benetti
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig Kilian Zinnecker via buildroot
  2024-02-13 17:44 ` [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Giulio Benetti
  2 siblings, 1 reply; 8+ messages in thread
From: Kilian Zinnecker via buildroot @ 2024-02-11 12:08 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Robert Nelson, Kilian Zinnecker, Thomas Petazzoni

This patch adds a package for Xuantie binary blobs. These binaries
are needed for the BeagleV-Ahead.

Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
---
 DEVELOPERS                             |  1 +
 package/Config.in                      |  1 +
 package/xuantie-bins/Config.in         |  8 ++++++++
 package/xuantie-bins/xuantie-bins.hash |  1 +
 package/xuantie-bins/xuantie-bins.mk   | 23 +++++++++++++++++++++++
 5 files changed, 34 insertions(+)
 create mode 100644 package/xuantie-bins/Config.in
 create mode 100644 package/xuantie-bins/xuantie-bins.hash
 create mode 100644 package/xuantie-bins/xuantie-bins.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 1c6c84b05b..fa0596fd6b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1894,6 +1894,7 @@ F:	board/radxa/rock5b/
 F:	configs/rock5b_defconfig
 F:	configs/avnet_rzboard_v2l_defconfig
 F:	package/rockchip-rkbin/
+F:	package/xuantie-bins/
 
 N:	Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
 F:	package/wqy-zenhei/
diff --git a/package/Config.in b/package/Config.in
index 91a6f1de00..5e28fb6e88 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -657,6 +657,7 @@ endmenu
 	source "package/wipe/Config.in"
 	source "package/xorriso/Config.in"
 	source "package/xr819-xradio/Config.in"
+	source "package/xuantie-bins/Config.in"
 endmenu
 
 menu "Interpreter languages and scripting"
diff --git a/package/xuantie-bins/Config.in b/package/xuantie-bins/Config.in
new file mode 100644
index 0000000000..40388edd06
--- /dev/null
+++ b/package/xuantie-bins/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_XUANTIE_BINS
+	bool "xuantie-bins"
+	depends on BR2_riscv
+	help
+	  This package provides binary blobs, needed for the
+	  BeagleV-Ahead's SoC (TH1520). They contain an FPGA binary
+          (light_aon_fpga.bin) for power management and a binary for
+          the audio system (light_c906_audio.bin).
diff --git a/package/xuantie-bins/xuantie-bins.hash b/package/xuantie-bins/xuantie-bins.hash
new file mode 100644
index 0000000000..4d1ec297c9
--- /dev/null
+++ b/package/xuantie-bins/xuantie-bins.hash
@@ -0,0 +1 @@
+sha256  608e9fec79823996004f65ba692a76d741307b0de23552d147ad1b567e7054dc  xuantie-bins-0a2e02bb53758cc12448d8670e65c854528a96b4-br1.tar.gz
diff --git a/package/xuantie-bins/xuantie-bins.mk b/package/xuantie-bins/xuantie-bins.mk
new file mode 100644
index 0000000000..6db18685bc
--- /dev/null
+++ b/package/xuantie-bins/xuantie-bins.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# xuantie-bins
+#
+################################################################################
+
+XUANTIE_BINS_VERSION = 0a2e02bb53758cc12448d8670e65c854528a96b4
+XUANTIE_BINS_SITE = https://github.com/beagleboard/xuantie-ubuntu.git
+XUANTIE_BINS_SITE_METHOD = git
+XUANTIE_BINS_LICENSE = PROPRIETARY
+
+XUANTIE_BINS_INSTALL_IMAGES = YES
+XUANTIE_BINS_INSTALL_TARGET = NO
+
+XUANTIE_BINS_FPGA_BIN_FILENAME = "bins/light_aon_fpga.bin"
+XUANTIE_BINS_AUDIO_BIN_FILENAME = "bins/light_c906_audio.bin"
+
+define XUANTIE_BINS_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 -t $(BINARIES_DIR) $(@D)/$(XUANTIE_BINS_FPGA_BIN_FILENAME)
+	$(INSTALL) -D -m 0644 -t $(BINARIES_DIR) $(@D)/$(XUANTIE_BINS_AUDIO_BIN_FILENAME)
+endef
+
+$(eval $(generic-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig
  2024-02-11 12:08 [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Kilian Zinnecker via buildroot
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package Kilian Zinnecker via buildroot
@ 2024-02-11 12:08 ` Kilian Zinnecker via buildroot
  2024-02-13 18:06   ` Giulio Benetti
  2024-02-13 17:44 ` [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Giulio Benetti
  2 siblings, 1 reply; 8+ messages in thread
From: Kilian Zinnecker via buildroot @ 2024-02-11 12:08 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Robert Nelson, Kilian Zinnecker, Thomas Petazzoni

This patch adds board support for the BeagleV-Ahead. It uses a
custom kernel for the board's SoC. As the SoC has an outdated and
currently not supported version of the RISC-V vector extension, the
vector extension is disabled. The used OpenSBI version for this board
support does not define the neccessary flags for GCC 12 to activate
the zicsr and zifencei extensions. Therefore this board support uses
GCC 13.

https://www.beagleboard.org/boards/beaglev-ahead
Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
---
 DEVELOPERS                                    |  2 +
 board/beaglev-ahead/genimage.cfg              | 62 +++++++++++++++
 board/beaglev-ahead/linux.fragment            |  2 +
 .../0001-Overwrite-bootcmd-by-force.patch     | 30 +++++++
 board/beaglev-ahead/post-image.sh             |  6 ++
 board/beaglev-ahead/readme.txt                | 78 +++++++++++++++++++
 board/beaglev-ahead/uEnv.txt                  |  4 +
 board/beaglev-ahead/uboot.fragment            |  2 +
 configs/beaglev_ahead_defconfig               | 46 +++++++++++
 9 files changed, 232 insertions(+)
 create mode 100644 board/beaglev-ahead/genimage.cfg
 create mode 100644 board/beaglev-ahead/linux.fragment
 create mode 100644 board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
 create mode 100755 board/beaglev-ahead/post-image.sh
 create mode 100644 board/beaglev-ahead/readme.txt
 create mode 100644 board/beaglev-ahead/uEnv.txt
 create mode 100644 board/beaglev-ahead/uboot.fragment
 create mode 100644 configs/beaglev_ahead_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index fa0596fd6b..3ede2a111d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1890,9 +1890,11 @@ F:	package/libcamera/
 
 N:	Kilian Zinnecker <kilian.zinnecker@mail.de>
 F:	board/avnet/rzboard_v2l/
+F:	board/beaglev-ahead/
 F:	board/radxa/rock5b/
 F:	configs/rock5b_defconfig
 F:	configs/avnet_rzboard_v2l_defconfig
+F:	configs/beaglev_ahead_defconfig
 F:	package/rockchip-rkbin/
 F:	package/xuantie-bins/
 
diff --git a/board/beaglev-ahead/genimage.cfg b/board/beaglev-ahead/genimage.cfg
new file mode 100644
index 0000000000..080b169527
--- /dev/null
+++ b/board/beaglev-ahead/genimage.cfg
@@ -0,0 +1,62 @@
+# SD card image for BeagleV-Ahead
+
+image boot.vfat {
+	vfat {
+		files = {
+			"fw_dynamic.bin",
+			"Image",
+			"light_aon_fpga.bin",
+			"light-beagle.dtb",
+			"light_c906_audio.bin",
+		}
+
+		file uEnv.txt {
+			image = "uEnv.txt"
+		}
+
+		file overlays/BBORG_LOAD-00A2.dtbo {
+			image = "overlays/BBORG_LOAD-00A2.dtbo"
+		}
+
+		file overlays/BBORG_RELAY-00A2.dtbo {
+			image = "overlays/BBORG_RELAY-00A2.dtbo"
+		}
+
+		file overlays/BONE-LED_P8_03.dtbo {
+			image = "overlays/BONE-LED_P8_03.dtbo"
+		}
+
+		file overlays/BONE-LED_P9_11.dtbo {
+			image = "overlays/BONE-LED_P9_11.dtbo"
+		}
+
+		file overlays/BVA-MIKROBUS-0.dtbo {
+			image = "overlays/BVA-MIKROBUS-0.dtbo"
+		}
+	}
+	size = 48M
+}
+
+image sdcard.img {
+	hdimage {
+		partition-table-type = "gpt"
+		gpt-location = 2M
+	}
+
+	partition uboot {
+		in-partition-table = "false"
+		image = "u-boot-with-spl.bin"
+		offset = 0
+		holes = {"(440; 1048576)"}
+	}
+
+	partition boot {
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		image = "rootfs.ext2"
+	}
+}
+
diff --git a/board/beaglev-ahead/linux.fragment b/board/beaglev-ahead/linux.fragment
new file mode 100644
index 0000000000..00f93f39a4
--- /dev/null
+++ b/board/beaglev-ahead/linux.fragment
@@ -0,0 +1,2 @@
+# CONFIG_VECTOR is not set
+# CONFIG_VECTOR_0_7 is not set
diff --git a/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
new file mode 100644
index 0000000000..bcf5b965ce
--- /dev/null
+++ b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
@@ -0,0 +1,30 @@
+From 81db2d155db74192e127ae1d98dd4ec415f53dd3 Mon Sep 17 00:00:00 2001
+From: Kilian Zinnecker <kilian.zinnecker@mail.de>
+Date: Mon, 21 Aug 2023 23:51:59 +0200
+Subject: [PATCH] Overwrite bootcmd by force
+
+This patch is a dirty hack: Trying to overwrite the bootcmd via the
+usual BOOT_COMMAND had no effect: Upon boot the bootcmd defaulted
+to some preset value and could not be changed easily. Therefore a
+hook is used to force the bootcmd to be overwritten.
+
+Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
+---
+ board/thead/light-c910/light.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/board/thead/light-c910/light.c b/board/thead/light-c910/light.c
+index 8d5478e916..1448db974e 100644
+--- a/board/thead/light-c910/light.c
++++ b/board/thead/light-c910/light.c
+@@ -2282,6 +2282,7 @@ int board_late_init(void)
+ 	light_usb_boot_check();
+ 	do_firmware_load();
+ 	ap_peri_clk_disable();
++	run_command("load mmc 1:1 $ramdisk_addr_r uEnv.txt; env import -t $ramdisk_addr_r $filesize; run uenvcmd", 0);
+ 	return 0;
+ }
+
+--
+2.34.1
+
diff --git a/board/beaglev-ahead/post-image.sh b/board/beaglev-ahead/post-image.sh
new file mode 100755
index 0000000000..9e16eeff3f
--- /dev/null
+++ b/board/beaglev-ahead/post-image.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -e
+
+cp -r ${BUILD_DIR}/linux-custom/arch/riscv/boot/dts/thead/overlays/ ${BINARIES_DIR}
+cp board/beaglev-ahead/uEnv.txt ${BINARIES_DIR}/
+support/scripts/genimage.sh -c board/beaglev-ahead/genimage.cfg
diff --git a/board/beaglev-ahead/readme.txt b/board/beaglev-ahead/readme.txt
new file mode 100644
index 0000000000..758082a792
--- /dev/null
+++ b/board/beaglev-ahead/readme.txt
@@ -0,0 +1,78 @@
+BeagleV-Ahead
+==============
+https://www.beagleboard.org/boards/beaglev-ahead
+https://forum.beagleboard.org/c/beaglev/
+
+The SoC (TH1520) of the BeagleV-Ahead implements an outdated and
+currently not supported version of the RISC-V vector extension. Hence,
+the vector extension is disabled. The used OpenSBI version for this
+board support does not define the neccessary flags for GCC 12 to
+activate the zicsr and zifencei extensions. Therefore this board
+support uses GCC 13.
+
+Build:
+======
+  $ make beaglev_ahead_defconfig
+  $ make
+
+Files created in output directory
+=================================
+
+output/images
+.
+├── boot.vfat
+├── bootloader-JH7100-buildroot.bin.out
+├── ddrinit-2133-buildroot.bin.out
+├── fw_dynamic.bin
+├── fw_dynamic.elf
+├── fw_jump.bin
+├── fw_jump.elf
+├── fw_payload.bin
+├── fw_payload.elf
+├── Image
+├── light-beagle.dtb
+├── light_aon_fpga.bin
+├── light_c906_audio.bin
+├── overlays
+├── rootfs.ext2
+├── rootfs.ext4
+├── rootfs.tar
+├── sdcard.img
+├── u-boot-with-spl.bin
+├── u-boot.bin
+└── uEnv.txt
+
+Creating bootable SD card:
+==========================
+
+Simply invoke (as root)
+
+sudo dd if=output/images/sdcard.img of=/dev/sdX && sync
+
+Where X is your SD card device.
+
+Booting:
+========
+
+SD card boot button:
+--------------------
+To let the board boot from SD card, keep the "SD button" pressed during power
+up / power cycle. The button is near the SD card slot.
+
+Serial console:
+---------------
+The BeagleV-Ahead has a "Debug" GPIO header. Its layout can be seen here:
+https://docs.beagleboard.org/latest/boards/beaglev/ahead/02-quick-start.html#access-uart-debug-console
+
+Note, that there are reported issues with some uart interface cables/dongles:
+https://forum.beagleboard.org/t/beaglev-ahead-debug-terminal-problems/35331
+
+Baudrate for this board is 115200.
+
+Login:
+------
+Enter 'root' as login user, and the prompt is ready.
+
+wiki link:
+----------
+https://docs.beagleboard.org/latest/boards/beaglev/ahead/index.html
diff --git a/board/beaglev-ahead/uEnv.txt b/board/beaglev-ahead/uEnv.txt
new file mode 100644
index 0000000000..7e98ae5f81
--- /dev/null
+++ b/board/beaglev-ahead/uEnv.txt
@@ -0,0 +1,4 @@
+bootcmd=booti ${kernel_addr_r} - ${fdt_addr_r}
+uenvcmd=fatload mmc 1:1 ${kernel_addr_r} Image; fatload mmc 1:1 ${fdt_addr_r} light-beagle.dtb
+bootargs=root=/dev/mmcblk1p2 rootfstype=ext4 rootwait ro console=ttyS0,115200 earlycon clk_ignore_unused net.ifnames=0
+
diff --git a/board/beaglev-ahead/uboot.fragment b/board/beaglev-ahead/uboot.fragment
new file mode 100644
index 0000000000..1f51cef106
--- /dev/null
+++ b/board/beaglev-ahead/uboot.fragment
@@ -0,0 +1,2 @@
+CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_AUTOBOOT=y
diff --git a/configs/beaglev_ahead_defconfig b/configs/beaglev_ahead_defconfig
new file mode 100644
index 0000000000..9000b1f0ad
--- /dev/null
+++ b/configs/beaglev_ahead_defconfig
@@ -0,0 +1,46 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_RVM=y
+BR2_RISCV_ISA_RVA=y
+BR2_RISCV_ISA_RVF=y
+BR2_RISCV_ISA_RVD=y
+BR2_RISCV_ISA_RVC=y
+# Use GCC 13 for OpenSBI zicsr zifencei issue
+BR2_GCC_VERSION_13_X=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev-ahead/patches"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev-ahead/post-image.sh"
+BR2_TARGET_GENERIC_HOSTNAME="BeagleV-Ahead"
+BR2_TARGET_GENERIC_ISSUE="Welcome to the BeagleV-Ahead"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/linux/archive/refs/heads/beaglev-v5.10.113-1.1.2-ubuntu.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="beaglev"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="thead/light-beagle"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/beaglev-ahead/linux.fragment"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_BEAGLEV_DDRINIT=y
+BR2_TARGET_BEAGLEV_SECONDBOOT=y
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/beaglev-ahead-opensbi/archive/refs/heads/0.9-1.1.2-ubuntu.tar.gz"
+BR2_TARGET_OPENSBI_PLAT="generic"
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/beaglev-ahead-u-boot/archive/refs/heads/beaglev-v2020.01-1.1.2-ubuntu.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="light_beagle"
+BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/beaglev-ahead/uboot.fragment"
+BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-with-spl.bin"
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_XUANTIE_BINS=y
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead
  2024-02-11 12:08 [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Kilian Zinnecker via buildroot
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package Kilian Zinnecker via buildroot
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig Kilian Zinnecker via buildroot
@ 2024-02-13 17:44 ` Giulio Benetti
  2 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2024-02-13 17:44 UTC (permalink / raw)
  To: Kilian Zinnecker, buildroot; +Cc: Robert Nelson, Thomas Petazzoni

Hi Kilian,

On 11/02/24 13:08, Kilian Zinnecker via buildroot wrote:
> This patch series adds board support for the BeagleV-Ahead.
> 
> This patch series introduces a package which fetches binaries for the
> SoC, i.e., one binary blob for an on-chip FPGA and one binary blob for
> audio. Currently they are not used, but are intended to be used in the
> future.
> 
> This board support generates an image suitable for SD card. The boot
> command for uboot to boot the kernel could not easily be changed. It
> seemed that a default boot command was persisent and any change to it
> by normal means (e.g., uboot config parameters like
> CONFIG_BOOT_COMMAND) did not have any effect. Hence a patch for the
> custom u-boot is introduced for now, to insert the proper boot
> command.
> 

please report the patches changelogs in the patches most of all.
It's useful there while reviewing, more than here where it should be
a brief explanation.

Thank you
Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas

> v2 -> v3:
> 
>    - Added brief description what the xuantie bin binaries are for
>    - Unrolled loop in XUANTIE_BINS_INSTALL_IMAGES_CMDS of
>      package/xuantie-bins/xuantie-bins.mk
>    - Added a second product page link to board's readme.txt
>    - Added URL to the product page to git commit message
>    - Dropped "_CUSTOM" from all "BR2_RISCV_ISA_*" in the board's
>      defconfig
>    - Add description to the board's readme.txt and defconfig  why GCC
>      v13 is chosen
>    - Added BR2_PACKAGE_HOST_DOSFSTOOLS to board's defconfig
> 
> v1 -> v2:
> 
>    - Added hash file for xuantie-bins package
>    - Now uses uEnv.txt for actual boot commands
>    - Removed extlinux.conf
>    - Removed superflous comments inside config files
> 
> 
> Kilian Zinnecker (2):
>    package/xuantie-bins: new package
>    configs/beaglev_ahead: new defconfig
> 
>   DEVELOPERS                                    |  3 +
>   board/beaglev-ahead/genimage.cfg              | 62 +++++++++++++++
>   board/beaglev-ahead/linux.fragment            |  2 +
>   .../0001-Overwrite-bootcmd-by-force.patch     | 30 +++++++
>   board/beaglev-ahead/post-image.sh             |  6 ++
>   board/beaglev-ahead/readme.txt                | 78 +++++++++++++++++++
>   board/beaglev-ahead/uEnv.txt                  |  4 +
>   board/beaglev-ahead/uboot.fragment            |  2 +
>   configs/beaglev_ahead_defconfig               | 46 +++++++++++
>   package/Config.in                             |  1 +
>   package/xuantie-bins/Config.in                |  8 ++
>   package/xuantie-bins/xuantie-bins.hash        |  1 +
>   package/xuantie-bins/xuantie-bins.mk          | 23 ++++++
>   13 files changed, 266 insertions(+)
>   create mode 100644 board/beaglev-ahead/genimage.cfg
>   create mode 100644 board/beaglev-ahead/linux.fragment
>   create mode 100644 board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
>   create mode 100755 board/beaglev-ahead/post-image.sh
>   create mode 100644 board/beaglev-ahead/readme.txt
>   create mode 100644 board/beaglev-ahead/uEnv.txt
>   create mode 100644 board/beaglev-ahead/uboot.fragment
>   create mode 100644 configs/beaglev_ahead_defconfig
>   create mode 100644 package/xuantie-bins/Config.in
>   create mode 100644 package/xuantie-bins/xuantie-bins.hash
>   create mode 100644 package/xuantie-bins/xuantie-bins.mk
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package Kilian Zinnecker via buildroot
@ 2024-02-13 17:49   ` Giulio Benetti
  0 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2024-02-13 17:49 UTC (permalink / raw)
  To: Kilian Zinnecker, buildroot; +Cc: Robert Nelson, Thomas Petazzoni

Hi Kilian,

On 11/02/24 13:08, Kilian Zinnecker via buildroot wrote:
> This patch adds a package for Xuantie binary blobs. These binaries
> are needed for the BeagleV-Ahead.

Please report here the same description you point in Config.in

> 
> Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
> ---
>   DEVELOPERS                             |  1 +
>   package/Config.in                      |  1 +
>   package/xuantie-bins/Config.in         |  8 ++++++++
>   package/xuantie-bins/xuantie-bins.hash |  1 +
>   package/xuantie-bins/xuantie-bins.mk   | 23 +++++++++++++++++++++++
>   5 files changed, 34 insertions(+)
>   create mode 100644 package/xuantie-bins/Config.in
>   create mode 100644 package/xuantie-bins/xuantie-bins.hash
>   create mode 100644 package/xuantie-bins/xuantie-bins.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 1c6c84b05b..fa0596fd6b 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1894,6 +1894,7 @@ F:	board/radxa/rock5b/
>   F:	configs/rock5b_defconfig
>   F:	configs/avnet_rzboard_v2l_defconfig

Can you please send a patch to alphabetize the 2 lines above?

>   F:	package/rockchip-rkbin/
> +F:	package/xuantie-bins/
>   
>   N:	Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
>   F:	package/wqy-zenhei/
> diff --git a/package/Config.in b/package/Config.in
> index 91a6f1de00..5e28fb6e88 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -657,6 +657,7 @@ endmenu
>   	source "package/wipe/Config.in"
>   	source "package/xorriso/Config.in"
>   	source "package/xr819-xradio/Config.in"
> +	source "package/xuantie-bins/Config.in"
>   endmenu
>   
>   menu "Interpreter languages and scripting"
> diff --git a/package/xuantie-bins/Config.in b/package/xuantie-bins/Config.in
> new file mode 100644
> index 0000000000..40388edd06
> --- /dev/null
> +++ b/package/xuantie-bins/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_XUANTIE_BINS
> +	bool "xuantie-bins"
> +	depends on BR2_riscv
> +	help
> +	  This package provides binary blobs, needed for the
> +	  BeagleV-Ahead's SoC (TH1520). They contain an FPGA binary
> +          (light_aon_fpga.bin) for power management and a binary for
> +          the audio system (light_c906_audio.bin).

the 2 lines above have 4 useless empty spaces, please remove them

> diff --git a/package/xuantie-bins/xuantie-bins.hash b/package/xuantie-bins/xuantie-bins.hash
> new file mode 100644
> index 0000000000..4d1ec297c9
> --- /dev/null
> +++ b/package/xuantie-bins/xuantie-bins.hash
> @@ -0,0 +1 @@
> +sha256  608e9fec79823996004f65ba692a76d741307b0de23552d147ad1b567e7054dc  xuantie-bins-0a2e02bb53758cc12448d8670e65c854528a96b4-br1.tar.gz
> diff --git a/package/xuantie-bins/xuantie-bins.mk b/package/xuantie-bins/xuantie-bins.mk
> new file mode 100644
> index 0000000000..6db18685bc
> --- /dev/null
> +++ b/package/xuantie-bins/xuantie-bins.mk
> @@ -0,0 +1,23 @@
> +################################################################################
> +#
> +# xuantie-bins
> +#
> +################################################################################
> +
> +XUANTIE_BINS_VERSION = 0a2e02bb53758cc12448d8670e65c854528a96b4
> +XUANTIE_BINS_SITE = https://github.com/beagleboard/xuantie-ubuntu.git
> +XUANTIE_BINS_SITE_METHOD = git

Here ^^^ please use github helper instead of this, like:
https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/openswan/openswan.mk#L8

> +XUANTIE_BINS_LICENSE = PROPRIETARY
> +
> +XUANTIE_BINS_INSTALL_IMAGES = YES
> +XUANTIE_BINS_INSTALL_TARGET = NO
> +
> +XUANTIE_BINS_FPGA_BIN_FILENAME = "bins/light_aon_fpga.bin"
> +XUANTIE_BINS_AUDIO_BIN_FILENAME = "bins/light_c906_audio.bin"

The 2 lines above are useless now since you use them only once so please
drop them

> +
> +define XUANTIE_BINS_INSTALL_IMAGES_CMDS
> +	$(INSTALL) -D -m 0644 -t $(BINARIES_DIR) $(@D)/$(XUANTIE_BINS_FPGA_BIN_FILENAME)
> +	$(INSTALL) -D -m 0644 -t $(BINARIES_DIR) $(@D)/$(XUANTIE_BINS_AUDIO_BIN_FILENAME)
> +endef
> +
> +$(eval $(generic-package))

Can you please send a V4 with such corrections?

Thank you

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig
  2024-02-11 12:08 ` [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig Kilian Zinnecker via buildroot
@ 2024-02-13 18:06   ` Giulio Benetti
  2024-02-14 23:03     ` kilian.zinnecker--- via buildroot
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2024-02-13 18:06 UTC (permalink / raw)
  To: Kilian Zinnecker, buildroot; +Cc: Robert Nelson, Thomas Petazzoni

Hi Kilian,

On 11/02/24 13:08, Kilian Zinnecker wrote:
> This patch adds board support for the BeagleV-Ahead. It uses a
> custom kernel for the board's SoC. As the SoC has an outdated and
> currently not supported version of the RISC-V vector extension, the
> vector extension is disabled. The used OpenSBI version for this board
> support does not define the neccessary flags for GCC 12 to activate
> the zicsr and zifencei extensions. Therefore this board support uses
> GCC 13.
> 
> https://www.beagleboard.org/boards/beaglev-ahead

Please add newline here

> Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
> ---
>   DEVELOPERS                                    |  2 +
>   board/beaglev-ahead/genimage.cfg              | 62 +++++++++++++++
>   board/beaglev-ahead/linux.fragment            |  2 +
>   .../0001-Overwrite-bootcmd-by-force.patch     | 30 +++++++
>   board/beaglev-ahead/post-image.sh             |  6 ++
>   board/beaglev-ahead/readme.txt                | 78 +++++++++++++++++++
>   board/beaglev-ahead/uEnv.txt                  |  4 +
>   board/beaglev-ahead/uboot.fragment            |  2 +
>   configs/beaglev_ahead_defconfig               | 46 +++++++++++
>   9 files changed, 232 insertions(+)
>   create mode 100644 board/beaglev-ahead/genimage.cfg
>   create mode 100644 board/beaglev-ahead/linux.fragment
>   create mode 100644 board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
>   create mode 100755 board/beaglev-ahead/post-image.sh
>   create mode 100644 board/beaglev-ahead/readme.txt
>   create mode 100644 board/beaglev-ahead/uEnv.txt
>   create mode 100644 board/beaglev-ahead/uboot.fragment
>   create mode 100644 configs/beaglev_ahead_defconfig
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index fa0596fd6b..3ede2a111d 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1890,9 +1890,11 @@ F:	package/libcamera/
>   
>   N:	Kilian Zinnecker <kilian.zinnecker@mail.de>
>   F:	board/avnet/rzboard_v2l/
> +F:	board/beaglev-ahead/
>   F:	board/radxa/rock5b/
>   F:	configs/rock5b_defconfig
>   F:	configs/avnet_rzboard_v2l_defconfig

as told on previous patch need an "alphabetization" patch

> +F:	configs/beaglev_ahead_defconfig
>   F:	package/rockchip-rkbin/
>   F:	package/xuantie-bins/
>   
> diff --git a/board/beaglev-ahead/genimage.cfg b/board/beaglev-ahead/genimage.cfg
> new file mode 100644
> index 0000000000..080b169527
> --- /dev/null
> +++ b/board/beaglev-ahead/genimage.cfg
> @@ -0,0 +1,62 @@
> +# SD card image for BeagleV-Ahead
> +
> +image boot.vfat {
> +	vfat {
> +		files = {
> +			"fw_dynamic.bin",
> +			"Image",
> +			"light_aon_fpga.bin",
> +			"light-beagle.dtb",
> +			"light_c906_audio.bin",
> +		}
> +
> +		file uEnv.txt {
> +			image = "uEnv.txt"
> +		}
> +
> +		file overlays/BBORG_LOAD-00A2.dtbo {
> +			image = "overlays/BBORG_LOAD-00A2.dtbo"
> +		}
> +
> +		file overlays/BBORG_RELAY-00A2.dtbo {
> +			image = "overlays/BBORG_RELAY-00A2.dtbo"
> +		}
> +
> +		file overlays/BONE-LED_P8_03.dtbo {
> +			image = "overlays/BONE-LED_P8_03.dtbo"
> +		}
> +
> +		file overlays/BONE-LED_P9_11.dtbo {
> +			image = "overlays/BONE-LED_P9_11.dtbo"
> +		}
> +
> +		file overlays/BVA-MIKROBUS-0.dtbo {
> +			image = "overlays/BVA-MIKROBUS-0.dtbo"
> +		}
> +	}
> +	size = 48M
> +}
> +
> +image sdcard.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +		gpt-location = 2M
> +	}
> +
> +	partition uboot {
> +		in-partition-table = "false"
> +		image = "u-boot-with-spl.bin"
> +		offset = 0
> +		holes = {"(440; 1048576)"}
> +	}
> +
> +	partition boot {
> +		bootable = "true"
> +		image = "boot.vfat"
> +	}
> +
> +	partition rootfs {
> +		image = "rootfs.ext2"
> +	}
> +}
> +
> diff --git a/board/beaglev-ahead/linux.fragment b/board/beaglev-ahead/linux.fragment
> new file mode 100644
> index 0000000000..00f93f39a4
> --- /dev/null
> +++ b/board/beaglev-ahead/linux.fragment
> @@ -0,0 +1,2 @@
> +# CONFIG_VECTOR is not set
> +# CONFIG_VECTOR_0_7 is not set
> diff --git a/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
> new file mode 100644
> index 0000000000..bcf5b965ce
> --- /dev/null
> +++ b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
> @@ -0,0 +1,30 @@
> +From 81db2d155db74192e127ae1d98dd4ec415f53dd3 Mon Sep 17 00:00:00 2001
> +From: Kilian Zinnecker <kilian.zinnecker@mail.de>
> +Date: Mon, 21 Aug 2023 23:51:59 +0200
> +Subject: [PATCH] Overwrite bootcmd by force
> +
> +This patch is a dirty hack: Trying to overwrite the bootcmd via the
> +usual BOOT_COMMAND had no effect: Upon boot the bootcmd defaulted
> +to some preset value and could not be changed easily. Therefore a
> +hook is used to force the bootcmd to be overwritten.

This is strange because if so also the bootcmd content of uEnv.txt below
should be skipped, or maybe there is a bug in this u-boot that evaluates
bootcmd too early without taking into account environment variables.
But I'm also noticing that you have your Environment variables in Fat,
but it depends how u-boot deals with environment variables. Usually
you have to specificy an offset in memory where environment variables
live.

But I see in your "make uboot-menuconfig" that CONFIG_ENV_IS_IN_FAT is
not enabled, but only CONFIG_ENV_IS_IN_MMC is and you have to specify:
CONFIG_ENV_OFFSET
CONFIG_ENV_SIZE

So if you want to go with vfat way you need to enable
CONFIG_ENV_IS_IN_FAT and specify:
CONFIG_ENV_FAT_INTERFACE
CONFIG_ENV_FAT_DEVICE_AND_PART
and most of all:
CONFIG_ENV_FAT_FILE=uEnv.txt
in uboot.fragment below

I would go with this last way instead of adding such dirty hack, can you
work on that?

> +
> +Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
> +---
> + board/thead/light-c910/light.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/board/thead/light-c910/light.c b/board/thead/light-c910/light.c
> +index 8d5478e916..1448db974e 100644
> +--- a/board/thead/light-c910/light.c
> ++++ b/board/thead/light-c910/light.c
> +@@ -2282,6 +2282,7 @@ int board_late_init(void)
> + 	light_usb_boot_check();
> + 	do_firmware_load();
> + 	ap_peri_clk_disable();
> ++	run_command("load mmc 1:1 $ramdisk_addr_r uEnv.txt; env import -t $ramdisk_addr_r $filesize; run uenvcmd", 0);
> + 	return 0;
> + }
> +
> +--
> +2.34.1
> +
> diff --git a/board/beaglev-ahead/post-image.sh b/board/beaglev-ahead/post-image.sh
> new file mode 100755
> index 0000000000..9e16eeff3f
> --- /dev/null
> +++ b/board/beaglev-ahead/post-image.sh
> @@ -0,0 +1,6 @@
> +#!/usr/bin/env bash
> +set -e
> +
> +cp -r ${BUILD_DIR}/linux-custom/arch/riscv/boot/dts/thead/overlays/ ${BINARIES_DIR}
> +cp board/beaglev-ahead/uEnv.txt ${BINARIES_DIR}/
> +support/scripts/genimage.sh -c board/beaglev-ahead/genimage.cfg
> diff --git a/board/beaglev-ahead/readme.txt b/board/beaglev-ahead/readme.txt
> new file mode 100644
> index 0000000000..758082a792
> --- /dev/null
> +++ b/board/beaglev-ahead/readme.txt
> @@ -0,0 +1,78 @@
> +BeagleV-Ahead
> +==============
> +https://www.beagleboard.org/boards/beaglev-ahead
> +https://forum.beagleboard.org/c/beaglev/
> +
> +The SoC (TH1520) of the BeagleV-Ahead implements an outdated and
> +currently not supported version of the RISC-V vector extension. Hence,
> +the vector extension is disabled. The used OpenSBI version for this
> +board support does not define the neccessary flags for GCC 12 to
> +activate the zicsr and zifencei extensions. Therefore this board
> +support uses GCC 13.
> +
> +Build:
> +======
> +  $ make beaglev_ahead_defconfig
> +  $ make
> +
> +Files created in output directory
> +=================================
> +
> +output/images
> +.
> +├── boot.vfat
> +├── bootloader-JH7100-buildroot.bin.out
> +├── ddrinit-2133-buildroot.bin.out
> +├── fw_dynamic.bin
> +├── fw_dynamic.elf
> +├── fw_jump.bin
> +├── fw_jump.elf
> +├── fw_payload.bin
> +├── fw_payload.elf
> +├── Image
> +├── light-beagle.dtb
> +├── light_aon_fpga.bin
> +├── light_c906_audio.bin
> +├── overlays
> +├── rootfs.ext2
> +├── rootfs.ext4
> +├── rootfs.tar
> +├── sdcard.img
> +├── u-boot-with-spl.bin
> +├── u-boot.bin
> +└── uEnv.txt
> +
> +Creating bootable SD card:
> +==========================
> +
> +Simply invoke (as root)
> +
> +sudo dd if=output/images/sdcard.img of=/dev/sdX && sync
> +
> +Where X is your SD card device.
> +
> +Booting:
> +========
> +
> +SD card boot button:
> +--------------------
> +To let the board boot from SD card, keep the "SD button" pressed during power
> +up / power cycle. The button is near the SD card slot.
> +
> +Serial console:
> +---------------
> +The BeagleV-Ahead has a "Debug" GPIO header. Its layout can be seen here:
> +https://docs.beagleboard.org/latest/boards/beaglev/ahead/02-quick-start.html#access-uart-debug-console
> +
> +Note, that there are reported issues with some uart interface cables/dongles:
> +https://forum.beagleboard.org/t/beaglev-ahead-debug-terminal-problems/35331
> +
> +Baudrate for this board is 115200.
> +
> +Login:
> +------
> +Enter 'root' as login user, and the prompt is ready.
> +
> +wiki link:
> +----------
> +https://docs.beagleboard.org/latest/boards/beaglev/ahead/index.html
> diff --git a/board/beaglev-ahead/uEnv.txt b/board/beaglev-ahead/uEnv.txt
> new file mode 100644
> index 0000000000..7e98ae5f81
> --- /dev/null
> +++ b/board/beaglev-ahead/uEnv.txt
> @@ -0,0 +1,4 @@
> +bootcmd=booti ${kernel_addr_r} - ${fdt_addr_r}
> +uenvcmd=fatload mmc 1:1 ${kernel_addr_r} Image; fatload mmc 1:1 ${fdt_addr_r} light-beagle.dtb
> +bootargs=root=/dev/mmcblk1p2 rootfstype=ext4 rootwait ro console=ttyS0,115200 earlycon clk_ignore_unused net.ifnames=0
> +
> diff --git a/board/beaglev-ahead/uboot.fragment b/board/beaglev-ahead/uboot.fragment
> new file mode 100644
> index 0000000000..1f51cef106
> --- /dev/null
> +++ b/board/beaglev-ahead/uboot.fragment
> @@ -0,0 +1,2 @@
> +CONFIG_LEGACY_IMAGE_FORMAT=y
> +CONFIG_AUTOBOOT=y
> diff --git a/configs/beaglev_ahead_defconfig b/configs/beaglev_ahead_defconfig
> new file mode 100644
> index 0000000000..9000b1f0ad
> --- /dev/null
> +++ b/configs/beaglev_ahead_defconfig
> @@ -0,0 +1,46 @@
> +BR2_riscv=y
> +BR2_riscv_custom=y
> +BR2_RISCV_ISA_RVM=y
> +BR2_RISCV_ISA_RVA=y
> +BR2_RISCV_ISA_RVF=y
> +BR2_RISCV_ISA_RVD=y
> +BR2_RISCV_ISA_RVC=y
> +# Use GCC 13 for OpenSBI zicsr zifencei issue
> +BR2_GCC_VERSION_13_X=y
> +BR2_GLOBAL_PATCH_DIR="board/beaglev-ahead/patches"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev-ahead/post-image.sh"
> +BR2_TARGET_GENERIC_HOSTNAME="BeagleV-Ahead"
> +BR2_TARGET_GENERIC_ISSUE="Welcome to the BeagleV-Ahead"
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/linux/archive/refs/heads/beaglev-v5.10.113-1.1.2-ubuntu.tar.gz"
> +BR2_LINUX_KERNEL_DEFCONFIG="beaglev"
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="thead/light-beagle"
> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/beaglev-ahead/linux.fragment"
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_BEAGLEV_DDRINIT=y
> +BR2_TARGET_BEAGLEV_SECONDBOOT=y
> +BR2_TARGET_OPENSBI=y
> +BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
> +BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/beaglev-ahead-opensbi/archive/refs/heads/0.9-1.1.2-ubuntu.tar.gz"
> +BR2_TARGET_OPENSBI_PLAT="generic"
> +BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/beagleboard/beaglev-ahead-u-boot/archive/refs/heads/beaglev-v2020.01-1.1.2-ubuntu.tar.gz"
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="light_beagle"
> +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/beaglev-ahead/uboot.fragment"
> +BR2_TARGET_UBOOT_FORMAT_BIN=y
> +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
> +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-with-spl.bin"
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_MTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_XUANTIE_BINS=y

Thank you!

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig
  2024-02-13 18:06   ` Giulio Benetti
@ 2024-02-14 23:03     ` kilian.zinnecker--- via buildroot
  2024-02-15 17:22       ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: kilian.zinnecker--- via buildroot @ 2024-02-14 23:03 UTC (permalink / raw)
  To: Kilian Zinnecker, buildroot
  Cc: Giulio Benetti, Robert Nelson, Thomas Petazzoni

Hello Giulio, all,

[--SNIP--]

> > a/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
> > b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
> > new file mode 100644
> > index 0000000000..bcf5b965ce
> > --- /dev/null
> > +++
> > b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
> > @@ -0,0 +1,30 @@
> > +From 81db2d155db74192e127ae1d98dd4ec415f53dd3 Mon Sep 17 00:00:00 2001
> > +From: Kilian Zinnecker <kilian.zinnecker@mail.de>
> > +Date: Mon, 21 Aug 2023 23:51:59 +0200
> > +Subject: [PATCH] Overwrite bootcmd by force
> > +
> > +This patch is a dirty hack: Trying to overwrite the bootcmd via the
> > +usual BOOT_COMMAND had no effect: Upon boot the bootcmd defaulted
> > +to some preset value and could not be changed easily. Therefore a
> > +hook is used to force the bootcmd to be overwritten.
> 
> This is strange because if so also the bootcmd content of uEnv.txt below
> should be skipped, or maybe there is a bug in this u-boot that evaluates
> bootcmd too early without taking into account environment variables.
> But I'm also noticing that you have your Environment variables in Fat,
> but it depends how u-boot deals with environment variables. Usually
> you have to specificy an offset in memory where environment variables
> live.
> 
> But I see in your "make uboot-menuconfig" that CONFIG_ENV_IS_IN_FAT is
> not enabled, but only CONFIG_ENV_IS_IN_MMC is and you have to specify:
> CONFIG_ENV_OFFSET
> CONFIG_ENV_SIZE
> 
> So if you want to go with vfat way you need to enable
> CONFIG_ENV_IS_IN_FAT and specify:
> CONFIG_ENV_FAT_INTERFACE
> CONFIG_ENV_FAT_DEVICE_AND_PART
> and most of all:
> CONFIG_ENV_FAT_FILE=uEnv.txt
> in uboot.fragment below
> 
> I would go with this last way instead of adding such dirty hack, can you
> work on that?

I tried, but so far I am not successful, maybe due to my lack of experience 
with uboot or maybe due to the customization of this particular uboot. I 
removed my custom-uboot patch and added the following configs to the 
uboot.fragment file, but it did not work yet:

# CONFIG_ENV_IS_IN_MMC is not set
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
CONFIG_ENV_FAT_FILE="uEnv.txt"

I also tried to use mainline uboot v2024.01, which features the Lichee Pi 4A, 
which features the same SoC, but this didn't work either. I had a look at the 
custom uboot source and it defines a lot of configs inside this header file:

https://openbeagle.org/beaglev-ahead/beaglev-ahead-u-boot/-/blob/beaglev-v2020.01-1.1.2-ubuntu/include/configs/light-c910.h?ref_type=heads#L363-388

I tried to remove the hard-coded bootcmd from this header, but that also 
didn't work. I don't understand the inner workings of uboot well enough yet to 
get it properly working, so I appreciate all hints and any help here.

However, I will already send a v4 of the patches, in which I try to address 
all the other issues.

Thanks again for reviewing and best regards,
Kilian


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig
  2024-02-14 23:03     ` kilian.zinnecker--- via buildroot
@ 2024-02-15 17:22       ` Giulio Benetti
  0 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2024-02-15 17:22 UTC (permalink / raw)
  To: kilian.zinnecker, buildroot; +Cc: Robert Nelson, Thomas Petazzoni

Hi Kilian,

On 15/02/24 00:03, kilian.zinnecker--- via buildroot wrote:
> Hello Giulio, all,
> 
> [--SNIP--]
> 
>>> a/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
>>> b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
>>> new file mode 100644
>>> index 0000000000..bcf5b965ce
>>> --- /dev/null
>>> +++
>>> b/board/beaglev-ahead/patches/uboot/0001-Overwrite-bootcmd-by-force.patch
>>> @@ -0,0 +1,30 @@
>>> +From 81db2d155db74192e127ae1d98dd4ec415f53dd3 Mon Sep 17 00:00:00 2001
>>> +From: Kilian Zinnecker <kilian.zinnecker@mail.de>
>>> +Date: Mon, 21 Aug 2023 23:51:59 +0200
>>> +Subject: [PATCH] Overwrite bootcmd by force
>>> +
>>> +This patch is a dirty hack: Trying to overwrite the bootcmd via the
>>> +usual BOOT_COMMAND had no effect: Upon boot the bootcmd defaulted
>>> +to some preset value and could not be changed easily. Therefore a
>>> +hook is used to force the bootcmd to be overwritten.
>>
>> This is strange because if so also the bootcmd content of uEnv.txt below
>> should be skipped, or maybe there is a bug in this u-boot that evaluates
>> bootcmd too early without taking into account environment variables.
>> But I'm also noticing that you have your Environment variables in Fat,
>> but it depends how u-boot deals with environment variables. Usually
>> you have to specificy an offset in memory where environment variables
>> live.
>>
>> But I see in your "make uboot-menuconfig" that CONFIG_ENV_IS_IN_FAT is
>> not enabled, but only CONFIG_ENV_IS_IN_MMC is and you have to specify:
>> CONFIG_ENV_OFFSET
>> CONFIG_ENV_SIZE
>>
>> So if you want to go with vfat way you need to enable
>> CONFIG_ENV_IS_IN_FAT and specify:
>> CONFIG_ENV_FAT_INTERFACE
>> CONFIG_ENV_FAT_DEVICE_AND_PART
>> and most of all:
>> CONFIG_ENV_FAT_FILE=uEnv.txt
>> in uboot.fragment below
>>
>> I would go with this last way instead of adding such dirty hack, can you
>> work on that?
> 
> I tried, but so far I am not successful, maybe due to my lack of experience
> with uboot or maybe due to the customization of this particular uboot. I
> removed my custom-uboot patch and added the following configs to the
> uboot.fragment file, but it did not work yet:
> 
> # CONFIG_ENV_IS_IN_MMC is not set
> CONFIG_ENV_IS_IN_FAT=y
> CONFIG_ENV_FAT_INTERFACE="mmc"
> CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
> CONFIG_ENV_FAT_FILE="uEnv.txt"

First of all you have to give a try using ush(u-boot shell) to see if
you can really access fat partition and read uEnv.txt file.
Like:
=> fatload ...
to a memory address

If that works then you should also:
=> printenv
and check if the variables you want to override look like expected

> 
> I also tried to use mainline uboot v2024.01, which features the Lichee Pi 4A,
> which features the same SoC, but this didn't work either. I had a look at the
> custom uboot source and it defines a lot of configs inside this header file:
> 
> https://openbeagle.org/beaglev-ahead/beaglev-ahead-u-boot/-/blob/beaglev-v2020.01-1.1.2-ubuntu/include/configs/light-c910.h?ref_type=heads#L363-388

This is a usual way for the these variables. You can dig into it or 
override them as you're trying to do. But you need to make sure uEnv.txt
is really read from your sd-card.

For example it could be a problem with CONFIG_ENV_FAT_INTERFACE name or
CONFIG_ENV_FAT_DEVICE_AND_PART numbering.
If you try using ush everything will be clearer.

> 
> I tried to remove the hard-coded bootcmd from this header, but that also
> didn't work. I don't understand the inner workings of uboot well enough yet to
> get it properly working, so I appreciate all hints and any help here.

Above there is some explanation. Anyway do all the tests without the
uboot patch applied.

> However, I will already send a v4 of the patches, in which I try to address
> all the other issues. > Thanks again for reviewing and best regards,

You're welcome, the goal is to make this patch looks the best it could.

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-02-15 17:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 12:08 [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Kilian Zinnecker via buildroot
2024-02-11 12:08 ` [Buildroot] [PATCH v3 1/2] package/xuantie-bins: new package Kilian Zinnecker via buildroot
2024-02-13 17:49   ` Giulio Benetti
2024-02-11 12:08 ` [Buildroot] [PATCH v3 2/2] configs/beaglev_ahead: new defconfig Kilian Zinnecker via buildroot
2024-02-13 18:06   ` Giulio Benetti
2024-02-14 23:03     ` kilian.zinnecker--- via buildroot
2024-02-15 17:22       ` Giulio Benetti
2024-02-13 17:44 ` [Buildroot] [PATCH v3 0/2] Add board support for the BeagleV-Ahead Giulio Benetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox