diff --git a/mpt/Makefile b/mpt/Makefile index 7d244ecab..40dde0a2c 100644 --- a/mpt/Makefile +++ b/mpt/Makefile @@ -1,5 +1,32 @@ -SCST_INC_DIR := include/scst +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +# Main targets: +# all (the default) : make all +# clean : clean files +# extraclean : clean + clean dependencies +# install : install +# uninstall : uninstall +# +# Notes : +# - install and uninstall must be made as root +# + +#SCST_INC_DIR := /usr/local/include/scst +#SCST_DIR := $(SCST_INC_DIR) +SCST_INC_DIR := $(SUBDIRS)/../scst/include +SCST_DIR := $(shell pwd)/../scst/src + FUSION_INC_DIR := drivers/message/fusion + EXTRA_CFLAGS += -I$(SCST_INC_DIR) -I$(FUSION_INC_DIR) -Iinclude/scsi EXTRA_CFLAGS += -DEXTRACHECKS @@ -7,5 +34,59 @@ EXTRA_CFLAGS += -DEXTRACHECKS EXTRA_CFLAGS += -DDEBUG #EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD -obj-$(CONFIG_FUSION_SCST) += mpt_scst.o +ifeq ($(KVER),) + ifeq ($(KDIR),) + KDIR := /lib/modules/$(shell uname -r)/build + endif +else + KDIR := /lib/modules/$(KVER)/build +endif +LSI_INC_DIR := $(KDIR)/drivers/message/fusion +EXTRA_CFLAGS += -I$(LSI_INC_DIR) + +ifneq ($(KERNELRELEASE),) +obj-m += mpt_scst.o +else + +all: Modules.symvers Module.symvers + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m + +tgt: Modules.symvers Module.symvers + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=n + +install: all + $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \ + modules_install + -depmod -a + +SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null) +ifneq ($(SCST_MOD_VERS),) +Modules.symvers: $(SCST_DIR)/Modules.symvers + cp $(SCST_DIR)/Modules.symvers . +else +.PHONY: Modules.symvers +endif + +# It's renamed in 2.6.18 +SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Module.symvers 2>/dev/null) +ifneq ($(SCST_MOD_VERS),) +Module.symvers: $(SCST_DIR)/Module.symvers + cp $(SCST_DIR)/Module.symvers . +else +.PHONY: Module.symvers +endif + +uninstall: + rm -f $(INSTALL_DIR)/mpt_scst.ko + -/sbin/depmod -a +endif + +clean: + rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers \ + Module.symvers Module.markers modules.order + rm -rf .tmp_versions + +extraclean: clean + +.PHONY: all tgt install uninstall clean extraclean diff --git a/mpt/README b/mpt/README index 99fd81d2d..d5cb35efd 100644 --- a/mpt/README +++ b/mpt/README @@ -18,12 +18,15 @@ Building from the Linux kernel tree To build from the kernel tree, you should: -1. Link drivers/message/fusion/mpt_scst to $(SCST_DIR)/mpt +1. Link drivers/message/fusion/mpt_scst to $(SCST_DIR)/mpt. -2. Patch drivers/message/fusion/Makefile and +2. Copy or link Makefile and Kconfig from $(SCST_DIR)/mpt/in-tree to +$(SCST_DIR)/mpt (Makefile will be replaced). + +3. Patch drivers/message/fusion/Makefile and drivers/message/fusion/Kconfig by diffs from $(SCST_DIR)/mpt/in-tree -3. Correct in drivers/message/fusion/Makefile SCST_INC_DIR variable so +4. Correct in drivers/message/fusion/Makefile SCST_INC_DIR variable so it points to correct directory with SCST include files. Building outside the Linux kernel tree diff --git a/mpt/Kconfig b/mpt/in-tree/Kconfig similarity index 100% rename from mpt/Kconfig rename to mpt/in-tree/Kconfig diff --git a/mpt/in-tree/Makefile b/mpt/in-tree/Makefile new file mode 100644 index 000000000..7d244ecab --- /dev/null +++ b/mpt/in-tree/Makefile @@ -0,0 +1,11 @@ +SCST_INC_DIR := include/scst +FUSION_INC_DIR := drivers/message/fusion +EXTRA_CFLAGS += -I$(SCST_INC_DIR) -I$(FUSION_INC_DIR) -Iinclude/scsi + +EXTRA_CFLAGS += -DEXTRACHECKS +#EXTRA_CFLAGS += -DTRACING +EXTRA_CFLAGS += -DDEBUG +#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD + +obj-$(CONFIG_FUSION_SCST) += mpt_scst.o +