From a30cb143fe071853bbe524a8eab49b2fcbb99d02 Mon Sep 17 00:00:00 2001 From: smckown Date: Wed, 25 Nov 2009 20:10:50 +0000 Subject: [PATCH] First pass at building a dkms package. --- Makefile | 99 ++++++++++++++++++++++++++++++++++++++++------ Makefile.build | 85 --------------------------------------- Makefile.dkms | 18 +++++++++ debian.in/control | 17 ++++---- debian.in/postinst | 1 - debian.in/rules | 31 +++------------ dkms.conf | 4 +- 7 files changed, 122 insertions(+), 133 deletions(-) mode change 100755 => 100644 Makefile delete mode 100644 Makefile.build create mode 100755 Makefile.dkms diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 6488d65..5ffcc6c --- a/Makefile +++ b/Makefile @@ -1,18 +1,93 @@ -#!/usr/bin/make -f +# Makefile for newer cp2101 driver, we call cp210x +# Essentially, it makes a debian source package which +# then can be built by pbuilder, etc. -STRIP = strip --strip-unneeded --remove-section=.comment --remove-section=.note +# Change or override these values as necessary for each package release + +PKGVER = 0.11 +DEBDIST = hardy +DEBRELEASE = 0tmi + + +# No need to change anything below this line + +REPOID := $(shell svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/svn:revision \1/') +ifeq (,$(REPOID)) + REPOID := $(shell git svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/svn:revision \1/') +ifeq (,$(REPOID)) + REPOID := $(shell git log -n1 2>/dev/null | head -1 | sed -e s'/^/git:/') +endif +endif +ifeq (,$(REPOID)) + $(error You much check the code out via svn, git-svn, or git) +endif + +BUILD := build +DEBVER := $(PKGVER)-$(DEBRELEASE) +RFC822DATE := $(shell date --rfc-822) +ROOTNAME := cp210x +PACKAGE := $(ROOTNAME)-module-dkms +TARFILE := $(PACKAGE)_$(DEBVER).orig.tar.gz +DEBSRC := $(PACKAGE)-$(PKGVER) +ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEBFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb +DEBSRCFILE := $(BUILD)/$(PACKAGE)_$(DEBVER).dsc + + +source: $(DEBSRCFILE) +$(DEBSRCFILE): $(BUILD)/debian-stamp + cd $(BUILD) && dpkg-source -b $(DEBSRC) + touch $@ + + +binary: $(DEBFILE) +$(DEBFILE): $(BUILD)/debian-stamp + cd $(BUILD)/$(DEBSRC) && dpkg-buildpackage -sa -us -uc + + +$(BUILD)/src-stamp: $(wildcard src/*) dkms.conf + mkdir -p $(BUILD) + rm -rf $(BUILD)/$(DEBSRC) + cp -a src $(BUILD)/$(DEBSRC) + cp -a dkms.conf $(BUILD)/$(DEBSRC) + perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/dkms.conf + find $(BUILD)/$(DEBSRC) -name .svn -type d -exec rm -rf "{}" ";" 2>/dev/null || exit 0 + rm -rf $(BUILD)/$(DEBSRC)/.git || exit 0 + tar -C $(BUILD) -czf $(BUILD)/$(TARFILE) $(DEBSRC) + touch $@ + + +configure: $(BUILD)/debian-stamp +$(BUILD)/debian-stamp: $(BUILD)/src-stamp $(wildcard debian.in/*) + mkdir -p $(BUILD)/$(DEBSRC)/debian + rsync --quiet -avz --exclude=.svn/ --exclude=.git/ debian.in/ $(BUILD)/$(DEBSRC)/debian/ + perl -i -pe 's/xxPACKAGExx/$(PACKAGE)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxROOTNAMExx/$(ROOTNAME)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxPKGVERxx/$(PKGVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxDEBDISTxx/$(DEBDIST)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxRFC822DATExx/$(RFC822DATE)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxREPOIDxx/$(REPOID)/g' $(BUILD)/$(DEBSRC)/debian/* + touch $@ -all: - -rm -rf builddir - cp -a src builddir - cd builddir && ./configure -kver $(KVER) - test -f builddir/Makefile.go - $(MAKE) -C builddir -f Makefile.go - cp builddir/cp2101.ko cp210x.ko - $(STRIP) cp210x.ko clean: - -rm -rf builddir cp210x.ko + rm -rf $(BUILD) + + +debug: + @echo "BUILD = $(BUILD)" + @echo "PKGVER = $(PKGVER)" + @echo "REPOID = $(REPOID)" + @echo "DEBRELEASE = $(DEBRELEASE)" + @echo "DEBVER = $(DEBVER)" + @echo "RFC822DATE = $(RFC822DATE)" + @echo "PACKAGE = $(PACKAGE)" + @echo "TARFILE = $(TARFILE)" + @echo "DEBSRC = $(DEBSRC)" + @echo "ARCH = $(ARCH)" + @echo "DEBFILE = $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb" + @echo "DEBSRCFILE = $(BUILD)/$(PACKAGE)_$(DEBVER).dsc" -.PHONY: all clean +.PHONY: clean binary source configure diff --git a/Makefile.build b/Makefile.build deleted file mode 100644 index 5ffb569..0000000 --- a/Makefile.build +++ /dev/null @@ -1,85 +0,0 @@ -# Makefile for newer cp2101 driver, we call cp210x -# Essentially, it makes a debian source package which -# then can be built by pbuilder, etc. - -DEBDIST = hardy -BUILD = build -KVER := $(shell uname -r) -PKGVER = 0.11 - -REPORELEASE := $(shell svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/\1/') -ifeq (,$(REPORELEASE)) - REPORELEASE := $(shell git svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/\1/') -endif -ifeq (,$(REPORELEASE)) - $(error You much check the code out from svn using svn or git) -endif - -DEBRELEASE := 0tmi$(REPORELEASE) -DEBVER := $(PKGVER)-$(DEBRELEASE) -RFC822DATE := $(shell date --rfc-822) -ROOTNAME := cp210x -PACKAGE := $(ROOTNAME)-module-$(KVER) -TARFILE := $(PACKAGE)_$(DEBVER).orig.tar.gz -DEBSRC := $(PACKAGE)-$(PKGVER) -ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEBFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb -DEBSRCFILE := $(BUILD)/$(PACKAGE)_$(DEBVER).dsc - - -source: $(DEBSRCFILE) -$(DEBSRCFILE): $(BUILD)/debian-stamp - cd $(BUILD) && dpkg-source -b $(DEBSRC) - touch $@ - - -binary: $(DEBFILE) -$(DEBFILE): $(BUILD)/debian-stamp - cd $(BUILD)/$(DEBSRC) && dpkg-buildpackage -sa -us -uc - - -$(BUILD)/src-stamp: $(wildcard src/*) - mkdir -p $(BUILD) - rm -rf $(BUILD)/$(DEBSRC) - cp -a src $(BUILD)/$(DEBSRC) - find $(BUILD)/$(DEBSRC) -name .svn -type d -exec rm -rf "{}" ";" 2>/dev/null || exit 0 - rm -rf $(BUILD)/$(DEBSRC)/.git || exit 0 - tar -C $(BUILD) -czf $(BUILD)/$(TARFILE) $(DEBSRC) - touch $@ - - -configure: $(BUILD)/debian-stamp -$(BUILD)/debian-stamp: $(BUILD)/src-stamp $(wildcard debian.in/*) - mkdir -p $(BUILD)/$(DEBSRC)/debian - rsync --quiet -avz --exclude=.svn/ --exclude=.git/ debian.in/ $(BUILD)/$(DEBSRC)/debian/ - perl -i -pe 's/xxPACKAGExx/$(PACKAGE)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxROOTNAMExx/$(ROOTNAME)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxPKGVERxx/$(PKGVER)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxKVERxx/$(KVER)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxDEBDISTxx/$(DEBDIST)/g' $(BUILD)/$(DEBSRC)/debian/* - perl -i -pe 's/xxRFC822DATExx/$(RFC822DATE)/g' $(BUILD)/$(DEBSRC)/debian/* - touch $@ - - -clean: - rm -rf $(BUILD) - - -debug: - @echo "BUILD = $(BUILD)" - @echo "KVER = $(KVER)" - @echo "PKGVER = $(PKGVER)" - @echo "REPORELEASE = |$(REPORELEASE)|" - @echo "DEBRELEASE = $(DEBRELEASE)" - @echo "DEBVER = $(DEBVER)" - @echo "RFC822DATE = $(RFC822DATE)" - @echo "PACKAGE = $(PACKAGE)" - @echo "TARFILE = $(TARFILE)" - @echo "DEBSRC = $(DEBSRC)" - @echo "ARCH = $(ARCH)" - @echo "DEBFILE = $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb" - @echo "DEBSRCFILE = $(BUILD)/$(PACKAGE)_$(DEBVER).dsc" - - -.PHONY: clean binary source configure diff --git a/Makefile.dkms b/Makefile.dkms new file mode 100755 index 0000000..6488d65 --- /dev/null +++ b/Makefile.dkms @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +STRIP = strip --strip-unneeded --remove-section=.comment --remove-section=.note + +all: + -rm -rf builddir + cp -a src builddir + cd builddir && ./configure -kver $(KVER) + test -f builddir/Makefile.go + $(MAKE) -C builddir -f Makefile.go + cp builddir/cp2101.ko cp210x.ko + $(STRIP) cp210x.ko + +clean: + -rm -rf builddir cp210x.ko + + +.PHONY: all clean diff --git a/debian.in/control b/debian.in/control index 58ca2c4..9acffae 100644 --- a/debian.in/control +++ b/debian.in/control @@ -3,15 +3,18 @@ Section: devel Priority: optional Maintainer: R. Steve McKown Standards-Version: 3.7.2.0 -Build-Depends: dpkg-dev (>= 1.13.9), binutils (>= 2.9.5.0.12), gcc (>= 4:4.2.2), dpatch, file, bzip2, lsb-release, linux-headers-xxKVERxx +Build-Depends: dpkg-dev (>= 1.13.9) Package: xxPACKAGExx Architecture: any -Depends: linux-image-xxKVERxx +Depends: dkms (>> 2.0.20), linux-headers, linux-image, binutils (>= 2.9.5.0.12), gcc (>= 4:4.2.2), dpatch, file, bzip2, lsb-release +Conflicts: cp210x-module-2.6.24-19-generic, cp210x-module-2.6.24-21-generic, cp210x-module-2.6.24-22-generic, cp210x-module-2.6.24-23-generic, cp210x-module-2.6.24-24-generic, cp210x-module-2.6.24-25-generic Priority: extra -Description: Enhanced USB/serial kernel module for xxROOTNAMExx based devices. +Description: Enhanced USB/serial kernel module for cp210x based devices. This module blacklists the standard cp2101 module installed in the kernel, - effectively taking its place. This package will be obsolete once the ioctl - calls supporting the advanced features of the xxROOTNAMExx appear in the mainline - kernel source. This code is an enhanced version of Silicon Lab's xxPKGVERxx - driver. + effectively taking its place. This code is an enhanced version of Silicon + Lab's v0.11 driver, released under the GPLv2 with their permission. It + provides support for setting USB metadata, configuring port state, and + interacting with the GPIO pins. This package will be obsolete once the + new features of this module have been incorporated into the mainline kernel + driver. Built from xxREPOIDxx diff --git a/debian.in/postinst b/debian.in/postinst index 77a08e6..a818525 100755 --- a/debian.in/postinst +++ b/debian.in/postinst @@ -3,6 +3,5 @@ set -e if [ "$1" = "configure" ]; then - depmod -q xxKVERxx || true modprobe -rq cp2101 || true fi diff --git a/debian.in/rules b/debian.in/rules index 3eac6fc..e8b27ae 100755 --- a/debian.in/rules +++ b/debian.in/rules @@ -1,5 +1,5 @@ #!/usr/bin/make -f -# debian/rules file - for xxROOTNAMExx-module +# debian/rules file - for cp210x-module-dkms # Based on sample debian/rules file - for GNU Hello (1.3). # Copyright 1994,1995 by Ian Jackson. # Copyright 1998-2007 James Troup @@ -10,9 +10,7 @@ # This file may have to be extensively modified package = xxPACKAGExx -inst_dir = debian/tmp/lib/modules/xxKVERxx/kernel/drivers/usb/serial - -STRIP = strip --strip-unneeded --remove-section=.comment --remove-section=.note +inst_dir = debian/tmp/usr/src/xxPACKAGExx-xxDEBVERxx install_dir = install -d -m 755 install_file = install -m 644 @@ -22,25 +20,13 @@ install_binary = install -m 755 -s DISTRIBUTION := $(shell lsb_release -is) -# At the current time (20080828) this package has to build from the source -# directory. For now, the solution is quite hackish: copy the source -# directory to the build directory before running configure. -tempdir := $(shell tempfile $(package)) - configure-stamp: - $(checkdir) - rm -rf configure-stamp builddir - rm -f $(tempdir) - cp -a . $(tempdir) - mv -f $(tempdir) builddir - cd builddir && ./configure -kver xxKVERxx touch $@ build: build-stamp build-stamp: configure-stamp $(checkdir) - $(MAKE) -C builddir -f Makefile.go touch $@ @@ -49,16 +35,9 @@ install-stamp: checkroot build-stamp $(checkdir) rm -rf debian/tmp $(install_dir) $(inst_dir) - chmod a+x builddir/installmod - $(MAKE) -C builddir -f Makefile.go \ - INSTALL_PREFIX=$$(pwd)/debian/tmp install - mv $(inst_dir)/cp2101.ko $(inst_dir)/xxROOTNAMExx.ko + cp -a . $(inst_dir) $(install_dir) debian/tmp/etc/modprobe.d echo "blacklist cp2101" > debian/tmp/etc/modprobe.d/$(package) -ifeq ($(with_strip),yes) - find debian/tmp -type f | xargs file | grep "ELF.*executable" | \ - cut -f 1 -d : | xargs $(STRIP) -endif touch $@ @@ -94,13 +73,13 @@ binary: binary-indep binary-arch clean: $(checkdir) - -rm -rf debian/tmp builddir + -rm -rf debian/tmp -rm -fr debian/patched debian/files* debian/substvars -rm -f *-stamp define checkdir - test -f Makefile.go -a -f debian/rules + test -f debian/rules endef diff --git a/dkms.conf b/dkms.conf index 9593aa5..0daa7c6 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ -PACKAGE_VERSION="0.11-0tmi81" -PACKAGE_NAME="cp210x-module" +PACKAGE_VERSION="xxDEBVERxx" +PACKAGE_NAME="cp210x-module-dkms" CLEAN="make clean" BUILT_MODULE_NAME[0]=cp210x DEST_MODULE_LOCATION[0]="/kernel/drivers/usb/serial/" -- 2.39.2