Skip to contentSkip to conversation

barebox: add support for custom version, tarball, git and patch dir

PATCH New Jean-Christophe PLAGNIOL-VILLARD 5 participants 9 messages Sep 17, 2011 – Sep 23, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

---
 boot/barebox/Config.in  |   53 +++++++++++++++++++++++++++++++++++++++++++++++
 boot/barebox/barebox.mk |   23 +++++++++++++++++++-
 2 files changed, 75 insertions(+), 1 deletions(-)
boot/barebox/Config.in +53 -0
index a821c45..c11c03d 100644
@@ -6,6 +6,59 @@ menuconfig BR2_TARGET_BAREBOX
 	  http://www.barebox.org
 
 if BR2_TARGET_BAREBOX
+choice
+	prompt "Barebox Version"
+	default BR2_TARGET_BAREBOX_2011_09
+	help
+	  Select the specific Barebox version you want to use
+
+config BR2_TARGET_BAREBOX_2011_08
+	bool "2011.08"
+
+config BR2_TARGET_BAREBOX_2011_09
+	bool "2011.09"
+
+config BR2_TARGET_BAREBOX_CUSTOM_TARBALL
+	bool "Custom tarball"
+
+config BR2_TARGET_BAREBOX_CUSTOM_GIT
+	bool "Custom Git repository"
+
+endchoice
+
+if BR2_TARGET_BAREBOX_CUSTOM_TARBALL
+
+config BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION
+	string "URL of custom Barebox tarball"
+
+endif
+
+config BR2_TARGET_BAREBOX_VERSION
+	string
+	default "2011.08.0"	if BR2_TARGET_BAREBOX_2011_08
+	default "2011.09.0"	if BR2_TARGET_BAREBOX_2011_09
+	default "custom"	if BR2_TARGET_BAREBOX_CUSTOM_TARBALL
+	default $BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION if BR2_TARGET_BAREBOX_CUSTOM_GIT
+
+config BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR
+	string "custom patch dir"
+	help
+	  If your board requires custom patches, add the path to the
+	  directory containing the patches here. The patches must be
+	  named barebox-<version>-<something>.patch.
+
+	  Most users may leave this empty
+
+if BR2_TARGET_BAREBOX_CUSTOM_GIT
+
+config BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL
+	string "URL of custom Git repository"
+
+config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION
+	string "Custom Git version"
+
+endif
+
 config BR2_TARGET_BAREBOX_BOARD_DEFCONFIG
 	string "board defconfig"
 	help
boot/barebox/barebox.mk +22 -1
index 0dfcff3..8826ef9 100644
@@ -4,9 +4,30 @@
 #
 #############################################################
 
-BAREBOX_VERSION = 2011.09.0
+BAREBOX_VERSION    = $(call qstrip,$(BR2_TARGET_BAREBOX_VERSION))
+
+ifeq ($(BAREBOX_VERSION),custom)
+# Handle custom Barebox tarballs as specified by the configuration
+BAREBOX_TARBALL = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
+BAREBOX_SITE    = $(dir $(BAREBOX_TARBALL))
+BAREBOX_SOURCE  = $(notdir $(BAREBOX_TARBALL))
+else ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
+BAREBOX_SITE        = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
+BAREBOX_SITE_METHOD = git
+else
+# Handle stable official Barebox versions
 BAREBOX_SOURCE = barebox-$(BAREBOX_VERSION).tar.bz2
 BAREBOX_SITE = http://www.barebox.org/download/
+endif
+
+ifneq ($(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
+define BAREBOX_APPLY_CUSTOM_PATCHES
+	toolchain/patch-kernel.sh $(@D) $(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \
+		barebox-$(BAREBOX_VERSION)-\*.patch
+endef
+
+BAREBOX_POST_PATCH_HOOKS += BAREBOX_APPLY_CUSTOM_PATCHES
+endif
 
 BAREBOX_INSTALL_IMAGES = YES
 ifneq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"JC" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

JC> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

In reply to Jean-Christophe PLAGNIOL-VILLARD

boot/barebox/Config.in menuconfig BR2_TARGET_BAREBOX · line 50

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
boot/barebox/Config.in +8 -0
+config BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR
+       string "custom patch dir"
+       help
+         If your board requires custom patches, add the path to the
+         directory containing the patches here. The patches must be
+         named barebox-<version>-<something>.patch.
+
+         Most users may leave this empty

Do people often use buildroot this way? I always make a project-specific
branch of the buildroot tree and drop any patches directly in there.

Not that it hurts to have the option of course :-)

But if many people use buildroot this way, it would make total sense to try
to implement overlays like openembedded does.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43
#3 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Le Thu, 22 Sep 2011 19:20:36 +0200,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 3 lines

Do people often use buildroot this way? I always make a
project-specific branch of the buildroot tree and drop any patches directly in there.

I typically make a per-project branch as well, but for kernel/u-boot patches, I typically like to store them into

board/<company>/<project>/linux-x.y.z-patches board/<company>/<project>/uboot-x.y.z-patches

because those patches are typically board and project specific.

Where do you put them ? Directly in linux/ and boot/uboot/ ?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Quoted 11 lines · Thomas Petazzoni

Le Thu, 22 Sep 2011 19:20:36 +0200,

Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 4 lines

Do people often use buildroot this way? I always make a

project-specific branch of the buildroot tree and drop any patches directly in there.

I typically make a per-project branch as well, but for kernel/u-boot patches, I typically like to store them into

Quoted 6 lines

board/<company>/<project>/linux-x.y.z-patches board/<company>/<project>/uboot-x.y.z-patches

because those patches are typically board and project specific.

Where do you put them ? Directly in linux/ and boot/uboot/ ?

Since I have a separate branch or even repository per project, yes I put them
directly into the package directories. But I realize this is not necessarily the best way to work.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43
#5 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Le Thu, 22 Sep 2011 21:45:19 +0200,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 3 lines

Since I have a separate branch or even repository per project, yes I put them
directly into the package directories. But I realize this is not necessarily the best way to work.

I don't think there "a best way" to work, but I think that for highly hardware-dependent packages such as bootloaders and kernel, it makes sense to offer some options to apply additional patches.

Note that this option not only supports a local directory, but also the URL of a patch, or the URL of a tarball containing patches. This can be very useful for hardware manufacturers who want to ship a Buildroot environment with a proper configuration. They can just do a config that says:

* Use Linux 3.0
* Use Linux patches available at
http://foobar.com/linux-3.0-my-patches.tar.bz2
* Use U-Boot 2011.09
* Use U-Boot patches available at
http://foobar.com/u-boot-2001.09-my-patches.tar.bz2

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

In reply to Arnout Vandecappelle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Arnout> On Saturday 17 September 2011 22:23:08, Jean-Christophe PLAGNIOL-VILLARD

Quoted 8 lines · Arnout> wrote:

boot/barebox/Config.in menuconfig BR2_TARGET_BAREBOX · line 50

Quoted 8 lines
boot/barebox/Config.in +8 -0
+config BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR
+       string "custom patch dir"
+       help
+         If your board requires custom patches, add the path to the
+         directory containing the patches here. The patches must be
+         named barebox-<version>-<something>.patch.
+
+         Most users may leave this empty

Arnout> Do people often use buildroot this way? I always make a Arnout> project-specific branch of the buildroot tree and drop any Arnout> patches directly in there.

I need to support a bunch of projects at work, so I keep them all in a seperate repo (which gets synced with mainline buildroot ever so often. Bootloader and kernel are likewise in (shared) local repos.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Quoted 13 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

?Arnout> On Saturday 17 September 2011 22:23:08, Jean-Christophe PLAGNIOL-VILLARD ?Arnout> wrote:
?>> +config BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR
?>> + ? ? ? string "custom patch dir"
?>> + ? ? ? help
?>> + ? ? ? ? If your board requires custom patches, add the path to the ?>> + ? ? ? ? directory containing the patches here. The patches must be ?>> + ? ? ? ? named barebox-<version>-<something>.patch.
?>> +
?>> + ? ? ? ? Most users may leave this empty

Quoted 8 lines

?Arnout> ?Do people often use buildroot this way? ?I always make a ?Arnout> project-specific branch of the buildroot tree and drop any ?Arnout> patches directly in there.

I need to support a bunch of projects at work, so I keep them all in a seperate repo (which gets synced with mainline buildroot ever so often. Bootloader and kernel are likewise in (shared) local repos.

Of the approaches described above, I prefer Thomas' one: use the board/<company>/<project>/ directory for such patches. But are these patches automatically detected and applied by buildroot?

The advantage of this approach is that if you have multiple related projects, you do not need two separate buildroot repos or branches. For example, in my case, we could have two different boards with different CPU architectures, both using a same buildroot platform (of course with different configurations). Some of the patches may be the same, but some will be different, and then the board/ directory would be a logical place.

-Thomas

#8 lore raw

PATCH 1/1 barebox: add support for custom version, tarball, git and patch dir

Le Fri, 23 Sep 2011 08:27:24 +0200,
Thomas De Schampheleire <[email protected]> a ?crit :

Quoted 3 lines

Of the approaches described above, I prefer Thomas' one: use the board/<company>/<project>/ directory for such patches. But are these patches automatically detected and applied by buildroot?

Depends on what you call automatically. As long as you tell the kernel config, u-boot config or barebox config to apply those patches, then, they will be applied.

Here is the config that I have for a project:

BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="myboard"
BR2_TARGET_UBOOT_1_3_4=y BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR="board/company/boardname/u-boot-1.3.4-patches/" # BR2_TARGET_UBOOT_NETWORK is not set
BR2_TARGET_AT91BOOTSTRAP=y
BR2_TARGET_AT91BOOTSTRAP_BOARD="myboard" BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR="board/company/boardname/at91bootstrap-1.16-patches/" BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="2.6.39" BR2_LINUX_KERNEL_PATCH="board/company/boardname/linux-2.6.39-patches/" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/company/boardname/linux-2.6.39.config"

This allows to build U-Boot 1.3.4 (old!) with patches, AT91Bootstrap 1.16 with patches, and Linux 2.6.39 with patches.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com