Everything is implemented except subarch stuff.

svn path=/branches/kernel-image-2.6.11/; revision=3136
This commit is contained in:
Jurij Smakov 2005-05-17 23:04:42 +00:00
parent 3ca64fbdc1
commit 67696af0b0
6 changed files with 166 additions and 91 deletions

22
README
View File

@ -60,6 +60,17 @@ headers_dirs
headers_dirs := sparc | sparc64
headers_extra
This variable is substituted into the headers-install script,'
and may be used to specify extra files, which a particular
architecture would like to include in the kernel-headers package.
Files should be specified with a full path relative to the
top-level kernel directory, unquoted and separated by spaces.
Typical usage:
headers_extra := arch/i386/kernel/asm-offsets.s
headers_subarch
The subarch to pass to the --subarch option for the make-kpkg
@ -104,4 +115,13 @@ build_makeflags
build_makeflags := 'CC=amd64-linux-gcc V=1'
The value of the variable must be properly quoted.
initrd_modules
This variable may contain a space-separated list of modules
which should be hard-linked into the /lib/modules/<version>/initrd
directory, so that they will be included by mkinitrd. Full
pathname relative to the /lib/modules/<version> directory should
be give, no quoting is necessary. Typical usage:
initrd_modules := kernel/drivers/video/vesafb.ko kernel/security/capability.ko

View File

@ -1,4 +1,6 @@
#
# Variables
#
include_common_config = no
include_common_config := no
headers_extra := arch/i386/kernel/ams-offsets.s
initrd_modules := kernel/drivers/video/vesafb.ko kernel/security/capability.ko

26
debian/rules vendored
View File

@ -115,7 +115,7 @@ build-stamp: unpack-stamp
clean:
dh_testdir
rm -f *-stamp header-install config.*
rm -f *-stamp header-install post-install config.*
rm -rf $(kdir) build-* install-* bin/touch.orig
dh_clean
#
@ -154,11 +154,15 @@ binary-arch: build
binary: binary-indep binary-arch
header-install: header-install.in
sed -e 's/@kbpkg@/$(kbpkg)/g' \
-e 's/@karch@/$(karch)/g' \
-e 's/@headers_dirs@/$(headers_dirs)/g' \
header-install.in > header-install
sed -e 's,@kbpkg@,$(kbpkg),g' \
-e 's,@headers_dirs@,$(headers_dirs),g' \
-e 's,@headers_extra@,$(headers_extra),g' \
header-install.in > header-install
chmod u+x header-install
post-install: post-install.in
sed -e 's,@initrd_modules@,$(initrd_modules),' \
post-install.in > post-install
#
# Generates the kernel config file for a subarch by merging
# the arch-independent config file (arch/config.common),
@ -193,15 +197,15 @@ config.%:
#
debian/control:
cat debian/control.in $(controls) | \
sed -e 's/@karch@/$(karch)/g' \
-e 's/@version@/$(version)/g' \
-e 's/@ktver@/$(ktver)/g' \
-e 's/@abiname@/$(abiname)/g' \
-e 's/@kbpkg@/$(kbpkg)/g' | \
sed -e 's,@karch@,$(karch),g' \
-e 's,@version@,$(version),g' \
-e 's,@ktver@,$(ktver),g' \
-e 's,@abiname@,$(abiname),g' \
-e 's,@kbpkg@,$(kbpkg),g' | \
sed '/^[[:space:]]*$$/d' | \
sed 's/^Package:/\n&/g' > debian/control
$(kdir):
$(kdir): post-install
dh_testdir
tar jxf /usr/src/kernel-source-$(version).tar.bz2
cd $(kdir) && $(kpatch) $(version)-$(ktver)

View File

@ -1,25 +1,33 @@
#!/bin/sh
#
# This is the make-kpkg hook file, which runs when make-kpkg is invoked
# (from debian/rules) to create the flavour-independent kernel-headers
# package. Two major tasks which it performs are a) copying the extra
# files into the temporary kernel-headers directory and b) removing
# unneeded include/asm-* directories.
#
set -e
kbpkg=@kbpkg@
cd $DEBIAN_SRCTOP
{
find . -path './scripts/*' -prune -o \
-path './Documentation/*' -prune -o \
-path './debian/*' -prune -o \
-type f \( -name Makefile -o -name 'Kconfig*' \) -print
echo arch/@karch@/kernel/asm-offsets.s
find . -path './scripts/*' -prune -o \
-path './Documentation/*' -prune -o \
-path './debian/*' -prune -o \
-type f \( -name Makefile -o -name 'Kconfig*' \) -print
for i in @headers_extra@; do
echo "${i}"
done
} | cpio -pd --preserve-modification-time $OLDPWD
cd - > /dev/null
ln -s ../$kbpkg/scripts .
ln -s ../${kbpkg}/scripts .
remove=
cd include
for i in asm-*; do
case ${i#asm-} in
generic | @header_dirs@)
generic | @headers_dirs@)
;;
*)
remove="$remove $i"

View File

@ -1,70 +0,0 @@
#!/bin/sh
set -e
debhelper_pre() {
dh_clean -k --package="$1"
dh_installdirs --package="$1"
}
debhelper_post() {
dh_installdocs --package="$1"
dh_installchangelogs --package="$1"
dh_compress --package="$1"
dh_fixperms --package="$1"
dh_installdeb --package="$1"
dh_gencontrol --package="$1"
dh_md5sums --package="$1"
dh_builddeb --package="$1"
}
suffix=${version#*$debnum-}
prefix=${version%%-*}$debnum
pkg=kernel-headers-$version
top=$PWD/debian/$pkg
dir=$top/usr/src/kernel-headers-$version
karch=${suffix%-smp}
karch=${karch%32}
debhelper_pre $pkg
mkdir -p $dir/include/linux
cp -a .config $dir
echo $debnum-$suffix > $dir/.extraversion
cp -a Module.symvers $dir
find . -mindepth 1 -maxdepth 1 \
! -name debian -a ! -name Documentation -a ! -name include -a \
! -name '.*' -a \( \
-name Makefile -o -type d \) \
-printf "../kernel-headers-$prefix/%f\n" |
xargs ln -s --target-directory="$dir"
cd include
find . -mindepth 1 -maxdepth 1 \
! -name config -a ! -name linux -a \( \
! -name 'asm-*' -o -name asm-generic -o -name asm-$karch \) \
-printf "../../kernel-headers-$prefix/include/%f\n" |
xargs ln -s --target-directory=$dir/include
cp -a config $dir/include
ln -sf asm-$karch $dir/include/asm
find linux -mindepth 1 -maxdepth 1 \
! -name autoconf.h -a ! -name compile.h -a ! -name version.h \
-printf "../../../kernel-headers-$prefix/include/linux/%f\n" |
xargs ln -s --target-directory=$dir/include/linux
cp -a linux/autoconf.h linux/compile.h \
linux/version.h $dir/include/linux
cd ..
mkdir -p $top/lib/modules/$version
ln -s /usr/src/kernel-headers-$version $top/lib/modules/$version/build
debhelper_post $pkg
bpkg=kernel-build-$prefix
top=$PWD/../debian/$bpkg
[ -d $top/usr/src/$bpkg ] || mkdir -p $top/usr/src/$bpkg
ln -s ../kernel-headers-$version $top/usr/src/$bpkg/$suffix

111
post-install.in Normal file
View File

@ -0,0 +1,111 @@
#!/bin/sh
#
# This is the hook file executed by make-kpkg in the end of creation
# of the kernel-image for a particular flavour. The major task it performs
# is the creation of the flavour-specific kernel-headers package.
#
set -e
debhelper_pre() {
dh_clean -k --package="$1"
dh_installdirs --package="$1"
}
debhelper_post() {
dh_installdocs --package="$1"
dh_installchangelogs --package="$1"
dh_compress --package="$1"
dh_fixperms --package="$1"
dh_installdeb --package="$1"
dh_gencontrol --package="$1"
dh_md5sums --package="$1"
dh_builddeb --package="$1"
}
suffix=${version#*$debnum-}
prefix=${version%%-*}$debnum
pkg=kernel-headers-$version
top=$PWD/debian/$pkg
dir=$top/usr/src/kernel-headers-$version
#
# Here we need to find the kernel architecture which
# is appropriate for the current flavour. It is available
# in kernel-package as KERNEL_ARCH. Cleanest way is to get
# make-kpkg export it to this script.
#
# Currently we'll have to do some fiddling here For
# example for sparc we need to map sparc32* to 'sparc'
# and sparc64* to 'sparc64'. The default for other
# arches is the name of the architecture.
#
case ${DEB_HOST_ARCH} in
sparc*)
KERNEL_ARCH=${suffix%-smp}
KERNEL_ARCH=${KERNEL_ARCH%32}
;;
*)
KERNEL_ARCH=${DEB_HOST_ARCH}
;;
esac
debhelper_pre $pkg
#
# Stuff below is ugly as hell, but does the trick so I'm not
# touching it until we can invent something better.
#
mkdir -p $dir/include/linux
cp -a .config $dir
echo $debnum-$suffix > $dir/.extraversion
cp -a Module.symvers $dir
find . -mindepth 1 -maxdepth 1 \
! -name debian -a ! -name Documentation -a ! -name include -a \
! -name '.*' -a \( \
-name Makefile -o -type d \) \
-printf "../kernel-headers-$prefix/%f\n" |
xargs ln -s --target-directory="$dir"
cd include
find . -mindepth 1 -maxdepth 1 \
! -name config -a ! -name linux -a \( \
! -name 'asm-*' -o -name asm-generic -o -name asm-${KERNEL_ARCH} \) \
-printf "../../kernel-headers-$prefix/include/%f\n" |
xargs ln -s --target-directory=$dir/include
cp -a config $dir/include
ln -sf asm-${KERNEL_ARCH} $dir/include/asm
find linux -mindepth 1 -maxdepth 1 \
! -name autoconf.h -a ! -name compile.h -a ! -name version.h \
-printf "../../../kernel-headers-$prefix/include/linux/%f\n" |
xargs ln -s --target-directory=$dir/include/linux
cp -a linux/autoconf.h linux/compile.h \
linux/version.h $dir/include/linux
cd ..
mkdir -p $top/lib/modules/$version
ln -s /usr/src/kernel-headers-$version $top/lib/modules/$version/build
debhelper_post $pkg
#
# This is kernel-build cruft which we will probably phase out
#
# bpkg=kernel-build-$prefix
# top=$PWD/../debian/$bpkg
#
# [ -d $top/usr/src/$bpkg ] || mkdir -p $top/usr/src/$bpkg
# ln -s ../kernel-headers-$version $top/usr/src/$bpkg/$suffix
#
# Check whether we should force any modules to be available
# on the initrd.
#
cd ${IMAGE_TOP}/lib/modules/${version}
modules='@initrd_modules@'
if [ -n "${modules}" ]; then
mkdir initrd
for i in ${modules}; do
if [ -f "${i}" ]; then
ln "${i}" initrd
fi
done
fi