From fc54e0e6c39b95ffe1d1c091fd9d0f89066b5d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kt=C3=BCrk=20Y=C3=BCksek?= Date: Mon, 4 Sep 2017 20:47:19 -0400 Subject: [PATCH] kpatch-build: allow the number of make jobs to be specified using CPUS Instead of always using the maximum number of CPUs available, allow user to tune the number of make jobs using the command line argument ('-j', '--jobs'). --- kpatch-build/kpatch-build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index b0c3a1f..68b87ba 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -326,6 +326,7 @@ usage() { echo " -s, --sourcedir Specify kernel source directory" >&2 echo " -c, --config Specify kernel config file" >&2 echo " -v, --vmlinux Specify original vmlinux" >&2 + echo " -j, --jobs Specify the number of make jobs" >&2 echo " -t, --target Specify custom kernel build targets" >&2 echo " -o, --output Specify output folder" >&2 echo " -d, --debug Keep scratch files in /tmp" >&2 @@ -334,7 +335,7 @@ usage() { echo " (not recommended)" >&2 } -options=$(getopt -o hr:s:c:v:t:o:d -l "help,sourcerpm:,sourcedir:,config:,vmlinux:,target:,output:,debug,skip-gcc-check,skip-cleanup" -- "$@") || die "getopt failed" +options=$(getopt -o hr:s:c:v:j:t:o:d -l "help,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,output:,debug,skip-gcc-check,skip-cleanup" -- "$@") || die "getopt failed" eval set -- "$options" @@ -367,6 +368,11 @@ while [[ $# -gt 0 ]]; do VMLINUX=$(readlink -f "$2") shift ;; + -j|--jobs) + [[ ! "$2" -gt 0 ]] && die "Invalid number of make jobs '$2'" + CPUS="$2" + shift + ;; -t|--target) TARGETS="$TARGETS $2" shift