#!/usr/bin/make -f ### KERNEL SETUP ### Setup the stuff needed for making kernel module packages ### taken from /usr/share/kernel-package/sample.module.rules # prefix of the target package name PACKAGE=oss4-modules # modifieable for experiments or debugging m-a MA_DIR ?= /usr/share/modass # load generic variable handling -include $(MA_DIR)/include/generic.make # load default rules, including kdist, kdist_image, ... -include $(MA_DIR)/include/common-rules.make # module assistant calculates all needed things for us and sets # following variables: # KSRC (kernel source directory), KVERS (kernel version string), KDREV # (revision of the Debian kernel-image package), CC (the correct # compiler), VERSION (the final package version string), PKGNAME (full # package name with KVERS included), DEB_DESTDIR (path to store DEBs) # The kdist_configure target is called by make-kpkg modules_config and # by kdist* rules by dependency. It should configure the module so it is # ready for compilation (mostly useful for calling configure). # prep-deb-files from module-assistant creates the neccessary debian/ files kdist_config kdist_configure: prep-deb-files # the kdist_clean target is called by make-kpkg modules_clean and from # kdist* rules. It is responsible for cleaning up any changes that have # been made by the other kdist_commands (except for the .deb files created) kdist_clean: cd core && rm -f *.o *.ko *.mod.c *.mod.o .*.cmd modules.order Module.symvers limits.h && rm -rf .tmp_versions && cd .. cd drivers && rm -f *.o *.ko *.mod.c *.mod.o .*.cmd modules.order osscore_symbols.inc && rm -rf .tmp_versions && cd .. # rm -f driver/*.o driver/*.ko # ### end KERNEL SETUP .PHONY: binary_modules binary-modules: dh_testroot dh_clean -k dh_installdirs lib/modules/$(KVERS)/kernel/oss4 # This is Bad(tm) but necessary since linux-headers >= 2.6.29 cp /lib/modules/$(KVERS)/source/include/linux/limits.h $(PWD)/core # Build the modules $(MAKE) -C $(KSRC) M=$(PWD)/core modules $(MAKE) -C $(PWD)/drivers osscore_symbols.inc $(MAKE) -C $(KSRC) M=$(PWD)/drivers modules # Install the modules cp core/osscore.ko drivers/*.ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/oss4 dh_installdocs dh_installchangelogs dh_installmodules #sed -e "s/@KERNEL@/$(KVERS)/g" debian/preinst.modules.in > debian/preinst #sed -e "s/@KERNEL@/$(KVERS)/g" debian/postrm.modules.in > debian/postrm dh_compress dh_fixperms dh_installdeb dh_gencontrol -- -v$(VERSION) dh_md5sums dh_builddeb --destdir=$(DEB_DESTDIR) dh_clean -k