29
# some default definitions, important!
31
# Name of the source package
32
psource:=#PACKAGE#-source
34
# The short upstream name, used for the module source directory
30
38
### Setup the stuff needed for making kernel module packages
31
39
### taken from /usr/share/kernel-package/sample.module.rules
35
# KSRC is the location of the kernel source. This is the default value,
36
# when make-kpkg is used it will supply to real value
38
# KDREV is the package-revision, as given to make-kpkg by the user.
39
# Just put a simply default value in here which we use when we test
40
# the packagebuilding without make-kpkg
41
ifeq ($(strip $(KDREV)),)
45
## Now to determine the kernel version, normally supplied by make-kpkg
46
ifeq ($(strip $(KVERS)),)
47
# Now we need to get the kernel-version somehow (we are not running
49
ifeq ($(strip $(KSRC)),)
50
$(error Error. I do not know how to determine the kernel version)
52
kversion :=$(shell grep -E '^VERSION +=' $(KSRC)/Makefile 2>/dev/null | \
53
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
54
kplevel :=$(shell grep -E '^PATCHLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
55
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
56
ksublevel:=$(shell grep -E '^SUBLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
57
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
58
EXTRA_VERSION:=$(shell grep -E '^EXTRAVERSION +=' $(KSRC)/Makefile 2>/dev/null | \
59
sed -e 's/EXTRAVERSION[\t ]*=[\t ]*\(.*\)/\1/')
60
kextra:=$(strip $(EXTRA_VERSION))
61
HAVE_NEW_MODLIB:=$(shell grep -E '\(INSTALL_MOD_PATH\)' \
62
$(KSRC)/Makefile 2>/dev/null )
64
# If you want to have more than one kernel configuration per kernel
65
# version, set FLAVOUR in the top level kernel Makefile *before*
66
# invoking make-kpkg -- it will be appended to UTS_RELEASE in
67
# version.h (separated by a hyphen). This affects everything -- the
68
# names and versions of the image, source, headers, and doc packages,
69
# and where the modules are searched for in /lib/modules.
72
# uhm - should check if we really have a Makefile capable of Flavours?
75
FLAVOUR:=$(shell grep ^FLAVOUR $(KSRC)/Makefile 2>/dev/null | \
76
perl -ple 's/FLAVOUR[\s:=]+//g')
78
ifneq ($(strip $(FLAVOUR)),)
79
INT_FLAV := -$(FLAVOUR)
80
FLAV_ARG := FLAVOUR=$(FLAVOUR)
86
## This is the replacement for FLAVOUR
87
ifneq ($(strip $(APPEND_TO_VERSION)),)
88
iatv := $(strip $(APPEND_TO_VERSION))
89
EXTRAV_ARG := EXTRAVERSION=${EXTRA_VERSION}${iatv}
95
KVERS = $(kversion).$(kplevel).$(ksublevel)$(kextra)$(iatv)$(INT_FLAV)
100
non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
101
epoch=$(shell echo $(KVERS) | perl -ne 'm/^(\d+:)/ && print $$1')
103
# We also need the package version
104
pversion = $(shell sed -ne '1s/.*\((.*)\).*/\1/' debian/changelog)
105
pversion = $(shell sed -ne '1s/.*(\(.*\)).*/\1/p' debian/changelog)
107
# MODDIR is the place where the final .deb package should be made. This is the
108
# default value, when make-kpkg is used it will supply to real value
111
pmodules = $(package)-modules-$(non_epoch_version)
112
psource = $(package)-source
114
# Prepares the package for distribution. Intended for the kernel
116
kdist: kdist_clean kdist_config kdist_image
118
# The kdist_configure target is called by make-kpkg modules_config. It
119
# should configure the module so it is ready for compilation (mostly
120
# useful for calling configure)
122
@echo Nothing to configure
124
# the kdist_image target is called by make-kpkg modules_image. It is
125
# responsible for compiling the module and creating the package. It
126
# should also clean up after making the module. Please note we use a
127
# seperate binary-modules target to make testing the package building
130
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-modules
131
$(MAKE) $(MFLAGS) -f debian/rules clean
133
# the kdist_clean target is called by make-kpkg modules_clean. It is
134
# responsible for cleaning up any changes that have been made by the
135
# other kdist_commands (except for the .deb files created).
137
$(MAKE) $(MFLAGS) -f debian/rules clean
41
# prefix of the target package name
42
PACKAGE=#PACKAGE#-modules
43
# modifieable for experiments or debugging m-a
44
MA_DIR ?= /usr/share/modass
45
# load generic variable handling
46
-include $(MA_DIR)/include/generic.make
47
# load default rules, including kdist, kdist_image, ...
48
-include $(MA_DIR)/include/common-rules.make
50
# module assistant calculates all needed things for us and sets
51
# following variables:
52
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
53
# (revision of the Debian kernel-image package), CC (the correct
54
# compiler), VERSION (the final package version string), PKGNAME (full
55
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
57
# The kdist_configure target is called by make-kpkg modules_config and
58
# by kdist* rules by dependency. It should configure the module so it is
59
# ready for compilation (mostly useful for calling configure).
60
# prep-deb-files from module-assistant creates the neccessary debian/ files
61
kdist_configure: prep-deb-files
63
# the kdist_clean target is called by make-kpkg modules_clean and from
64
# kdist* rules. It is responsible for cleaning up any changes that have
65
# been made by the other kdist_commands (except for the .deb files created)
67
$(MAKE) $(MFLAGS) -f debian/rules clean
68
# rm -f driver/*.o driver/*.ko
139
70
### end KERNEL SETUP
147
78
# Add here command to compile/build the package.
150
touch build-arch-stamp
152
# the binary-modules target prepares the $(pmodules) package.
153
# It is called by make-kpkg and *not* during a normal build
83
#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
85
# the binary-modules rule is invoked by module-assistant while processing the
86
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
87
# during a normal build
155
export DH_OPTIONS='-p$(pmodules)'
157
# Is this needed for setting up a Depends?
158
#echo "kpkg:Package-Version=$(epoch)$(pversion)+$(non_epoch_version)" \
159
# >> debian/$(package).substvars
160
echo "kpkg:Kernel-Version=$(non_epoch_version)" > \
161
debian/$(pmodules).substvars
163
# The substvars mechanism seems slightly broken, hack to get around it
164
# stolen from the qce-ga package. Yaaaa!
165
sed -e 's/$${kpkg\:Kernel\-Version}/$(non_epoch_version)/' \
166
debian/control.modules.in > debian/control
91
dh_installdirs lib/modules/$(KVERS)/misc
172
93
# Build the module
94
$(MAKE) -C drivers KERNEL_DIR=$(KSRC) KVERS=$(KVERS)
175
96
# Install the module
176
$(MAKE) install DESTDIR=$(CURDIR)/debian/$(pmodules)
97
cp drivers/slusb.$ko drivers/slamr.$ko debian/$(PKGNAME)/lib/modules/$(KVERS)/misc
179
# FIXME dh_installdocs README
180
100
dh_installchangelogs
182
# We're not using this yet
186
#dh_gencontrol -- -v$(epoch)$(pversion)+$(non_epoch_version)+$(KDREV)
187
dh_gencontrol -- -v$(epoch)$(pversion)
104
dh_gencontrol -- -v$(VERSION)
189
#dh_builddeb --destdir=$(KSRC)/..
190
dh_builddeb --destdir=$(MODDIR)
106
dh_builddeb --destdir=$(DEB_DESTDIR)
193
109
build-indep: #CONFIG_STATUS# #CONFIGURE_STAMP# build-indep-stamp
194
110
build-indep-stamp:
223
139
# Create the directories to install the source into
224
dh_installdirs -p$(psource) usr/src/modules/$(package)
225
dh_installdirs -p$(psource) usr/src/modules/$(package)/debian
140
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
227
142
# Copy only the driver source to the proper location
228
cp -s driver/* debian/$(psource)/usr/src/modules/$(package)
143
cp -s driver/* debian/$(psource)/usr/src/modules/$(sname)
229
144
# Copy the needed debian/ pieces to the proper location
230
cp debian/*-modules.* \
231
debian/$(psource)/usr/src/modules/$(package)/debian
232
cp debian/control.modules.in \
233
debian/$(psource)/usr/src/modules/$(package)/debian/control.in
235
debian/$(psource)/usr/src/modules/$(package)/debian
236
cp debian/changelog \
237
debian/$(psource)/usr/src/modules/$(package)/debian
238
cp debian/copyright \
239
debian/$(psource)/usr/src/modules/$(package)/debian
145
cp debian/*modules.in* \
146
debian/$(psource)/usr/src/modules/$(sname)/debian
147
cp debian/*_KVERS_* debian/rules debian/changelog debian/copyright \
148
debian/compat debian/$(psource)/usr/src/modules/$(sname)/debian/
149
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
241
151
# Add here commands to install the package into debian/#PACKAGE#.