Skip to contentSkip to conversation

boot/at91bootstrap3: add support for at91bootstrap 4.x series

PATCH New Eugen Hristev 2 participants 3 messages Apr 27, 2021 – May 18, 2021 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 boot/at91bootstrap3: add support for at91bootstrap 4.x series

Introduce support for the next generation of at91bootstrap, at91bootstrap 4.x series.

AT91Bootstrap 4.x only supports devices: sam9x60, sama5d2, sama5d3, sama5d4, sama7g5.

User can select 4.x series as a bool, and if so, the latest 4.x version is automatically selected.
If the user deselects this option, only 3.x latest version can be picked.

---
Changes in v3:
- s/BR2_TARGET_AT91BOOTSTRAP4_NEEDS_PYTHON3/BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3 missed that.

Changes in v2:
- adapt both 3.x and 4.x series in the same package

 boot/at91bootstrap3/Config.in         | 20 ++++++++++++++++++--
 boot/at91bootstrap3/at91bootstrap3.mk | 12 +++++++++++-
 2 files changed, 29 insertions(+), 3 deletions(-)
boot/at91bootstrap3/Config.in +18 -2
index 25ab30489f..18f027639c 100644
@@ -14,13 +14,23 @@ config BR2_TARGET_AT91BOOTSTRAP3
 
 if BR2_TARGET_AT91BOOTSTRAP3
 
+config BR2_TARGET_AT91BOOTSTRAP3_4SERIES
+	bool "AT91Bootstrap3 4.x series"
+	help
+	  AT91Bootstrap3 4.x series version
+
 choice
 
 	prompt "AT91 Bootstrap 3 version"
 
-config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION
+config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X
+	depends on !BR2_TARGET_AT91BOOTSTRAP3_4SERIES
 	bool "3.9.3"
 
+config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_4X
+	depends on BR2_TARGET_AT91BOOTSTRAP3_4SERIES
+	bool "4.0.0-rc1"
+
 config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT
 	bool "Custom Git repository"
 	help
@@ -51,7 +61,8 @@ endif
 
 config BR2_TARGET_AT91BOOTSTRAP3_VERSION
 	string
-	default "v3.9.3" if BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION
+	default "v3.9.3" if BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X
+	default "v4.0.0-rc1" if BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_4X
 	default BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION \
 		if BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT
 	default "custom"	if BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
@@ -96,4 +107,9 @@ config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE
 	help
 	  Path to the at91bootstrap3 configuration file
 
+config BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3
+	bool "AT91Bootstrap3 requires host Python 3.x for NAND/PMECC scripts"
+	help
+	  Host Python 3.x needs to be installed to use the NAND/PMECC python scripts
+
 endif # BR2_TARGET_AT91BOOTSTRAP3
boot/at91bootstrap3/at91bootstrap3.mk +11 -1
index a942afcdc9..7f11eb1dbb 100644
@@ -6,6 +6,10 @@
 
 AT91BOOTSTRAP3_VERSION = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_VERSION))
 
+ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3),y)
+AT91BOOTSTRAP3_DEPENDENCIES += host-python3
+endif
+
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
 AT91BOOTSTRAP3_TARBALL = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION))
 AT91BOOTSTRAP3_SITE = $(patsubst %/,%,$(dir $(AT91BOOTSTRAP3_TARBALL)))
@@ -19,7 +23,7 @@ else
 AT91BOOTSTRAP3_SITE = $(call github,linux4sam,at91bootstrap,$(AT91BOOTSTRAP3_VERSION))
 endif
 
-AT91BOOTSTRAP3_LICENSE = Atmel License
+AT91BOOTSTRAP3_LICENSE = Microchip License
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION),y)
 AT91BOOTSTRAP3_LICENSE_FILES = main.c
 endif
@@ -47,9 +51,15 @@ define AT91BOOTSTRAP3_BUILD_CMDS
 	$(MAKE) $(AT91BOOTSTRAP3_MAKE_OPTS) -C $(@D)
 endef
 
+ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_4SERIES),y)
+define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
+	cp $(@D)/build/binaries/*.bin $(BINARIES_DIR)
+endef
+else
 define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
 	cp $(@D)/binaries/*.bin $(BINARIES_DIR)
 endef
+endif
 
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG),y)
 AT91BOOTSTRAP3_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG))_defconfig
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 2/2 configs/microchip_sama5d2_icp: new defconfigs

Add the new SAMA5D2 ICP (Industrial Connectivity Board) with linux4sam_2020.10 components.
Update README file with new defconfigs.

https://www.linux4sam.org/bin/view/Linux4SAM/Sama5d2IcpMainPage

---
Changes in v3:
- none
Changes in v2:
- removed unwanted configs
- adapted to use bootstrap3 4.x series.

 board/atmel/readme.txt                        |  2 +
 board/microchip/sama5d2_icp/genimage.cfg      | 31 ++++++++
 configs/microchip_sama5d2_icp_mmc_defconfig   | 32 ++++++++
 .../microchip_sama5d2_icp_mmc_dev_defconfig   | 75 +++++++++++++++++++
 4 files changed, 140 insertions(+)
 create mode 100644 board/microchip/sama5d2_icp/genimage.cfg
 create mode 100644 configs/microchip_sama5d2_icp_mmc_defconfig
 create mode 100644 configs/microchip_sama5d2_icp_mmc_dev_defconfig
board/atmel/readme.txt +2 -0
index 1f21dd15e4..a29d027214 100644
@@ -23,6 +23,8 @@ This guide covers the following configurations:
  - microchip_sama5d27_wlsom1_ek_mmc_dev_defconfig
  - microchip_sam9x60ek_mmc_defconfig
  - microchip_sam9x60ek_mmc_dev_defconfig
+ - microchip_sama5d2_icp_mmc_defconfig
+ - microchip_sama5d2_icp_mmc_dev_defconfig
 
 These configurations will use AT91Bootstrap, u-boot and a linux kernel from
 the git trees maintained by Atmel.
board/microchip/sama5d2_icp/genimage.cfg new file +31 -0
new file mode 100644
index 0000000000..854751713f
@@ -0,0 +1,31 @@
+# Image for SD card boot on Microchip SAMA5D2 ICP (Industrial Connectivity Platform)
+#
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"at91-sama5d2_icp.dtb",
+			"boot.bin",
+			"u-boot.bin"
+		}
+	}
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+		offset = 1M
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
configs/microchip_sama5d2_icp_mmc_defconfig new file +32 -0
new file mode 100644
index 0000000000..f1d11a25b0
@@ -0,0 +1,32 @@
+BR2_arm=y
+BR2_cortex_a5=y
+BR2_ARM_ENABLE_NEON=y
+BR2_ARM_ENABLE_VFP=y
+BR2_ARM_INSTRUCTIONS_THUMB2=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/microchip/sama5d2_icp/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4sam,linux-at91,linux4sam-2020.10)/linux-linux4sam-2020.10.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="sama5"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="at91-sama5d2_icp"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
+BR2_TARGET_AT91BOOTSTRAP3=y
+BR2_TARGET_AT91BOOTSTRAP3_4SERIES=y
+BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT=y
+BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL=y
+BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION="$(call github,linux4sam,at91bootstrap,v4.0.0-rc1)/at91bootstrap-v4.0.0-rc1.tar.gz"
+BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG="sama5d2_icpsd_uboot"
+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,linux4sam,u-boot-at91,linux4sam-2020.10)/u-boot-at91-linux4sam-2020.10.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sama5d2_icp_mmc"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
configs/microchip_sama5d2_icp_mmc_dev_defconfig new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v3 1/2 boot/at91bootstrap3: add support for at91bootstrap 4.x series

In reply to Eugen Hristev

Hello Eugen,

Quoted 6 lines · On Tue, 27 Apr 2021 15:56:56 +0300 Eugen Hristev via buildroot…

Introduce support for the next generation of at91bootstrap, at91bootstrap 4.x series.

AT91Bootstrap 4.x only supports devices: sam9x60, sama5d2, sama5d3, sama5d4, sama7g5.

Quoted 6 lines

User can select 4.x series as a bool, and if so, the latest 4.x version is automatically selected.
If the user deselects this option, only 3.x latest version can be picked.

I just submitted a patch series that is based on your work, but modified to match how I believe it should be done. Some comments below to explain which changes I made.

boot/at91bootstrap3/Config.in config BR2_TARGET_AT91BOOTSTRAP3 · line 20

Quoted 4 lines
boot/at91bootstrap3/Config.in +4 -0
+config BR2_TARGET_AT91BOOTSTRAP3_4SERIES
+	bool "AT91Bootstrap3 4.x series"
+	help
+	  AT91Bootstrap3 4.x series version

This option is not necessary, see below for how I handled that.

boot/at91bootstrap3/Config.in config BR2_TARGET_AT91BOOTSTRAP3 · line 26

Quoted 6 lines

choice

boot/at91bootstrap3/Config.in +1 -1
 	prompt "AT91 Bootstrap 3 version"
 
-config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION
+config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X

We don't want this option rename, as otherwise we would need a Config.in.legacy entry, and we would potentially break existing configuration. So instead, I have kept BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION, which points to 4.0.0-rc2. Indeed, this is really the "latest" version".

And then I've added a new BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X symbol, which points to 3.9.3.

Note that you had forgotten to update the .hash file to add the hash of the 4.0.0-rc1 tarball, so in fact your patch wasn't working when trying to build 4.0.0-rc1.

boot/at91bootstrap3/Config.in config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE · line 113

Quoted 4 lines
boot/at91bootstrap3/Config.in +4 -0
+config BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3
+	bool "AT91Bootstrap3 requires host Python 3.x for NAND/PMECC scripts"
+	help
+	  Host Python 3.x needs to be installed to use the NAND/PMECC python scripts

I've moved that to a separate commit, with a better prompt and help text.

boot/at91bootstrap3/at91bootstrap3.mk line 11

Quoted 3 lines
boot/at91bootstrap3/at91bootstrap3.mk +3 -0
+ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3),y)
+AT91BOOTSTRAP3_DEPENDENCIES += host-python3
+endif

Moved to the separate patch as well, of course.

boot/at91bootstrap3/at91bootstrap3.mk else · line 26

Quoted 10 lines
boot/at91bootstrap3/at91bootstrap3.mk +2 -1
+
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
 AT91BOOTSTRAP3_TARBALL = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION))
 AT91BOOTSTRAP3_SITE = $(patsubst %/,%,$(dir $(AT91BOOTSTRAP3_TARBALL)))
@@ -19,7 +23,7 @@ else
 AT91BOOTSTRAP3_SITE = $(call github,linux4sam,at91bootstrap,$(AT91BOOTSTRAP3_VERSION))
 endif
 
-AT91BOOTSTRAP3_LICENSE = Atmel License
+AT91BOOTSTRAP3_LICENSE = Microchip License

This is unrelated, and actually quite dubious, since the main.c file which we use as the license file is still referring to "Atmel", in both 3.x and 4.x versions, which makes this change anyway independent from the 4.x support.

Quoted 6 lines
boot/at91bootstrap3/at91bootstrap3.mk +0 -0
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION),y)
 AT91BOOTSTRAP3_LICENSE_FILES = main.c
 endif
@@ -47,9 +51,15 @@ define AT91BOOTSTRAP3_BUILD_CMDS
 	$(MAKE) $(AT91BOOTSTRAP3_MAKE_OPTS) -C $(@D)
 endef

boot/at91bootstrap3/at91bootstrap3.mk define AT91BOOTSTRAP3_BUILD_CMDS · line 62

Quoted 10 lines
boot/at91bootstrap3/at91bootstrap3.mk +6 -0
 
+ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_4SERIES),y)
+define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
+	cp $(@D)/build/binaries/*.bin $(BINARIES_DIR)
+endef
+else
 define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
 	cp $(@D)/binaries/*.bin $(BINARIES_DIR)
 endef
+endif

Replaced by using $(wildcard ...) to copy both build/binaries/*.bin and binaries/*.bin so that we are compatible with 3.x and 4.x without the need for BR2_TARGET_AT91BOOTSTRAP3_4SERIES.

See my patch series at:

https://patchwork.ozlabs.org/project/buildroot/list/?series=244548

Note that I have not taken care of your second patch adding the defconfig. Indeed, once the at91bootstrap 4.x support is applied, your defconfig should not be problematic at all to apply.

Best regards,

Thomas

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