overlay/sys-kernel/genkernel/files/3.4.11/genkernel-3.4.10.907-nice-option.patch

216 lines
7.3 KiB
Diff
Raw Normal View History

Index: genkernel.8
===================================================================
--- genkernel.8 (.../3.4.10.907-jrg-mod2) (revision 974)
+++ genkernel.8 (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -47,7 +47,7 @@
behaviour. Certain options have ``\fB--no-\fR'' variants which
do the opposite thing. You can specify your options in any order.
.PP
-.BR Debugging \ Options
+.BR Debugging\ Options
.TP
\fB\-\-loglevel=\fR<0-5>
This controls the out verbosity level of genkernel output - if this is set
@@ -61,7 +61,7 @@
\fB\-\-\fR[no\-]\fBcolor\fR
Turns on, or off, output in color using escape sequences.
.PP
-.BR Kernel \ Configuration
+.BR Kernel\ Configuration
.TP
\fB\-\-\fR[no\-]\fBmenuconfig\fR
Runs, or does not run "make menuconfig" after running "make oldconfig".
@@ -79,7 +79,7 @@
.I /etc/kernels
if the kernel is successfully compiled.
.PP
-.BR Kernel \ Compilation
+.BR Kernel\ Compilation
.TP
\fB\-\-\fR[no\-]\fBclean\fR
Runs, or does not run, "make clean" before compilation - this erases any
@@ -129,11 +129,21 @@
Implies \fB\-\-no\-clean\fR, and thus \fB\-\-no\-mrproper\fR, running a
"make oldconfig".
.TP
+\fB\-\-makeopts=\fR<makeopts>
+GNU Make options such as \fB\-j2\fR, etc.
+.TP
+\fB\-\-\fR[no\-]\fBnice\fR
+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.
+.TP
+\fB\-\-nice=\fR<niceness>
+Runs the kernel make at the specified niceness (reduction in priority).
+.TP
\fB\-\-callback=\fR<...>
Run the specified arguments in the current environment after the kernel and
modules have been compiled.
.PP
-.BR Kernel \ Locations
+.BR Kernel\ Locations
.TP
\fB\-\-kerneldir=\fR<dir>
This specifies the location of the kernel sources; the default is
@@ -144,7 +154,7 @@
default genkernel uses the config from the previous build of the same kernel
version or a default kernel config if there isn't a previous config.
.PP
-.BR Low-Level \ Compilation \ Options
+.BR Low-Level\ Compilation\ Options
.TP
\fB\-\-kernel\-cc=\fR<compiler>
Compiler to use for the kernel compilation (e.g. distcc).
@@ -169,9 +179,6 @@
.TP
\fB\-\-utils\-make=\fR<makeprog>
GNU Make to use for utilities.
-.TP
-\fB\-\-makeopts=\fR<makeopts>
-GNU Make options such as \fB\-j2\fR, etc.
.PP
.BR Initialization
.TP
@@ -225,7 +232,7 @@
\fB\-\-tempdir=\fR<dir>
Sets genkernel's temporary working directory to <dir>.
.PP
-.BR Output \ Settings
+.BR Output\ Settings
.TP
\fB\-\-kernname=\fR<...>
Tag the kernel and initrd with a name, if not defined this option defaults to genkernel
Index: gen_compile.sh
===================================================================
--- gen_compile.sh (.../3.4.10.907-jrg-mod2) (revision 974)
+++ gen_compile.sh (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -244,24 +244,31 @@
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}" == 'runtask' ]
then
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/-j1} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${target} $*
+ print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS/-j?/-j1} ${ARGS} ${target} $*" 1 0 1
+ eval ${NICEOPTS}${MAKE} -s ${MAKEOPTS/-j?/-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} ${1} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
+ print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${1} $*" 1 0 1
+ eval ${NICEOPTS}${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
RET=$?
fi
[ "${RET}" -ne '0' ] &&
Index: genkernel
===================================================================
--- genkernel (.../3.4.10.907-jrg-mod2) (revision 974)
+++ genkernel (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -4,10 +4,6 @@
PATH="${PATH}:/sbin:/usr/sbin"
GK_V='3.4.10.907'
-# Set the default for TMPDIR. May be modified by genkernel.conf or the
-# --tempdir command line option.
-TMPDIR='/var/tmp/genkernel'
-
TODEBUGCACHE=1 # Until an error occurs or LOGFILE is fully qualified.
small_die() {
@@ -53,8 +49,8 @@
}
cleanup(){
- if [ -n "$TEMP" -a -d "$TEMP" ]; then
- rm -rf "$TEMP"
+ if [ -n "${TEMP}" -a -d "${TEMP}" ]; then
+ rm -rf "${TEMP}"
fi
if isTrue ${POSTCLEAR}
Index: gen_cmdline.sh
===================================================================
--- gen_cmdline.sh (.../3.4.10.907-jrg-mod2) (revision 974)
+++ gen_cmdline.sh (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -47,6 +47,10 @@
echo " --static Build a static (monolithic kernel)"
echo " --genzimage Build zImage.initrd for PowerPC arch"
echo " --no-genzimage Do not build zImage.initrd"
+ 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 " Kernel settings"
echo " --kerneldir=<dir> Location of the kernel sources"
echo " --kernel-config=<file> Kernel configuration file to use for compilation"
@@ -595,6 +599,23 @@
--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
Index: gen_determineargs.sh
===================================================================
--- gen_determineargs.sh (.../3.4.10.907-jrg-mod2) (revision 974)
+++ gen_determineargs.sh (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -133,6 +133,7 @@
set_config_with_override 1 SLOWUSB CMD_SLOWUSB
set_config_with_override 2 UTILS_ARCH CMD_UTILS_ARCH
set_config_with_override 2 TMPDIR CMD_TMPDIR "/var/tmp/genkernel"
+ set_config_with_override 2 NICE CMD_NICE "10"
BOOTDIR=`arch_replace "${BOOTDIR}"`
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
Index: genkernel.conf
===================================================================
--- genkernel.conf (.../3.4.10.907-jrg-mod2) (revision 974)
+++ genkernel.conf (.../3.4.10.907-jrg-mod3) (revision 974)
@@ -61,6 +61,9 @@
# argument is: <number of processors>*<number of cores per processor>+1
# MAKEOPTS="-j2"
+# 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"