diff options
| author | Riku Voipio <riku.voipio@linaro.org> | 2015-09-02 05:57:24 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.com> | 2015-09-04 05:25:03 -0400 |
| commit | 3716001bcb7f5822382ac1f2f54226b87312cc6b (patch) | |
| tree | 21ec20a68bf4d6787fc014dc2791c5fb5d19beae /scripts/package | |
| parent | 26803821463c4e76322559b3dfb0c6b0fcc8aee8 (diff) | |
deb-pkg: add source package
Make deb-pkg build both source and binary package like make rpm-pkg does.
For people who only need binary kernel package, there is now bindeb-pkg
target, same target also used to build the .deb files if built from the
source package using dpkg-buildpackage.
Generated source package will build the same kernel .config than what
was available for make deb-pkg. The name of the source package can
be set with KDEB_SOURCENAME enviroment variable.
The source package is useful for GPL compliance, or for feeding to a
automated debian package builder.
Cc: Chris J Arges <chris.j.arges@canonical.com>
Reviewed-by: maximilian attems <maks@stro.at>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/package')
| -rw-r--r-- | scripts/package/Makefile | 17 | ||||
| -rwxr-xr-x | scripts/package/builddeb | 38 |
2 files changed, 49 insertions, 6 deletions
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 297e75684738..1aca224e8597 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | 23 | ||
| 24 | # Remove hyphens since they have special meaning in RPM filenames | 24 | # Remove hyphens since they have special meaning in RPM filenames |
| 25 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) | 25 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) |
| 26 | KDEB_SOURCENAME ?= linux-$(KERNELRELEASE) | ||
| 27 | export KDEB_SOURCENAME | ||
| 26 | # Include only those top-level files that are needed by make, plus the GPL copy | 28 | # Include only those top-level files that are needed by make, plus the GPL copy |
| 27 | TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \ | 29 | TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \ |
| 28 | Kbuild Kconfig COPYING $(wildcard localversion*) | 30 | Kbuild Kconfig COPYING $(wildcard localversion*) |
| @@ -83,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB | |||
| 83 | } && \ | 85 | } && \ |
| 84 | \ | 86 | \ |
| 85 | $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ | 87 | $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ |
| 86 | $(srctree)/scripts/package/builddeb | 88 | $(srctree)/scripts/package/builddeb $@ |
| 87 | 89 | ||
| 88 | deb-pkg: FORCE | 90 | deb-pkg: FORCE |
| 91 | $(MAKE) clean | ||
| 92 | $(call cmd,src_tar,$(KDEB_SOURCENAME)) | ||
| 93 | $(MAKE) KBUILD_SRC= | ||
| 94 | +$(call cmd,builddeb) | ||
| 95 | |||
| 96 | bindeb-pkg: FORCE | ||
| 89 | $(MAKE) KBUILD_SRC= | 97 | $(MAKE) KBUILD_SRC= |
| 90 | $(call cmd,builddeb) | 98 | +$(call cmd,builddeb) |
| 91 | 99 | ||
| 92 | clean-dirs += $(objtree)/debian/ | 100 | clean-dirs += $(objtree)/debian/ |
| 93 | 101 | ||
| @@ -132,8 +140,9 @@ perf-%pkg: FORCE | |||
| 132 | # --------------------------------------------------------------------------- | 140 | # --------------------------------------------------------------------------- |
| 133 | help: FORCE | 141 | help: FORCE |
| 134 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' | 142 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' |
| 135 | @echo ' binrpm-pkg - Build only the binary kernel package' | 143 | @echo ' binrpm-pkg - Build only the binary kernel RPM package' |
| 136 | @echo ' deb-pkg - Build the kernel as a deb package' | 144 | @echo ' deb-pkg - Build both source and binary deb kernel packages' |
| 145 | @echo ' bindeb-pkg - Build only the binary kernel deb package' | ||
| 137 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' | 146 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' |
| 138 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' | 147 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' |
| 139 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' | 148 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 0c18cfd93287..0cd46e129920 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -79,6 +79,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then | |||
| 79 | else | 79 | else |
| 80 | packageversion=$version-$revision | 80 | packageversion=$version-$revision |
| 81 | fi | 81 | fi |
| 82 | sourcename=$KDEB_SOURCENAME | ||
| 82 | tmpdir="$objtree/debian/tmp" | 83 | tmpdir="$objtree/debian/tmp" |
| 83 | fwdir="$objtree/debian/fwtmp" | 84 | fwdir="$objtree/debian/fwtmp" |
| 84 | kernel_headers_dir="$objtree/debian/hdrtmp" | 85 | kernel_headers_dir="$objtree/debian/hdrtmp" |
| @@ -238,7 +239,7 @@ fi | |||
| 238 | 239 | ||
| 239 | # Generate a simple changelog template | 240 | # Generate a simple changelog template |
| 240 | cat <<EOF > debian/changelog | 241 | cat <<EOF > debian/changelog |
| 241 | linux-upstream ($packageversion) $distribution; urgency=low | 242 | $sourcename ($packageversion) $distribution; urgency=low |
| 242 | 243 | ||
| 243 | * Custom built Linux kernel. | 244 | * Custom built Linux kernel. |
| 244 | 245 | ||
| @@ -265,12 +266,16 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public | |||
| 265 | License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. | 266 | License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. |
| 266 | EOF | 267 | EOF |
| 267 | 268 | ||
| 269 | |||
| 270 | build_depends="bc, kmod, cpio " | ||
| 271 | |||
| 268 | # Generate a control file | 272 | # Generate a control file |
| 269 | cat <<EOF > debian/control | 273 | cat <<EOF > debian/control |
| 270 | Source: linux-upstream | 274 | Source: $sourcename |
| 271 | Section: kernel | 275 | Section: kernel |
| 272 | Priority: optional | 276 | Priority: optional |
| 273 | Maintainer: $maintainer | 277 | Maintainer: $maintainer |
| 278 | Build-Depends: $build_depends | ||
| 274 | Standards-Version: 3.8.4 | 279 | Standards-Version: 3.8.4 |
| 275 | Homepage: http://www.kernel.org/ | 280 | Homepage: http://www.kernel.org/ |
| 276 | EOF | 281 | EOF |
| @@ -391,4 +396,33 @@ EOF | |||
| 391 | create_package "$dbg_packagename" "$dbg_dir" | 396 | create_package "$dbg_packagename" "$dbg_dir" |
| 392 | fi | 397 | fi |
| 393 | 398 | ||
| 399 | if [ "x$1" = "xdeb-pkg" ] | ||
| 400 | then | ||
| 401 | cat <<EOF > debian/rules | ||
| 402 | #!/usr/bin/make -f | ||
| 403 | |||
| 404 | build: | ||
| 405 | \$(MAKE) | ||
| 406 | |||
| 407 | binary-arch: | ||
| 408 | \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg | ||
| 409 | |||
| 410 | clean: | ||
| 411 | rm -rf debian/*tmp | ||
| 412 | mv debian/ debian.backup # debian/ might be cleaned away | ||
| 413 | \$(MAKE) clean | ||
| 414 | mv debian.backup debian | ||
| 415 | |||
| 416 | binary: binary-arch | ||
| 417 | EOF | ||
| 418 | mv ${sourcename}.tar.gz ../${sourcename}_${version}.orig.tar.gz | ||
| 419 | tar caf ../${sourcename}_${packageversion}.debian.tar.gz debian/{copyright,rules,changelog,control} | ||
| 420 | dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \ | ||
| 421 | -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz | ||
| 422 | mv ${sourcename}_${packageversion}*dsc .. | ||
| 423 | dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes | ||
| 424 | else | ||
| 425 | dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes | ||
| 426 | fi | ||
| 427 | |||
| 394 | exit 0 | 428 | exit 0 |
