[Pkg-dkms-commits] [dkms] 01/01: Build modules using all CPU cores.
Petter Reinholdtsen
pere at moszumanska.debian.org
Sun May 1 13:01:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
pere pushed a commit to branch master
in repository dkms.
commit dd205cd86e2d91b7b8714e3115daadc5f078662b
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Sun May 1 15:01:11 2016 +0200
Build modules using all CPU cores.
Patch by Andras Korn, updated by Aron Xu.
Closes: #663114
---
debian/patches/parallell-build.patch | 108 +++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 109 insertions(+)
diff --git a/debian/patches/parallell-build.patch b/debian/patches/parallell-build.patch
new file mode 100644
index 0000000..06b0680
--- /dev/null
+++ b/debian/patches/parallell-build.patch
@@ -0,0 +1,108 @@
+Description: Build in parallell by default.
+ Build using 'make -j#' where # is based on the number of CPU cores available.
+ Patch was updated by Aron Xu <aron at debian.org>.
+Author: Andras Korn <korn-debbugs at elan.rulez.org>
+Bug-Debian: https://bugs.debian.org/663114
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663114
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen <pere at hungry.com>
+Last-Update: 2016-05-01
+
+--- dkms-2.2.0.3.orig/dkms
++++ dkms-2.2.0.3/dkms
+@@ -127,6 +127,7 @@ show_usage()
+ echo $" [--kernelsourcedir=source-location] [--no-prepare-kernel] [--no-initrd]"
+ echo $" [--binaries-only] [--source-only] [-r release (SuSE)] [--verbose]"
+ echo $" [--size] [--spec=specfile] [--media=floppy|iso|tar] [--legacy-postinst=0|1]"
++ echo $" [-j number]"
+ }
+
+ VER()
+@@ -145,6 +146,18 @@ VER()
+ -e 's: ::g'
+ }
+
++# Find out how many CPUs there are so that we may pass an appropriate -j
++# option to make. Ignore hyperthreading for now.
++get_num_cpus()
++{
++ # use nproc(1) from coreutils 8.1-1+ if available, otherwise single job
++ if [ -x /usr/bin/nproc ]; then
++ nproc
++ else
++ echo "1"
++ fi
++}
++
+ # Figure out the correct module suffix for the kernel we are currently
+ # dealing with, which may or may not be the currently installed kernel.
+ set_module_suffix()
+@@ -1089,7 +1102,7 @@ prepare_kernel()
+ invoke_command "cp /boot/vmlinuz.version.h include/linux/version.h" "using /boot/vmlinux.version.h"
+ invoke_command "cp -f $kernel_config .config" "using $kernel_config"
+ invoke_command "make KERNELRELEASE=$1 cloneconfig" "make cloneconfig" background
+- invoke_command "make CONFIG_MODVERSIONS=1 KERNELRELEASE=$1 dep" "make CONFIG_MODVERSIONS=1 dep" background
++ invoke_command "make -j$parallel_jobs CONFIG_MODVERSIONS=1 KERNELRELEASE=$1 dep" "make CONFIG_MODVERSIONS=1 dep" background
+ elif grep -q rhconfig.h $kernel_source_dir/include/linux/{modversions,version}.h 2>/dev/null; then
+ echo $"Running Red Hat style preparation routine"
+ invoke_command "make clean" "make clean" background
+@@ -1135,9 +1148,9 @@ prepare_kernel()
+
+ invoke_command "make KERNELRELEASE=$1 oldconfig" "make oldconfig" background
+ if [[ $(VER $1) < $(VER 2.5) ]]; then
+- invoke_command "make KERNELRELEASE=$1 dep" "make dep" background
++ invoke_command "make -j$parallel_jobs KERNELRELEASE=$1 dep" "make dep" background
+ else
+- invoke_command "make KERNELRELEASE=$1 prepare-all scripts" "make prepare-all" background
++ invoke_command "make -j$parallel_jobs KERNELRELEASE=$1 prepare-all scripts" "make prepare-all" background
+ fi
+ fi
+ cd - >/dev/null
+@@ -1209,7 +1222,7 @@ do_build()
+ invoke_command "$clean" "cleaning build area" background
+ echo $"DKMS make.log for $module-$module_version for kernel $kernelver ($arch)" >> "$dkms_tree/$module/$module_version/build/make.log"
+ date >> "$dkms_tree/$module/$module_version/build/make.log"
+- local the_make_command="${make_command/#make/make KERNELRELEASE=$kernelver}"
++ local the_make_command="${make_command/#make/make -j$parallel_jobs KERNELRELEASE=$kernelver}"
+
+ invoke_command "{ $the_make_command; } >> $dkms_tree/$module/$module_version/build/make.log 2>&1" "$the_make_command" background || \
+ report_build_problem 10 $"Bad return status for module build on kernel: $kernelver ($arch)" \
+@@ -3498,6 +3511,7 @@ while (($# > 0)); do
+ --debug)
+ export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
+ set -x;;
++ -j) read_arg parallel_jobs "$1" "$2" || shift;;
+ -*|--*) error $" Unknown option: $1"
+ show_usage
+ exit 2;;
+@@ -3545,6 +3559,12 @@ if [[ $arch && $all ]]; then
+ $"--all on the command line."
+ fi
+
++# Default to -j<number of CPUs>
++parallel_jobs=${parallel_jobs:-$(get_num_cpus)}
++
++# Make sure we're not passing -j0 to make; treat -j0 as just "-j"
++[[ "$parallel_jobs" = 0 ]] && parallel_jobs=""
++
+ # Run the specified action
+ for action_to_run in $action; do
+ setup_kernels_arches "$action_to_run"
+--- dkms-2.2.0.3.orig/dkms.8
++++ dkms-2.2.0.3/dkms.8
+@@ -515,6 +515,15 @@ prior than DKMS 2.1. This option curren
+ A supplemental configuration file to the system-wide dkms framework, typically located
+ in /etc/dkms/framework.conf. All option that are normally provided on a command line
+ can be provided in this file.
++.TP
++.B \-j number
++Run no more than
++.I number
++jobs in parallel; see the -j option of
++.I make(1).
++Defaults to the number of CPUs in the system, detected by
++.I nproc(1).
++Specify 0 to impose no limit on the number of parallel jobs.
+ .SH ORIGINAL MODULES
+ During the first install of a module for a <kernelversion>,
+ .B dkms
diff --git a/debian/patches/series b/debian/patches/series
index f648f5a..eef8e9f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ fix_have_one_kernel_for_non-zero_return_code.diff
1491729-0001-Add-POST_BUILD-to-the-dkms_conf_variables-list.patch
1491729-0002-Add_BUILD_DEPENDS_configuration_option.patch
apport-write-binary.patch
+parallell-build.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-dkms/dkms.git
More information about the Pkg-dkms-commits
mailing list