summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2016-01-23 21:49:13 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2016-01-23 21:49:13 -0800
commit92cb275526ce94fb6118cb715622b4dd9a136444 (patch)
tree234f9dc48b1a04b2fde7ff9ff3ccac0d64ea6be2
parentkconfig/generic: Remove dupe option CONFIG_NET_IPGRE_DEMUX. (diff)
downloadgenkernel-92cb275526ce94fb6118cb715622b4dd9a136444.tar.gz
genkernel-92cb275526ce94fb6118cb715622b4dd9a136444.tar.bz2
genkernel-92cb275526ce94fb6118cb715622b4dd9a136444.zip
Support nice(1) to affect the scheduling of the make invocations.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--doc/genkernel.8.txt3
-rwxr-xr-xgen_cmdline.sh20
-rwxr-xr-xgen_compile.sh19
-rwxr-xr-xgen_determineargs.sh1
-rw-r--r--genkernel.conf3
5 files changed, 40 insertions, 6 deletions
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 45af60e0..ef0aa1e4 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -233,6 +233,9 @@ LOW-LEVEL COMPILATION OPTIONS
*--makeopts*=<makeopts>::
GNU Make options such as -j2, etc.
+*--*[*no-*]*nice*[=<niceness>]::
+ Runs the kernel make at the default niceness (reduction in priority) of
+ 10, or in the case of --no-nice, runs the kernel make at normal priority.
INITIALIZATION
~~~~~~~~~~~~~~
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index c4f027a1..01adfdd2 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -80,6 +80,9 @@ longusage() {
echo " --no-mountboot Don't mount BOOTDIR automatically"
echo " --bootdir=<dir> Set the location of the boot-directory, default is /boot"
echo " --modprobedir=<dir> Set the location of the modprobe.d-directory, default is /etc/modprobe.d"
+ echo " --nice Run the kernel make at the default nice level (10)."
+ echo " --nice=<0-19> Run the kernel make at the selected nice level."
+ echo " --no-nice Don't be nice while running the kernel make."
echo " Initialization"
echo " --splash=<theme> Enable framebuffer splash using <theme>"
echo " --splash-res=<res> Select splash theme resolutions to install"
@@ -598,6 +601,23 @@ parse_cmdline() {
--config=*)
print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`"
;;
+ --nice)
+ CMD_NICE=10
+ print_info 2 "CMD_NICE: ${CMD_NICE}"
+ ;;
+ --nice=*)
+ CMD_NICE=`parse_opt "$*"`
+ if [ ${CMD_NICE} -lt 0 -o ${CMD_NICE} -gt 19 ]
+ then
+ echo "Error: Illegal value specified for --nice= parameter."
+ exit 1
+ fi
+ print_info 2 "CMD_NICE: ${CMD_NICE}"
+ ;;
+ --no-nice)
+ CMD_NICE=0
+ print_info 2 "CMD_NICE: ${CMD_NICE}"
+ ;;
all)
BUILD_KERNEL=1
BUILD_MODULES=1
diff --git a/gen_compile.sh b/gen_compile.sh
index 99cf37c0..c26a6522 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -261,25 +261,32 @@ compile_generic() {
esac
shift 2
+ if [ ${NICE} -ne 0 ]
+ then
+ NICEOPTS="nice -n${NICE} "
+ else
+ NICEOPTS=""
+ fi
+
# the eval usage is needed in the next set of code
# as ARGS can contain spaces and quotes, eg:
# ARGS='CC="ccache gcc"'
if [ "${argstype}" == 'kernelruntask' ]
then
# Silent operation, forced -j1
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $*
+ print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1
+ eval ${NICEOPTS}${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $*
RET=$?
elif [ "${LOGLEVEL}" -gt "1" ]
then
# Output to stdout and logfile
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE}
+ print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
+ eval ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE}
RET=${PIPESTATUS[0]}
else
# Output to logfile only
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
+ print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
+ eval ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
RET=$?
fi
[ ${RET} -ne 0 ] &&
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index cbc88baf..522996d2 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -78,6 +78,7 @@ determine_real_args() {
set_config_with_override STRING COMPRESS_INITRD CMD_COMPRESS_INITRD "$DEFAULT_COMPRESS_INITRD"
set_config_with_override STRING COMPRESS_INITRD_TYPE CMD_COMPRESS_INITRD_TYPE "$DEFAULT_COMPRESS_INITRD_TYPE"
set_config_with_override STRING MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS"
+ set_config_with_override STRING NICE CMD_NICE "10"
set_config_with_override STRING KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE"
set_config_with_override STRING UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE"
set_config_with_override STRING KERNEL_CC CMD_KERNEL_CC "$DEFAULT_KERNEL_CC"
diff --git a/genkernel.conf b/genkernel.conf
index 2e38e415..6b974e17 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -55,6 +55,9 @@ USECOLOR="yes"
# argument is: <number of processors>*<number of cores per processor>+1
#MAKEOPTS="$(portageq envvar MAKEOPTS)"
+# Run the kernel make at the following NICE level. Default is 10.
+# NICE=10
+
# Add in LVM support from static binaries if they exist on the system, or
# compile static LVM binaries if static ones do not exist.
#LVM="no"