# Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 17 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> gen_cmdline.sh,
+ gen_compile.sh, gen_determineargs.sh, gen_funcs.sh, gen_initrd.sh,
+ genkernel, genkernel.8, genkernel.conf:
+ Rename DEBUGLEVEL/DEBUGFILE to LOGLEVEL/LOGFILE to help reduce confusion.
+
17 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> gen_cmdline.sh,
gen_configkernel.sh, genkernel:
Some more generalcleanup and adding support for using a config file other
echo " Configuration settings"
echo " --config=<file> genkernel configuration file to use"
echo " Debug settings"
- echo " --debuglevel=<0-5> Debug Verbosity Level"
- echo " --debugfile=<outfile> Output file for debug info"
+ echo " --loglevel=<0-5> Debug Verbosity Level"
+ echo " --logfile=<outfile> Output file for debug info"
echo " --color Output debug in color"
echo " --no-color Do not output debug in color"
echo " Kernel Configuration settings"
CMD_BOOTLOADER=`parse_opt "$*"`
print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
;;
- --debuglevel=*)
- CMD_DEBUGLEVEL=`parse_opt "$*"`
- DEBUGLEVEL="${CMD_DEBUGLEVEL}"
- print_info 2 "CMD_DEBUGLEVEL: ${CMD_DEBUGLEVEL}"
+ --loglevel=*)
+ CMD_LOGLEVEL=`parse_opt "$*"`
+ LOGLEVEL="${CMD_LOGLEVEL}"
+ print_info 2 "CMD_LOGLEVEL: ${CMD_LOGLEVEL}"
;;
--menuconfig)
TERM_LINES=`stty -a | head -n 1 | cut -d\ -f5 | cut -d\; -f1`
print_info 2 "USECOLOR: ${USECOLOR}"
setColorVars
;;
- --debugfile=*)
- CMD_DEBUGFILE=`parse_opt "$*"`
- DEBUGFILE=`parse_opt "$*"`
- print_info 2 "CMD_DEBUGFILE: ${CMD_DEBUGFILE}"
- print_info 2 "DEBUGFILE: ${CMD_DEBUGFILE}"
+ --logfile=*)
+ CMD_LOGFILE=`parse_opt "$*"`
+ LOGFILE=`parse_opt "$*"`
+ print_info 2 "CMD_LOGFILE: ${CMD_LOGFILE}"
+ print_info 2 "LOGFILE: ${CMD_LOGFILE}"
;;
--kerneldir=*)
CMD_KERNELDIR=`parse_opt "$*"`
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${target} $*" 1 0 1
eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${target} $*
RET=$?
- elif [ "${DEBUGLEVEL}" -gt "1" ]
+ elif [ "${LOGLEVEL}" -gt "1" ]
then
- # Output to stdout and debugfile
+ # 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 ${DEBUGFILE}
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE}
RET=${PIPESTATUS[0]}
else
- # Output to debugfile only
+ # Output to logfile only
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${DEBUGFILE} 2>&1
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
RET=$?
fi
[ "${RET}" -ne '0' ] &&
LDFLAGS="-L${TEMP}/device-mapper/lib" \
CFLAGS="-I${TEMP}/device-mapper/include" \
CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/lvm >> ${DEBUGFILE} 2>&1 ||
+ ./configure --enable-static_link --prefix=${TEMP}/lvm >> ${LOGFILE} 2>&1 ||
gen_die 'Configure of lvm failed!'
print_info 1 'lvm: >> Compiling...'
compile_generic '' utils
LDFLAGS="-L${TEMP}/device-mapper/lib" \
CFLAGS="-I${TEMP}/device-mapper/include" \
CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
+ ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 ||
gen_die 'Configure of dmraid failed!'
# We dont necessarily have selinux installed yet... look into
gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
cd "${DEVICE_MAPPER_DIR}"
./configure --prefix=${TEMP}/device-mapper --enable-static_link \
- --disable-selinux >> ${DEBUGFILE} 2>&1 ||
+ --disable-selinux >> ${LOGFILE} 2>&1 ||
gen_die 'Configuring device-mapper failed!'
print_info 1 'device-mapper: >> Compiling...'
compile_generic '' utils
gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
cd "${E2FSPROGS_DIR}"
print_info 1 'e2fsprogs: >> Configuring...'
- ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
+ ./configure --with-ldopts=-static >> ${LOGFILE} 2>&1 ||
gen_die 'Configuring e2fsprogs failed!'
print_info 1 'e2fsprogs: >> Compiling...'
MAKE=${UTILS_MAKE} compile_generic "" ""
}
determine_real_args() {
- if [ "${CMD_DEBUGFILE}" != '' ]
+ if [ "${CMD_LOGFILE}" != '' ]
then
- DEBUGFILE="${CMD_DEBUGFILE}"
+ LOGFILE="${CMD_LOGFILE}"
fi
if [ "${CMD_MAKEOPTS}" != '' ]
dump_debugcache() {
TODEBUGCACHE=0
- echo "${DEBUGCACHE}" >> ${DEBUGFILE}
+ echo "${DEBUGCACHE}" >> ${LOGFILE}
}
-# print_info(debuglevel, print [, newline [, prefixline [, forcefile ] ] ])
+# print_info(loglevel, print [, newline [, prefixline [, forcefile ] ] ])
print_info() {
local NEWLINE=1
local FORCEFILE=0
fi
fi
- # PRINT TO SCREEN ONLY IF PASSED DEBUGLEVEL IS HIGHER THAN
+ # PRINT TO SCREEN ONLY IF PASSED LOGLEVEL IS HIGHER THAN
# OR EQUAL TO SET DEBUG LEVEL
- if [ "$1" -lt "${DEBUGLEVEL}" -o "$1" -eq "${DEBUGLEVEL}" ]
+ if [ "$1" -lt "${LOGLEVEL}" -o "$1" -eq "${LOGLEVEL}" ]
then
SCRPRINT='1'
fi
if [ "${TODEBUGCACHE}" -eq 1 ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"
else
- echo -ne "${STR}" >> ${DEBUGFILE}
+ echo -ne "${STR}" >> ${LOGFILE}
fi
else
if [ "${TODEBUGCACHE}" -eq 1 ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
else
- echo "${STR}" >> ${DEBUGFILE}
+ echo "${STR}" >> ${LOGFILE}
fi
fi
fi
}
clear_log() {
- if [ -f "${DEBUGFILE}" ]
+ if [ -f "${LOGFILE}" ]
then
- (echo > "${DEBUGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${DEBUGFILE}."
+ (echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}."
fi
}
if isTrue ${USECOLOR}
then
- GREP_COLOR='1' grep -B5 -E --colour=always "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${DEBUGFILE}
+ GREP_COLOR='1' grep -B5 -E --colour=always "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${LOGFILE}
else
- grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${DEBUGFILE}
+ grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${LOGFILE}
fi
echo
print_info 1 "-- End log... --"
echo
- print_info 1 "Please consult ${DEBUGFILE} for more information and any"
+ print_info 1 "Please consult ${LOGFILE} for more information and any"
print_info 1 "errors that were reported above."
echo
print_info 1 "Report any genkernel bugs to bugs.gentoo.org and"
print_info 1 "assign your bug to genkernel@gentoo.org. Please include"
print_info 1 "as much information as you can in your bug report; attaching"
- print_info 1 "${DEBUGFILE} so that your issue can be dealt with effectively."
+ print_info 1 "${LOGFILE} so that your issue can be dealt with effectively."
print_info 1 ''
print_info 1 'Please do *not* report compilation failures as genkernel bugs!'
print_info 1 ''
[ "$#" -ne '1' ] && gen_die 'create_initrd_loop(): Not enough arguments!'
mkdir -p ${TEMP}/initrd-mount ||
gen_die 'Could not create loopback mount directory!'
- dd if=/dev/zero of=${TMPDIR}/initrd-${KV} bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 ||
+ dd if=/dev/zero of=${TMPDIR}/initrd-${KV} bs=1k count=${1} >> "${LOGFILE}" 2>&1 ||
gen_die "Could not zero initrd-${KV}"
- mke2fs -F -N750 -q "${TMPDIR}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 ||
+ mke2fs -F -N750 -q "${TMPDIR}/initrd-${KV}" >> "${LOGFILE}" 2>&1 ||
gen_die "Could not format initrd-${KV}!"
- mount -t ext2 -o loop "${TMPDIR}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 ||
+ mount -t ext2 -o loop "${TMPDIR}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${LOGFILE}" 2>&1 ||
gen_die 'Could not mount the initrd filesystem!'
}
move_initrd_to_loop() {
cd "${TEMP}/initrd-temp"
- mv * "${TEMP}/initrd-mount" >> ${DEBUGFILE} 2>&1
+ mv * "${TEMP}/initrd-mount" >> ${LOGFILE} 2>&1
}
# check for static linked file with objdump
# --tempdir command line option.
TMPDIR='/var/tmp/genkernel'
-TODEBUGCACHE=1 # Until an error occurs or DEBUGFILE is fully qualified.
+TODEBUGCACHE=1 # Until an error occurs or LOGFILE is fully qualified.
small_die() {
echo $1
then
echo
echo
- eval ${CMD_CALLBACK} | tee -a ${DEBUGFILE}
+ eval ${CMD_CALLBACK} | tee -a ${LOGFILE}
CMD_STATUS="${PIPESTATUS[0]}"
echo
print_info 1 "<<< Callback exit status: ${CMD_STATUS}"
.PP
.BR Debugging \ Options
.TP
-\fB\-\-debuglevel=\fR<0-5>
+\fB\-\-loglevel=\fR<0-5>
This controls the out verbosity level of genkernel output - if this is set
to 0, minimal debugging is done; if this is set to 5 as much output as
possible is given.
.TP
-\fB\-\-debugfile=\fR<outfile>
+\fB\-\-logfile=\fR<outfile>
This outputs debugging data to the file <outfile>. By default this is
.I /var/log/genkernel.log\fR.
.TP
# Location of the default cache
CACHE_DIR="/var/cache/genkernel/%%ARCH%%"
# Log output file
-DEBUGFILE="/var/log/genkernel.log"
+LOGFILE="/var/log/genkernel.log"
# Debug Level
-DEBUGLEVEL=1
+LOGLEVEL=1
# Default location of kernel source
DEFAULT_KERNEL_SOURCE="/usr/src/linux"