]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'kbuild/misc' into kbuild/for-next
authorMichal Marek <mmarek@suse.com>
Fri, 4 Sep 2015 11:20:37 +0000 (13:20 +0200)
committerMichal Marek <mmarek@suse.com>
Fri, 4 Sep 2015 11:20:37 +0000 (13:20 +0200)
scripts/package/Makefile
scripts/package/builddeb

index 8b11d5adec7f58f3e4244504ba6e3fe37eff3b27..1aca224e8597c838a78ce18c64d847e66d816091 100644 (file)
 
 # Remove hyphens since they have special meaning in RPM filenames
 KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
+KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
+export KDEB_SOURCENAME
 # Include only those top-level files that are needed by make, plus the GPL copy
-TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
+TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
                Kbuild Kconfig COPYING $(wildcard localversion*)
-TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
 MKSPEC     := $(srctree)/scripts/package/mkspec
 
+quiet_cmd_src_tar = TAR     $(2).tar.gz
+      cmd_src_tar = \
+if test "$(objtree)" != "$(srctree)"; then \
+       echo "Building source tarball is not possible outside the"; \
+       echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
+       echo "binrpm-pkg or bindeb-pkg target instead."; \
+       false; \
+fi ; \
+$(srctree)/scripts/setlocalversion --save-scmversion; \
+ln -sf $(srctree) $(2); \
+tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
+       $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
+rm -f $(2) $(objtree)/.scmversion
+
 # rpm-pkg
 # ---------------------------------------------------------------------------
 rpm-pkg rpm: FORCE
-       @if test "$(objtree)" != "$(srctree)"; then \
-               echo "Building source + binary RPM is not possible outside the"; \
-               echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
-               echo "binrpm-pkg target instead."; \
-               false; \
-       fi
        $(MAKE) clean
-       ln -sf $(srctree) $(KERNELPATH)
        $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
-       $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
-       tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
-       rm $(KERNELPATH)
-       rm -f $(objtree)/.scmversion
+       $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
        $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
        mv -f $(objtree)/.tmp_version $(objtree)/.version
        rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
@@ -80,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB
        } && \
        \
        $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
-               $(srctree)/scripts/package/builddeb
+               $(srctree)/scripts/package/builddeb $@
 
 deb-pkg: FORCE
+       $(MAKE) clean
+       $(call cmd,src_tar,$(KDEB_SOURCENAME))
+       $(MAKE) KBUILD_SRC=
+       +$(call cmd,builddeb)
+
+bindeb-pkg: FORCE
        $(MAKE) KBUILD_SRC=
-       $(call cmd,builddeb)
+       +$(call cmd,builddeb)
 
 clean-dirs += $(objtree)/debian/
 
@@ -129,8 +140,9 @@ perf-%pkg: FORCE
 # ---------------------------------------------------------------------------
 help: FORCE
        @echo '  rpm-pkg             - Build both source and binary RPM kernel packages'
-       @echo '  binrpm-pkg          - Build only the binary kernel package'
-       @echo '  deb-pkg             - Build the kernel as a deb package'
+       @echo '  binrpm-pkg          - Build only the binary kernel RPM package'
+       @echo '  deb-pkg             - Build both source and binary deb kernel packages'
+       @echo '  bindeb-pkg          - Build only the binary kernel deb package'
        @echo '  tar-pkg             - Build the kernel as an uncompressed tarball'
        @echo '  targz-pkg           - Build the kernel as a gzip compressed tarball'
        @echo '  tarbz2-pkg          - Build the kernel as a bzip2 compressed tarball'
index 0c18cfd932876143dcf7319eb1955539632f1400..0cd46e129920e8ad114eb335ae92ce85230d068d 100755 (executable)
@@ -79,6 +79,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
 else
        packageversion=$version-$revision
 fi
+sourcename=$KDEB_SOURCENAME
 tmpdir="$objtree/debian/tmp"
 fwdir="$objtree/debian/fwtmp"
 kernel_headers_dir="$objtree/debian/hdrtmp"
@@ -238,7 +239,7 @@ fi
 
 # Generate a simple changelog template
 cat <<EOF > debian/changelog
-linux-upstream ($packageversion) $distribution; urgency=low
+$sourcename ($packageversion) $distribution; urgency=low
 
   * Custom built Linux kernel.
 
@@ -265,12 +266,16 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public
 License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
 EOF
 
+
+build_depends="bc, kmod, cpio "
+
 # Generate a control file
 cat <<EOF > debian/control
-Source: linux-upstream
+Source: $sourcename
 Section: kernel
 Priority: optional
 Maintainer: $maintainer
+Build-Depends: $build_depends
 Standards-Version: 3.8.4
 Homepage: http://www.kernel.org/
 EOF
@@ -391,4 +396,33 @@ EOF
        create_package "$dbg_packagename" "$dbg_dir"
 fi
 
+if [ "x$1" = "xdeb-pkg" ]
+then
+    cat <<EOF > debian/rules
+#!/usr/bin/make -f
+
+build:
+       \$(MAKE)
+
+binary-arch:
+       \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
+
+clean:
+       rm -rf debian/*tmp
+       mv debian/ debian.backup # debian/ might be cleaned away
+       \$(MAKE) clean
+       mv debian.backup debian
+
+binary: binary-arch
+EOF
+       mv ${sourcename}.tar.gz ../${sourcename}_${version}.orig.tar.gz
+       tar caf ../${sourcename}_${packageversion}.debian.tar.gz debian/{copyright,rules,changelog,control}
+       dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \
+               -b / ../${sourcename}_${version}.orig.tar.gz  ../${sourcename}_${packageversion}.debian.tar.gz
+       mv ${sourcename}_${packageversion}*dsc ..
+       dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes
+else
+       dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes
+fi
+
 exit 0