Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] boot/arm-trusted-firmware: add config option for custom patches
@ 2022-01-28 14:51 Andreas Ehmanns
  2022-01-28 16:25 ` Robert Hancock via buildroot
  2022-04-25 15:40 ` [Buildroot] Enable missing security options for ISC dhcp server Andreas Ehmanns
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Ehmanns @ 2022-01-28 14:51 UTC (permalink / raw)
  To: buildroot; +Cc: Andreas Ehmanns

Many embedded board manufacturer provide their BSP as patches to
linux kernel and u-boot. They can simply be applied by setting the
corresponding buildroot config (custom patches).
Nowadays patches for the arm trusted firmware (ATF) are also part of
BSP deliveries but there is no config option in buildroot for ATF
to apply custom patches.
This patch adds (similar to linux kernel and u-boot) an option to
apply custom patches to ATF.

Signed-off-by: Andreas Ehmanns <universeiii@gmx.de>
---
 boot/arm-trusted-firmware/Config.in           |  8 +++++++
 .../arm-trusted-firmware.mk                   | 21 +++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
index b1fc03e10b..786a3083a2 100644
--- a/boot/arm-trusted-firmware/Config.in
+++ b/boot/arm-trusted-firmware/Config.in
@@ -63,6 +63,14 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION

 endif

+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_PATCH
+	string "Custom ATF patches"
+	help
+	  A space-separated list of patches to apply to ATF.
+	  Each patch can be described as an URL, a local file path,
+	  or a directory. In the case of a directory, all files
+	  matching *.patch in the directory will be applied.
+
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM
 	string "ATF platform"
 	help
diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 03fa83b7b5..d329bdbfc3 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -29,6 +29,27 @@ ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST
 BR_NO_CHECK_HASH_FOR += $(ARM_TRUSTED_FIRMWARE_SOURCE)
 endif

+# Analogous code exists in linux/linux.mk. Basically, the generic
+# package infrastructure handles downloading and applying remote
+# patches. Local patches are handled depending on whether they are
+# directories or files.
+ARM_TRUSTED_FIRMWARE_PATCHES = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PATCH))
+ARM_TRUSTED_FIRMWARE_PATCH = $(filter ftp://% http://% https://%,$(ARM_TRUSTED_FIRMWARE_PATCHES))
+
+define ARM_TRUSTED_FIRMWARE_APPLY_LOCAL_PATCHES
+	for p in $(filter-out ftp://% http://% https://%,$(ARM_TRUSTED_FIRMWARE_PATCHES)) ; do \
+		if test -d $$p ; then \
+			$(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \
+		else \
+			$(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \
+		fi \
+	done
+endef
+ARM_TRUSTED_FIRMWARE_POST_PATCH_HOOKS += ARM_TRUSTED_FIRMWARE_APPLY_LOCAL_PATCHES
+
+# We have no way to know the hashes for user-supplied patches.
+BR_NO_CHECK_HASH_FOR += $(notdir $(ARM_TRUSTED_FIRMWARE_PATCHES))
+
 ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES

 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC),y)
--
2.26.2

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

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

end of thread, other threads:[~2022-04-25 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 14:51 [Buildroot] [PATCH] boot/arm-trusted-firmware: add config option for custom patches Andreas Ehmanns
2022-01-28 16:25 ` Robert Hancock via buildroot
2022-01-28 17:16   ` Yann E. MORIN
2022-01-28 20:27   ` Andreas Ehmanns
2022-04-25 15:40 ` [Buildroot] Enable missing security options for ISC dhcp server Andreas Ehmanns

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