Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] boot/ti-k3-r5-loader: add support for patch files and URLs
@ 2023-11-29 17:28 Dario Binacchi
  2024-02-07 18:56 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Binacchi @ 2023-11-29 17:28 UTC (permalink / raw)
  To: buildroot
  Cc: Xuanhao Shi, michael, linux-amarula, Dario Binacchi,
	Anand Gadiyar

The patch adds support for URLs using similar code as found
in linux/linux.mk and uboot/uboot.mk.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 boot/ti-k3-r5-loader/Config.in          | 11 +++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
index 8c8368a1a5a8..e17e18299d46 100644
--- a/boot/ti-k3-r5-loader/Config.in
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -68,6 +68,17 @@ config BR2_TARGET_TI_K3_R5_LOADER_VERSION
 		if BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_GIT || \
 		   BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_HG  || \
 		   BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_SVN
+
+config BR2_TARGET_TI_K3_R5_LOADER_PATCH
+	string "Custom U-Boot patches"
+	help
+	  A space-separated list of patches to apply to U-Boot.
+	  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.
+
+	  Most users may leave this empty
+
 choice
 	prompt "U-Boot Configuration"
 	default BR2_TARGET_TI_K3_R5_LOADER_USE_DEFCONFIG
diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
index 0ffcb8235f2e..4b7b10950b2d 100644
--- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
@@ -49,6 +49,24 @@ TI_K3_R5_LOADER_KCONFIG_DEPENDENCIES = \
 	$(BR2_BISON_HOST_DEPENDENCY) \
 	$(BR2_FLEX_HOST_DEPENDENCY)
 
+# Analogous code exists in uboot/uboot.mk. Basically, the generic
+# package infrastructure handles downloading and applying remote
+# patches. Local patches are handled depending on whether they are
+# directories or files.
+TI_K3_R5_LOADER_PATCHES = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_PATCH))
+TI_K3_R5_LOADER_PATCH = $(filter ftp://% http://% https://%,$(TI_K3_R5_LOADER_PATCHES))
+
+define TI_K3_R5_LOADER_APPLY_LOCAL_PATCHES
+	for p in $(filter-out ftp://% http://% https://%,$(TI_K3_R5_LOADER_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
+TI_K3_R5_LOADER_POST_PATCH_HOOKS += TI_K3_R5_LOADER_APPLY_LOCAL_PATCHES
+
 ifeq ($(BR2_TARGET_TI_K3_R5_LOADER_USE_DEFCONFIG),y)
 TI_K3_R5_LOADER_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_BOARD_DEFCONFIG))_defconfig
 else ifeq ($(BR2_TARGET_TI_K3_R5_LOADER_USE_CUSTOM_CONFIG),y)
-- 
2.43.0

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

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

end of thread, other threads:[~2024-02-07 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-29 17:28 [Buildroot] [PATCH 1/1] boot/ti-k3-r5-loader: add support for patch files and URLs Dario Binacchi
2024-02-07 18:56 ` Thomas Petazzoni via buildroot
2024-02-07 20:11   ` Dario Binacchi

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