# Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 07 Nov 2007; Chris Gianelloni <wolf31o2@gentoo.org> alpha/config.sh,
+ gen_cmdline.sh, gen_determineargs.sh, gen_funcs.sh, gen_initramfs.sh,
+ gen_initrd.sh, gen_package.sh, genkernel, genkernel.conf, ia64/config.sh,
+ mips/config.sh, parisc/config.sh, parisc64/config.sh, ppc/config.sh,
+ ppc64/config.sh, sparc/config.sh, sparc64/config.sh, um/config.sh,
+ x86/config.sh, x86_64/config.sh, xen0/config.sh, xenU/config.sh:
+ Added a nice patch from John R. Graham <john_r_graham@mindspring.com> to
+ allow all command line options to be configurable from within the
+ genkernel.conf file. This is for bug #182616. This is genkernel 3.4.9_pre8
+ for testing.
+
07 Nov 2007; Chris Gianelloni <wolf31o2@gentoo.org>
generic/initrd.scripts:
Fixed the noload module code. Thanks to Mijail Fedorovich
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="boot"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="arch/alpha/boot/vmlinux.gz"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
echo " initrd"
echo " --luks Include LUKS support"
echo " --> 'emerge cryptsetup-luks' with USE=-dynamic"
+ echo " --no-busybox Do not include busybox in the initrd or initramfs."
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect"
echo " --cachedir=<dir> Override the default cache location"
print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
;;
--bootdir=*)
- BOOTDIR=`parse_opt "$*"`
- print_info 2 "BOOTDIR: ${BOOTDIR}"
+ CMD_BOOTDIR=`parse_opt "$*"`
+ print_info 2 "CMD_BOOTDIR: ${CMD_BOOTDIR}"
;;
--do-keymap-auto)
CMD_DOKEYMAPAUTO=1
print_info 2 "CMD_MDADM: $CMD_MDADM"
;;
--no-busybox)
- CMD_NO_BUSYBOX=1
- print_info 2 "CMD_NO_BUSYBOX: ${CMD_NO_BUSYBOX}"
+ CMD_BUSYBOX=0
+ print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}"
;;
--slowusb)
CMD_SLOWUSB=1
KERN_24=1
KV=${VER}.${PAT}.${SUB}${EXV}
fi
-
- fi
-
- if isTrue "${CMD_DISKLABEL}"
- then
- DISKLABEL=1
- else
- DISKLABEL=0
- fi
-
- if isTrue "${CMD_LUKS}"
- then
- LUKS=1
fi
}
determine_real_args() {
- if [ "${CMD_LOGFILE}" != '' ]
- then
- LOGFILE="${CMD_LOGFILE}"
- fi
-
- if [ "${CMD_MAKEOPTS}" != '' ]
- then
- MAKEOPTS="${CMD_MAKEOPTS}"
- fi
-
- if [ "${CMD_KERNELDIR}" != '' ]
- then
- KERNEL_DIR=${CMD_KERNELDIR}
- else
- KERNEL_DIR=${DEFAULT_KERNEL_SOURCE}
- fi
-
- if [ "${CMD_NO_KERNEL_SOURCES}" != "1" ]
- then
- if [ ! -d ${KERNEL_DIR} ]
- then
- gen_die "kernel source directory \"${KERNEL_DIR}\" was not found!"
- fi
- fi
-
- if [ "${CMD_KERNCACHE}" != "" ]
- then
- if [ "${KERNEL_DIR}" = '' -a "${CMD_NO_KERNEL_SOURCES}" != "1" ]
- then
- gen_die 'No kernel source directory!'
- fi
- if [ ! -e "${KERNEL_DIR}" -a "${CMD_NO_KERNEL_SOURCES}" != "1" ]
- then
- gen_die 'No kernel source directory!'
- fi
- else
- if [ "${KERNEL_DIR}" = '' ]
- then
- gen_die 'Kernel Cache specified but no kernel tree to verify against!'
- fi
- fi
-
- if [ "${CMD_KERNNAME}" != "" ]
- then
- KNAME=${CMD_KERNNAME}
- else
- KNAME="genkernel"
- fi
+ print_info 4 "Resolving config file, command line, and arch default settings."
+
+ # Config File Command Line Arch Default
+ # ----------- ------------ ------------
+ set_config_with_override 2 DEBUGFILE CMD_DEBUGFILE
+ set_config_with_override 2 KERNEL_DIR CMD_KERNEL_DIR "${DEFAULT_KERNEL_SOURCE}"
+ set_config_with_override 1 NO_KERNEL_SOURCES CMD_NO_KERNEL_SOURCES
+ set_config_with_override 2 KERNCACHE CMD_KERNCACHE
+ set_config_with_override 2 KNAME CMD_KNAME "genkernel"
+
+ set_config_with_override 2 MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS"
+ set_config_with_override 2 KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE"
+ set_config_with_override 2 UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE"
+ set_config_with_override 2 KERNEL_CC CMD_KERNEL_CC "$DEFAULT_KERNEL_CC"
+ set_config_with_override 2 KERNEL_LD CMD_KERNEL_LD "$DEFAULT_KERNEL_LD"
+ set_config_with_override 2 KERNEL_AS CMD_KERNEL_AS "$DEFAULT_KERNEL_AS"
+ set_config_with_override 2 UTILS_CC CMD_UTILS_CC "$DEFAULT_UTILS_CC"
+ set_config_with_override 2 UTILS_LD CMD_UTILS_LD "$DEFAULT_UTILS_LD"
+ set_config_with_override 2 UTILS_AS CMD_UTILS_AS "$DEFAULT_UTILS_AS"
+
+ set_config_with_override 2 KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
+ set_config_with_override 2 UTILS_CROSS_COMPILE CMD_UTILS_CROSS_COMPILE
+ set_config_with_override 2 BOOTDIR CMD_BOOTDIR "/boot"
+
+ set_config_with_override 1 SPLASH CMD_SPLASH
+ set_config_with_override 1 POSTCLEAR CMD_POSTCLEAR
+ set_config_with_override 1 MRPROPER CMD_MRPROPER
+ set_config_with_override 1 MENUCONFIG CMD_MENUCONFIG
+ set_config_with_override 1 CLEAN CMD_CLEAN
+
+ set_config_with_override 2 MINKERNPACKAGE CMD_MINKERNPACKAGE
+ set_config_with_override 2 MODULESPACKAGE CMD_MODULESPACKAGE
+ set_config_with_override 2 KERNCACHE CMD_KERNCACHE
+ set_config_with_override 1 NOINITRDMODULES CMD_NOINITRDMODULES
+ set_config_with_override 2 INITRAMFS_OVERLAY CMD_INITRAMFS_OVERLAY
+ set_config_with_override 1 MOUNTBOOT CMD_MOUNTBOOT
+ set_config_with_override 1 BUILD_STATIC CMD_STATIC
+ set_config_with_override 1 BUILD_INITRAMFS CMD_INITRAMFS
+ set_config_with_override 1 SAVE_CONFIG CMD_SAVE_CONFIG
+ set_config_with_override 1 SYMLINK CMD_SYMLINK
+ set_config_with_override 2 INSTALL_MOD_PATH CMD_INSTALL_MOD_PATH
+ set_config_with_override 1 OLDCONFIG CMD_OLDCONFIG
+ set_config_with_override 1 LVM CMD_LVM
+ set_config_with_override 1 EVMS CMD_EVMS
+ set_config_with_override 1 UNIONFS CMD_UNIONFS
+ set_config_with_override 1 DMRAID CMD_DMRAID
+ set_config_with_override 1 BUSYBOX CMD_BUSYBOX "yes"
+ set_config_with_override 1 DEVFS CMD_UNDEFINED_CMD "no"
- if [ "${CMD_KERNEL_MAKE}" != '' ]
- then
- KERNEL_MAKE="${CMD_KERNEL_MAKE}"
- fi
+ set_config_with_override 1 DISKLABEL CMD_DISKLABEL
+ set_config_with_override 1 LUKS CMD_LUKS
- if [ "${KERNEL_MAKE}" = '' ]
- then
- KERNEL_MAKE='make'
- fi
-
- if [ "${CMD_UTILS_MAKE}" != '' ]
- then
- UTILS_MAKE="${CMD_UTILS_MAKE}"
- fi
-
- if [ "${UTILS_MAKE}" = '' ]
- then
- UTILS_MAKE='make'
- fi
-
- if [ "${CMD_KERNEL_CC}" != '' ]
- then
- KERNEL_CC="${CMD_KERNEL_CC}"
- fi
-
- if [ "${CMD_KERNEL_LD}" != '' ]
- then
- KERNEL_LD="${CMD_KERNEL_LD}"
- fi
-
- if [ "${CMD_KERNEL_AS}" != '' ]
- then
- KERNEL_AS="${CMD_KERNEL_AS}"
- fi
-
- if [ "${CMD_KERNEL_CROSS_COMPILE}" != '' ]
- then
- KERNEL_CROSS_COMPILE="${CMD_KERNEL_CROSS_COMPILE}"
- fi
-
- if [ "${CMD_UTILS_CC}" != '' ]
- then
- UTILS_CC="${CMD_UTILS_CC}"
- fi
-
- if [ "${CMD_UTILS_LD}" != '' ]
- then
- UTILS_LD="${CMD_UTILS_LD}"
- fi
-
- if [ "${CMD_UTILS_AS}" != '' ]
- then
- UTILS_AS="${CMD_UTILS_AS}"
- fi
-
- if [ "${CMD_UTILS_CROSS_COMPILE}" != '' ]
- then
- UTILS_CROSS_COMPILE="${CMD_UTILS_CROSS_COMPILE}"
- fi
-
- if [ "${BOOTDIR}" != '' ]
- then
BOOTDIR=`arch_replace "${BOOTDIR}"`
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
- else
- BOOTDIR="/boot"
- fi
CACHE_DIR=`arch_replace "${CACHE_DIR}"`
BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
UNIONFS_MODULES_BINCACHE=`arch_replace "${UNIONFS_MODULES_BINCACHE}"`
BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
- if [ "${CMD_SPLASH}" != '' ]
- then
- SPLASH=${CMD_SPLASH}
- fi
- if isTrue ${SPLASH}
- then
- SPLASH=1
- else
- SPLASH=0
- fi
-
- if isTrue ${COMPRESS_INITRD}
- then
- COMPRESS_INITRD=1
- else
- COMPRESS_INITRD=0
- fi
-
- if isTrue ${CMD_POSTCLEAR}
- then
- POSTCLEAR=1
- else
- POSTCLEAR=0
- fi
-
- if [ "${CMD_MRPROPER}" != '' ]
- then
- MRPROPER="${CMD_MRPROPER}"
- fi
-
- if [ "${CMD_MENUCONFIG}" != '' ]
- then
- MENUCONFIG="${CMD_MENUCONFIG}"
- fi
-
- if [ "${CMD_CLEAN}" != '' ]
- then
- CLEAN="${CMD_CLEAN}"
- if ! isTrue ${CLEAN}
- then
- MRPROPER=0
- fi
- fi
-
- if [ "${CMD_MINKERNPACKAGE}" != '' ]
- then
- MINKERNPACKAGE="${CMD_MINKERNPACKAGE}"
- mkdir -p `dirname ${MINKERNPACKAGE}`
- fi
-
- if [ "${CMD_MODULESPACKAGE}" != '' ]
- then
- MODULESPACKAGE="${CMD_MODULESPACKAGE}"
- mkdir -p `dirname ${MODULESPACKAGE}`
- fi
-
- if [ "${CMD_KERNCACHE}" != '' ]
- then
- KERNCACHE="${CMD_KERNCACHE}"
- mkdir -p `dirname ${KERNCACHE}`
- fi
-
- if [ "${CMD_NOINITRDMODULES}" != '' ]
- then
- NOINITRDMODULES="${CMD_NOINITRDMODULES}"
- fi
-
- if [ "${CMD_INITRAMFS_OVERLAY}" != '' ]
- then
- INITRAMFS_OVERLAY="${CMD_INITRAMFS_OVERLAY}"
- fi
-
- if [ "${CMD_MOUNTBOOT}" != '' ]
+ if [ "${CMD_BOOTLOADER}" != '' ]
then
- MOUNTBOOT="${CMD_MOUNTBOOT}"
- fi
+ BOOTLOADER="${CMD_BOOTLOADER}"
- if isTrue ${MOUNTBOOT}
+ if [ "${CMD_BOOTLOADER}" != "${CMD_BOOTLOADER/:/}" ]
then
- MOUNTBOOT=1
- else
- MOUNTBOOT=0
+ BOOTFS=`echo "${CMD_BOOTLOADER}" | cut -f2- -d:`
+ BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
fi
-
- if [ "${CMD_STATIC}" != '' ]
- then
- BUILD_STATIC=${CMD_STATIC}
fi
- if isTrue ${BUILD_STATIC}
+ if [ "${NO_KERNEL_SOURCES}" != "1" ]
then
- BUILD_STATIC=1
- else
- BUILD_STATIC=0
- fi
-
- if [ "${CMD_INITRAMFS}" != '' ]
+ if [ ! -d ${KERNEL_DIR} ]
then
- BUILD_INITRAMFS=${CMD_INITRAMFS}
+ gen_die "kernel source directory \"${KERNEL_DIR}\" was not found!"
fi
-
- if isTrue ${BUILD_INITRAMFS}
- then
- BUILD_INITRAMFS=1
- else
- BUILD_INITRAMFS=0
fi
- if [ "${CMD_SAVE_CONFIG}" != '' ]
+ if [ -z "${KERNCACHE}" ]
then
- SAVE_CONFIG="${CMD_SAVE_CONFIG}"
- fi
-
- if isTrue "${SAVE_CONFIG}"
+ if [ "${KERNEL_DIR}" = '' -a "${NO_KERNEL_SOURCES}" != "1" ]
then
- SAVE_CONFIG=1
- else
- SAVE_CONFIG=0
+ gen_die 'No kernel source directory!'
fi
-
- if [ "${CMD_SYMLINK}" != '' ]
+ if [ ! -e "${KERNEL_DIR}" -a "${NO_KERNEL_SOURCES}" != "1" ]
then
- SYMLINK="${CMD_SYMLINK}"
+ gen_die 'No kernel source directory!'
fi
-
- if isTrue "${SYMLINK}"
- then
- SYMLINK=1
else
- SYMLINK=0
- fi
-
- if [ "${CMD_INSTALL_MOD_PATH}" != '' ]
- then
- INSTALL_MOD_PATH="${CMD_INSTALL_MOD_PATH}"
- fi
-
- if [ "${CMD_BOOTLOADER}" != '' ]
- then
- BOOTLOADER="${CMD_BOOTLOADER}"
-
- if [ "${CMD_BOOTLOADER}" != "${CMD_BOOTLOADER/:/}" ]
+ if [ "${KERNEL_DIR}" = '' ]
then
- BOOTFS=`echo "${CMD_BOOTLOADER}" | cut -f2- -d:`
- BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
- fi
+ gen_die 'Kernel Cache specified but no kernel tree to verify against!'
fi
-
- if [ "${CMD_OLDCONFIG}" != '' ]
- then
- OLDCONFIG="${CMD_OLDCONFIG}"
fi
- if isTrue "${OLDCONFIG}"
+ # Special case: If --no-clean is specified on the command line,
+ # imply --no-mrproper.
+ if [ "${CMD_CLEAN}" != '' ]
then
- OLDCONFIG=1
- else
- OLDCONFIG=0
- fi
-
- if isTrue "${CMD_LVM}"
+ if ! isTrue ${CLEAN}
then
- LVM=1
- else
- LVM=0
+ MRPROPER=0
fi
-
- if isTrue "${CMD_EVMS}"
- then
- EVMS=1
- else
- EVMS=0
fi
- if isTrue "${CMD_UNIONFS}"
+ if [ -n "${MINKERNPACKAGE}" ]
then
- UNIONFS=1
- else
- UNIONFS=0
+ mkdir -p `dirname ${MINKERNPACKAGE}`
fi
- if isTrue "${CMD_NO_BUSYBOX}"
+ if [ -n "${MODULESPACKAGE}" ]
then
- BUSYBOX=0
- else
- BUSYBOX=1
+ mkdir -p `dirname ${MODULESPACKAGE}`
fi
- if isTrue "${CMD_DMRAID}"
+ if [ -n "${KERNCACHE}" ]
then
- DMRAID=1
- else
- DMRAID=0
+ mkdir -p `dirname ${KERNCACHE}`
fi
if isTrue "${CMD_MDADM}"
if [ "${NEWLINE}" = '0' ]
then
- if [ "${TODEBUGCACHE}" -eq 1 ]; then
+ if [ "${TODEBUGCACHE}" -eq '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"
else
echo -ne "${STR}" >> ${LOGFILE}
fi
else
- if [ "${TODEBUGCACHE}" -eq 1 ]; then
+ if [ "${TODEBUGCACHE}" -eq '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
else
echo "${STR}" >> ${LOGFILE}
fi
}
+#
+# Helper function to allow command line arguments to override configuration
+# file specified values and to apply defaults.
+#
+# Arguments:
+# $1 Argument type:
+# 1 Switch type arguments (e.g., --color / --no-color).
+# 2 Value type arguments (e.g., --debuglevel=5).
+# $2 Config file variable name.
+# $3 Command line variable name.
+# $4 Default. If both the config file variable and the command line
+# option are not present, then the config file variable is set to
+# this default value. Optional.
+#
+# The order of priority of these three sources (highest first) is:
+# Command line, which overrides
+# Config file (/etc/genkernel.conf), which overrides
+# Default.
+#
+# Arguments $2 and $3 are variable *names*, not *values*. This function uses
+# various forms of indirection to access the values.
+#
+# For switch type arguments, all forms of "True" are converted to a numeric 1
+# and all forms of "False" (everything else, really) to a numeric 0.
+#
+# - JRG
+#
+set_config_with_override() {
+ local VarType=$1
+ local CfgVar=$2
+ local OverrideVar=$3
+ local Default=$4
+ local Result
+
+ #
+ # Syntax check the function arguments.
+ #
+ case "$VarType" in
+ 1|2)
+ ;;
+ *)
+ gen_die "Illegal variable type \"$VarType\" passed to set_config_with_override()."
+ ;;
+ esac
+
+ if [ -n "${!OverrideVar}" ]
+ then
+ Result=${!OverrideVar}
+ if [ -n "${!CfgVar}" ]
+ then
+ print_info 5 " $CfgVar overridden on command line to \"$Result\"."
+ else
+ print_info 5 " $CfgVar set on command line to \"$Result\"."
+ fi
+ else
+ if [ -n "${!CfgVar}" ]
+ then
+ Result=${!CfgVar}
+ print_info 5 " $CfgVar set in config file to \"${Result}\"."
+ else
+ if [ -n "$Default" ]
+ then
+ Result=${Default}
+ print_info 5 " $CfgVar defaulted to \"${Result}\"."
+ else
+ print_info 5 " $CfgVar not set."
+ fi
+ fi
+ fi
+
+ if [ "$VarType" -eq "1" ]
+ then
+ if isTrue "${Result}"
+ then
+ Result=1
+ else
+ Result=0
+ fi
+ fi
+
+ eval ${CfgVar}=${Result}
+}
+
append_data 'evms' "${EVMS}"
append_data 'mdadm' "${MDADM}"
- if [ "${NOINITRDMODULES}" = '' ]
+ if [ "${NOINITRDMODULES}" -eq '0' ]
then
append_data 'modules'
else
# Pegasos hack for merging the initramfs into the kernel at compile time
cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/arch/powerpc/boot/ramdisk.image.gz &&
rm ${TMPDIR}/initramfs-${KV}
- elif [ ${BUILD_INITRAMFS} -eq 1 ]
+ elif [ ${BUILD_INITRAMFS} -eq '1' ]
then
# Mips also mimics Pegasos to merge the initramfs into the kernel
cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
# SGI LiveCDs need the following binary (no better place for it than here)
# getdvhoff is a DEPEND of genkernel, so it *should* exist
- if [ ${BUILD_INITRAMFS} -eq 1 ]
+ if [ ${BUILD_INITRAMFS} -eq '1' ]
then
[ -e /usr/lib/getdvhoff/getdvhoff ] \
&& cp /usr/lib/getdvhoff/getdvhoff ${TEMP}/initrd-temp/bin \
fi
# DMRAID
- if [ "${DMRAID}" = '1' ]
+ if [ "${DMRAID}" -eq '1' ]
then
print_info 1 'DMRAID: Adding support (compiling binaries)...'
compile_dmraid
fi
# LVM
- if [ "${LVM}" = '1' ]
+ if [ "${LVM}" -eq '1' ]
then
if [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable';
then
fi
# EVMS
- if [ "${EVMS}" = '1' ]
+ if [ "${EVMS}" -eq '1' ]
then
if [ -e '/sbin/evms_activate' ]
then
print_info 1 "initrd: >> Initializing..."
create_base_initrd_sys
- if [ "${NOINITRDMODULES}" = '' ]
+ if [ "${NOINITRDMODULES}" -eq '0' ]
then
print_info 1 " >> Copying modules..."
create_initrd_modules
#!/bin/bash
-gen_minkernpackage()
-{
+gen_minkernpackage() {
print_info 1 'Creating minimal kernel package'
rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
mkdir "${TEMP}/minkernpackage" || gen_die 'Could not make a directory for the kernel package!'
- if [ "${CMD_KERNCACHE}" != "" ]
+ if [ "${KERNCACHE}" != "" ]
then
- /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} kernel-${ARCH}-${KV}
- /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} config-${ARCH}-${KV}
+ /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernel-${ARCH}-${KV}
+ /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} config-${ARCH}-${KV}
if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
then
- /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} kernelz-${ARCH}-${KV}
+ /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} kernelz-${ARCH}-${KV}
fi
else
cd "${KERNEL_DIR}"
fi
fi
- if [ "${CMD_KERNCACHE}" != "" ]
+ if [ "${KERNCACHE}" != "" ]
then
- /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} System.map-${ARCH}-${KV}
+ /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} System.map-${ARCH}-${KV}
else
cp "${KERNEL_DIR}/System.map" "${TEMP}/minkernpackage/System.map-${ARCH}-${KV}" || gen_die 'Could not copy System.map for the kernel package!';
fi
/bin/tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
}
-gen_modulespackage()
-{
+
+gen_modulespackage() {
print_info 1 'Creating modules package'
rm -rf "${TEMP}/modulespackage" > /dev/null 2>&1
mkdir "${TEMP}/modulespackage" || gen_die 'Could not make a directory for the kernel package!'
gen_kerncache_is_valid()
{
KERNCACHE_IS_VALID=0
- if [ "${CMD_NO_KERNEL_SOURCES}" = '1' ]
+ if [ "${NO_KERNEL_SOURCES}" = '1' ]
then
BUILD_KERNEL=0
#!/bin/bash
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
-GK_V='3.4.9_pre7'
+GK_V='3.4.9_pre8'
# Set the default for TMPDIR. May be modified by genkernel.conf or the
# --tempdir command line option.
done
# Check if no action is specified...
-if [ "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ]
+if [ "${BUILD_KERNEL}" -eq '0' -a "${BUILD_INITRD}" -eq '0' ]
then
usage
exit 1
gen_kerncache_is_valid
fi
-if [ ${BUILD_KERNEL} -eq 1 -a "${KERNCACHE_IS_VALID}" == "0" ]
+if [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
then
# Configure kernel
config_kernel
# KV may have changed due to the configuration
get_KV
- # Compile kernel; If using --genzimage, or building a mips kernel, skip compile
- # till after initrd/initramfs is done
- [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq 0 ] && compile_kernel
+ # Compile kernel; If using --genzimage, or building a mips kernel, skip
+ # compile until after initrd/initramfs is done
+ [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq '0' ] && compile_kernel
# Compile modules
- if [ ${BUILD_MODULES} -eq 1 -a ${BUILD_STATIC} -eq 0 ]
+ if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ]
then
compile_modules
fi
- if [ ${SAVE_CONFIG} -eq 1 ]
+ if [ ${SAVE_CONFIG} -eq '1' ]
then
print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
if [ "${KERNCACHE}" != "" -a "${KERNCACHE_IS_VALID}" != "0" ]
then
- [ ${BUILD_STATIC} -eq 0 ] && gen_kerncache_extract_modules
+ [ ${BUILD_STATIC} -eq '0' ] && gen_kerncache_extract_modules
gen_kerncache_extract_config
fi
-
# Run callback
if [ "${CMD_CALLBACK}" != "" ]
then
CALLBACK_COUNT=0
trap "CALLBACK_ESCAPE=1" TERM KILL INT QUIT ABRT
- while [[ ${CALLBACK_ESCAPE} -eq 0 && ${CALLBACK_COUNT} -lt 5 ]]
+ while [[ ${CALLBACK_ESCAPE} -eq '0' && ${CALLBACK_COUNT} -lt 5 ]]
do
sleep 1; echo -n '.';
let CALLBACK_COUNT=${CALLBACK_COUNT}+1
done
- if [ "${CALLBACK_ESCAPE}" -eq 0 ]
+ if [ "${CALLBACK_ESCAPE}" -eq '0' ]
then
echo
echo
# with the internal settings being least important, configuration file
# settings next, and command line options being most important.
-# ===========GENKERNEL BASIC CONFIGURATION=============
+# =========Common Command Line Option Defaults=========
# Run 'make oldconfig' before compiling this kernel?
# If set to "yes", also suppresses the fetch of the kernel .config file from
# argument is: <number of processors>*<number of cores per processor>+1
# MAKEOPTS="-j2"
+# 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"
+
+# Add in EVMS support from static binaries if they exist on the system: you
+# should run "emerge evms" first.
+# EVMS="no"
+
+# UnionFS support. Under active development. Do not use unless you are working
+# on developing this feature.
+# UNIONFS="no"
+
+# Add DMRAID support.
+# DMRAID="no"
+
+# Include (or suppresses the inclusion of) busybox in the initrd or initramfs.
+# If included, busybox is rebuilt if the cached copy is out of date,
+# BUSYBOX="yes"
+
+# =========Low Level Compile Settings=========
+#
+# GNU Make to use for kernel. See also the --kernel-make command line option.
+# KERNEL_MAKE="make"
+
+# Compiler to use for the kernel (e.g. distcc). See also the --kernel-cc
+# command line option.
+# KERNEL_CC="gcc"
+
+# Assembler to use for the kernel. See also the --kernel-as command line
+# option.
+# KERNEL_AS="as"
+
+# Linker to use for the kernel. See also the --kernel-ld command line option.
+# KERNEL_LD="ld"
+
+# GNU Make to use for the utilities. See also the --utils-make command line
+# option.
+# UTILS_MAKE="make"
+
+# Compiler to use for the utilities (e.g. distcc). See also the --utils-cc
+# command line option.
+# UTILS_CC="gcc"
+
+# Assembler to use for the utilities. See also the --utils-as command line
+# option.
+# UTILS_AS="as"
+
+# Linker to use for the utilities. See also the --utils-ld command line
+# option.
+# UTILS_LD="ld"
+
# =========GENKERNEL LOCATION CONFIGURATION============
# Variables:
# %%ARCH%% - Final determined architecture
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE=""
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinux.gz"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
-# Kernel Build Info
-KERNEL_MAKE=make
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="./vmlinux"
-# Utils Build Info
-UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
-
# Initrd/Initramfs Options
COMPRESS_INITRD="yes"
USECOLOR="yes"
# genkernel on mips is only used for LiveCDs && netboots. Catalyst
# will know where to get the kernels at.
CMD_NOINSTALL=1
+
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
+
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_BINARY="vmlinux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_BINARY="vmlinux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j1"
+COMPRESS_INITRD=yes
+USECOLOR="no"
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j1"
-KERNEL_CC=gcc
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
-COMPRESS_INITRD=yes
-USECOLOR="no"
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="vmlinux"
KERNEL_MAKE_DIRECTIVE_2="image"
KERNEL_BINARY="arch/sparc64/boot/image"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
+USECOLOR="no"
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=sparc64-linux-gcc
-#KERNEL_AS=as
-#KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=sparc64-linux-gcc
+#DEFAULT_KERNEL_AS=as
+#DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
-USECOLOR="no"
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="linux"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="linux"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
+ARCH_HAVENOPREPARE=yes
-KERNEL_MAKE="make ARCH=um"
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE="make ARCH=um"
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
-ARCH_HAVENOPREPARE=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="bzImage"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="arch/i386/boot/bzImage"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE="bzImage"
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="arch/x86_64/boot/bzImage"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE=make
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE=""
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinuz"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE="make ARCH=xen"
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE="make ARCH=xen"
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
-COMPRESS_INITRD=yes
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
#!/bin/bash
+#
+# Arch-specific options that normally shouldn't be changed.
+#
KERNEL_MAKE_DIRECTIVE=""
KERNEL_MAKE_DIRECTIVE_2=""
KERNEL_BINARY="vmlinuz"
-[ -z "${MAKEOPTS}" ] && MAKEOPTS="-j2"
+COMPRESS_INITRD=yes
-KERNEL_MAKE="make ARCH=xen"
-UTILS_MAKE=make
+#
+# Arch-specific defaults that can be overridden in the config file or on the
+# command line.
+#
+DEFAULT_MAKEOPTS="-j2"
-KERNEL_CC=gcc
-KERNEL_AS=as
-KERNEL_LD=ld
+DEFAULT_KERNEL_MAKE="make ARCH=xen"
+DEFAULT_UTILS_MAKE=make
-UTILS_CC=gcc
-UTILS_AS=as
-UTILS_LD=ld
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_LD=ld
+
+DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_LD=ld
-COMPRESS_INITRD=yes