Commit 1d7bae8f authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: deb-pkg: build binary-arch in parallel

'make deb-pkg' builds build-arch in parallel, but binary-arch serially.

Given that all binary packages are independent of one another, they can
be built in parallel.

I am uncertain whether debian/files is robust against a race condition.
Just in case, make dh_gencontrol (dpkg-gencontrol) output to separate
debian/*.files, which are then concatenated into debian/files.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
parent caf400c8
...@@ -24,18 +24,6 @@ if_enabled_echo() { ...@@ -24,18 +24,6 @@ if_enabled_echo() {
fi fi
} }
create_package() {
export DH_OPTIONS="-p${1}"
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_gencontrol
dh_md5sums
dh_builddeb -- ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS}
}
install_linux_image () { install_linux_image () {
pname=$1 pname=$1
pdir=debian/$1 pdir=debian/$1
...@@ -161,21 +149,15 @@ install_libc_headers () { ...@@ -161,21 +149,15 @@ install_libc_headers () {
mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}" mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}"
} }
rm -f debian/files package=$1
packages_enabled=$(dh_listpackages) case "${package}" in
*-dbg)
for package in ${packages_enabled}
do
case ${package} in
*-dbg)
install_linux_image_dbg "${package}";; install_linux_image_dbg "${package}";;
linux-image-*|user-mode-linux-*) linux-image-*|user-mode-linux-*)
install_linux_image "${package}";; install_linux_image "${package}";;
linux-libc-dev) linux-libc-dev)
install_libc_headers "${package}";; install_libc_headers "${package}";;
linux-headers-*) linux-headers-*)
install_kernel_headers "${package}";; install_kernel_headers "${package}";;
esac esac
create_package "${package}"
done
...@@ -25,12 +25,43 @@ revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version))) ...@@ -25,12 +25,43 @@ revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))
CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-) CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)
make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE)) make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
all-packages = $(shell dh_listpackages)
image-package = $(filter linux-image-% user-%, $(filter-out %-dbg, $(all-packages)))
image-dbg-package = $(filter %-dbg, $(all-packages))
libc-dev-package = $(filter linux-libc-dev, $(all-packages))
headers-package = $(filter linux-headers-%, $(all-packages))
mk-files = $(patsubst binary-%,debian/%.files,$1)
package = $($(@:binary-%=%-package))
# DH_OPTION is an environment variable common for all debhelper commands.
# We could 'export' it, but here it is passed from the command line to clarify
# which package is being processed in the build log.
DH_OPTIONS = -p$(package)
define binary
$(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)'
$(Q)dh_installdocs $(DH_OPTIONS)
$(Q)dh_installchangelogs $(DH_OPTIONS)
$(Q)dh_compress $(DH_OPTIONS)
$(Q)dh_fixperms $(DH_OPTIONS)
$(Q)dh_gencontrol $(DH_OPTIONS) -- -f$(call mk-files,$@)
$(Q)dh_md5sums $(DH_OPTIONS)
$(Q)dh_builddeb $(DH_OPTIONS) -- $(addprefix -Z,$(KDEB_COMPRESS))
endef
.PHONY: $(binary-targets)
$(binary-targets): build-arch
$(Q)truncate -s0 $(call mk-files,$@)
$(if $(package),$(binary))
.PHONY: binary binary-indep binary-arch .PHONY: binary binary-indep binary-arch
binary: binary-arch binary-indep binary: binary-arch binary-indep
binary-indep: build-indep binary-indep: build-indep
binary-arch: build-arch binary-arch: $(binary-targets)
$(Q)$(MAKE) $(make-opts) \ $(Q)cat $(call mk-files,$^) > debian/files
run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb'
.PHONY: build build-indep build-arch .PHONY: build build-indep build-arch
build: build-arch build-indep build: build-arch build-indep
...@@ -41,7 +72,7 @@ build-arch: ...@@ -41,7 +72,7 @@ build-arch:
.PHONY: clean .PHONY: clean
clean: clean:
$(Q)rm -rf debian/files debian/linux-* debian/deb-env.vars* $(Q)rm -rf debian/files debian/linux-* debian/deb-env.vars* debian/*.files
$(Q)$(MAKE) ARCH=$(ARCH) clean $(Q)$(MAKE) ARCH=$(ARCH) clean
# If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed # If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment