Skip to contentSkip to conversation

config: add socfpga_agilex5_defconfig

PATCH RESEND In review Dinh Nguyen via buildroot 1 participant 3 messages Oct 28 – Nov 9

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 config: add socfpga_agilex5_defconfig

Build Linux, U-Boot, and TF-A for the Agilex 5 SoC Development Kit from the QPDS 26.1.1 GSRD sources.

---
 board/altera/agilex5/genimage.cfg   | 27 ++++++++++++++++
 board/altera/agilex5/linux.fragment |  4 +++
 board/altera/agilex5/readme.txt     | 50 +++++++++++++++++++++++++++++
 board/altera/agilex5/uboot.fragment |  4 +++
 configs/socfpga_agilex5_defconfig   | 49 ++++++++++++++++++++++++++++
 5 files changed, 134 insertions(+)
 create mode 100644 board/altera/agilex5/genimage.cfg
 create mode 100644 board/altera/agilex5/linux.fragment
 create mode 100644 board/altera/agilex5/readme.txt
 create mode 100644 board/altera/agilex5/uboot.fragment
 create mode 100644 configs/socfpga_agilex5_defconfig
board/altera/agilex5/genimage.cfg new file +27 -0
new file mode 100644
index 0000000000..720d646546
@@ -0,0 +1,27 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"Image",
+			"socfpga_agilex5_socdk.dtb",
+			"u-boot.itb"
+		}
+	}
+
+	size = 64M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xc
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+	}
+}
board/altera/agilex5/linux.fragment new file +4 -0
new file mode 100644
index 0000000000..7c8f9dec31
@@ -0,0 +1,4 @@
+# QSPI access fails when 4K sectors are enabled (ES-14728).
+# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
+# Marvell PHY on the SoC Development Kit Ethernet ports.
+CONFIG_MARVELL_PHY=y
board/altera/agilex5/readme.txt new file +50 -0

50 lines not on this page · raw message

board/altera/agilex5/uboot.fragment new file +4 -0
new file mode 100644
index 0000000000..1e3327555c
@@ -0,0 +1,4 @@
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="if fatload mmc 0:1 ${loadaddr} ghrd.core.rbf; then fpga load 0 ${loadaddr} ${filesize}; bridge enable; fi; mmc rescan; fatload mmc 0:1 82000000 Image; fatload mmc 0:1 86000000 socfpga_agilex5_socdk.dtb; setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait; booti 0x82000000 - 0x86000000"
configs/socfpga_agilex5_defconfig new file +49 -0

49 lines not on this page · raw message

Signature · 6 lines
2.42.0.411.g813d9a9188

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

Hi Dinh,

Thanks for the patch. I have few comments.

Since this defconfig uses "vendor" uboot, TF-A and kernel, I suggest to rename it to socfpga_agilex5_vendor_defconfig, to follow the "new" convention described in:
https://elinux.org/Buildroot:DeveloperDaysELCE2024#Rules_for_defconfigs

Also, to follow the convention in Buildroot, could you change the commit title to:

configs/socfpga_agilex5_vendor: new defconfig

Quoted 5 lines · Dinh Nguyen via buildroot

Build Linux, U-Boot, and TF-A for the Agilex 5 SoC Development Kit from the QPDS 26.1.1 GSRD sources.

---

[...]

Quoted 12 lines
board/altera/agilex5/readme.txt new file +6 -0
new file mode 100644
index 0000000000..4460e43477
@@ -0,0 +1,50 @@
+Altera SoCFPGA Agilex 5 SoC Development Kit
+
+Intro
+=====
+
+This configuration builds a Linux system for the Agilex 5 SoC 
Quoted 3 lines

Development
+Kit (socfpga_agilex5_socdk) from the QPDS 26.1.1 Golden System Reference

Could you add a link to the precise development board(s) page(s) and reference(s) being supported, please?

For example:
[1] https://www.altera.com/products/devkit/po-3274/agilex-5-fpga-and-soc-e-series-065b-modular-development-kit

When reading this file for a newcomer, it is not obvious which board is actually supported.

Quoted 41 lines
board/altera/agilex5/readme.txt new file +3 -0
+Design component versions:
+
+  https://github.com/altera-fpga/linux-socfpga          

QPDS26.1.1_REL_GSRD_PR
+ https://github.com/altera-fpga/u-boot-socfpga
QPDS26.1.1_REL_GSRD_PR
+ https://github.com/altera-fpga/arm-trusted-firmware
QPDS26.1.1_REL_GSRD_PR

board/altera/agilex5/readme.txt new file +3 -0
+
+The HPS first-stage bootloader is packaged by Quartus into the FPGA
+configuration file. This defconfig builds the software that the HPS 

loads

board/altera/agilex5/readme.txt new file +21 -0
+after that: U-Boot (u-boot.itb, with TF-A BL31), the kernel Image, the
+socfpga_agilex5_socdk device tree, and a root filesystem.
+
+Build
+=====
+
+    make socfpga_agilex5_defconfig
+    make
+
+output/images will contain:
+
+    Image
+    socfpga_agilex5_socdk.dtb
+    u-boot.itb
+    u-boot-spl-dtb.hex
+    bl31.bin
+    rootfs.ext2
+    rootfs.tar.gz
+    sdcard.img
+
+sdcard.img has a FAT boot partition (Image, device tree, u-boot.itb) 

and

board/altera/agilex5/readme.txt new file +7 -0
+an ext4 root filesystem on the second partition.
+
+Creating a bootable SD card
+===========================
+
+Copy a fabric configuration file named ghrd.core.rbf onto the FAT
+partition if the design needs the FPGA loaded before Linux starts. 
Quoted 2 lines

U-Boot
+skips that step when the file is absent.

I suggest to move the previous paragraph _after_ the "dd" command. The "dd" will create the vfat partition first, then the user can add a file manually, if needed.

Quoted 1 line

+

I suggest to add before the "dd" command something like:

Prepare the a SD card with the command:

Quoted 1 line

+ dd if=output/images/sdcard.img of=/dev/sdX

And add notes, such as:

Notes:
- replace 'sdX' with the actual device with your micro SDcard,
- you may need to be root to do that (use 'sudo').

Quoted 4 lines
board/altera/agilex5/readme.txt new file +4 -0
+
+Program the HPS first-stage bootloader with Quartus, using
+output/images/u-boot-spl-dtb.hex as the HPS handoff file. Boot the HPS
+from the SD card. The serial console is ttyS0 at 115200 8n1.

[...]

configs/socfpga_agilex5_defconfig line 1

Quoted 7 lines
configs/socfpga_agilex5_defconfig new file +1 -0
new file mode 100644
index 0000000000..25d5beaded
@@ -0,0 +1,49 @@
+BR2_aarch64=y

The "BR2_aarch64=y" can be removed. AArch64 recently became the default architecture in Buildroot.

configs/socfpga_agilex5_defconfig line 4

Quoted 3 lines
configs/socfpga_agilex5_defconfig new file +3 -0
+BR2_cortex_a55=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_18=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y

The last two lines can be removed, and replaced by:

BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y

to follow the guidelines from:
https://elinux.org/Buildroot:DeveloperDaysELCE2024#Rules_for_defconfigs
to use a Bootlin external glibc stable toolchains.

configs/socfpga_agilex5_defconfig line 5

Quoted 1 line
configs/socfpga_agilex5_defconfig new file +1 -0
+BR2_PACKAGE_HOST_GDB=y

To keep this defconfig minimal, could you remove this host gdb, please?

Also, you should add here:
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y

The command "make check-package" reports the error:
configs/socfpga_agilex5_defconfig:0: missing BR2_DOWNLOAD_FORCE_CHECK_HASHES

You'll also need to add a BR2_GLOBAL_PATCH_DIR pointing to "board/altera/agilex5/patches".

Then you can add manually, or use the utils/add-custom-hashes script to add your hash files. See for example:
https://gitlab.com/buildroot.org/buildroot/-/commit/1c393bfa6374a378550305ad70d096d4c16cf88b

Quoted 8 lines
configs/socfpga_agilex5_defconfig new file +5 -0
+BR2_TARGET_GENERIC_HOSTNAME="agilex5"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+BR2_SYSTEM_DHCP="eth0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c 

board/altera/agilex5/genimage.cfg"

configs/socfpga_agilex5_defconfig new file +2 -0
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y

configs/socfpga_agilex5_defconfig line 22

Quoted 10 lines
configs/socfpga_agilex5_defconfig new file +10 -0
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/altera-fpga/linux-socfpga.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="QPDS26.1.1_REL_GSRD_PR"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/altera/agilex5/linux.fragment"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="intel/socfpga_agilex5_socdk"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_PACKAGE_GDB=y
+BR2_PACKAGE_DROPBEAR=y

gdb and dropbear should be removed. defconfigs should be minimal, see:
https://elinux.org/Buildroot:DeveloperDaysELCE2024#Rules_for_defconfigs

configs/socfpga_agilex5_defconfig line 25

Quoted 3 lines
configs/socfpga_agilex5_defconfig new file +3 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="512M"

The filesystem size could probably be reduced to 256M.

Quoted 1 line

+BR2_TARGET_ROOTFS_TAR_GZIP=y

The gzip'ed tar root fs can be removed. It is not used in the boot method described in the readme.txt. It could even be replaced with:

# BR2_TARGET_ROOTFS_TAR is not set

Quoted 24 lines
configs/socfpga_agilex5_defconfig new file +23 -1
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://github.com/altera-fpga/arm-trusted-firmware.git"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="QPDS26.1.1_REL_GSRD_PR"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="agilex5"
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/altera-fpga/u-boot-socfpga.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="QPDS26.1.1_REL_GSRD_PR"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="socfpga_agilex5"
+BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/altera/agilex5/uboot.fragment"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_USE_BINMAN=y
+# BR2_TARGET_UBOOT_FORMAT_BIN is not set
+BR2_TARGET_UBOOT_FORMAT_ITB=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl-dtb.hex"
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
--
Quoted 1 line

2.42.0.411.g813d9a9188

Could you send a v2 addressing those comments, please?

After those changes, please also make sure the the defconfig is regenerated with "make savedefconfig" and "utils/docker-run make check-package" does not report errors. Thanks.

Best regards,

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

#2 lore raw

Hi Julien,

Quoted 20 lines · Julien Olivain

Hi Dinh,

Thanks for the patch. I have few comments.

Since this defconfig uses "vendor" uboot, TF-A and kernel, I suggest to rename it to socfpga_agilex5_vendor_defconfig, to follow the "new" convention described in:
https://elinux.org/Buildroot:DeveloperDaysELCE2024#Rules_for_defconfigs

Also, to follow the convention in Buildroot, could you change the commit title to:

configs/socfpga_agilex5_vendor: new defconfig

Quoted 5 lines · Dinh Nguyen via buildroot

Build Linux, U-Boot, and TF-A for the Agilex 5 SoC Development Kit from the QPDS 26.1.1 GSRD sources.

---

[snip]

Quoted 11 lines
Quoted 3 lines

+BR2_PACKAGE_HOST_MTOOLS=y

Signature · 1 line
2.42.0.411.g813d9a9188

Could you send a v2 addressing those comments, please?

After those changes, please also make sure the the defconfig is regenerated with "make savedefconfig" and "utils/docker-run make check-package" does not report errors. Thanks.

Thank you for the review. I have addressed your comments and sent out a v2.

Thanks,
Dinh

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