[kernel] r6458 - in people/jurij/sample-module-package: . debian debian/source debian/templates

Jurij Smakov jurij-guest at costa.debian.org
Thu Apr 20 03:57:51 UTC 2006


Author: jurij-guest
Date: Thu Apr 20 03:57:50 2006
New Revision: 6458

Added:
   people/jurij/sample-module-package/
   people/jurij/sample-module-package/Makefile
   people/jurij/sample-module-package/debian/
   people/jurij/sample-module-package/debian/changelog
   people/jurij/sample-module-package/debian/compat
   people/jurij/sample-module-package/debian/copyright
   people/jurij/sample-module-package/debian/rules   (contents, props changed)
   people/jurij/sample-module-package/debian/rules.real
   people/jurij/sample-module-package/debian/source/
   people/jurij/sample-module-package/debian/source/control.modules.in
   people/jurij/sample-module-package/debian/source/rules   (contents, props changed)
   people/jurij/sample-module-package/debian/templates/
   people/jurij/sample-module-package/debian/templates/control.main.in
   people/jurij/sample-module-package/debian/templates/control.modules.in
   people/jurij/sample-module-package/debian/templates/control.source.in
   people/jurij/sample-module-package/debian/templates/postinst-rm.in   (contents, props changed)
   people/jurij/sample-module-package/foo.c
Log:
Initial commit of the stuff which will initially become
a sample policy-compliant module package. It only builds
the PACKAGE-source package at the moment. Please coordinate
with me if you want to hack on it, since I'm working on it
and will commit in big chunks.


Added: people/jurij/sample-module-package/Makefile
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/Makefile	Thu Apr 20 03:57:50 2006
@@ -0,0 +1 @@
+obj-m += foo.o

Added: people/jurij/sample-module-package/debian/changelog
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/changelog	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,5 @@
+foo-modules (1.0-1) UNRELEASED; urgency=low
+
+  * Initial version.
+
+ -- Jurij Smakov <jurij at wooyd.org>  Wed, 12 Apr 2006 20:34:59 -0700

Added: people/jurij/sample-module-package/debian/compat
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/compat	Thu Apr 20 03:57:50 2006
@@ -0,0 +1 @@
+5

Added: people/jurij/sample-module-package/debian/copyright
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/copyright	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,5 @@
+This is a sample policy-compliant out-of-tree module
+package, packaging a fictitious foo driver.
+
+Copyright 2006 Jurij Smakov
+

Added: people/jurij/sample-module-package/debian/rules
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/rules	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+UPSTREAMVERSION  := 2.6.16
+ABINAME          := 1
+
+include /usr/src/linux-support-$(UPSTREAMVERSION)-$(ABINAME)/modules/rules.include
+

Added: people/jurij/sample-module-package/debian/rules.real
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/rules.real	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,64 @@
+include /usr/src/linux-support-$(VERSION)$(ABINAME)/modules/rules.real.include
+
+# Base name of the modules
+PACKAGE  := foo
+PKGSRC   := $(PACKAGE)-source
+STAMPDIR := debian/stamps
+BUILDDIR := debian/build
+#
+# You should define the following targets here:
+#
+binary-arch-flavour:
+	@echo "binary-arch-flavour called"
+
+build:
+	$(MAKE) -f debian/rules.real build-source VERSION='$(VERSION)' ABINAME='$(ABINAME)'
+
+install:
+	$(MAKE) -f debian/rules.real install-source VERSION='$(VERSION)' ABINAME='$(ABINAME)'
+
+binary-indep: build install 
+
+#
+# Target which builds the $(PACKAGE)-source package from which the
+# binary modules may be built using modules-assistant.
+#
+build-source: $(STAMPDIR) $(BUILDDIR)
+build-source: $(STAMPDIR)/build-source-stamp
+$(STAMPDIR)/build-source-stamp:
+	rm -rf $(BUILDDIR)/source
+	mkdir -p $(BUILDDIR)/source
+	sed -e 's/^$(PACKAGE)-modules/$(PACKAGE)-source/' \
+		debian/changelog > $(BUILDDIR)/source/changelog
+	# _KVERS_ is going to be expanded by m-a when building the module
+	sed -e 's/@kernelversion@/_KVERS_/g' \
+		debian/templates/postinst-rm.in > $(BUILDDIR)/source/postinst.modules.in
+	sed -e 's/@kernelversion@/_KVERS_/g' \
+		debian/templates/postinst-rm.in > $(BUILDDIR)/source/postrm.modules.in
+	touch $(STAMPDIR)/build-source-stamp
+
+install-source: $(STAMPDIR) 
+install-source: $(STAMPDIR)/build-source-stamp
+install-source: $(STAMPDIR)/install-source-stamp
+$(STAMPDIR)/install-source-stamp:
+	dh_testdir
+	dh_testroot
+	dh_installdirs       -p$(PKGSRC)
+	dh_installchangelogs -p$(PKGSRC) 
+	dh_installdocs       -p$(PKGSRC)
+	# Install the source files
+	dh_install -p$(PKGSRC) -Xdebian $(wildcard *) usr/src/modules/$(PACKAGE)
+	dh_install -p$(PKGSRC) $(wildcard debian/source/*) \
+		$(wildcard $(BUILDDIR)/source/*) \
+		debian/compat \
+		usr/src/modules/$(PACKAGE)/debian
+	cd debian/$(PKGSRC)/usr/src && \
+		tar -czf $(PACKAGE).tar.gz modules && \
+	   	rm -rf modules/*
+	dh_compress   -p$(PKGSRC)
+	dh_fixperms   -p$(PKGSRC)
+	dh_installdeb -p$(PKGSRC)
+	dh_gencontrol -p$(PKGSRC)
+	dh_md5sums    -p$(PKGSRC)
+	dh_builddeb   -p$(PKGSRC)
+	touch $(STAMPDIR)/install-source-stamp

Added: people/jurij/sample-module-package/debian/source/control.modules.in
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/source/control.modules.in	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,13 @@
+Source: foo-source
+Section: contrib/net
+Priority: extra
+Build-Depends: debhelper (>= 5.0.0)
+Maintainer: Jurij Smakov <jurij at wooyd.org>
+Standards-Version: 3.6.2.1
+
+Package: foo-linux-modules-_KVERS_
+Architecture: any
+Description: Linux driver for foo device family
+ This packages contains the set of loadable kernel modules for devices
+ foo. The modules were compiled to be compatible with the _KVERS_
+ kernel version.

Added: people/jurij/sample-module-package/debian/source/rules
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/source/rules	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,37 @@
+#!/usr/bin/make -f
+
+# Base name of the package
+PACKAGE := foo
+# Names of the modules to be installed, without extension
+MODULES := foo
+
+MA_DIR  ?= /usr/share/modass
+STAMPDIR := debian/stamps
+-include $(MA_DIR)/include/generic.make
+-include $(MA_DIR)/include/common-rules.make
+
+#
+# This rule is going to be invoked by m-a to build
+# the modules for the custom kernel. The KVERS variable
+# will be set and should be used.
+#
+binary-modules: binary_modules
+binary_modules: prep-deb-files
+	# Build the modules
+	$(MAKE) -C '$(KSRC)' M='$(PWD)'
+
+	dh_testdir
+	dh_testroot
+	dh_installdirs
+	# Install the module files
+	dh_install $(addsuffix $(if ifeq($(KMAJ),2.6),.ko,.o),$(MODULES)) \
+		   lib/modules/$(KVERS)/$(PACKAGE)
+	dh_installdocs
+	dh_installchangelogs
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol 
+	dh_md5sums
+	dh_builddeb --destdir=$(DEB_DESTDIR)

Added: people/jurij/sample-module-package/debian/templates/control.main.in
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/templates/control.main.in	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,10 @@
+Package: foo-source
+Architecture: all
+Depends: debhelper (>= 4.0), module-assistant
+Description: Source for building the foo module for custom kernels
+ This package provides the source code of the foo Linux drivers. It may
+ be used to build the binary modules for a custom kernel using module-
+ assistant. If you are running one of the official Debian kernels, you
+ should use foo-linux-module-FLAVOUR package, which contains prebuilt
+ binary modules for your kernel. The FLAVOUR part of the package name
+ may be obtained by running a 'uname -r' command.

Added: people/jurij/sample-module-package/debian/templates/control.modules.in
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/templates/control.modules.in	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,8 @@
+Package: foo-linux-modules- at upstreamversion@@abiname@@localversion@
+Section: net
+Priority: optional
+Depends: linux-image- at upstreamversion@@abiname@@localversion@
+Description: Binary foo modules for Linux kernel @upstreamversion@ on @class@ machines
+ This package provides the drivers for foo device in the form of binary 
+ loadable modules. They have been built for use with Linux kernel version
+ @upstreamversion@ on @longclass@ machines.

Added: people/jurij/sample-module-package/debian/templates/control.source.in
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/templates/control.source.in	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,6 @@
+Source: foo-modules
+Section: devel
+Priority: optional
+Maintainer: Jurij Smakov <jurij at wooyd.org>
+Standards-Version: 3.6.2
+Build-Depends: debhelper (>= 4.1.0), module-assistant

Added: people/jurij/sample-module-package/debian/templates/postinst-rm.in
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/debian/templates/postinst-rm.in	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,4 @@
+#!/bin/sh
+DEPMOD=$(which depmod)
+test -x "${DEPMOD}" || exit 0
+${DEPMOD} @kernelversion@

Added: people/jurij/sample-module-package/foo.c
==============================================================================
--- (empty file)
+++ people/jurij/sample-module-package/foo.c	Thu Apr 20 03:57:50 2006
@@ -0,0 +1,18 @@
+#include <linux/init.h>
+#include <linux/module.h>
+MODULE_LICENSE("GPL");
+
+static int foo_init(void)
+{
+	printk(KERN_ALERT "foo is now loaded.\n");
+	return 0;
+}
+
+static void foo_exit(void)
+{
+	printk(KERN_ALERT "Oh noes, foo is unloading.\n");
+}
+
+module_init(foo_init);
+module_exit(foo_exit);
+



More information about the Kernel-svn-changes mailing list