2008-04-15 15:27:22 +02:00
|
|
|
diff --git a/Makefile b/Makefile
|
2008-07-25 16:58:50 +02:00
|
|
|
index e405c9c..58bb24d 100644
|
2008-04-15 15:27:22 +02:00
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
|
|
|
@@ -54,7 +54,7 @@ clean:
|
|
|
|
install_etc install_iface install_doc install_kernel install_iname
|
|
|
|
|
|
|
|
install: install_kernel install_programs install_doc install_etc \
|
|
|
|
- install_initd install_iname install_iface
|
2008-07-25 16:58:50 +02:00
|
|
|
+ install_initd install_iface
|
2008-04-15 15:27:22 +02:00
|
|
|
|
|
|
|
install_usr: install_programs install_doc install_etc \
|
|
|
|
install_initd install_iname install_iface
|
|
|
|
diff --git a/kernel/Makefile b/kernel/Makefile
|
2008-07-25 16:58:50 +02:00
|
|
|
index 3dae671..65a291a 100644
|
2008-04-15 15:27:22 +02:00
|
|
|
--- a/kernel/Makefile
|
|
|
|
+++ b/kernel/Makefile
|
|
|
|
@@ -32,11 +32,16 @@ V ?= 0
|
|
|
|
# eg to compile for a kernel that you aren't currently running
|
|
|
|
KERNELRELEASE ?= $(shell uname -r)
|
|
|
|
KSRC ?= /lib/modules/$(KERNELRELEASE)/build
|
|
|
|
+KSRC := $(shell test -f $(KSRC)/Makefile || echo "")
|
|
|
|
KBUILD_OUTPUT ?=
|
|
|
|
# this is the basic Kbuild invocation, just append your make target
|
|
|
|
KBUILD_BASE = +$(MAKE) -C $(KSRC) M=`pwd` KBUILD_OUTPUT=$(KBUILD_OUTPUT) $(KARCH) V=$(V)
|
|
|
|
|
|
|
|
-all: kernel_check
|
|
|
|
+all: kernel_src
|
|
|
|
+
|
|
|
|
+kernel_src: $(shell test -n "$(KSRC)" && echo has_kernel_src)
|
|
|
|
+
|
|
|
|
+has_kernel_src: kernel_check
|
|
|
|
$(KBUILD_BASE) modules
|
|
|
|
|
|
|
|
# ============ BEGIN code for kernel_check and source patching ================
|
2008-07-25 16:58:50 +02:00
|
|
|
@@ -59,9 +64,11 @@ cur_patched=cur_patched
|
2008-04-15 15:27:22 +02:00
|
|
|
# check to see if code is unpatched
|
|
|
|
unpatch_code=$(shell test -e $(cur_patched) && echo do_unpatch_code )
|
|
|
|
|
|
|
|
-KSUBLEVEL = $(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
|
|
|
|
+KSUBLEVEL = $(shell cat $(KSRC)/Makefile 2> /dev/null | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
|
|
|
|
sed 's/^[ \t]*//;s/[ \t]*$$//')
|
|
|
|
|
|
|
|
+KSUBLEVEL?=$(shell echo $(KERNELRELEASE) | sed -n 's/.\..\.\([[:digit:]]*\)\..*/\1/p')
|
|
|
|
+
|
|
|
|
KERNEL_TARGET=linux_2_6_$(KSUBLEVEL)
|
|
|
|
kernel_check: $(KERNEL_TARGET)
|
|
|
|
|
2008-07-25 16:58:50 +02:00
|
|
|
@@ -128,7 +135,11 @@ has_24_patch: $(24_patch)
|
2008-04-15 15:27:22 +02:00
|
|
|
|
|
|
|
# ============ END code for kernel_check and source patching =================
|
|
|
|
|
|
|
|
-clean: $(unpatch_code)
|
|
|
|
+clean: clean_kernel_src
|
|
|
|
+
|
|
|
|
+clean_kernel_src: $(shell test -n "$(KSRC)" && echo has_clean_kernel_src)
|
|
|
|
+
|
|
|
|
+has_clean_kernel_src: $(unpatch_code)
|
|
|
|
$(KBUILD_BASE) clean
|
|
|
|
rm -f Module.symvers
|
|
|
|
|
2008-07-25 16:58:50 +02:00
|
|
|
@@ -167,7 +178,9 @@ ko = $(patsubst %.o,%.ko,$(obj-m))
|
2008-04-15 15:27:22 +02:00
|
|
|
$(ko): all
|
|
|
|
|
|
|
|
# now the actual command
|
|
|
|
-install_kernel: $(ko)
|
|
|
|
+install_kernel: $(shell test -n "$(KSRC)" && echo install_kernel_obj);
|
|
|
|
+
|
|
|
|
+install_kernel_obj: $(ko)
|
|
|
|
$(KBUILD_BASE) modules_install INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH)
|
|
|
|
|
2008-07-25 16:58:50 +02:00
|
|
|
dpkg_divert:
|
2008-04-15 15:27:22 +02:00
|
|
|
diff --git a/usr/Makefile b/usr/Makefile
|
2008-07-25 16:58:50 +02:00
|
|
|
index 7794831..840510d 100644
|
2008-04-15 15:27:22 +02:00
|
|
|
--- a/usr/Makefile
|
|
|
|
+++ b/usr/Makefile
|
|
|
|
@@ -7,9 +7,11 @@ OSNAME=$(shell uname -s)
|
|
|
|
KERNELRELEASE ?= $(shell uname -r)
|
|
|
|
KSRC ?= /lib/modules/$(KERNELRELEASE)/build
|
|
|
|
|
|
|
|
-KSUBLEVEL=$(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
|
|
|
|
+KSUBLEVEL=$(shell cat $(KSRC)/Makefile 2> /dev/null | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
|
|
|
|
sed 's/^[ \t]*//;s/[ \t]*$$//')
|
|
|
|
|
|
|
|
+KSUBLEVEL?=$(shell echo $OSNAME | sed -n 's/.\..\.\([[:digit:]]*\)\..*/\1/p')
|
|
|
|
+
|
|
|
|
ifeq ($(OSNAME),Linux)
|
|
|
|
ifeq ($(KSUBLEVEL),11)
|
|
|
|
IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
|