From 67696af0b0a697e95a1f4f619f8b8b319a7fb01a Mon Sep 17 00:00:00 2001 From: Jurij Smakov Date: Tue, 17 May 2005 23:04:42 +0000 Subject: [PATCH] Everything is implemented except subarch stuff. svn path=/branches/kernel-image-2.6.11/; revision=3136 --- README | 22 +++++++- arch/i386/Makefile.inc | 4 +- debian/rules | 26 ++++++---- header-install.in | 24 ++++++--- post-install | 70 -------------------------- post-install.in | 111 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 166 insertions(+), 91 deletions(-) delete mode 100644 post-install create mode 100644 post-install.in diff --git a/README b/README index 8288cfe51..192f3bc75 100644 --- a/README +++ b/README @@ -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//initrd + directory, so that they will be included by mkinitrd. Full + pathname relative to the /lib/modules/ directory should + be give, no quoting is necessary. Typical usage: + + initrd_modules := kernel/drivers/video/vesafb.ko kernel/security/capability.ko diff --git a/arch/i386/Makefile.inc b/arch/i386/Makefile.inc index c3c90ee83..201ff1229 100644 --- a/arch/i386/Makefile.inc +++ b/arch/i386/Makefile.inc @@ -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 diff --git a/debian/rules b/debian/rules index 4eebe93fe..010a74d08 100755 --- a/debian/rules +++ b/debian/rules @@ -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) diff --git a/header-install.in b/header-install.in index 554d2fc04..e2856d3d9 100644 --- a/header-install.in +++ b/header-install.in @@ -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" diff --git a/post-install b/post-install deleted file mode 100644 index 43ccaf22a..000000000 --- a/post-install +++ /dev/null @@ -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 diff --git a/post-install.in b/post-install.in new file mode 100644 index 000000000..974388ca8 --- /dev/null +++ b/post-install.in @@ -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