From 378548577097db8170334b9cb48e44b21c1d1957 Mon Sep 17 00:00:00 2001 From: Jurij Smakov Date: Sun, 29 May 2005 04:46:18 +0000 Subject: [PATCH] Builds source, tree and images. Images currently break due to some stem issues. svn path=/branches/kernel-image-2.6.11/; revision=3262 --- debian/Makefile | 58 ++++++++++++++--------------- debian/arch/i386/control.in | 25 ++----------- debian/rules | 53 ++++++++++---------------- debian/templates/control.headers.in | 17 +++++++++ debian/templates/control.main.in | 20 ---------- debian/templates/control.source.in | 6 +++ debian/templates/post-install.in | 6 +-- 7 files changed, 78 insertions(+), 107 deletions(-) create mode 100644 debian/templates/control.headers.in create mode 100644 debian/templates/control.source.in diff --git a/debian/Makefile b/debian/Makefile index e650fb6c5..86bc7914b 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -5,24 +5,23 @@ # Additionally, variables version, abiname and ktver are # expected to be available (need to be exported from the parent process). # It is possible to override the flavours by setting the flavours -# variable. +# variable. It will also be passed a list of source files # -# This Makefile is run from the debian subdir +# This Makefile is run from the debian subdir. # SHELL := sh -e debver := $(version)-$(abiname) uver := $(subst .,_,$(version)) debnum := -$(abiname) -kbpkg := kernel-kbuild-$(version)-$(abiname) -# This will eventually have to be changed to a command, applying -# the debian's patches from the local tree (arch/patches?) -kpatch := /usr/src/kernel-patches/all/$(version)/apply/debian $(version)-$(ktver) +# +# These variables control the behaviour of make-kpkg +# DEBIAN_UPSTREAM_VERSION := $(version) ifeq (,$(DEB_HOST_ARCH)) DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) endif -export version debnum DEBIAN_UPSTREAM_VERSION +export version debnum DEBIAN_UPSTREAM_VERSION DEBIAN_STEM karch := $(DEB_HOST_ARCH) # @@ -33,8 +32,9 @@ ifeq ($(subarch),none) append := else basedir := arch/$(karch)/$(subarch) - append := -$(subarch) + append := $(subarch)- endif + default := $(basedir)/config.default configs := $(notdir $(wildcard $(basedir)/config.*)) configs := $(filter-out config.common config.default, $(configs)) @@ -43,6 +43,8 @@ kdir := kernel-source-$(version)-$(subarch) ifndef flavours flavours := $(patsubst config.%,%,$(configs)) endif +controls := templates/control.source.in templates/control.headers.in +controls += $(basedir)/control.in -include $(basedir)/Makefile.inc @@ -54,8 +56,10 @@ endif # replaced by the flavour for which the command is run. # kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install-$(subarch)' -kpkg_headers_cmd += make-kpkg --append-to-version $(debnum)$(append) -kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-@flavour@ +kpkg_headers_cmd += make-kpkg --append-to-version $(append)$(debnum) +kpkg_headers_cmd += --stem linux +kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-@flavour@ +kpkg_build_cmd += --stem linux ifdef added_patches kpkg_headers_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches)) kpkg_build_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches)) @@ -119,9 +123,6 @@ install-stamp-$(subarch)-%: build-$(subarch)-% build-stamp-$(subarch)-% touch install-stamp-$(subarch)-$* headers-stamp: $(kdir) - dh_testdir - dh_clean -k - dh_installdirs cp $(default) $(kdir)/.config cd $(kdir); $(kpkg_headers_cmd) cat $(kdir)/debian/files >> files @@ -165,24 +166,23 @@ config.%: # Flavour config file must be present cat $(basedir)/$@ >> $@ -$(kdir): post-install-$(subarch) - dh_testdir - tar jxf /usr/src/$(tkdir).tar.bz2 +srcfiles := $(filter-out ../debian ../linux-source-$(version), $(shell echo ../*)) +$(kdir): post-install-$(subarch) $(controls) + mkdir -p $(tkdir) + cp -al $(srcfiles) $(tkdir) mkdir -p $(tkdir)/debian - cp debian/changelog $(tkdir)/debian - cp debian/control $(tkdir)/debian - cp debian/copyright $(tkdir)/debian + cp changelog $(tkdir)/debian + cp copyright $(tkdir)/debian + cat $(controls) | \ + sed -e 's/@version@/$(version)/g' \ + -e 's/@ltver@/$(ltver)/g' \ + -e 's/@subarch@/$(append)/g' \ + -e 's/@major@/$(major)/g' \ + -e 's/@abiname@/$(abiname)/g' | \ + sed '/^[[:space:]]*$$/d' | \ + sed 's/^Package:/\n&/g' > $(tkdir)/debian/control touch $(tkdir)/debian/official install post-install-$(subarch) $(tkdir)/debian/post-install - cd $(tkdir) && $(kpatch) -# Arch/subarch-specific patches - if [ -d $(basedir)/patches ] && \ - [ -s $(basedir)/patches/list ]; then \ - cd $(tkdir); \ - for i in $$(cat ../$(basedir)/patches/list); do \ - patch -p1 < ../$(basedir)/patches/$${i}; \ - done; \ - fi mv $(tkdir) $@ # # This target performs a build for a particular flavour. Note @@ -199,7 +199,6 @@ $(kdir): post-install-$(subarch) # still needs variables headers_dirs and headers_extra set. # build-stamp-$(subarch)-%: build-$(subarch)-% - dh_testdir PATH=$$PWD/bin:$$PATH; \ cd $<; \ $(subst @flavour@,$*,$(kpkg_build_cmd)); \ @@ -216,7 +215,6 @@ build-stamp-$(subarch)-%: build-$(subarch)-% # Creates a build directory for a particular flavour # build-$(subarch)-%: $(kdir) config.% - dh_testdir if [ ! -d $@ ]; then \ cp -al $(kdir) $@; \ cp config.$* $@/.config; \ diff --git a/debian/arch/i386/control.in b/debian/arch/i386/control.in index d0057b63c..b28e660ad 100644 --- a/debian/arch/i386/control.in +++ b/debian/arch/i386/control.in @@ -1,37 +1,20 @@ -Package: kernel-headers-@version@-@abiname@-foo -Architecture: any -Section: devel -Priority: optional -Depends: coreutils | fileutils (>= 4.0) -Provides: kernel-headers, kernel-headers-2.6 -Description: Header files related to Linux kernel version @version@ - This package provides kernel header files for version @version@, generally - used for building out-of-tree kernel modules. See the 'module-assistant' - package for more information. - . - This package consists mostly of the common files between the subarchitecture - specific header packages, which should be used for building modules. - . - For more information you can also read: - /usr/share/doc/kernel-headers-@version@-@abiname@/debian.README.gz. - -Package: kernel-headers-2.6.11-1-686 +Package: linux-headers-2.6.11-1-686 Architecture: i386 Section: devel Priority: optional Depends: coreutils | fileutils (>= 4.0), kernel-headers-2.6.11-1 -Provides: kernel-headers, kernel-headers-2.6 +Provides: linux-headers, linux-headers-2.6 Description: Linux kernel headers 2.6.11 on PPro/Celeron/PII/PIII/P4 This package provides kernel header files for version 2.6.11 on Pentium Pro/Celeron/Pentium II/Pentium III/Pentium 4. Please read /usr/share/doc/kernel-headers-2.6.11-1/debian.README.gz for details -Package: kernel-image-2.6.11-1-686 +Package: linux-image-2.6.11-1-686 Architecture: i386 Section: base Priority: optional -Provides: kernel-image, kernel-image-2.6 +Provides: linux-image, linux-image-2.6 Depends: initrd-tools (>= 0.1.76), coreutils | fileutils (>= 4.0), module-init-tools (>= 0.9.13) Conflicts: hotplug (<< 0.0.20040105-1) Suggests: lilo (>= 19.1) | grub, fdutils, kernel-doc-2.6.11 | kernel-source-2.6.11 diff --git a/debian/rules b/debian/rules index 01d13cb59..6943fa5a7 100755 --- a/debian/rules +++ b/debian/rules @@ -9,7 +9,6 @@ ltver := 5 # Generally nothing needs to be modified below this line # SHELL := sh -e -controls := $(wildcard debian/arch/*/control.in debian/arch/*/*/control.in) karch := $(shell dpkg-architecture -qDEB_HOST_ARCH) major := $(basename $(version)) srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}') @@ -43,7 +42,7 @@ endif # source_files = $(filter-out debian linux-source-$(version), $(shell echo *)) -export version abiname ltver kbuildver flavours +export version abiname ltver kbuildver flavours major patch: debian/patch-stamp debian/patch-stamp: debian/bin/apply @@ -107,24 +106,24 @@ debian/tree-stamp: dh_builddeb -p$(tpkg) touch debian/tree-stamp -unpack: debian/linux-source-$(version).tar.bz2 unpack-stamp -unpack-stamp: +unpack: debian/unpack-stamp +debian/unpack-stamp: debian/patch-stamp dh_testdir - for i in $(subarchs); do \ - cd debian; \ - $(MAKE) subarch=$${i} source_files='$(source_files)' unpack; \ + for i in $(subarchs); do \ + cd debian; \ + $(MAKE) subarch=$${i} unpack; \ done ln -s $$(command -v touch) debian/bin/touch.orig - touch unpack-stamp + touch debian/unpack-stamp -build: build-stamp -build-stamp: unpack-stamp +build: debian/build-stamp +debian/build-stamp: debian/unpack-stamp dh_testdir - for i in $(subarchs); do \ - cd debian; \ - $(MAKE) subarch=$${i} source_files='$(source_files)' build; \ + for i in $(subarchs); do \ + cd debian; \ + $(MAKE) subarch=$${i} build; \ done - touch build-stamp + touch debian/build-stamp clean: unpatch dh_testdir @@ -136,12 +135,12 @@ clean: unpatch rm -rf kernel-source-* build-* install-* dh_clean -binary-indep: build +binary-indep: source tree binary-arch: build dh_testdir - for i in $(subarchs); do \ - cd debian; \ - $(MAKE) subarch=$${i} source_files='$(source_files)' binary; \ + for i in $(subarchs); do \ + cd debian; \ + $(MAKE) subarch=$${i} binary; \ done binary: binary-indep binary-arch @@ -151,7 +150,8 @@ binary: binary-indep binary-arch # variable values into the template. # debian/control: debian/templates/control.main.in - cat debian/templates/control.main.in | \ + cat debian/templates/control.source.in \ + debian/templates/control.main.in | \ sed -e 's/@version@/$(version)/g' \ -e 's/@major@/$(major)/g' \ -e 's/@ltver@/$(ltver)/g' \ @@ -161,18 +161,5 @@ debian/control: debian/templates/control.main.in -e 's/@abiname@/$(abiname)/g' | \ sed '/^[[:space:]]*$$/d' | \ sed 's/^Package:/\n&/g' > debian/control -# -# If we ended up here, either we need to perform the linux-source -# build, or use the existing linux-source to unpack the kernels. -# This can be controlled by the use_existing_source variable. -# -debian/linux-source-$(version).tar.bz2: debian/Makefile.source - dh_testdir - if [ '$(use_existing_source)' = 'yes' ]; then \ - ln -s /usr/src/linux-source-$(version).tar.bz2 \ - debian/linux-source-$(version).tar.bz2; \ - else \ - $(MAKE) -f debian/Makefile.source binary; \ - fi -.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source +.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree diff --git a/debian/templates/control.headers.in b/debian/templates/control.headers.in new file mode 100644 index 000000000..28bd4e86a --- /dev/null +++ b/debian/templates/control.headers.in @@ -0,0 +1,17 @@ +Package: linux-headers@subarch@-@version@-@abiname@ +Architecture: any +Section: devel +Priority: optional +Depends: coreutils | fileutils (>= 4.0) +Provides: linux-headers, linux-headers-@major@ +Description: Common architecture-specific header files for Linux kernel @version@ + This package provides the architecture-specific common kernel header files + for Linux kernel version @version@, generally used for building out-of-tree + kernel modules. To obtain a complete set of headers you also need to install + the linux-headers-@version@-@abiname@-(flavour) package, matching the flavour + of the kernel you intend the build for. To obtain such a set for the currently + running kernel it is sufficient to run a command + + apt-get install linux-headers-@version@-@abiname@-$(uname -r) + . + and it will be unpacked in /usr/src/linux-headers-@version@-@abiname@-(flavour). diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index 9cbfde5f0..9971d196b 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -1,10 +1,3 @@ -Source: linux-source-@version@ -Section: devel -Priority: optional -Maintainer: Debian Kernel Team -Standards-Version: 3.6.1.0 -Build-Depends: Build-Depends: gcc (>= 4:3.3), debhelper (>= 4), kernel-package, module-init-tools, sparc-utils [sparc] - Package: linux-source-@version@ Architecture: all Section: devel @@ -73,19 +66,6 @@ Description: Linux kernel source tree for building Debian kernel images The package serves no purpose outside of the Debian build and archive infrastructure. -Package: linux-headers-@version@-@abiname@ -Architecture: all -Section: devel -Priority: optional -Depends: coreutils | fileutils (>= 4.0) -Provides: linux-headers, linux-headers-@major@ -Description: Architecture-independent header files for Linux kernel @version@ - This package provides the architecture-independent kernel header files - for Linux kernel version @version@, generally used for building out-of-tree - kernel modules. It does not include the header files for (sub)architectures - which require additional unmerged patches to build, for those separate - header packages are provided. - Package: linux-scripts-@version@-@abiname@ Architecture: any Section: devel diff --git a/debian/templates/control.source.in b/debian/templates/control.source.in new file mode 100644 index 000000000..a30176cd9 --- /dev/null +++ b/debian/templates/control.source.in @@ -0,0 +1,6 @@ +Source: linux-source-@version@ +Section: devel +Priority: optional +Maintainer: Debian Kernel Team +Standards-Version: 3.6.1.0 +Build-Depends: Build-Depends: gcc (>= 4:3.3), debhelper (>= 4), kernel-package, module-init-tools, sparc-utils [sparc] diff --git a/debian/templates/post-install.in b/debian/templates/post-install.in index aa9f80322..8b34ce015 100644 --- a/debian/templates/post-install.in +++ b/debian/templates/post-install.in @@ -28,14 +28,14 @@ debhelper_post() { # prefix=$(version)-$(abiname) # prefix is then used to form a destination directory # to link to. For cases with subarch we need to link -# to kernel-headers-$(version)-$(abiname)-$(subarch), +# to kernel-headers-$(subarch)-$(version)-$(abiname), # not just kernel-headers-$(version)-$(abiname). Note # that the append_subarch substitution must contain a -# dash, if it is non-empty. +# trailing dash, if it is non-empty. # append='@append_subarch@' suffix=${version#*$debnum-} -prefix=${version%%-*}${debnum}${append} +prefix=${append}${version%%-*}${debnum} pkg=kernel-headers-$version top=$PWD/debian/$pkg dir=$top/usr/src/kernel-headers-$version