Skip to contentSkip to conversation

Make "make sync" in kernel dir work for multiple archs

PATCH Superseded Jerone Young 2 participants 2 messages Apr 15, 2008 KVM

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Make "make sync" in kernel dir work for multiple archs

1 file changed, 31 insertions(+), 17 deletions(-)

kernel/Makefile | 48 +++++++++++++++++++++++++++++++-----------------

This patch add the ability for make sync in the kernel directory to work for mulitiple architectures and not just x86.

kernel/Makefile +31 -17
@@ -1,5 +1,10 @@ include ../config.mak
 include ../config.mak
 
+ARCH_DIR=$(ARCH)
+ifneq '$(filter $(ARCH_DIR), x86_64 i386)' ''
+	ARCH_DIR=x86
+endif
+ 
 KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR))
 
 DESTDIR=
@@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \
 	    | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig
 
 _unifdef = mv $1 $1.orig && \
-	  unifdef -DCONFIG_X86 $1.orig > $1; \
+	  unifdef -DCONFIG_$(ARCH_DIR) $1.orig > $1; \
           [ $$? -le 1 ] && rm $1.orig
 
 hack = $(call _hack,tmp/$(strip $1))
 unifdef = $(call _unifdef,tmp/$(strip $1))
+
+ifneq '$(filter $(ARCH_DIR), x86_64 i386)' ''
+UNIFDEF_FILES = include/linux/kvm.h \
+		include/linux/kvm_para.h \
+		include/asm-$(ARCH_DIR)/kvm.h \
+		include/asm-x86/kvm_para.h
+
+HACK_FILES = kvm_main.c \
+		mmu.c \
+		vmx.c \
+		svm.c \
+		x86.c \
+		irq.h 
+endif
 
 all::
 	# include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
@@ -34,26 +53,21 @@ sync:
 sync:
 	rm -rf tmp include
 	rsync --exclude='*.mod.c' -R \
-             "$(LINUX)"/arch/x86/kvm/./*.[ch] \
+             "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[ch] \
              "$(LINUX)"/virt/kvm/./*.[ch] \
 	     "$(LINUX)"/./include/linux/kvm*.h \
-	     "$(LINUX)"/./include/asm-x86/kvm*.h \
+	     "$(LINUX)"/./include/asm-$(ARCH_DIR)/kvm*.h \
              tmp/
-	mkdir -p include/linux include/asm-x86
-	ln -s asm-x86 include/asm
-	ln -sf asm-x86 include-compat/asm
+	mkdir -p include/linux include/asm-$(ARCH_DIR)
+	ln -s asm-$(ARCH_DIR) include/asm
+	ln -sf asm-$(ARCH_DIR) include-compat/asm
 
-	$(call unifdef, include/linux/kvm.h)
-	$(call unifdef, include/linux/kvm_para.h)
-	$(call unifdef, include/asm-x86/kvm.h)
-	$(call unifdef, include/asm-x86/kvm_para.h)
-	$(call hack, include/linux/kvm.h)
-	$(call hack, kvm_main.c)
-	$(call hack, mmu.c)
-	$(call hack, vmx.c)
-	$(call hack, svm.c)
-	$(call hack, x86.c)
-	$(call hack, irq.h)
+	for i in $(UNIFDEF_FILES); \
+		do $(call unifdef, $$i); done
+
+	for i in $(HACK_FILES); \
+		do $(call hack, $$i); done
+
 	for i in $$(find tmp -type f -printf '%P '); \
 		do cmp -s $$i tmp/$$i || cp tmp/$$i $$i; done
 	rm -rf tmp

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

#1 lore raw
Quoted 24 lines · On Tuesday 15 April 2008 14:43:12 Jerone Young wrote:
1 file changed, 31 insertions(+), 17 deletions(-)

kernel/Makefile | 48 +++++++++++++++++++++++++++++++-----------------

This patch add the ability for make sync in the kernel directory to work for mulitiple architectures and not just x86.

kernel/Makefile +5 -0
@@ -1,5 +1,10 @@ include ../config.mak
 include ../config.mak
 
+ARCH_DIR=$(ARCH)
+ifneq '$(filter $(ARCH_DIR), x86_64 i386)' ''
+	ARCH_DIR=x86
+endif
+
 KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR))
 
 DESTDIR=

kernel/Makefile _hack = mv $1 $1.orig && \ · line 28

Quoted 7 lines
kernel/Makefile +1 -1
@@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \
 
 	    | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig
 
 _unifdef = mv $1 $1.orig && \
-	  unifdef -DCONFIG_X86 $1.orig > $1; \
+	  unifdef -DCONFIG_$(ARCH_DIR) $1.orig > $1; \
           [ $$? -le 1 ] && rm $1.orig

This isn't going to work because you've changed -DCONFIG_X86 to -DCONFIG_x86 .

Signature · 8 lines
Hollis Blanchard
IBM Linux Technology Center

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone