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 <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
Thomas Petazzoni 2010-12-05 21:53:18 +01:00 committed by Peter Korsgaard
parent fb358f7b38
commit 55b0a375ea
2 changed files with 16 additions and 16 deletions

View File

@ -70,11 +70,12 @@ config BR2_LINUX_KERNEL_VERSION
# #
config BR2_LINUX_KERNEL_PATCH config BR2_LINUX_KERNEL_PATCH
string "Custom kernel patch" string "Custom kernel patches"
help help
The location can be an URL, a file path, or a directory. In A space-separated list of patches to apply to the
the case of a directory, all files matching linux-*.patch kernel. Each patch can be described as an URL, a local file
will be applied. path, or a directory. In the case of a directory, all files
matching linux-*.patch in the directory will be applied.
# #
# Configuration selection # Configuration selection

View File

@ -51,9 +51,8 @@ endif
$(LINUX26_DIR)/.stamp_downloaded: $(LINUX26_DIR)/.stamp_downloaded:
@$(call MESSAGE,"Downloading kernel") @$(call MESSAGE,"Downloading kernel")
$(call DOWNLOAD,$(LINUX26_SITE),$(LINUX26_SOURCE)) $(call DOWNLOAD,$(LINUX26_SITE),$(LINUX26_SOURCE))
ifneq ($(filter ftp://% http://%,$(LINUX26_PATCH)),) $(foreach patch,$(filter ftp://% http://%,$(LINUX26_PATCH)),\
$(call DOWNLOAD,$(dir $(LINUX26_PATCH)),$(notdir $(LINUX26_PATCH))) $(call DOWNLOAD,$(dir $(patch)),$(notdir $(patch)))$(sep))
endif
mkdir -p $(@D) mkdir -p $(@D)
touch $@ touch $@
@ -68,15 +67,15 @@ $(LINUX26_DIR)/.stamp_extracted: $(LINUX26_DIR)/.stamp_downloaded
# Patch # Patch
$(LINUX26_DIR)/.stamp_patched: $(LINUX26_DIR)/.stamp_extracted $(LINUX26_DIR)/.stamp_patched: $(LINUX26_DIR)/.stamp_extracted
@$(call MESSAGE,"Patching kernel") @$(call MESSAGE,"Patching kernel")
ifneq ($(LINUX26_PATCH),) for p in $(LINUX26_PATCH) ; do \
ifneq ($(filter ftp://% http://%,$(LINUX26_PATCH)),) if echo $$p | grep -q -E "^ftp://|^http://" ; then \
toolchain/patch-kernel.sh $(@D) $(DL_DIR) $(notdir $(LINUX26_PATCH)) toolchain/patch-kernel.sh $(@D) $(DL_DIR) `basename $$p` ; \
else ifeq ($(shell test -d $(LINUX26_PATCH) && echo "dir"),dir) elif test -d $$p ; then \
toolchain/patch-kernel.sh $(@D) $(LINUX26_PATCH) linux-\*.patch toolchain/patch-kernel.sh $(@D) $$p linux-\*.patch ; \
else else \
toolchain/patch-kernel.sh $(@D) $(dir $(LINUX26_PATCH)) $(notdir $(LINUX26_PATCH)) toolchain/patch-kernel.sh $(@D) `dirname $$p` `basename $$p` ; \
endif fi \
endif done
$(Q)touch $@ $(Q)touch $@