forked from pool/open-iscsi
90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
diff --git a/Makefile b/Makefile
|
|
index e405c9c..58bb24d 100644
|
|
--- 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
|
|
+ install_initd install_iface
|
|
|
|
install_usr: install_programs install_doc install_etc \
|
|
install_initd install_iname install_iface
|
|
diff --git a/kernel/Makefile b/kernel/Makefile
|
|
index 3dae671..65a291a 100644
|
|
--- 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 ================
|
|
@@ -59,9 +64,11 @@ cur_patched=cur_patched
|
|
# 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)
|
|
|
|
@@ -128,7 +135,11 @@ has_24_patch: $(24_patch)
|
|
|
|
# ============ 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
|
|
|
|
@@ -167,7 +178,9 @@ ko = $(patsubst %.o,%.ko,$(obj-m))
|
|
$(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)
|
|
|
|
dpkg_divert:
|
|
diff --git a/usr/Makefile b/usr/Makefile
|
|
index 7794831..840510d 100644
|
|
--- 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
|