diff options
authorThomas Petazzoni <>2010-12-05 20:53:18 (GMT)
committer Peter Korsgaard <>2010-12-16 21:30:18 (GMT)
commit55b0a375eaf32728573e3c852d8712267e5c7812 (patch)
parentfb358f7b38866b7e48ecc58b1a1f59c1aa95ce44 (diff)
linux: support a space-separated list of patches
The kernel being a component that often needs a fairly important set of changes to be adapted to a particular hardware platform, having maximum flexibility on the patching process is a nice thing. Therefore, as per the discussions from the Buildroot Developer Day, we add a mechanism to apply a list of patches (that could come either from URLs, local files or local directories). Signed-off-by: Thomas Petazzoni <> Signed-off-by: Peter Korsgaard <>
2 files changed, 16 insertions, 16 deletions
diff --git a/linux/ b/linux/
index 7b781a4..4ded38b 100644
--- a/linux/
+++ b/linux/
@@ -70,11 +70,12 @@ config BR2_LINUX_KERNEL_VERSION
- string "Custom kernel patch"
+ string "Custom kernel patches"
- The location can be an URL, a file path, or a directory. In
- the case of a directory, all files matching linux-*.patch
- will be applied.
+ A space-separated list of patches to apply to the
+ kernel. Each patch can be described as an URL, a local file
+ path, or a directory. In the case of a directory, all files
+ matching linux-*.patch in the directory will be applied.
# Configuration selection
diff --git a/linux/ b/linux/
index 639e4ce..40109ac 100644
--- a/linux/
+++ b/linux/
@@ -51,9 +51,8 @@ endif
@$(call MESSAGE,"Downloading kernel")
-ifneq ($(filter ftp://% http://%,$(LINUX26_PATCH)),)
- $(call DOWNLOAD,$(dir $(LINUX26_PATCH)),$(notdir $(LINUX26_PATCH)))
+ $(foreach patch,$(filter ftp://% http://%,$(LINUX26_PATCH)),\
+ $(call DOWNLOAD,$(dir $(patch)),$(notdir $(patch)))$(sep))
mkdir -p $(@D)
touch $@
@@ -68,15 +67,15 @@ $(LINUX26_DIR)/.stamp_extracted: $(LINUX26_DIR)/.stamp_downloaded
# Patch
$(LINUX26_DIR)/.stamp_patched: $(LINUX26_DIR)/.stamp_extracted
@$(call MESSAGE,"Patching kernel")
-ifneq ($(LINUX26_PATCH),)
-ifneq ($(filter ftp://% http://%,$(LINUX26_PATCH)),)
- toolchain/ $(@D) $(DL_DIR) $(notdir $(LINUX26_PATCH))
-else ifeq ($(shell test -d $(LINUX26_PATCH) && echo "dir"),dir)
- toolchain/ $(@D) $(LINUX26_PATCH) linux-\*.patch
- toolchain/ $(@D) $(dir $(LINUX26_PATCH)) $(notdir $(LINUX26_PATCH))
+ for p in $(LINUX26_PATCH) ; do \
+ if echo $$p | grep -q -E "^ftp://|^http://" ; then \
+ toolchain/ $(@D) $(DL_DIR) `basename $$p` ; \
+ elif test -d $$p ; then \
+ toolchain/ $(@D) $$p linux-\*.patch ; \
+ else \
+ toolchain/ $(@D) `dirname $$p` `basename $$p` ; \
+ fi \
+ done
$(Q)touch $@