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

* Re: [Buildroot] [PATCH 1/1] boot/ti-k3-r5-loader: add support for patch files and URLs
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-07 18:56 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: Xuanhao Shi, Anand Gadiyar, michael, linux-amarula, buildroot

On Wed, 29 Nov 2023 18:28:52 +0100
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> 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(+)

Thanks a lot for your proposal, but we no longer add package-specific
options to apply patches, as BR2_GLOBAL_PATCH_DIR allows to patch all
packages. We do have options that exist for linux and u-boot indeed,
because they predate BR2_GLOBAL_PATCH_DIR, and we need to keep them for
backwards compatibility. But we do not introduce such options for new
packages. For the example, the arm-trusted-firmware has no custom patch
option, because BR2_GLOBAL_PATCH_DIR can/should be used instead.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] boot/ti-k3-r5-loader: add support for patch files and URLs
  2024-02-07 18:56 ` Thomas Petazzoni via buildroot
@ 2024-02-07 20:11   ` Dario Binacchi
  0 siblings, 0 replies; 3+ messages in thread
From: Dario Binacchi @ 2024-02-07 20:11 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Xuanhao Shi, Anand Gadiyar, michael, linux-amarula, buildroot

Hi Thomas,

On Wed, Feb 7, 2024 at 7:56 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Wed, 29 Nov 2023 18:28:52 +0100
> Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:
>
> > 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(+)
>
> Thanks a lot for your proposal, but we no longer add package-specific
> options to apply patches, as BR2_GLOBAL_PATCH_DIR allows to patch all
> packages. We do have options that exist for linux and u-boot indeed,
> because they predate BR2_GLOBAL_PATCH_DIR, and we need to keep them for
> backwards compatibility. But we do not introduce such options for new
> packages. For the example, the arm-trusted-firmware has no custom patch
> option, because BR2_GLOBAL_PATCH_DIR can/should be used instead.

Thank you for your explanations.

Best regards,

Dario
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com



-- 

Dario Binacchi

Senior Embedded Linux Developer

dario.binacchi@amarulasolutions.com

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
info@amarulasolutions.com

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

^ permalink raw reply	[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