[4/5] Linux: Unpatch customer kernel source tree before make clean.

Submitted by Sonic Zhang on Aug. 7, 2012, 9:09 a.m.

Details

Message ID 1344330577-25159-4-git-send-email-sonic.adi@gmail.com
State Rejected
Headers show

Commit Message

Sonic Zhang Aug. 7, 2012, 9:09 a.m.
From: Sonic Zhang <sonic.zhang@analog.com>

Unpatch only patches which match current kernel version.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 Makefile       |    2 +-
 linux/linux.mk |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

Comments

Thomas Petazzoni Aug. 11, 2012, 6:11 p.m.
Le Tue, 7 Aug 2012 17:09:36 +0800,
Sonic Zhang <sonic.adi@gmail.com> a écrit :

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Unpatch only patches which match current kernel version.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

What is the use case for this?

Again, you're implementing something completely specific for the linux
package while the logic itself has nothing specific to the Linux
kernel. So if we ever want something like this, we want to implement it
at the package infrastructure level, and clearly not in some random
specific package.

I'm sorry to reject some of your patches this way, but as Buildroot
developers, we have to maintain a good coherency and consistency in the
implementation of the package recipes and the package infrastructure.
And this consistency means that we don't want to implement specific
things in packages that should in fact be implemented at the package
infrastructure level.

Best regards,

Thomas
Sonic Zhang Aug. 13, 2012, 10:21 a.m.
On Sun, Aug 12, 2012 at 2:11 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Le Tue, 7 Aug 2012 17:09:36 +0800,
> Sonic Zhang <sonic.adi@gmail.com> a écrit :
>
>> From: Sonic Zhang <sonic.zhang@analog.com>
>>
>> Unpatch only patches which match current kernel version.
>>
>> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
>
> What is the use case for this?
>
> Again, you're implementing something completely specific for the linux
> package while the logic itself has nothing specific to the Linux
> kernel. So if we ever want something like this, we want to implement it
> at the package infrastructure level, and clearly not in some random
> specific package.
>

I will try to turn these unpatch script into a make clean hook for
packages with override source.


Regards,

Sonic

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index ce81045..e7da18e 100644
--- a/Makefile
+++ b/Makefile
@@ -663,7 +663,7 @@  ifeq ($(NEED_WRAPPER),y)
 	$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
 endif
 
-clean:
+clean: linux-unpatch
 	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
 		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
 		$(LEGAL_INFO_DIR)
diff --git a/linux/linux.mk b/linux/linux.mk
index 48021a1..4ad8b49 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -309,6 +309,19 @@  $(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LI
 # after it generated the initramfs list of files.
 linux-rebuild-with-initramfs linux26-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_initramfs_rebuilt
 
+LINUX_PATCH_LIST=$(wildcard $(LINUX_PATCHES)/linux-$(KERNELVERSION)-*.patch)
+linux-unpatch:
+ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TREE),y)
+ifneq ($(wildcard $(BUILD_DIR)/linux-$(LINUX_VERSION)/.stamp_patched),)
+	@echo "unpatch linux kernel...."
+	for p in $(LINUX_PATCH_LIST) ; do \
+		patch -RE -p1 -d $(LINUX_SOURCE_DIR) < $$p; \
+	done
+else
+	@echo "linux kernel didn't patched, skip unpatch...."
+endif
+endif
+
 # Checks to give errors that the user can understand
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)