Skip to contentSkip to conversation

package/ti-k3-r5-loader: support patching in same way as u-boot

PATCH Bryan Brattlof via buildroot 2 participants 4 messages May 17, 2024 – Jul 12, 2024 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi Marc,

On May 16, 2024 thus sayeth Marc Murphy:

Quoted 16 lines
---
 boot/ti-k3-r5-loader/Config.in          | 12 ++++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)
boot/ti-k3-r5-loader/Config.in +2 -0
index c276528fad..0e26a15369 100644
@@ -69,6 +69,18 @@ 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

boot/ti-k3-r5-loader/Config.in config BR2_TARGET_TI_K3_R5_LOADER_VERSION · line 83

Quoted 10 lines
boot/ti-k3-r5-loader/Config.in +10 -0
+	string "Custom U-Boot patches"
+	default ""
+	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
+

Thanks for the patch! Just trying to understand what we're trying to do.

Anytime I have some patches I want to apply on-top of a package version I'll typically put them in the board/ folder and use the BR2_GLOBAL_PATCH_DIR to point to that folder:

board/<vendor>/<board>/patches

Ideally we should be applying the same patches for uboot and ti-k3-r5-loader as it's really just a 32bit build of the SPL

Is there something you're trying to do that needs a list of patches in different paths and not in the 64bit uboot package?

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

#2 lore raw

Hi Bryan,

Quoted 23 lines

Hi Marc,

On May 16, 2024 thus sayeth Marc Murphy:

Quoted 20 lines
---
 boot/ti-k3-r5-loader/Config.in          | 12 ++++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)
(quoted diff) +0 -0

b/boot/ti-k3-r5-loader/Config.in index c276528fad..0e26a15369 100644

boot/ti-k3-r5-loader/Config.in +6 -0
@@ -69,6 +69,18 @@ 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"
+	default ""
+	help
+	  A space-separated list of patches to apply to U-Boot.
Quoted 8 lines

boot/ti-k3-r5-loader/Config.in config BR2_TARGET_TI_K3_R5_LOADER_VERSION · line 83

Quoted 6 lines
boot/ti-k3-r5-loader/Config.in +6 -0
+	  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
+

Thanks for the patch! Just trying to understand what we're trying to do.

When we use an external config (BR2_EXTERNAL) and specify the version of u-boot to use we need to apply platform specific patches we normally use:
$BR2_EXTERNAL /board/board-type/patches/uboot

If we want to use a dedicated Ti release e.g. 08.06.00.007 and apply our patches to it, this is good for the normal uboot bootloader. If we need to apply patches to the k3 bootloader it is not possible and buildroot checks out a dedicated folder for building:

drwxr-xr-x  25 marc marc    4096 May 16 14:34 ti-k3-r5-loader-custom
drwxr-xr-x  25 marc marc    4096 May 16 14:34 uboot-custom

We have dedicated board configs, device tree and some code changes that are not in mainline and need applying to both builds of uboot. If there is another way to do this I would appreciate the feedback.

Quoted 10 lines

Anytime I have some patches I want to apply on-top of a package version I'll typically put them in the board/ folder and use the BR2_GLOBAL_PATCH_DIR to point to that folder:

board/<vendor>/<board>/patches

Ideally we should be applying the same patches for uboot and ti-k3-r5-loader as it's really just a 32bit build of the SPL

Quoted 8 lines

Is there something you're trying to do that needs a list of patches in different paths and not in the 64bit uboot package?

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

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

#3 lore raw

On May 17, 2024 thus sayeth Marc Murphy:

Quoted 37 lines

Hi Bryan,

Quoted 23 lines

Hi Marc,

On May 16, 2024 thus sayeth Marc Murphy:

Quoted 20 lines
---
 boot/ti-k3-r5-loader/Config.in          | 12 ++++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)
(quoted diff) +0 -0

b/boot/ti-k3-r5-loader/Config.in index c276528fad..0e26a15369 100644

boot/ti-k3-r5-loader/Config.in +6 -0
@@ -69,6 +69,18 @@ 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"
+	default ""
+	help
+	  A space-separated list of patches to apply to U-Boot.
Quoted 8 lines

boot/ti-k3-r5-loader/Config.in config BR2_TARGET_TI_K3_R5_LOADER_VERSION · line 83

Quoted 6 lines
boot/ti-k3-r5-loader/Config.in +6 -0
+	  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
+

Thanks for the patch! Just trying to understand what we're trying to do.

When we use an external config (BR2_EXTERNAL) and specify the version of u-boot to use we need to apply platform specific patches we normally use:
$BR2_EXTERNAL /board/board-type/patches/uboot

Quoted 7 lines

If we want to use a dedicated Ti release e.g. 08.06.00.007 and apply our patches to it, this is good for the normal uboot bootloader. If we need to apply patches to the k3 bootloader it is not possible and buildroot checks out a dedicated folder for building:

drwxr-xr-x  25 marc marc    4096 May 16 14:34 ti-k3-r5-loader-custom
drwxr-xr-x  25 marc marc    4096 May 16 14:34 uboot-custom

We have dedicated board configs, device tree and some code changes that are not in mainline and need applying to both builds of uboot. If there is another way to do this I would appreciate the feedback.

Ah yeah. I've been trying to find a way good way to do that myself. Ideally these packages should be exactly the same with a different cross compiler. My end goal is trying to find a way to short-circuit the DL path and the PATCH directory to point to U-Boot but I haven't found a way to do that yet. :/

This solution works for me as a stopgap for now but if you know of a way to point these variables to whatever uboot/ is using let me know

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

#4 lore raw

Hello Marc, Bryan, All,

Le 05/06/2024 à 19:30, Bryan Brattlof via buildroot a écrit :

Quoted 46 lines

On May 17, 2024 thus sayeth Marc Murphy:

Quoted 37 lines

Hi Bryan,

Quoted 23 lines

Hi Marc,

On May 16, 2024 thus sayeth Marc Murphy:

Quoted 20 lines
---
 boot/ti-k3-r5-loader/Config.in          | 12 ++++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)
(quoted diff) +0 -0

b/boot/ti-k3-r5-loader/Config.in index c276528fad..0e26a15369 100644

boot/ti-k3-r5-loader/Config.in +6 -0
@@ -69,6 +69,18 @@ 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"
+	default ""
+	help
+	  A space-separated list of patches to apply to U-Boot.
Quoted 8 lines

boot/ti-k3-r5-loader/Config.in config BR2_TARGET_TI_K3_R5_LOADER_VERSION · line 83

Quoted 6 lines
boot/ti-k3-r5-loader/Config.in +6 -0
+	  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
+

Thanks for the patch! Just trying to understand what we're trying to do.

When we use an external config (BR2_EXTERNAL) and specify the version of u-boot to use we need to apply platform specific patches we normally use:
$BR2_EXTERNAL /board/board-type/patches/uboot

Quoted 7 lines

If we want to use a dedicated Ti release e.g. 08.06.00.007 and apply our patches to it, this is good for the normal uboot bootloader. If we need to apply patches to the k3 bootloader it is not possible and buildroot checks out a dedicated folder for building:

drwxr-xr-x  25 marc marc    4096 May 16 14:34 ti-k3-r5-loader-custom
drwxr-xr-x  25 marc marc    4096 May 16 14:34 uboot-custom

We have dedicated board configs, device tree and some code changes that are not in mainline and need applying to both builds of uboot. If there is another way to do this I would appreciate the feedback.

Quoted 8 lines

Ah yeah. I've been trying to find a way good way to do that myself. Ideally these packages should be exactly the same with a different cross compiler. My end goal is trying to find a way to short-circuit the DL path and the PATCH directory to point to U-Boot but I haven't found a way to do that yet. :/

This solution works for me as a stopgap for now but if you know of a way to point these variables to whatever uboot/ is using let me know

Indeed, the BR2_GLOBAL_PATCH_DIR option is usually the preferred method for specifying a custom patch directory for packages [1]. The linux and u-boot packages are exceptions with their "Custom {kernel/U-Boot} patches" option.

There is another example in Buildroot were two packages can actually use the same source: linux and linux-headers with BR2_KERNEL_HEADERS_AS_KERNEL enabled.

It could be interesting to implement something similar:

config BR2_TARGET_TI_K3_R5_LOADER_AS_UBOOT
string "Same as uboot being built"

Doing so it would be possible to retrieve uboot patches from BR2_GLOBAL_PATCH_DIR:

TARGET_TI_K3_R5_LOADER_PATCHES = \
	$(wildcard $(addsuffix /uboot,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))

[1]
https://nightly.buildroot.org/manual.html#_adding_project_specific_patches_and_hashes

Can you try?

In the meantime, I'll mark this patch "Changes requested".

Thanks!

Best regards,
Romain

Quoted 6 lines

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

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