configs/beaglev_fire: add support for BeagleV Fire
PATCH 1/1 configs/beaglev_fire: add support for BeagleV Fire
Add support for the BeagleV Fire, the Beagleboard SBC powered by Microchip's PolarFire SoC.
The configuration file is beaglev_fire_defconfig. It builds a bootable kernel image with an embedded root file system. The image built can be flashed to the board using the eMMC.
The yaml configuration file is used by the hss payload generator. It maps the ELF binaries or binary blobs to the application hart.
The image generator script sets the partitions of the image.
The image tree souce file creates a FIT image.
The post image script creates the payload using the payload generator host package and finally, creates the FIT image using the ITS after the kernel build. It also creates the BMAP file for use with the BMAP command line tool to transfer the image to the board.
The U-Boot script and additional U-Boot configurations ensure that U-Boot behaves as expected for the BeagleV-Fire and boots the FIT image.
The rootfs-overlay contains scripts for updating the BeagleV-Fire gateware.
The README.txt documents how to build and boot the Beagle-V Fire with this configuration. It also explains how to program a custom bitstream.
--- DEVELOPERS | 2 + board/beaglev_fire/README.txt | 90 +++++++++++++++++++ board/beaglev_fire/beaglev_fire.its | 56 ++++++++++++ board/beaglev_fire/config.yaml | 28 ++++++ board/beaglev_fire/genimage.cfg | 36 ++++++++ board/beaglev_fire/post-image.sh | 14 +++ board/beaglev_fire/rootfs-overlay/etc/motd | 5 ++ .../beagleboard/gateware/change-gateware.sh | 25 ++++++ .../usr/share/microchip/update-gateware.sh | 36 ++++++++ board/beaglev_fire/uboot-env.txt | 16 ++++ board/beaglev_fire/uboot-fragment.config | 1 + configs/beaglev_fire_defconfig | 40 +++++++++ 12 files changed, 349 insertions(+) create mode 100644 board/beaglev_fire/README.txt create mode 100644 board/beaglev_fire/beaglev_fire.its create mode 100644 board/beaglev_fire/config.yaml create mode 100644 board/beaglev_fire/genimage.cfg create mode 100755 board/beaglev_fire/post-image.sh create mode 100644 board/beaglev_fire/rootfs-overlay/etc/motd create mode 100644 board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh create mode 100644 board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh create mode 100644 board/beaglev_fire/uboot-env.txt create mode 100644 board/beaglev_fire/uboot-fragment.config create mode 100644 configs/beaglev_fire_defconfig
DEVELOPERS +2 -0
@@ -1484,7 +1484,9 @@ F: package/swaybg/ F: package/yad/ N: Jamie Gibbons <[email protected]> +F: board/beaglev_fire/ F: board/microchip/mpfs_icicle/ +F: configs/beaglev_fire_defconfig F: configs/microchip_mpfs_icicle_defconfig F: package/microchip-hss-payload-generator/
board/beaglev_fire/README.txt new file +90 -0
91 lines not on this page · raw message
board/beaglev_fire/beaglev_fire.its new file +56 -0
56 lines not on this page · raw message
board/beaglev_fire/config.yaml new file +28 -0
@@ -0,0 +1,28 @@ +# +# HSS Payload Generator - buildroot configuration file +# + +# First, we can optionally set a name for our image, otherwise one will be created dynamically +set-name: 'PolarFire-SoC-HSS::U-Boot' + +# +# Next, we'll define the entry point addresses for each hart, as follows: +# +hart-entry-points: {u54_1: '0x80200000', u54_2: '0x80200000', u54_3: '0x80200000', u54_4: '0x80200000'} +# +# Finally, we'll define a payloads (source binary file) that will be placed at certain regions in memory +# The payload section is defined with the keyword payloads, and then a number of individual +# payload descriptors. +# +# Each payload has a name (path to its ELF/bin file), an owner-hart, and optionally 1-3 secondary-harts. +# +# Additionally, it has a privilege mode in which it will start execution. +# * Valid privilege modes are PRV_M, PRV_S and PRV_U. +# +# +# In this case, the only payload is the u-boot s-mode binary. +# +# Case only matters for the ELF path names, not the keywords. +# +payloads: + u-boot.bin: {exec-addr: '0x80200000', owner-hart: u54_1, secondary-hart: u54_2, secondary-hart: u54_3, secondary-hart: u54_4, priv-mode: prv_s}
board/beaglev_fire/genimage.cfg new file +36 -0
@@ -0,0 +1,36 @@ +# Image for eMMC boot on the Microchip PolarFire SOC BeagleV-Fire Board +# +image boot.vfat { + vfat { + files = { + "beaglev_fire.itb", + } + + file boot.scr { + image = "boot.scr" + } + } + size = 60M +} + +image sdcard.img { + hdimage { + gpt = true + } + + partition uboot { + partition-type-uuid = 21686148-6449-6E6F-744E-656564454649 + image = "payload.bin" + } + + partition kernel { + partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + bootable = "true" + image = "boot.vfat" + } + + partition root { + partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + image = "rootfs.cpio" + } +}
board/beaglev_fire/post-image.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +HSS_PAYLOAD_GENERATOR="${HOST_DIR}"/bin/hss-payload-generator +MKIMAGE="${HOST_DIR}"/bin/mkimage +BOARD_DIR="$(pwd)"/"${0%/*}" + +pushd "${BINARIES_DIR}" +"${HSS_PAYLOAD_GENERATOR}" -c "${BOARD_DIR}"/config.yaml payload.bin +cp "${BOARD_DIR}"/beaglev_fire.its "${BINARIES_DIR}"/beaglev_fire.its +gzip -9 Image -c > Image.gz +"${MKIMAGE}" -f beaglev_fire.its beaglev_fire.itb +popd +support/scripts/genimage.sh -c "${BOARD_DIR}"/genimage.cfg
board/beaglev_fire/rootfs-overlay/etc/motd new file +5 -0
@@ -0,0 +1,5 @@ + +This is version v2024.02 of PolarFire SoC Buildroot External. + +Updated images and documentation are available at: +https://github.com/polarfire-soc/
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh new file +25 -0
@@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -d "$1" ] +then + echo "Changing gateware." + if [ -e "$1"/mpfs_bitstream.spi ] + then + if [ -e "$1"/mpfs_dtbo.spi ] + then + if ! [ -d /lib/firmware ] + then + mkdir /lib/firmware + fi + cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi + cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi + . /usr/share/microchip/update-gateware.sh + else + echo "No device tree overlay file found." + fi + else + echo "No gateware file found." + fi +else + echo "No directory found for this requested gateware." +fi
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +36 -0
@@ -0,0 +1,36 @@ +#!/bin/bash +echo "================================================================================" +echo "| FPGA Gateware Update |" +echo "| |" +echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |" +echo "| update has been copied to directory /lib/firmware. |" +echo "| |" +echo "| !!! This will take a couple of minutes. !!! |" +echo "| |" +echo "| Give the system a few minutes to reboot itself |" +echo "| after Linux has shutdown. |" +echo "| |" +echo "================================================================================" + +read -rsp $'Press any key to continue...\n' -n1 key + +mount -t debugfs none /sys/kernel/debug + +# Trash exisitng device tree overlay in case the rest of the process fails: +mtd_debug erase /dev/mtd0 0x0 0x10000 + +# Write device tree overlay +dtbo_ls=$(ls -l /lib/firmware/mpfs_dtbo.spi) +dtbo_size=$(echo "$dtbo_ls" | cut -d " " -f 5) + +mtd_debug write /dev/mtd0 0x400 "$dtbo_size" /lib/firmware/mpfs_dtbo.spi > /dev/zero + +# Fake the presence of a golden image for now. +mtd_debug write /dev/mtd0 0 4 /dev/zero > /dev/zero + +# Initiate FPGA update. +echo 1 > /sys/kernel/debug/fpga/microchip_exec_update + +# Reboot Linux for the gateware update to take effect. +# FPGA reprogramming takes places between Linux shut-down and HSS restarting the board. +reboot
board/beaglev_fire/uboot-env.txt new file +16 -0
@@ -0,0 +1,16 @@ +# this assumes ${scriptaddr} is already set!! + +# Try to boot a fitImage from eMMC/SD + +setenv fdt_high 0xffffffffffffffff +setenv initrd_high 0xffffffffffffffff + +load mmc 0:${distro_bootpart} ${scriptaddr} beaglev_fire.itb; +bootm start ${scriptaddr}#kernel_dtb; +bootm loados ${scriptaddr}; +# Try to load a ramdisk if available inside fitImage +bootm ramdisk; +bootm prep; +fdt set /soc/ethernet@20112000 mac-address ${beaglevfire_mac_addr0}; +fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr1}; +bootm go;
board/beaglev_fire/uboot-fragment.config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_MPFS_PRIORITISE_QSPI_BOOT=n
configs/beaglev_fire_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +BR2_riscv=y +BR2_RISCV_ISA_RVC=y +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="6.1.30" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="board/beaglev_fire/rootfs-overlay/" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev_fire/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,linux-6.1-mchp+fpga)/linux4microchip+fpga-2024.02.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="mpfs" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_MTD=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=y +BR2_PACKAGE_BASH=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_INITRAMFS=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,polarfire-soc,u-boot)linux4microchip+fpga-2024.02.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="beaglev_fire" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/beaglev_fire/uboot-fragment.config" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_GENEXT2FS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_GPTFDISK=y +BR2_PACKAGE_HOST_MICROCHIP_HSS_PAYLOAD_GENERATOR=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_SQUASHFS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/beaglev_fire/uboot-env.txt"
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Jamie,
Quoted 2 lines · On Tue, 7 May 2024 15:34:09 +0100 Jamie Gibbons via buildroot…
Add support for the BeagleV Fire, the Beagleboard SBC powered by Microchip's PolarFire SoC.
Thanks a lot for this patch! It mostly looks good, but there are a number of small questions/comments below.
board/beaglev_fire/README.txt line 58
Quoted 12 lines
board/beaglev_fire/README.txt new file +12
-0+Flashing the image to your eMMC +=============================== + +By default Buildroot builds a compatible image for you. The first partition +of this image contains a U-Boot binary, embedded in a Hart Software +Services (HSS) payload. The second partition contains a FAT filesystem +with a U-Boot env and an ITB file containing the kernel and the device +tree. The third partition contains the file system. This image can be +written directly to the eMMC. All you need to do is dd the image to the eMMC, +which can be done with the following command on your development host: + + '$ sudo dd if=output/images/sdcard.img of=/dev/sdb bs=1M'
I'm a bit confused: how can the board's eMMC be visible as /dev/sdb on the development host? Does the SoC ROM code expose the eMMC as a USB mass storage device? This probably needs a bit of explanation: /dev/sdb on the host might very well be something entirely different.
board/beaglev_fire/README.txt line 72
Quoted 12 lines
board/beaglev_fire/README.txt new file +12
-0+Customize BeagleV-Fire Cape Gateware Using Verilog +================================================== + +To customize your Beagle-V Fire gateware please follow the guide below to +create your custom bitstream (steps 1 - 6): +https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gateware/customize-cape-gateware-verilog.html + + +Program BeagleV-Fire With Your Custom Bitstream with Buildroot +============================================================== + +Unzip the downloaded artifacts.zip file.
Downloaded from where? According to the instructions in the previous section?
board/beaglev_fire/README.txt line 80
Quoted 4 lines
board/beaglev_fire/README.txt new file +4
-0+On your Linux host development computer, copy the bitstream to BeagleV-Fire +board, replacing </path/to/your/> with the path to your BeagleV-Fire root file +system. + 'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beaglev_fire/rootfs-overlay/etc/'
This will not do much if you don't regenerate the Buildroot image.
Quoted 21 lines
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh new file +15
-0@@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -d "$1" ] +then + echo "Changing gateware." + if [ -e "$1"/mpfs_bitstream.spi ] + then + if [ -e "$1"/mpfs_dtbo.spi ] + then + if ! [ -d /lib/firmware ] + then + mkdir /lib/firmware + fi + cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi + cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh line 25
Quoted 10 lines
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh new file +10
-0+ . /usr/share/microchip/update-gateware.sh + else + echo "No device tree overlay file found." + fi + else + echo "No gateware file found." + fi +else + echo "No directory found for this requested gateware." +fi
Please do error handling the other way around rather than having a script that indents like crazy:
if [ ! -d "$1" ] ; then
echo "No directory found for this requested gateware." exit 1
fi
echo "Changing gateware."
if [ ! -e "$1"/mpfs_bitstream.spi ]; then
echo "No gateware file found."
exit 1
fi
(Note: those two tests are redundant, doing the second test is sufficient)
etc. with the rest of the logic.
Why is update-gateware.sh in a separate script? It seems like a fairly gratuitous split.
Quoted 9 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +3
-0@@ -0,0 +1,36 @@ +#!/bin/bash +echo "================================================================================" +echo "| FPGA Gateware Update |"
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 13
Quoted 10 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +10
-0+echo "| |" +echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |" +echo "| update has been copied to directory /lib/firmware. |" +echo "| |" +echo "| !!! This will take a couple of minutes. !!! |" +echo "| |" +echo "| Give the system a few minutes to reboot itself |" +echo "| after Linux has shutdown. |" +echo "| |" +echo "================================================================================"
This whole message is silly as the previous script has already copied whatever is needed in /lib/firmware/. But in fact, what does it copy it in /lib/firmware/ in the first place?
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 24
Quoted 11 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +11
-0+ +read -rsp $'Press any key to continue...\n' -n1 key + +mount -t debugfs none /sys/kernel/debug + +# Trash exisitng device tree overlay in case the rest of the process fails: +mtd_debug erase /dev/mtd0 0x0 0x10000 + +# Write device tree overlay +dtbo_ls=$(ls -l /lib/firmware/mpfs_dtbo.spi) +dtbo_size=$(echo "$dtbo_ls" | cut -d " " -f 5)
dtbo_size=$(stat -c %s /lib/firmware/mpfs_dtbo.spi)
will do that in one go
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 26
Quoted 2 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +2
-0+ +mtd_debug write /dev/mtd0 0x400 "$dtbo_size" /lib/firmware/mpfs_dtbo.spi > /dev/zero
Why do you use mtd_debug in this script? It seems really debugging oriented. Why not flash_erase and then writing to /dev/mtd0 directly?
Quoted 12 lines
board/beaglev_fire/uboot-env.txt new file +6
-0@@ -0,0 +1,16 @@ +# this assumes ${scriptaddr} is already set!! + +# Try to boot a fitImage from eMMC/SD + +setenv fdt_high 0xffffffffffffffff +setenv initrd_high 0xffffffffffffffff
board/beaglev_fire/uboot-env.txt line 16
Quoted 10 lines
board/beaglev_fire/uboot-env.txt new file +10
-0+ +load mmc 0:${distro_bootpart} ${scriptaddr} beaglev_fire.itb; +bootm start ${scriptaddr}#kernel_dtb; +bootm loados ${scriptaddr}; +# Try to load a ramdisk if available inside fitImage +bootm ramdisk; +bootm prep; +fdt set /soc/ethernet@20112000 mac-address ${beaglevfire_mac_addr0}; +fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr1}; +bootm go;
Nowadays, we try to use distro bootcmd instead of custom uBoot environment scripts. See
https://source.denx.de/u-boot/u-boot/-/blob/v2024.04/doc/develop/distro.rst
for some details.
Quoted 21 lines
board/beaglev_fire/uboot-fragment.config new file +1
-0@@ -0,0 +1 @@ +CONFIG_MPFS_PRIORITISE_QSPI_BOOT=nconfigs/beaglev_fire_defconfig new file +8
-0@@ -0,0 +1,40 @@ +BR2_riscv=y +BR2_RISCV_ISA_RVC=y +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="6.1.30" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="board/beaglev_fire/rootfs-overlay/" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev_fire/post-image.sh"
configs/beaglev_fire_defconfig line 18
Quoted 10 lines
configs/beaglev_fire_defconfig new file +10
-0+BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,linux-6.1-mchp+fpga)/linux4microchip+fpga-2024.02.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="mpfs" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_MTD=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=y
dtc is needed on the targe?
configs/beaglev_fire_defconfig line 19
Quoted 1 line
configs/beaglev_fire_defconfig new file +1
-0+BR2_PACKAGE_BASH=y
Why?
configs/beaglev_fire_defconfig line 21
Quoted 2 lines
configs/beaglev_fire_defconfig new file +2
-0+BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_INITRAMFS=y
Your choice of root filesystem is weird. This option bundles the root filesystem as an initramfs in the kernel image. But in addition, you have put the root filesystem as a CPIO in a partition (which is useless, as Linux cannot mount a CPIO image from a block device).
Could you clarify how you expect the root filesystem to be handled?
configs/beaglev_fire_defconfig line 31
Quoted 10 lines
configs/beaglev_fire_defconfig new file +10
-0+# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,polarfire-soc,u-boot)linux4microchip+fpga-2024.02.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="beaglev_fire" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/beaglev_fire/uboot-fragment.config" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_GENEXT2FS=y
You don't generate an ext2 filesystem, so this is not needed.
configs/beaglev_fire_defconfig line 33
Quoted 2 lines
configs/beaglev_fire_defconfig new file +2
-0+BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_GPTFDISK=y
Not sure where this gets used.
configs/beaglev_fire_defconfig line 36
Quoted 3 lines
configs/beaglev_fire_defconfig new file +3
-0+BR2_PACKAGE_HOST_MICROCHIP_HSS_PAYLOAD_GENERATOR=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_SQUASHFS=y
Where this gets used?
configs/beaglev_fire_defconfig line 40
Quoted 4 lines
configs/beaglev_fire_defconfig new file +4
-0+BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/beaglev_fire/uboot-env.txt"
Could you have a look at those different comments, and submit a v2 that takes into account this feedback?
Thanks a lot!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Quoted 5 lines · Thomas Petazzoni
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Hello Jamie,
Quoted 8 lines
Quoted 2 lines · On Tue, 7 May 2024 15:34:09 +0100 Jamie Gibbons via buildroot…
Add support for the BeagleV Fire, the Beagleboard SBC powered by Microchip's PolarFire SoC.
Thanks a lot for this patch! It mostly looks good, but there are a number of small questions/comments below.
Thank you for all your feedback. I have been working on implementing the changes and preparing a v2. However, I have some replies and a question for you to gain clarification on your request.
Quoted 27 lines
Quoted 27 lines
board/beaglev_fire/uboot-env.txt new file +14
-0@@ -0,0 +1,16 @@ +# this assumes ${scriptaddr} is already set!! + +# Try to boot a fitImage from eMMC/SD + +setenv fdt_high 0xffffffffffffffff +setenv initrd_high 0xffffffffffffffff + +load mmc 0:${distro_bootpart} ${scriptaddr} beaglev_fire.itb; +bootm start ${scriptaddr}#kernel_dtb; +bootm loados ${scriptaddr}; +# Try to load a ramdisk if available inside fitImage +bootm ramdisk; +bootm prep; +fdt set /soc/ethernet@20112000 mac-address${beaglevfire_mac_addr0};
Quoted 8 lines
Quoted 3 lines
+fdt set /soc/ethernet@20110000 mac-address
${beaglevfire_mac_addr1};
+bootm go;Nowadays, we try to use distro bootcmd instead of custom uBoot environment scripts. See
https://source.denx.de/u-boot/u-boot/-/blob/v2024.04/doc/develop/distro.rst
for some details.
Could you clarify the change you are looking for here? We do use distro bootcmd (#include <config_distro_bootcmd.h> in our U-Boot config). This scans for our boot.scr, which as far as I can see is supported under that link you sent. Are you asking for us to replace the boot.scr with extlinux.conf? I can see other boards use "extlinux.conf" or "boot.cmd". Our preference is to use "boot.cmd" as this allows us to use FITImage and FDT set. Could you clarify your request?
Quoted 39 lines
Quoted 29 lines
board/beaglev_fire/uboot-fragment.config new file +1
-0@@ -0,0 +1 @@ +CONFIG_MPFS_PRIORITISE_QSPI_BOOT=nconfigs/beaglev_fire_defconfig new file +11
-0@@ -0,0 +1,40 @@ +BR2_riscv=y +BR2_RISCV_ISA_RVC=y +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="6.1.30" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="board/beaglev_fire/rootfs-overlay/" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev_fire/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(callgithub,linux4microchip,linux,linux-6.1-
mchp+fpga)/linux4microchip+fpga-2024.02.tar.gz"configs/beaglev_fire_defconfig line 18
Quoted 7 lines
configs/beaglev_fire_defconfig new file +7
-0+BR2_LINUX_KERNEL_DEFCONFIG="mpfs" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_MTD=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=ydtc is needed on the targe?
Quoted 3 lines
Quoted 1 line
+BR2_PACKAGE_BASH=y
Why?
The above four packages were used to support the gateware scripts. These will likely be removed for v2 due to the changes in those scripts.
Quoted 10 lines
configs/beaglev_fire_defconfig line 21
Quoted 3 lines
configs/beaglev_fire_defconfig new file +2
-0+BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_INITRAMFS=yCould you have a look at those different comments, and submit a v2 that
takes into account this feedback?
Quoted 7 lines
Thanks a lot!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 22 lines · Thomas Petazzoni via buildroot
Hello Jamie,
Quoted 2 lines · On Tue, 7 May 2024 15:34:09 +0100 Jamie Gibbons via buildroot…
Add support for the BeagleV Fire, the Beagleboard SBC powered by Microchip's PolarFire SoC.
Thanks a lot for this patch! It mostly looks good, but there are a number of small questions/comments below.
Quoted 9 lines
board/beaglev_fire/README.txt new file +9
-0+Flashing the image to your eMMC +=============================== + +By default Buildroot builds a compatible image for you. The first partition +of this image contains a U-Boot binary, embedded in a Hart Software +Services (HSS) payload. The second partition contains a FAT filesystem +with a U-Boot env and an ITB file containing the kernel and the device +tree. The third partition contains the file system. This image can be +written directly to the eMMC. All you need to do is dd the image to the eMMC,
Quoted 8 lines
board/beaglev_fire/README.txt line 58
Quoted 3 lines
board/beaglev_fire/README.txt new file +3
-0+which can be done with the following command on your development host: + + '$ sudo dd if=output/images/sdcard.img of=/dev/sdb bs=1M'I'm a bit confused: how can the board's eMMC be visible as
/dev/sdbon the development host? Does the SoC ROM code expose the eMMC as a USB mass storage device? This probably needs a bit of explanation:/dev/sdbon the host might very well be something entirely different.
HSS has a usb flash drive emulation, if you enter HSS shell, you can enable via..
Quoted 18 lines
Quoted 5 lines
mmc
usbdmscboard/beaglev_fire/README.txt new file +2
-0+Customize BeagleV-Fire Cape Gateware Using Verilog +==================================================board/beaglev_fire/README.txt line 72
Quoted 10 lines
board/beaglev_fire/README.txt new file +10
-0+ +To customize your Beagle-V Fire gateware please follow the guide below to +create your custom bitstream (steps 1 - 6): +https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gateware/customize-cape-gateware-verilog.html + + +Program BeagleV-Fire With Your Custom Bitstream with Buildroot +============================================================== + +Unzip the downloaded artifacts.zip file.Downloaded from where? According to the instructions in the previous section?
Might want to link directly to the ci page:
https://openbeagle.org/beaglev-fire/gateware
With our GitLab instance, BeagleBoard.org provides pre-configured Ubuntu Libero runner's to build end user FPGA designs.
The main branch holds production firmware. End users can fork and customize to their delite..
Quoted 56 lines
board/beaglev_fire/README.txt line 80
Quoted 5 lines
board/beaglev_fire/README.txt new file +4
-0+On your Linux host development computer, copy the bitstream to BeagleV-Fire +board, replacing </path/to/your/> with the path to your BeagleV-Fire root file +system. + 'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beaglev_fire/rootfs-overlay/etc/'This will not do much if you don't regenerate the Buildroot image.
Quoted 21 lines
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh new file +15
-0@@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -d "$1" ] +then + echo "Changing gateware." + if [ -e "$1"/mpfs_bitstream.spi ] + then + if [ -e "$1"/mpfs_dtbo.spi ] + then + if ! [ -d /lib/firmware ] + then + mkdir /lib/firmware + fi + cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi + cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spiboard/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh line 25
Quoted 10 lines
board/beaglev_fire/rootfs-overlay/usr/share/beagleboard/gateware/change-gateware.sh new file +10
-0+ . /usr/share/microchip/update-gateware.sh + else + echo "No device tree overlay file found." + fi + else + echo "No gateware file found." + fi +else + echo "No directory found for this requested gateware." +fiPlease do error handling the other way around rather than having a script that indents like crazy:
if [ ! -d "$1" ] ; then
echo "No directory found for this requested gateware." exit 1
fiecho "Changing gateware."
if [ ! -e "$1"/mpfs_bitstream.spi ]; then
echo "No gateware file found."
exit 1
fi
Quoted 6 lines
(Note: those two tests are redundant, doing the second test is sufficient)
etc. with the rest of the logic.
Why is
update-gateware.shin a separate script? It seems like a fairly gratuitous split.
Script came from Microchip, we did very basic cleanup on it, but yeah it needs work..
Head is here: https://openbeagle.org/beaglev-fire/gateware/-/tree/main/debian?ref_type=heads
Quoted 16 lines
Quoted 16 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +9
-0@@ -0,0 +1,36 @@ +#!/bin/bash +echo "================================================================================" +echo "| FPGA Gateware Update |" +echo "| |" +echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |" +echo "| update has been copied to directory /lib/firmware. |" +echo "| |" +echo "| !!! This will take a couple of minutes. !!! |" +echo "| |"
Quoted 8 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 13
Quoted 4 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +4
-0+echo "| Give the system a few minutes to reboot itself |" +echo "| after Linux has shutdown. |" +echo "| |" +echo "================================================================================"This whole message is silly as the previous script has already copied whatever is needed in
/lib/firmware/. But in fact, what does it copy it in/lib/firmware/in the first place?
It's a Microchip FAE thing. ;)
Quoted 14 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 24
Quoted 11 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +11
-0+ +read -rsp $'Press any key to continue...\n' -n1 key + +mount -t debugfs none /sys/kernel/debug + +# Trash exisitng device tree overlay in case the rest of the process fails: +mtd_debug erase /dev/mtd0 0x0 0x10000 + +# Write device tree overlay +dtbo_ls=$(ls -l /lib/firmware/mpfs_dtbo.spi) +dtbo_size=$(echo "$dtbo_ls" | cut -d " " -f 5)dtbo_size=$(stat -c %s
/lib/firmware/mpfs_dtbo.spi)
Quoted 1 line
will do that in one go
Thanks will do that..
Quoted 5 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 26
Quoted 2 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +2
-0+ +mtd_debug write /dev/mtd0 0x400 "$dtbo_size" /lib/firmware/mpfs_dtbo.spi > /dev/zeroWhy do you use
mtd_debugin this script? It seems really debugging oriented. Why notflash_eraseand then writing to/dev/mtd0directly?
Thanks will try this.
Quoted 19 lines
Quoted 19 lines
board/beaglev_fire/uboot-env.txt new file +13
-0@@ -0,0 +1,16 @@ +# this assumes ${scriptaddr} is already set!! + +# Try to boot a fitImage from eMMC/SD + +setenv fdt_high 0xffffffffffffffff +setenv initrd_high 0xffffffffffffffff + +load mmc 0:${distro_bootpart} ${scriptaddr} beaglev_fire.itb; +bootm start ${scriptaddr}#kernel_dtb; +bootm loados ${scriptaddr}; +# Try to load a ramdisk if available inside fitImage +bootm ramdisk; +bootm prep;
Quoted 8 lines
board/beaglev_fire/uboot-env.txt line 16
Quoted 3 lines
board/beaglev_fire/uboot-env.txt new file +3
-0+fdt set /soc/ethernet@20112000 mac-address ${beaglevfire_mac_addr0}; +fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr1}; +bootm go;Nowadays, we try to use distro bootcmd instead of custom uBoot environment scripts. See
https://source.denx.de/u-boot/u-boot/-/blob/v2024.04/doc/develop/distro.rst
for some details.
I agree totally, while implementing extlinux I had run into some fun memory kernel paging oops and dma-noncoherent bugs on Linux bootup.. At the time this was an early bringing-up with Microchips u-boot
(linux4microchip+fpga-2023.02). Microchip's recently rebased their
u-boot tree so i'll go after it again..
Please consider this temp, at the time Microchip developers didn't think users were going down the bootstd route, so I think they are now aware of it going forward..
Quoted 92 lines
Quoted 22 lines
board/beaglev_fire/uboot-fragment.config new file +1
-0@@ -0,0 +1 @@ +CONFIG_MPFS_PRIORITISE_QSPI_BOOT=nconfigs/beaglev_fire_defconfig new file +8
-0@@ -0,0 +1,40 @@ +BR2_riscv=y +BR2_RISCV_ISA_RVC=y +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="6.1.30" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="board/beaglev_fire/rootfs-overlay/" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/beaglev_fire/post-image.sh"configs/beaglev_fire_defconfig line 18
Quoted 10 lines
configs/beaglev_fire_defconfig new file +10
-0+BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,linux-6.1-mchp+fpga)/linux4microchip+fpga-2024.02.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="mpfs" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_MTD=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=ydtc is needed on the targe?
configs/beaglev_fire_defconfig line 19
Quoted 1 line
configs/beaglev_fire_defconfig new file +1
-0+BR2_PACKAGE_BASH=yWhy?
configs/beaglev_fire_defconfig line 21
Quoted 2 lines
configs/beaglev_fire_defconfig new file +2
-0+BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_INITRAMFS=yYour choice of root filesystem is weird. This option bundles the root filesystem as an initramfs in the kernel image. But in addition, you have put the root filesystem as a CPIO in a partition (which is useless, as Linux cannot mount a CPIO image from a block device).
Could you clarify how you expect the root filesystem to be handled?
configs/beaglev_fire_defconfig line 31
Quoted 10 lines
configs/beaglev_fire_defconfig new file +10
-0+# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,polarfire-soc,u-boot)linux4microchip+fpga-2024.02.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="beaglev_fire" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/beaglev_fire/uboot-fragment.config" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_GENEXT2FS=yYou don't generate an ext2 filesystem, so this is not needed.
configs/beaglev_fire_defconfig line 33
Quoted 2 lines
configs/beaglev_fire_defconfig new file +2
-0+BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_GPTFDISK=yNot sure where this gets used.
configs/beaglev_fire_defconfig line 36
Quoted 3 lines
configs/beaglev_fire_defconfig new file +3
-0+BR2_PACKAGE_HOST_MICROCHIP_HSS_PAYLOAD_GENERATOR=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_SQUASHFS=yWhere this gets used?
configs/beaglev_fire_defconfig line 40
Quoted 4 lines
configs/beaglev_fire_defconfig new file +4
-0+BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/beaglev_fire/uboot-env.txt"Could you have a look at those different comments, and submit a v2 that takes into account this feedback?
Thanks a lot!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list [email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 6 lines
Robert Nelson https://rcn-ee.com/ _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 35 lines · Conor Dooley
Quoted 25 lines · Robert Nelson
On Thu, May 9, 2024 at 3:04 PM Thomas Petazzoni via buildroot
Quoted 15 lines
Quoted 15 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +9
-0@@ -0,0 +1,36 @@ +#!/bin/bash +echo "================================================================================" +echo "| FPGA Gateware Update |" +echo "| |" +echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |" +echo "| update has been copied to directory /lib/firmware. |" +echo "| |" +echo "| !!! This will take a couple of minutes. !!! |" +echo "| |"Quoted 8 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 13
Quoted 4 lines
board/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh new file +4
-0+echo "| Give the system a few minutes to reboot itself |" +echo "| after Linux has shutdown. |" +echo "| |" +echo "================================================================================"This whole message is silly as the previous script has already copied whatever is needed in
/lib/firmware/. But in fact, what does it copy it in/lib/firmware/in the first place?Quoted 1 line
It's a Microchip FAE thing. ;)
I'm not a list member (afaik), so I'm expecting most people not to see this, but the whole
/lib/firmwaredance is going to go away - the mainlined version [1] of the driver being used by this script uses the Firmware Upload API (https://docs.kernel.org/driver-api/firmware/fw_upload.html)
and doesn't rely on a correctly placed file in/lib/firmwareor debugfs.
Quoted 4 lines
Cheers,
Conor.
That's awesome Conor, you spent a lot of time on that.. Landed in v6.8! ;)
For reference, the version we ship was one of Conor's early prototypes...
Regards,
Signature · 6 lines
Robert Nelson https://rcn-ee.com/ _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Jamie,
Quoted 5 lines · On Wed, 22 May 2024 16:06:54 +0000 <[email protected]> wrote:
Quoted 4 lines
Nowadays, we try to use distro bootcmd instead of custom uBoot environment scripts. See
https://source.denx.de/u-boot/u-boot/-/blob/v2024.04/doc/develop/distro.rst
for some details.
Quoted 7 lines
Could you clarify the change you are looking for here? We do use distro bootcmd (#include <
config_distro_bootcmd.h> in our U-Boot config). This scans for our boot.scr, which as far as I can see is supported under that link you sent. Are you asking for us to replace the boot.scr with extlinux.conf? I can see other boards use "extlinux.conf" or "boot.cmd". Our preference is to use "boot.cmd" as this allows us to use FITImage and FDT set. Could you clarify your request?
Yes, we ideally like new defconfigs to use extlinux.conf when possible. One motivation is precisely that boot script tend to do random hacks that are not very nice. That's not a strong requirement though, more of a "nice to have".
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+BR2_PACKAGE_BASH=y
Why?
The above four packages were used to support the gateware scripts. These will likely be removed for v2 due to the changes in those scripts.
I suppose such scripts don't really require bash, the Busybox shell should be more than enough.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot