New release:

*  Busybox patched to support loops on 2.4 thus giving 2.4 squashfs
     support.
  *  Various bug fixes; #46167, #46278, #47551, #48219, #48308,
     #48339, #49728, #51395, #51948.
  *  Speedups: "" > ''; [ ! ... ] && > [ ... ] || et al where
     applicable.


git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@106 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Tim Yamin 21 years ago
parent d46fc1ea7d
commit 27d080602a

@ -1,4 +1,4 @@
SCSI_MODULES="sd_mod sg sr_mod \
MODULES_SCSI="sd_mod sg sr_mod \
aic7xxx aic7xxx_old BusLogic \
ncr53c8xx NCR53c406a \
initio advansys aha1740 aha1542 aha152x \
@ -11,11 +11,7 @@ aacraid sym53c8xx a100u2w cpqfc \
dmx3191d dpt_i2o imm in2000 ips qla1280 \
sim710 sym53c416"
FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2"
ATARAID_MODULES="ataraid pdcraid hptraid"
PCMCIA_MODULES="ide-cs"
USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage"
MODULES_FIREWIRE="ieee1394 ohci1394 eth1394 sbp2"
MODULES_ATARAID="ataraid pdcraid hptraid"
MODULES_PCMCIA="ide-cs"
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage"

@ -1,7 +1,7 @@
#!/bin/bash
get_official_arch() {
if [ "${CMD_ARCHOVERRIDE}" != "" ]
if [ "${CMD_ARCHOVERRIDE}" != '' ]
then
ARCH=${CMD_ARCHOVERRIDE}
else
@ -16,5 +16,5 @@ get_official_arch() {
fi
ARCH_CONFIG="${GK_SHARE}/${ARCH}/config.sh"
[ ! -f "${ARCH_CONFIG}" ] && gen_die "ARCH: ${ARCH} not yet supported by genkernel. Please add arch-specific config file ${ARCH_CONFIG}"
[ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file, ${ARCH_CONFIG}"
}

@ -7,8 +7,8 @@ longusage() {
echo
echo "Available Actions: "
echo " all Build all steps"
echo " kernel Build only kernel and modules (not done yet)"
echo " initrd Build only initrd (not done yet)"
echo " kernel Build only the kernel and modules"
echo " initrd Build only the initrd"
echo
echo "Available Options: "
echo " Debug settings"
@ -22,14 +22,15 @@ longusage() {
echo " --gconfig Run gconfig after oldconfig"
echo " --xconfig Run xconfig after oldconfig"
echo " Kernel Compile settings"
echo " --mrproper Run make mrproper before compilation"
echo " --clean Run make clean before compilation"
echo " --mrproper Run make mrproper before compilation"
echo " --no-clean Do not run make clean before compilation"
echo " --no-mrproper Do not run make mrproper before compilation"
echo " --bootsplash Install bootsplash to initrd"
echo " --oldconfig Implies --no-clean and runs a 'make oldconfig'"
echo " --bootsplash Install bootsplash support to the initrd"
echo " --no-bootsplash Do not use bootsplash"
echo " --install Install kernel after building"
echo " --no-install Do not install kernel after building"
echo " --install Install the kernel after building"
echo " --no-install Do not install the kernel after building"
echo " --no-initrdmodules Don't copy any modules to the initrd"
echo " --callback=<...> Run the specified arguments after"
echo " the kernel and modules have been"
@ -48,22 +49,18 @@ longusage() {
echo " --utils-make=<makeprog> GNU Make to use for utils"
echo " --makeopts=<makeopts> Make options such as -j2, etc."
echo " Initialization"
echo " --bootsplash=<theme> Force bootsplash using <theme>."
echo " --do-keymap-auto Forces keymap selection at boot."
echo " --no-lvm2 Don't add in LVM2 support."
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect"
echo " --busybox-config=<file> Busybox configuration file to use"
echo " --busybox-bin=<file> Don't compile busybox, use this _static_"
echo " bzip2'd binary"
# echo " Misc Settings"
# echo " --max-kernel-size=<k> Maximum kernel size"
# echo " --max-initrd-size=<k> Maximum initrd size"
# echo " --max-kernel-and-initrd-size=<k> Maximum combined initrd + kernel size"
echo " Output Settings"
echo " --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and initrd to"
echo " These will be renamed to simply 'kernel' and"
echo " 'initrd' inside the package without any path"
echo " information. No modules outside of the initrd"
echo " will be included."
echo " --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and initrd:"
echo " No modules outside of the initrd will be"
echo " included..."
}
usage() {
@ -71,13 +68,14 @@ usage() {
echo "Usage: "
echo " genkernel [options] all"
echo
echo "Some useful options:"
echo " --menuconfig Run menuconfig after oldconfig"
echo " --no-clean Do not run make clean before compilation"
echo " --no-mrproper Do not run make mrproper before compilation"
echo 'Some useful options:'
echo ' --menuconfig Run menuconfig after oldconfig'
echo ' --no-clean Do not run make clean before compilation'
echo ' --no-mrproper Do not run make mrproper before compilation,'
echo ' this is implied by --no-clean.'
echo
echo "For a detailed list of supported options and flags; issue:"
echo " genkernel --help"
echo 'For a detailed list of supported options and flags; issue:'
echo ' genkernel --help'
}
parse_opt() {
@ -130,6 +128,10 @@ parse_cmdline() {
CMD_DOKEYMAPAUTO=1
print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO"
;;
--no-lvm-2)
CMD_NOLVM2=1
print_info 2 'CMD_NOLVM2: 1'
;;
--debuglevel*)
CMD_DEBUGLEVEL=`parse_opt "$*"`
DEBUGLEVEL="${CMD_DEBUGLEVEL}"
@ -176,6 +178,18 @@ parse_cmdline() {
CMD_CLEAN=0
print_info 2 "CMD_CLEAN: $CMD_CLEAN"
;;
--oldconfig)
CMD_CLEAN=0
CMD_OLDCONFIG=1
print_info 2 "CMD_CLEAN: $CMD_CLEAN"
print_info 2 "CMD_OLDCONFIG: $CMD_OLDCONFIG"
;;
--bootsplash=*)
CMD_BOOTSPLASH=1
BOOTSPLASH_THEME=`parse_opt "$*"`
print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH"
print_info 2 "BOOTSPLASH_THEME: $BOOTSPLASH_THEME"
;;
--bootsplash)
CMD_BOOTSPLASH=1
print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH"
@ -232,24 +246,13 @@ parse_cmdline() {
CMD_BUSYBOX_BIN=`parse_opt "$*"`
print_info 2 "CMD_BUSYBOX_BIN: $CMD_BUSYBOX_BIN"
;;
--max-kernel-size*)
CMD_MAX_KERNEL_SIZE=`parse_opt "$*"`
print_info 2 "MAX_KERNEL_SIZE: $CMD_MAX_KERNEL_SIZE"
;;
--max-initrd-size*)
CMD_MAX_INITRD_SIZE=`parse_opt "$*"`
print_info 2 "MAX_INITRD_SIZE: $CMD_MAX_INITRD_SIZE"
;;
--max-kernel-and-initrd-size*)
CMD_MAX_KERNEL_AND_INITRD_SIZE=`parse_opt "$*"`
print_info 2 "MAX_KERNEL_AND_INITRD_SIZE: $CMD_MAX_KERNEL_AND_INITRD_SIZE"
;;
--minkernpackage*)
CMD_MINKERNPACKAGE=`parse_opt "$*"`
print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE"
;;
all)
BUILD_ALL=1
BUILD_KERNEL=1
BUILD_INITRD=1
;;
initrd)
BUILD_INITRD=1
@ -261,11 +264,13 @@ parse_cmdline() {
longusage
exit 1
;;
--version)
echo "${GK_V}"
exit 0
;;
*)
echo "Error: Unknown option '$*'!"
exit 1
;;
esac
}

@ -4,17 +4,16 @@ compile_kernel_args()
{
local ARGS
ARGS=""
if [ "${KERNEL_CC}" != "" ]
ARGS=''
if [ "${KERNEL_CC}" != '' ]
then
ARGS="CC=\"${KERNEL_CC}\""
fi
if [ "${KERNEL_LD}" != "" ]
if [ "${KERNEL_LD}" != '' ]
then
ARGS="${ARGS} LD=\"${KERNEL_LD}\""
fi
if [ "${KERNEL_AS}" != "" ]
if [ "${KERNEL_AS}" != '' ]
then
ARGS="${ARGS} AS=\"${KERNEL_AS}\""
fi
@ -26,17 +25,16 @@ compile_utils_args()
{
local ARGS
ARGS=""
if [ "${UTILS_CC}" != "" ]
ARGS=''
if [ "${UTILS_CC}" != '' ]
then
ARGS="CC=\"${UTILS_CC}\""
fi
if [ "${UTILS_LD}" != "" ]
if [ "${UTILS_LD}" != '' ]
then
ARGS="${ARGS} LD=\"${UTILS_LD}\""
fi
if [ "${UTILS_AS}" != "" ]
if [ "${UTILS_AS}" != '' ]
then
ARGS="${ARGS} AS=\"${UTILS_AS}\""
fi
@ -46,15 +44,15 @@ compile_utils_args()
export_utils_args()
{
if [ "${UTILS_CC}" != "" ]
if [ "${UTILS_CC}" != '' ]
then
export CC="${UTILS_CC}"
fi
if [ "${UTILS_LD}" != "" ]
if [ "${UTILS_LD}" != '' ]
then
export LD="${UTILS_LD}"
fi
if [ "${UTILS_AS}" != "" ]
if [ "${UTILS_AS}" != '' ]
then
export AS="${UTILS_AS}"
fi
@ -62,15 +60,15 @@ export_utils_args()
unset_utils_args()
{
if [ "${UTILS_CC}" != "" ]
if [ "${UTILS_CC}" != '' ]
then
unset CC
fi
if [ "${UTILS_LD}" != "" ]
if [ "${UTILS_LD}" != '' ]
then
unset LD
fi
if [ "${UTILS_AS}" != "" ]
if [ "${UTILS_AS}" != '' ]
then
unset AS
fi
@ -78,15 +76,15 @@ unset_utils_args()
export_kernel_args()
{
if [ "${KERNEL_CC}" != "" ]
if [ "${KERNEL_CC}" != '' ]
then
export CC="${KERNEL_CC}"
fi
if [ "${KERNEL_LD}" != "" ]
if [ "${KERNEL_LD}" != '' ]
then
export LD="${KERNEL_LD}"
fi
if [ "${KERNEL_AS}" != "" ]
if [ "${KERNEL_AS}" != '' ]
then
export AS="${KERNEL_AS}"
fi
@ -94,15 +92,15 @@ export_kernel_args()
unset_kernel_args()
{
if [ "${KERNEL_CC}" != "" ]
if [ "${KERNEL_CC}" != '' ]
then
unset CC
fi
if [ "${KERNEL_LD}" != "" ]
if [ "${KERNEL_LD}" != '' ]
then
unset LD
fi
if [ "${KERNEL_AS}" != "" ]
if [ "${KERNEL_AS}" != '' ]
then
unset AS
fi
@ -110,51 +108,45 @@ unset_kernel_args()
compile_generic() {
local RET
if [ "$#" -lt "2" ]
then
gen_die "compile_generic(): improper usage"
fi
[ "$#" -lt '2' ] && gen_die "compile_generic(): improper usage"
CMAKEOPTS=${MAKEOPTS}
if [ "${2}" = "kernel" ] || [ "${2}" = "runtask" ]
if [ "${2}" = 'kernel' ] || [ "${2}" = 'runtask' ]
then
export_kernel_args
MAKE=${KERNEL_MAKE}
[ "${2}" = "runtask" ] && CMAKEOPTS=${MAKEOPTS/-j?/-j1}
elif [ "${2}" = "utils" ]
elif [ "${2}" = 'utils' ]
then
export_utils_args
MAKE=${UTILS_MAKE}
fi
if [ "${2}" == "runtask" ]
if [ "${2}" == 'runtask' ]
then
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
${MAKE} -s ${CMAKEOPTS} ${1}
${MAKE} -s ${MAKEOPTS/-j?/-j1} ${1}
RET=$?
elif [ "${DEBUGLEVEL}" -gt "1" ]
then
# Output to stdout and debugfile
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
${MAKE} ${CMAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
${MAKE} ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
RET=$?
else
# Output to debugfile only
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
${MAKE} ${CMAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
${MAKE} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
RET=$?
fi
[ "${RET}" -ne "0" ] && gen_die "Failed to compile the \"${1}\" target..."
[ "${RET}" -ne '0' ] && gen_die "Failed to compile the \"${1}\" target..."
unset MAKE
if [ "${2}" = "kernel" ]
if [ "${2}" = 'kernel' ]
then
unset_kernel_args
elif [ "${2}" = "utils" ]
elif [ "${2}" = 'utils' ]
then
unset_utils_args
fi
}
extract_dietlibc_bincache() {
@ -171,44 +163,49 @@ clean_dietlibc_bincache() {
cd - > /dev/null
}
compile_dep() {
# Only run ``make dep'' for 2.4 kernels
if [ "${VER}" -eq "2" ] && [ "${PAT}" -le "4" ]
if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ]
then
print_info 1 "kernel: >> Making dependencies..."
cd ${KERNEL_DIR}
compile_generic "dep" kernel
compile_generic dep kernel
fi
}
compile_modules() {
print_info 1 " >> Compiling ${KV} modules..."
cd ${KERNEL_DIR}
compile_generic "modules" kernel
compile_generic modules kernel
export UNAME_MACHINE="${ARCH}"
# On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures
if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ]
then
MAKEOPTS_SAVE="${MAKEOPTS}"
MAKEOPTS="-j1"
MAKEOPTS='-j1'
fi
compile_generic "modules_install" kernel
if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ]
then
MAKEOPTS="${MAKEOPTS_SAVE}"
fi
export MAKEOPTS
unset UNAME_MACHINE
}
compile_kernel() {
[ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined - I don't know how to compile kernel for this arch."
[ "${KERNEL_MAKE}" = '' ] && gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
cd ${KERNEL_DIR}
print_info 1 " >> Compiling ${KV} ${KERNEL_MAKE_DIRECTIVE/_install/ [ install ]/}..."
compile_generic "${KERNEL_MAKE_DIRECTIVE}" kernel
if [ "${KERNEL_MAKE_DIRECTIVE_2}" != "" ]
if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
then
print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
fi
if ! isTrue "${CMD_NOINSTALL}"
then
cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy the kernel binary to /boot!"
cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
else
cp "${KERNEL_BINARY}" "${TEMP}/kernel-${KV}" || gen_die "Could not copy the kernel binary to ${TEMP}!"
fi
@ -217,12 +214,12 @@ compile_kernel() {
compile_busybox() {
if [ ! -f "${BUSYBOX_BINCACHE}" ]
then
[ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
[ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
[ -f "${BUSYBOX_SRCTAR}" ] || gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
[ -f "${BUSYBOX_CONFIG}" ] || gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
cd "${TEMP}"
rm -rf ${BUSYBOX_DIR} > /dev/null
tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball!"
[ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} is invalid!"
tar -jxpf ${BUSYBOX_SRCTAR} || gen_die 'Could not extract busybox source tarball!'
[ -d "${BUSYBOX_DIR}" ] || gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
cd "${BUSYBOX_DIR}"
# Busybox and dietlibc don't play nice right now
@ -232,22 +229,21 @@ compile_busybox() {
# OLD_CC="${UTILS_CC}"
# UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
# fi
print_info 1 "busybox: >> Configuring..."
yes "" | compile_generic "oldconfig" utils
print_info 1 "busybox: >> Compiling..."
compile_generic "all" utils
print_info 1 'busybox: >> Configuring...'
yes '' | compile_generic oldconfig utils
print_info 1 'busybox: >> Compiling...'
compile_generic all utils
# Busybox and dietlibc don't play nice right now
# if [ "${USE_DIETLIBC}" -eq "1" ]
# then
# clean_dietlibc_bincache
# UTILS_CC="${OLD_CC}"
# fi
print_info 1 "busybox: >> Copying to cache..."
[ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] && gen_die "busybox executable does not exist after compile, error"
strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox"
bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "bzip2 compression of busybox failed"
[ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" ] && gen_die "could not find compressed busybox binary"
mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die "could not copy busybox binary to arch package directory, does the directory exist?"
print_info 1 'busybox: >> Copying to cache...'
[ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] || gen_die 'Busybox executable does not exist!'
strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die 'Could not strip busybox binary!'
bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die 'bzip2 compression of busybox failed!'
mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die 'Could not copy the busybox binary to package directory, does the directory exist?'
cd "${TEMP}"
rm -rf "${BUSYBOX_DIR}" > /dev/null
@ -266,7 +262,7 @@ compile_modutils() {
cd "${MODUTILS_DIR}"
print_info 1 "modutils: >> Configuring..."
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
extract_dietlibc_bincache
OLD_CC="${UTILS_CC}"
@ -275,24 +271,23 @@ compile_modutils() {
export_utils_args
export ARCH=${ARCH}
./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configuring modutils failed!"
./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die 'Configuring modutils failed!'
unset_utils_args
print_info 1 "modutils: >> Compiling..."
compile_generic "all" utils
print_info 1 'modutils: >> Compiling...'
compile_generic all utils
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
clean_dietlibc_bincache
UTILS_CC="${OLD_CC}"
fi
print_info 1 "modutils: >> Copying to cache..."
[ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] && gen_die "insmod.static does not exist after compilation of modutils"
strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "could not strip insmod.static"
bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "compression of insmod.static failed"
[ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" || gen_die "could not move compress binary to bincache"
print_info 1 'modutils: >> Copying to cache...'
[ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] || gen_die "insmod.static does not exist after the compilation of modutils!"
strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die 'Could not strip insmod.static!'
bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die 'Compression of insmod.static failed!'
mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" || gen_die 'Could not move the compressed insmod binary to the package cache!'
cd "${TEMP}"
rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
@ -309,9 +304,9 @@ compile_module_init_tools() {
tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
[ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid"
cd "${MODULE_INIT_TOOLS_DIR}"
print_info 1 "module-init-tools: >> Configuring"
print_info 1 'module-init-tools: >> Configuring'
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
extract_dietlibc_bincache
OLD_CC="${UTILS_CC}"
@ -319,23 +314,23 @@ compile_module_init_tools() {
fi
export_utils_args
./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed"
./configure >> ${DEBUGFILE} 2>&1 || gen_die 'Configure of module-init-tools failed!'
unset_utils_args
print_info 1 " >> Compiling..."
print_info 1 ' >> Compiling...'
compile_generic "all" utils
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
clean_dietlibc_bincache
UTILS_CC="${OLD_CC}"
fi
print_info 1 " >> Copying to cache..."
[ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] && gen_die "insmod.static does not exist after compilation of module-init-tools"
strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "could not strip insmod.static"
bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "compression of insmod.static failed"
[ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" || gen_die "could not move compressed binary to bincache"
print_info 1 ' >> Copying to cache...'
[ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] || gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die 'Could not strip insmod.static!'
bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die 'Compression of insmod.static failed!'
[ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] || gen_die 'Could not find compressed insmod.static.bz2 binary!'
mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" || gen_die 'Could not move the compressed insmod binary to the package cache!'
cd "${TEMP}"
rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
@ -353,42 +348,40 @@ compile_devfsd() {
[ ! -d "${DEVFSD_DIR}" ] && gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
cd "${DEVFSD_DIR}"
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
extract_dietlibc_bincache
OLD_CC="${UTILS_CC}"
UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
fi
print_info 1 "devfsd: >> Compiling..."
if [ "${USE_DIETLIBC}" -eq "1" ]
print_info 1 'devfsd: >> Compiling...'
if [ "${USE_DIETLIBC}" -eq '1' ]
then
compile_generic "has_dlopen=0 has_rpcsvc=0" utils
compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
else
compile_generic "LDFLAGS=-static" utils
compile_generic 'LDFLAGS=-static' utils
fi
if [ "${USE_DIETLIBC}" -eq "1" ]
if [ "${USE_DIETLIBC}" -eq '1' ]
then
clean_dietlibc_bincache
UTILS_CC="${OLD_CC}"
fi
print_info 1 " >> Copying to cache..."
[ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] && gen_die "devfsd executable does not exist after compilation of devfsd"
strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die "could not strip devfsd"
bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die "compression of devfsd failed"
[ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] && gen_die "could not find compressed devfsd.bz2 binary"
mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die "could not move compressed binary to bincache"
print_info 1 ' >> Copying to cache...'
[ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
[ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
[ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] && gen_die "devfsd.conf does not exist after compilation of devfsd"
bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die "compression of devfsd.conf failed"
[ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" ] && gen_die "could not find compressed devfsd.conf.bz2 binary"
mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die "could not move compressed binary to bincache"
[ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
cd "${TEMP}"
# rm -rf "${DEVFSD_DIR}" > /dev/null
rm -rf "${DEVFSD_DIR}" > /dev/null
fi
}
@ -399,24 +392,24 @@ compile_dietlibc() {
BUILD_DIETLIBC=0
[ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
[ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
if [ "${BUILD_DIETLIBC}" -eq "0" ]
if [ "${BUILD_DIETLIBC}" ]
then
ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
if [ "${TEMP}" != "${ORIGTEMP}" ]
then
print_warning 1 "dietlibc: Bincache exists, but current temp directory"
print_warning 1 " is different than original. Rebuilding."
print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
print_warning 1 ' is different to the original. Rebuilding.'
BUILD_DIETLIBC=1
fi
fi
if [ "${BUILD_DIETLIBC}" -eq "1" ]
if [ "${BUILD_DIETLIBC}" -eq '1' ]
then
[ ! -f "${DIETLIBC_SRCTAR}" ] && gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
[ -f "${DIETLIBC_SRCTAR}" ] || gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
cd "${TEMP}"
rm -rf "${DIETLIBC_DIR}" > /dev/null
tar -jxpf ${DIETLIBC_SRCTAR} || gen_die "Could not extract dietlibc source tarball"
[ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid"
[ -d "${DIETLIBC_DIR}" ] || gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
cd "${DIETLIBC_DIR}"
print_info 1 "dietlibc: >> Compiling..."
compile_generic "prefix=${TEMP}/diet" utils
@ -425,7 +418,7 @@ compile_dietlibc() {
print_info 1 " >> Copying to bincache..."
cd ${TEMP}
tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up the dietlibc binary!"
[ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "Dietlibc cache not created!"
[ -f "${DIETLIBC_BINCACHE}" ] || gen_die 'Dietlibc cache not created!'
echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
cd "${TEMP}"

@ -20,56 +20,66 @@ determine_config_file() {
then
KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config"
else
gen_die "Error: No kernel config specified, or file not found!"
gen_die 'Error: No kernel .config specified, or file not found!'
fi
}
config_kernel() {
determine_config_file
cd "${KERNEL_DIR}" || gen_die "Could not switch to the kernel directory!"
cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
if isTrue ${MRPROPER}
then
print_info 1 "kernel: >> Running mrproper..."
compile_generic "mrproper" kernel
print_info 1 'kernel: >> Running mrproper...'
compile_generic mrproper kernel
fi
# If we're not cleaning, then we don't want to try to overwrite the configs there
# or we might screw up something someone is trying to test.
if isTrue ${CLEAN}
# or we might remove configurations someone is trying to test.
if isTrue "${CLEAN}"
then
print_info 1 "config: Using config from ${KERNEL_CONFIG}"
print_info 1 " Previous config backed up to .config.bak"
print_info 1 ' Previous config backed up to .config.bak'
cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config.bak" > /dev/null 2>&1
cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die "could not copy config file"
print_info 1 " >> Running oldconfig..."
yes "" | compile_generic "oldconfig" kernel
print_info 1 "kernel: >> Cleaning..."
compile_generic "clean" kernel
cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
fi
if isTrue "${CLEAN}" || isTrue "${OLDCONFIG}"
then
if ! isTrue "${CLEAN}"
then
print_info 1 'config: >> Running oldconfig...'
else
print_info 1 ' >> Running oldconfig...'
fi
yes '' | compile_generic oldconfig kernel
fi
if isTrue "${CLEAN}"
then
print_info 1 'kernel: >> Cleaning...'
compile_generic clean kernel
else
print_info 1 "config: --no-clean is enabled; leaving the .config alone."
fi
if isTrue ${MENUCONFIG}
then
print_info 1 "config: >> Invoking menuconfig..."
print_info 1 'config: >> Invoking menuconfig...'
compile_generic menuconfig runtask
[ "$?" != "0" ] && gen_die "Error: menuconfig failed."
[ "$?" ] || gen_die 'Error: menuconfig failed!'
elif isTrue ${CMD_GCONFIG}
then
if [ "${VER}" == "2" ] && [ "${PAT}" -lt "6" ]
if [ "${VER}" == '2' ] && [ "${PAT}" -lt '6' ]
then
print_warning 1 "config: gconfig is not available in 2.4 series kernels. Running xconfig"
print_warning 1 " instead..."
print_warning 1 'config: gconfig is not available in 2.4 series kernels. Running xconfig'
print_warning 1 ' instead...'
CMD_GCONFIG=0
CMD_XCONFIG=1
else
print_info 1 "config: >> Invoking gconfig..."
print_info 1 'config: >> Invoking gconfig...'
compile_generic gconfig kernel
[ "$?" != "0" ] && gen_die "Error: gconfig failed."
[ "$?" ] || gen_die 'Error: gconfig failed!'
CMD_XCONFIG=0
fi
@ -77,9 +87,9 @@ config_kernel() {
if isTrue ${CMD_XCONFIG}
then
print_info 1 "config: >> Invoking xconfig..."
print_info 1 'config: >> Invoking xconfig...'
compile_generic xconfig kernel
[ "$?" != "0" ] && gen_die "Error: xconfig failed."
[ "$?" ] || gen_die 'Error: xconfig failed!'
fi
}

@ -12,72 +12,72 @@ get_KV() {
}
determine_real_args() {
if [ "${CMD_DEBUGFILE}" != "" ]
if [ "${CMD_DEBUGFILE}" != '' ]
then
DEBUGFILE="${CMD_DEBUGFILE}"
fi
if [ "${CMD_MAKEOPTS}" != "" ]
if [ "${CMD_MAKEOPTS}" != '' ]
then
MAKEOPTS="${CMD_MAKEOPTS}"
fi
if [ "${CMD_KERNELDIR}" != "" ]
if [ "${CMD_KERNELDIR}" != '' ]
then
KERNEL_DIR=${CMD_KERNELDIR}
else
KERNEL_DIR=${DEFAULT_KERNEL_SOURCE}
fi
[ "${KERNEL_DIR}" = "" ] && gen_die "No kernel source directory!"
[ "${KERNEL_DIR}" = '' ] && gen_die 'No kernel source directory!'
get_KV
if [ "${CMD_KERNEL_MAKE}" != "" ]
if [ "${CMD_KERNEL_MAKE}" != '' ]
then
KERNEL_MAKE="${CMD_KERNEL_MAKE}"
fi
if [ "${KERNEL_MAKE}" = "" ]
if [ "${KERNEL_MAKE}" = '' ]
then
KERNEL_MAKE="make"
KERNEL_MAKE='make'
fi
if [ "${CMD_UTILS_MAKE}" != "" ]
if [ "${CMD_UTILS_MAKE}" != '' ]
then
UTILS_MAKE="${CMD_UTILS_MAKE}"
fi
if [ "${UTILS_MAKE}" = "" ]
if [ "${UTILS_MAKE}" = '' ]
then
UTILS_MAKE="make"
UTILS_MAKE='make'
fi
if [ "${CMD_KERNEL_CC}" != "" ]
if [ "${CMD_KERNEL_CC}" != '' ]
then
KERNEL_CC="${CMD_KERNEL_CC}"
fi
if [ "${CMD_KERNEL_LD}" != "" ]
if [ "${CMD_KERNEL_LD}" != '' ]
then
KERNEL_LD="${CMD_KERNEL_LD}"
fi
if [ "${CMD_KERNEL_AS}" != "" ]
if [ "${CMD_KERNEL_AS}" != '' ]
then
KERNEL_AS="${CMD_KERNEL_AS}"
fi
if [ "${CMD_UTILS_CC}" != "" ]
if [ "${CMD_UTILS_CC}" != '' ]
then
UTILS_CC="${CMD_UTILS_CC}"
fi
if [ "${CMD_UTILS_LD}" != "" ]
if [ "${CMD_UTILS_LD}" != '' ]
then
UTILS_LD="${CMD_UTILS_LD}"
fi
if [ "${CMD_UTILS_AS}" != "" ]
if [ "${CMD_UTILS_AS}" != '' ]
then
UTILS_AS="${CMD_UTILS_AS}"
fi
@ -92,7 +92,7 @@ determine_real_args() {
DEVFSD_BINCACHE=`arch_replace "${DEVFSD_BINCACHE}"`
DEVFSD_CONF_BINCACHE=`arch_replace "${DEVFSD_CONF_BINCACHE}"`
if [ "${CMD_BOOTSPLASH}" != "" ]
if [ "${CMD_BOOTSPLASH}" != '' ]
then
BOOTSPLASH=${CMD_BOOTSPLASH}
fi
@ -111,15 +111,15 @@ determine_real_args() {
COMPRESS_INITRD=0
fi
if [ "${CMD_MRPROPER}" != "" ]
if [ "${CMD_MRPROPER}" != '' ]
then
MRPROPER="${CMD_MRPROPER}"
fi
if [ "${CMD_MENUCONFIG}" != "" ]
if [ "${CMD_MENUCONFIG}" != '' ]
then
MENUCONFIG="${CMD_MENUCONFIG}"
fi
if [ "${CMD_CLEAN}" != "" ]
if [ "${CMD_CLEAN}" != '' ]
then
CLEAN="${CMD_CLEAN}"
if ! isTrue ${CLEAN}
@ -128,12 +128,12 @@ determine_real_args() {
fi
fi
if [ "${CMD_MINKERNPACKAGE}" != "" ]
if [ "${CMD_MINKERNPACKAGE}" != '' ]
then
MINKERNPACKAGE="${CMD_MINKERNPACKAGE}"
fi
if [ "${CMD_NOINITRDMODULES}" != "" ]
if [ "${CMD_NOINITRDMODULES}" != '' ]
then
NOINITRDMODULES="${CMD_NOINITRDMODULES}"
fi

@ -21,14 +21,8 @@ isTrue() {
return 1
}
if isTrue ${USECOLOR}
then
# COLS="`stty size 2> /dev/null`"
# COLS="`getcols ${COLS}`"
# COLS=$((${COLS} - 7))
# ENDCOL=$'\e[A\e['${COLS}'G' # Now, ${ENDCOL} will move us to the end of the
# column; irregardless of character width
GOOD=$'\e[32;01m'
WARN=$'\e[33;01m'
BAD=$'\e[31;01m'
@ -36,57 +30,56 @@ then
BOLD=$'\e[0;01m'
UNDER=$'\e[4m'
else
GOOD=""
WARN=""
BAD=""
NORMAL=""
BOLD=""
UNDER=""
GOOD=''
WARN=''
BAD=''
NORMAL=''
BOLD=''
UNDER=''
fi
# print_info(debuglevel, print [, newline [, prefixline [, forcefile ] ] ])
print_info() {
local NEWLINE=1
local FORCEFILE=0
local PREFIXLINE=1
local SCRPRINT=0
local STR=""
local STR=''
# NOT ENOUGH ARGS
if [ "$#" -lt "2" ] ; then return 1; fi
if [ "$#" -lt '2' ] ; then return 1; fi
# IF 3 OR MORE ARGS, CHECK IF WE WANT A NEWLINE AFTER PRINT
if [ "$#" -gt "2" ]
if [ "$#" -gt '2' ]
then
if isTrue "$3"
then
NEWLINE="1";
NEWLINE='1';
else
NEWLINE="0";
NEWLINE='0';
fi
fi
# IF 4 OR MORE ARGS, CHECK IF WE WANT TO PREFIX WITH A *
if [ "$#" -gt "3" ]
if [ "$#" -gt '3' ]
then
if isTrue "$4"
then
PREFIXLINE="1"
PREFIXLINE='1'
else
PREFIXLINE="0"
PREFIXLINE='0'
fi
fi
# IF 5 OR MORE ARGS, CHECK IF WE WANT TO FORCE OUTPUT TO DEBUG
# FILE EVEN IF IT DOESN'T MEET THE MINIMUM DEBUG REQS
if [ "$#" -gt "4" ]
if [ "$#" -gt '4' ]
then
if isTrue "$5"
then
FORCEFILE="1"
FORCEFILE='1'
else
FORCEFILE="0"
FORCEFILE='0'
fi
fi
@ -94,26 +87,26 @@ print_info() {
# OR EQUAL TO SET DEBUG LEVEL
if [ "$1" -lt "${DEBUGLEVEL}" -o "$1" -eq "${DEBUGLEVEL}" ]
then
SCRPRINT="1"
SCRPRINT='1'
fi
# RETURN IF NOT OUTPUTTING ANYWHERE
if [ "${SCRPRINT}" != "1" -a "${FORCEFILE}" != "1" ]
if [ "${SCRPRINT}" != '1' -a "${FORCEFILE}" != '1' ]
then
return 0
fi
# STRUCTURE DATA TO BE OUTPUT TO SCREEN, AND OUTPUT IT
if [ "${SCRPRINT}" -eq "1" ]
if [ "${SCRPRINT}" -eq '1' ]
then
if [ "${PREFIXLINE}" = "1" ]
if [ "${PREFIXLINE}" = '1' ]
then
STR="${GOOD}*${NORMAL} ${2}"
else
STR="${2}"
fi
if [ "${NEWLINE}" = "0" ]
if [ "${NEWLINE}" = '0' ]
then
echo -ne "${STR}"
else
@ -122,21 +115,21 @@ print_info() {
fi
# STRUCTURE DATA TO BE OUTPUT TO FILE, AND OUTPUT IT
if [ "${SCRPRINT}" -eq "1" -o "${FORCEFILE}" -eq "1" ]
if [ "${SCRPRINT}" -eq '1' -o "${FORCEFILE}" -eq '1' ]
then
STRR=${2//${WARN}/}
STRR=${STRR//${BAD}/}
STRR=${STRR//${BOLD}/}
STRR=${STRR//${NORMAL}/}
if [ "${PREFIXLINE}" = "1" ]
if [ "${PREFIXLINE}" = '1' ]
then
STR="* ${STRR}"
else
STR="${STRR}"
fi
if [ "${NEWLINE}" = "0" ]
if [ "${NEWLINE}" = '0' ]
then
echo -ne "${STR}" >> ${DEBUGFILE}
else
@ -161,6 +154,7 @@ print_warning()
# $1 = variable name
# $2 = variable value
# $3 = string
var_replace()
{
echo "${3}" | sed -e "s/%%${1}%%/${2}/g" -
@ -176,7 +170,7 @@ clear_log() {
}
gen_die() {
if [ "$#" -gt "0" ]
if [ "$#" -gt '0' ]
then
print_error 1 "ERROR: ${1}"
fi
@ -186,7 +180,7 @@ gen_die() {
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]?)" ${DEBUGFILE}
else
grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${DEBUGFILE}
fi
@ -196,19 +190,19 @@ gen_die() {
print_info 1 "Please consult ${DEBUGFILE} for more information and any"
print_info 1 "errors that were reported above."
echo
print_info 1 "Report any real genkernel bugs to bugs.gentoo.org and"
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 ''
print_info 1 "DO ${BAD}NOT${NORMAL} REPORT KERNEL COMPILE FAILURES AS GENKERNEL BUGS!"
print_info 1 'Please do *not* report compilation failures as genkernel bugs!'
print_info 1 ''
exit 1
}
has_loop() {
dmesg | egrep -q '^loop:'
if [ -e "/dev/loop0" -o -e "/dev/loop/0" -a $? ]
if [ -e '/dev/loop0' -o -e '/dev/loop/0' -a $? ]
then
# We found devfs or standard dev loop device, assume
# loop is compiled into the kernel or the module is loaded

@ -3,17 +3,17 @@
# create_initrd_loop(size)
create_initrd_loop() {
local inodes
[ "$#" -ne "1" ] && gen_die "invalid use of create_initrd_loop"
mkdir -p ${TEMP}/initrd-mount || gen_die "could not create loopback mount dir"
dd if=/dev/zero of=${TEMP}/initrd-loop bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 || gen_die "could not zero initrd-loop"
mke2fs -F -N500 -q "${TEMP}/initrd-loop" >> "${DEBUGFILE}" 2>&1 || gen_die "could not format initrd-loop"
mount -t ext2 -o loop "${TEMP}/initrd-loop" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 || gen_die "could not mount initrd filesystem"
[ "$#" -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=${TEMP}/initrd-${KV} bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 || gen_die "Could not zero initrd-${KV}"
mke2fs -F -N500 -q "${TEMP}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 || gen_die "Could not format initrd-${KV}!"
mount -t ext2 -o loop "${TEMP}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 || gen_die 'Could not mount the initrd filesystem!'
}
create_initrd_unmount_loop()
{
cd ${TEMP}
umount "${TEMP}/initrd-mount" || gen_die "could not unmount initrd system"
umount "${TEMP}/initrd-mount" || gen_die 'Could not unmount initrd system!'
}
move_initrd_to_loop()
@ -50,7 +50,7 @@ create_base_initrd_sys() {
bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" || gen_die "could not uncompress busybox"
chmod +x "${TEMP}/initrd-temp/bin/busybox"
if [ "${NOINITRDMODULES}" = "" ]
if [ "${NOINITRDMODULES}" = '' ]
then
if [ "${PAT}" -gt "4" ]
then
@ -73,6 +73,18 @@ create_base_initrd_sys() {
# cp "${DEVFSD_CONF_BINCACHE}" "${TEMP}/initrd-temp/etc/devfsd.conf.bz2" || gen_die "could not copy devfsd.conf from bincache"
# bunzip2 "${TEMP}/initrd-temp/etc/devfsd.conf.bz2" || gen_die "could not uncompress devfsd.conf"
# LVM2
if [ -e '/sbin/vgscan.static' -a -e '/sbin/vgchange.static' ]
then
if [ "${CMD_NOLVM2}" -ne '1' ]
then
cp /sbin/vgscan.static "${TEMP}/initrd-temp/bin/vgscan" || gen_die 'Could not copy over vgscan!'
cp /sbin/vgchange.static "${TEMP}/initrd-temp/bin/vgchange" || gen_die 'Could not copy over vgchange!'
fi
# else
# print_warning 1 "initrd: No LVM2 static binaries found; skipping support..."
fi
for i in '[' ash basename cat chroot clear cp dirname echo env false find \
grep gunzip gzip ln ls loadkmap losetup lsmod mkdir mknod more mount mv \
pivot_root ps awk pwd rm rmdir rmmod sed sh sleep tar test touch true umount uname \
@ -92,6 +104,9 @@ print_list()
}
create_initrd_modules() {
local group
local group_modules
if [ "${PAT}" -gt "4" ]
then
MOD_EXT=".ko"
@ -115,11 +130,10 @@ create_initrd_modules() {
cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp
mkdir -p "${TEMP}/initrd-temp/etc/modules"
print_list ${SCSI_MODULES} > "${TEMP}/initrd-temp/etc/modules/scsi"
print_list ${FIREWIRE_MODULES} > "${TEMP}/initrd-temp/etc/modules/firewire"
print_list ${ATARAID_MODULES} > "${TEMP}/initrd-temp/etc/modules/ataraid"
print_list ${PCMCIA_MODULES} > "${TEMP}/initrd-temp/etc/modules/pcmcia"
print_list ${USB_MODULES} > "${TEMP}/initrd-temp/etc/modules/usb"
for group_modules in ${!MODULES_*}; do
group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
print_list ${!group_modules} > "${TEMP}/initrd-temp/etc/modules/${group}"
done
}
create_initrd_aux() {
@ -143,6 +157,14 @@ create_initrd_aux() {
else
cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults"
fi
echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initrd-temp/etc/initrd.defaults"
for group_modules in ${!MODULES_*}; do
group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
echo -n "${group} " >> "${TEMP}/initrd-temp/etc/initrd.defaults"
done
echo "\"" >> "${TEMP}/initrd-temp/etc/initrd.defaults"
if [ -f "${GK_SHARE}/${ARCH}/modprobe" ]
then
cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe"
@ -177,7 +199,7 @@ create_initrd() {
print_info 1 "initrd: >> Initializing..."
create_base_initrd_sys
if [ "${NOINITRDMODULES}" = "" ]
if [ "${NOINITRDMODULES}" = '' ]
then
print_info 1 " >> Copying modules..."
create_initrd_modules
@ -203,8 +225,8 @@ create_initrd() {
if [ "${COMPRESS_INITRD}" ]
then
gzip -f -9 ${TEMP}/initrd-loop
mv ${TEMP}/initrd-loop.gz ${TEMP}/initrd-loop
gzip -f -9 ${TEMP}/initrd-${KV}
mv ${TEMP}/initrd-${KV}.gz ${TEMP}/initrd-${KV}
fi
if [ "${BOOTSPLASH}" -eq "1" ]
@ -219,9 +241,9 @@ create_initrd() {
do
if [ -f "/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg" ]
then
/sbin/splash -s -f /etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg >> ${TEMP}/initrd-loop || gen_die "Error: could not copy ${bootRes} bootsplash!"
/sbin/splash -s -f /etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg >> ${TEMP}/initrd-${KV} || gen_die "Error: could not copy ${bootRes} bootsplash!"
else
print_info 1 "splash: Did not find a bootsplash for the ${bootRes} resolution..."
print_warning 1 "splash: Did not find a bootsplash for the ${bootRes} resolution..."
fi
done
else
@ -230,8 +252,6 @@ create_initrd() {
fi
if ! isTrue "${CMD_NOINSTALL}"
then
cp ${TEMP}/initrd-loop /boot/initrd-${KV} || gen_die "Could not copy the initrd to /boot!"
else
mv ${TEMP}/initrd-loop ${TEMP}/initrd-${KV} || gen_die "Could not move the initrd to ${TEMP}/initrd-${KV}!"
cp ${TEMP}/initrd-${KV} /boot/initrd-${KV} || gen_die 'Could not copy the initrd to /boot!'
fi
}

@ -51,12 +51,12 @@ gen_deps()
gen_dep_list()
{
local group_modules
rm -f ${TEMP}/moddeps > /dev/null
gen_deps ${SCSI_MODULES}
gen_deps ${FIREWIRE_MODULES}
gen_deps ${ATARAID_MODULES}
gen_deps ${PCMCIA_MODULES}
gen_deps ${USB_MODULES}
for group_modules in ${!MODULES_*}; do
gen_deps ${!group_modules}
done
# Only list each module once
cat ${TEMP}/moddeps | sort | uniq

@ -2,12 +2,13 @@
gen_minkernpackage()
{
print_info 1 "Creating minkernpackage"
print_info 1 'Creating kernel package'
rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
mkdir "${TEMP}/minkernpackage" || gen_die "Could not make directory for minkernpackage"
mkdir "${TEMP}/minkernpackage" || gen_die 'Could not make a directory for the kernel package!'
cd "${KERNEL_DIR}"
cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel" || gen_die "Could not copy kernel for minkernpackage"
cp "/boot/initrd-${KV}" "${TEMP}/minkernpackage/initrd" || gen_die "Could not copy initrd for minkernpackage"
cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the kernel package!'
[ "${BUILD_INITRD}" -ne 0 ] && cp "${TEMP}/initrd-${KV}" "${TEMP}/minkernpackage/initrd-${KV}" || gen_die 'Could not copy the initrd for the kernel package!'
cd "${TEMP}/minkernpackage"
tar -jcpf ${MINKERNPACKAGE} * || gen_die "Could not tar up minkernpackage"
tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
}

@ -12,19 +12,24 @@ KV="`uname -r`"
KMAJOR=`echo $KV | cut -f1 -d.`
KMINOR=`echo $KV | cut -f2 -d.`
KVER="${KMAJOR}.${KMINOR}"
MISCOPTS="cdcache idebug detect"
HWOPTS="scsi firewire ataraid pcmcia usb keymap cache"
MY_HWOPTS="usb firewire"
MISCOPTS='idebug detect'
# Only sections that are in by default or those that
# are not module groups need to be defined here...
HWOPTS="usb firewire keymap cache lvm2"
MY_HWOPTS="usb firewire lvm2"
QUIET=1
ROOT_LINKS="bin sbin lib lib64 boot usr opt"
ROOT_TREES="etc root home var"
INSMOD="insmod"
if [ "${KMINOR}" -gt "4" ]
ROOT_LINKS='bin sbin lib lib64 boot usr opt'
ROOT_TREES='etc root home var'
INSMOD='insmod'
if [ "${KMINOR}" -gt '4' ]
then
KSUFF=".ko"
KSUFF='.ko'
else
KSUFF=".o"
KSUFF='.o'
fi
REAL_ROOT=""
REAL_ROOT=''
CDROOT=0

@ -22,12 +22,6 @@ modules_scan() {
do
echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..."
modprobe ${x} -n
if [ $? -eq 0 ]
then
backup
echo -e "${GOOD} ::${NORMAL} Detected ${x} hardware..."
continue
fi
backup
echo -ne "${NORMAL}"
done

Binary file not shown.

@ -8,18 +8,18 @@
USE_DEVFS_NORMAL=1
if [ "$$" != "1" ]
if [ "$$" != '1' ]
then
echo "/linuxrc has to be run as the init process as the one"
echo "with a PID of 1. Try adding init=\"/linuxrc\" to the"
echo "kernel command line or running 'exec /linuxrc'."
echo '/linuxrc has to be run as the init process as the one'
echo 'with a PID of 1. Try adding init="/linuxrc" to the'
echo 'kernel command line or running "exec /linuxrc".'
exit 1
fi
mount -o remount,rw /
mount -t proc proc /proc
[ -n "$QUIET" ] && echo "0" > /proc/sys/kernel/printk
[ -n "$QUIET" ] && echo '0' > /proc/sys/kernel/printk
CMDLINE=`cat /proc/cmdline`
# Scan CMDLINE for any specified real_root= or cdroot arguments
@ -31,7 +31,7 @@ do
;;
cdroot)
CDROOT=1
REAL_ROOT=""
REAL_ROOT=''
;;
devfs)
USE_DEVFS_NORMAL=1
@ -65,7 +65,7 @@ do
done
done
if [ -d "/lib/modules" ]
if [ -d '/lib/modules' ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading modules...${NORMAL}"
# Load appropriate kernel modules
@ -81,12 +81,12 @@ fi
chooseKeymap() {
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading keymaps...${NORMAL}"
cat /lib/keymaps/keymapList
read -p "<< Load keymap: " keymap
read -p '<< Load keymap: ' keymap
if [ -e /lib/keymaps/${keymap}.map ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading the ''${keymap}'' keymap...${NORMAL}"
loadkmap < /lib/keymaps/${keymap}.map
elif [ "$keymap" = "" ]
elif [ "$keymap" = '' ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading default US keymap...${NORMAL}"
loadkmap < /lib/keymaps/us.map
@ -104,7 +104,7 @@ fi
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting filesystems...${NORMAL}"
mkdir /newroot
if [ "${CDROOT}" -eq "1" ]
if [ "${CDROOT}" -eq '1' ]
then
mount -t tmpfs tmpfs /newroot
mkdir /newroot/dev /newroot/mnt /newroot/mnt/cdrom /newroot/mnt/livecd /newroot/tmp /newroot/tmp/.initrd /newroot/mnt/gentoo
@ -114,12 +114,12 @@ then
findcdmount /newroot/dev/cdroms/*
# not in /dev/cdroms try /dev/ide/cd
if [ "${REAL_ROOT}" = "" ]
if [ "${REAL_ROOT}" = '' ]
then
findcdmount /newroot/dev/ide/cd/*
fi
if [ "${REAL_ROOT}" = "" ]
if [ "${REAL_ROOT}" = '' ]
then
exec /bin/ash
@ -137,32 +137,42 @@ then
fi
# Don't do else b/c we set CDROOT=0 if it fails to detect
if [ "${CDROOT}" -eq "0" -a "${USE_DEVFS_NORMAL}" -eq "1" ]
if [ "${CDROOT}" -eq '0' -a "${USE_DEVFS_NORMAL}" -eq '1' ]
then
[ ! -e /dev/.devfsd ] && mount -t devfs devfs /dev
devfsd /dev -np
fi
if [ "${DO_lvm2}" ]
then
if [ -e '/sbin/vgscan' -a -e '/sbin/vgchange' ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Scanning for Volume Groups...${NORMAL}"
/sbin/vgscan
echo -e "${GOOD}>>${NORMAL}${BOLD} Activating Volume Groups...${NORMAL}"
/sbin/vgchange -ay
fi
fi
echo -e "${GOOD}>>${NORMAL}${BOLD} Determining root device...${NORMAL}"
while true
do
while [ "${got_good_root}" != "1" ]
while [ "${got_good_root}" != '1' ]
do
if [ "${REAL_ROOT}" = "shell" ]
if [ "${REAL_ROOT}" = 'shell' ]
then
/bin/ash
REAL_ROOT=""
REAL_ROOT=''
got_good_root=0
continue
elif [ "${REAL_ROOT}" = "" ]
elif [ "${REAL_ROOT}" = '' ]
then
# No REAL_ROOT determined/specified. Prompt user for root block device.
echo -e "${BAD}>>${NORMAL} The root block device is unspecified or not detected."
echo " Please specify a device to boot, or \"shell\" for a shell."
echo -n "boot() :: "
echo ' Please specify a device to boot, or "shell" for a shell...'
echo -n 'boot() :: '
read REAL_ROOT
got_good_root=0
elif [ -b "${REAL_ROOT}" ]
@ -175,62 +185,62 @@ do
fi
done
if [ "${CDROOT}" -eq "1" -a "${got_good_root}" = "1" ]
if [ "${CDROOT}" -eq '1' -a "${got_good_root}" = '1' ]
then
break
else
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting root...${NORMAL}"
mount -o rw ${REAL_ROOT} /newroot
if [ "$?" = "0" ]
if [ "$?" = '0' ]
then
break
else
echo -e "${BAD}>> ${NORMAL}Could not mount specified ROOT, try again"
got_good_root=0
REAL_ROOT=""
REAL_ROOT=''
fi
fi
done
[ -n "$QUIET" ] && echo "6" > /proc/sys/kernel/printk
[ -n "$QUIET" ] && echo '6' > /proc/sys/kernel/printk
check_loop() {
if [ "${LOOP}" = "" -o ! -e "mnt/cdrom/${LOOP}" ]
if [ "${LOOP}" = '' -o ! -e "mnt/cdrom/${LOOP}" ]
then
echo "Invalid loop location: ${LOOP}"
echo "Please export LOOP with a valid location, or reboot and pass a proper loop=..."
echo "kernel command line!"
echo 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
echo 'kernel command line!'
/bin/ash
fi
}
if [ "${CDROOT}" = "1" ]
if [ "${CDROOT}" = '1' ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Filling tmpfs...${NORMAL}"
cd /newroot
# Failsafe if some idiot didn't set loop type
if [ "${LOOPTYPE}" = "" ]
# Failsafe the loop type wasn't set
if [ "${LOOPTYPE}" = '' ]
then
echo -e "${WARN}** ${NORMAL}${BOLD}Warning: loop type unspecified!${NORMAL}"
if [ "${LOOP}" = "/livecd.loop" ]
if [ "${LOOP}" = '/livecd.loop' ]
then
LOOPTYPE="normal"
elif [ "${LOOP}" = "/zisofs" ]
LOOPTYPE='normal'
elif [ "${LOOP}" = '/zisofs' ]
then
LOOPTYPE="zisofs"
elif [ "${LOOP}" = "/livecd.squashfs" ]
LOOPTYPE='zisofs'
elif [ "${LOOP}" = '/livecd.squashfs' ]
then
LOOPTYPE="squashfs"
elif [ "${LOOP}" = "/livecd.gcloop" ]
LOOPTYPE='squashfs'
elif [ "${LOOP}" = '/livecd.gcloop' ]
then
LOOPTYPE="gcloop"
LOOPTYPE='gcloop'
else
LOOPTYPE="noloop"
LOOPTYPE='noloop'
fi
fi
if [ "${LOOPTYPE}" != "noloop" ]
if [ "${LOOPTYPE}" != 'noloop' ]
then
check_loop
if [ "${DO_cache}" ]
@ -243,56 +253,56 @@ then
rm -rf /newroot/mnt/livecd.* 2>/dev/null
rm -rf /newroot/mnt/zisofs 2>/dev/null
else
LOOPEXT="../"
LOOPEXT='../'
fi
fi
fi
if [ "${LOOPTYPE}" = "normal" ]
if [ "${LOOPTYPE}" = 'normal' ]
then
# bind-mount /dev/ so that loop devices can be found
mount -o bind /newroot/dev /dev
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting loop filesystem...${NORMAL}"
mount -t ext2 -o loop,ro /newroot/mnt/cdrom/${LOOPEXT}${LOOP} /newroot/mnt/livecd
if [ "$?" != "0" ]
if [ "$?" != '0' ]
then
echo "FAILED TO MOUNT LOOP FILESYSTEM, barfing out to shell"
echo 'Failed to mount filesystem; failing back to the shell...'
/bin/ash
fi
FS_LOCATION="mnt/livecd"
FS_LOCATION='mnt/livecd'
umount /dev
elif [ "${LOOPTYPE}" = "squashfs" ]
elif [ "${LOOPTYPE}" = 'squashfs' ]
then
mount -o bind /newroot/dev /dev
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting squashfs filesystem...${NORMAL}"
mount -t squashfs -o loop,ro /newroot/mnt/cdrom/${LOOPEXT}${LOOP} /newroot/mnt/livecd
if [ "$?" != "0" ]
if [ "$?" != '0' ]
then
echo "FAILED TO MOUNT LOOP FILESYSTEM, barfing out to shell"
echo 'Failed to mount filesystem; failing back to the shell...'
/bin/ash
fi
FS_LOCATION="mnt/livecd"
FS_LOCATION='mnt/livecd'
umount /dev
elif [ "${LOOPTYPE}" = "gcloop" ]
elif [ "${LOOPTYPE}" = 'gcloop' ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting gcloop filesystem...${NORMAL}"
mount -o bind /newroot/dev /dev
echo " " | losetup -E 19 -e ucl-0 -p0 /newroot/dev/loop0 /newroot/mnt/cdrom/${LOOPEXT}${LOOP}
if [ "$?" != "0" ]
echo ' ' | losetup -E 19 -e ucl-0 -p0 /newroot/dev/loop0 /newroot/mnt/cdrom/${LOOPEXT}${LOOP}
if [ "$?" != '0' ]
then
echo "FAILED TO losetup THE LOOP DEVICE"
/bin/ash
fi
mount -t ext2 -o ro /newroot/dev/loop0 /newroot/mnt/livecd
FS_LOCATION="mnt/livecd"
FS_LOCATION='mnt/livecd'
umount /dev
elif [ "${LOOPTYPE}" = "zisofs" ]
elif [ "${LOOPTYPE}" = 'zisofs' ]
then
FS_LOCATION="mnt/cdrom/${LOOPEXT}${LOOP}"
elif [ "${LOOPTYPE}" = "noloop" ]
elif [ "${LOOPTYPE}" = 'noloop' ]
then
FS_LOCATION="mnt/cdrom"
FS_LOCATION='mnt/cdrom'
fi
echo -e "${GOOD}>>${NORMAL}${BOLD} Filling filesystem...${NORMAL}"
@ -314,12 +324,12 @@ cd /newroot
pivot_root . tmp/.initrd
echo -n '.'
if [ "${USE_DEVFS_NORMAL}" -eq "1" -a "${CDROOT}" -eq "0" ]
if [ "${USE_DEVFS_NORMAL}" -eq '1' -a "${CDROOT}" -eq '0' ]
then
umount /tmp/.initrd/proc || echo '*: Failed to unmount the initrd /proc!'
mount -n --move /tmp/.initrd/dev dev || echo '*: Failed to move over the /dev tree!'
rm /tmp/.initrd/dev -rf || '*: Failed to remove the initrd /dev!'
elif [ "${CDROOT}" -eq "1" ]
elif [ "${CDROOT}" -eq '1' ]
then
# If automount at boot was on with devfs, we'll want to umount it
# also umount proc
@ -344,8 +354,8 @@ exec chroot . /bin/sh <<- EOF
exec /sbin/init
EOF
echo "A fatal error has probably occured since /sbin/init did not"
echo "boot correctly. Trying to open a shell..."
echo 'A fatal error has probably occured since /sbin/init did not'
echo 'boot correctly. Trying to open a shell...'
echo
exec /bin/bash
exec /bin/sh

@ -4,22 +4,22 @@
usage()
{
echo "Usage:"
echo " modprobe moduleprefix"
echo 'Usage:'
echo ' modprobe moduleprefix'
echo
echo "Ex:"
echo " modprobe eepro100"
echo 'Example:'
echo ' modprobe eepro100'
echo
echo "Note: Do not pass the suffix to modprobe!"
echo 'Note: Do not pass the suffix to modprobe!'
exit 1
}
# Pass module name to this function
modules_dep_list()
{
if [ "$#" -lt "1" ]
if [ "$#" -lt '1' ]
then
echo "modules_dep_list(): improper usage"
echo 'modules_dep_list(): Improper usage!'
exit 1
fi
cat /lib/modules/${KV}/modules.dep | grep ${1}${KSUFF}\: | cut -d\: -f2
@ -33,7 +33,7 @@ strip_mod_paths()
local ret
local myret
[ "$#" -lt "1" ] && return
[ "$#" -lt '1' ] && return
for x in ${*}
do
@ -43,14 +43,13 @@ strip_mod_paths()
echo "${myret}"
}
LOADED_MODULES=""
LOADED_MODULES=''
is_module_already_loaded()
{
local x
if [ "$#" != "1" ]
if [ "$#" != '1' ]
then
echo "is_module_already_loaded(): improper usage"
echo 'is_module_already_loaded(): Improper usage!'
fi
for x in ${LOADED_MODULES}
@ -81,23 +80,23 @@ modprobe2()
local echoAppend
local echoFlags
if [ "$#" -lt "1" ]
if [ "$#" -lt '1' ]
then
echo "modprobe(): improper usage"
usage
exit 1
fi
real_path=`real_mod_path ${1}`
if [ "${real_path}" = "" -o "${real_path}" = " " ]
if [ "${real_path}" = '' -o "${real_path}" = ' ' ]
then
echo "module not found..."
echo ' module not found.'
exit 2
fi
modlist=`modules_dep_list ${1}`
if [ "${modlist}" != "" -a "${modlist}" != " " ]
if [ "${modlist}" != '' -a "${modlist}" != ' ' ]
then
deps=`strip_mod_paths ${modlist}`
else
deps=""
deps=''
fi
# Make sure we don't do any endless loops!
@ -106,7 +105,7 @@ modprobe2()
do
if ! is_module_already_loaded ${x}
then
if [ "${x}" != "" -a "${x}" != " " ]
if [ "${x}" != '' -a "${x}" != ' ' ]
then
modprobe2 "${x}" -n
fi
@ -116,22 +115,21 @@ modprobe2()
done
${INSMOD} ${real_path} > /dev/null 2>&1
ret=$?
if [ "$ret" -eq "0" ]
if [ "$ret" -eq '0' ]
then
echoAppend=" loaded..."
[ "${2}" = "-n" ] && echoFlags="-n" && echoAppend=", "
echoAppend=' loaded.'
[ "${2}" = '-n' ] && echoFlags='-n' && echoAppend=', '
echo ${echoFlags} "${1}${echoAppend}"
fi
return $ret
}
if [ "$#" -lt "1" ]
if [ "$#" -lt '1' ]
then
usage
fi
[ -f "/modules.cache" ] || touch /modules.cache
[ -f '/modules.cache' ] || touch /modules.cache
for x in `cat /modules.cache`
do
LOADED_MODULES="${LOADED_MODULES} ${x}"
@ -140,7 +138,7 @@ done
modprobe2 ${1}
modprobe_ret=$?
[ -f "/modules.cache" ] && rm -f /modules.cache > /dev/null 2>&1
[ -f '/modules.cache' ] && rm -f /modules.cache > /dev/null 2>&1
for x in ${LOADED_MODULES}
do
echo $x >> /modules.cache

@ -1,27 +1,26 @@
#!/bin/bash
# Genkernel v3
GK_V="3.0.2"
TEMP="/var/tmp/genkernel"
GK_V='3.0.2b'
TEMP='/var/tmp/genkernel'
small_die() {
echo $1
exit 1
}
source /etc/genkernel.conf || small_die "could not read /etc/genkernel.conf"
source ${GK_BIN}/gen_funcs.sh || small_die "could not read ${GK_BIN}/gen_funcs.sh"
source /etc/genkernel.conf || small_die "Could not read /etc/genkernel.conf"
source ${GK_BIN}/gen_funcs.sh || small_die "Could not read ${GK_BIN}/gen_funcs.sh"
clear_log
source ${GK_BIN}/gen_cmdline.sh || gen_die "could not read ${GK_BIN}/gen_cmdline.sh"
source ${GK_BIN}/gen_arch.sh || gen_die "could not read ${GK_BIN}/gen_arch.sh"
source ${GK_BIN}/gen_determineargs.sh || gen_die "could not read ${GK_BIN}/gen_determineargs.sh"
source ${GK_BIN}/gen_compile.sh || gen_die "could not read ${GK_BIN}/gen_compile.sh"
source ${GK_BIN}/gen_configkernel.sh || gen_die "could not read ${GK_BIN}/gen_configkernel.sh"
source ${GK_BIN}/gen_initrd.sh || gen_die "could not read ${GK_BIN}/gen_initrd.sh"
source ${GK_BIN}/gen_moddeps.sh || gen_die "could not read ${GK_BIN}/gen_moddeps.sh"
source ${GK_BIN}/gen_package.sh || gen_die "could not read ${GK_BIN}/gen_package.sh"
BUILD_ALL=0
source ${GK_BIN}/gen_cmdline.sh || gen_die "Could not read ${GK_BIN}/gen_cmdline.sh"
source ${GK_BIN}/gen_arch.sh || gen_die "Could not read ${GK_BIN}/gen_arch.sh"
source ${GK_BIN}/gen_determineargs.sh || gen_die "Could not read ${GK_BIN}/gen_determineargs.sh"
source ${GK_BIN}/gen_compile.sh || gen_die "Could not read ${GK_BIN}/gen_compile.sh"
source ${GK_BIN}/gen_configkernel.sh || gen_die "Could not read ${GK_BIN}/gen_configkernel.sh"
source ${GK_BIN}/gen_initrd.sh || gen_die "Could not read ${GK_BIN}/gen_initrd.sh"
source ${GK_BIN}/gen_moddeps.sh || gen_die "Could not read ${GK_BIN}/gen_moddeps.sh"
source ${GK_BIN}/gen_package.sh || gen_die "Could not read ${GK_BIN}/gen_package.sh"
BUILD_KERNEL=0
BUILD_INITRD=0
@ -32,7 +31,8 @@ do
parse_cmdline $Option
done
if [ "${BUILD_ALL}" -eq 0 -a "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ]
# Check if no action is specified...
if [ "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ]
then
usage
exit 1
@ -44,34 +44,39 @@ NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}${NORMAL}"
get_official_arch
# Read arch-specific config
source ${ARCH_CONFIG} || gen_die "could not read ${ARCH_CONFIG}"
source ${GK_SHARE}/${ARCH}/modules_load || gen_die "could not read ${GK_SHARE}/${ARCH}/modules_load"
source ${ARCH_CONFIG} || gen_die "Could not read ${ARCH_CONFIG}"
source ${GK_SHARE}/${ARCH}/modules_load || gen_die "Could not read ${GK_SHARE}/${ARCH}/modules_load"
[ ! -f "${TEMP}" ] && mkdir -p "${TEMP}"
# Based on genkernel.conf, arch-specific configs, and commandline options,
# get the real args for use.
# get the real arguments for usage...
determine_real_args
NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..."
echo
if ! has_loop
if [ "${BUILD_INITRD}" -ne '0' ]
then
if ! has_loop
then
modprobe loop 2>/dev/null
if ! has_loop
then
print_error 1 "Your kernel does not appear to have loop device support. "
print_error 1 "Please load loop support before running genkernel!"
gen_die "Load loop support!"
print_error 1 'Your kernel does not appear to have loop device support.'
print_error 1 'Please load loop support before running genkernel!'
gen_die 'Load loop support!'
else
print_info 1 'loop: "loop" module loaded successfully...'
fi
fi
fi
# Check /boot is mounted
if ! grep -q "/boot" /proc/mounts
if ! egrep -q ' /boot ' /proc/mounts
then
if egrep -q '^[^#].+ /boot ' /etc/fstab
then
if isTrue ${MOUNTBOOT}
then
if ! mount /boot
@ -79,51 +84,56 @@ then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!"
echo
else
print_info 1 "mount: /boot mounted successfully!"
print_info 1 'mount: /boot mounted successfully!'
fi
else
print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted /boot partition detected!"
print_warning 1 ' Run ``mount /boot`` to mount it!'
echo
fi
fi
fi
# Check whether another Genkernel is running
GENPIDS="`ps -C genkernel --no-headers -o pid | wc -l`"
if [ "${GENPIDS}" -gt "3" ]
if [ "${GENPIDS}" -gt '3' ]
then
[ "${GENPIDS}" -gt "4" ] && EX='s'
[ "${GENPIDS}" -gt '4' ] && EX='s'
print_warning 1 "${BOLD}WARNING${NORMAL}: Another Genkernel instance is running under"
print_warning 1 " process ID${EX} " 0
GENPIDS=`ps -C genkernel --no-headers -o pid`
echo -n ${GENPIDS} | sed -e "s/$$//; s/ /, /g"
echo "halting..."
echo -n "${GENPIDS}" | sed -e "s/$$//; s/ /, /g"
echo 'halting...'
echo
print_warning 1 "Running multiple genkernels on the same source tree will cause data loss!"
print_warning 1 'Running multiple genkernels on the same source tree will cause data loss!'
print_info 1 "Press ^C to halt; ^D to continue [ ${BOLD}if${NORMAL} you know what you're doing! ]"
cat
echo
TEMP="/var/tmp/genkernel-`date | md5sum | cut -d\ -f1`"
print_info 1 "thread: Running multiple genkernels may cause problems!"
CTEMP="${TEMP}"
TEMP="/var/tmp/genkernel-`dd if=/dev/random count=1 2>/dev/null | md5sum | cut -d\ -f1`"
print_info 1 'thread: Running multiple genkernels may cause problems!'
print_info 1 "thread: Temporary files reallocated to ${TEMP}..."
echo
fi
# Configure kernel
config_kernel
if [ ${BUILD_KERNEL} -eq 1 ]
then
# Configure kernel
config_kernel
# Make deps
compile_dep
# Make deps
compile_dep
# Compile kernel
compile_kernel
# Compile kernel
compile_kernel
# Compile modules
compile_modules
# Compile modules
compile_modules
print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels
cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels
cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
fi
# Run callback
if [ "${CMD_CALLBACK}" != "" ]
@ -156,51 +166,74 @@ then
print_info 1 "" 1 0
fi
# Compile dietlibc
if [ "${USE_DIETLIBC}" = "1" ]
if [ "${BUILD_INITRD}" -eq '1' ]
then
# Compile dietlibc
if [ "${USE_DIETLIBC}" = '1' ]
then
compile_dietlibc
fi
fi
# Compile Busybox
compile_busybox
# Compile Busybox
compile_busybox
# Only compile insmod if we're installing modules onto the initrd
if [ "${NOINITRDMODULES}" = "" ]
then
if [ "${PAT}" -gt "4" ]
# Only compile insmod if we're installing modules onto the initrd
if [ "${NOINITRDMODULES}" = '' ]
then
if [ "${PAT}" -gt '4' ]
then
# Compile module-init-tools
compile_module_init_tools
else
compile_modutils
fi
fi
fi
compile_devfsd
compile_devfsd
# Create initrd
create_initrd
# Create initrd
create_initrd
else
print_info 1 'initrd: Not building since only the kernel was requested...'
fi
[ "${MINKERNPACKAGE}" != "" ] && gen_minkernpackage
# Clean up...
[ -n "${CTEMP}" ] && rm -rf "${TEMP}"
if [ "${MINKERNPACKAGE}" != "" ]
if [ "${BUILD_KERNEL}" -eq '1' ]
then
gen_minkernpackage
print_info 1 ''
print_info 1 "Kernel compiled successfully!"
print_info 1 ''
print_info 1 'Required Kernel Parameters:'
if [ "${BUILD_INITRD}" -eq '0' ]
then
print_info 1 ' root=/dev/$ROOT'
print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
print_info 1 ''
print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 ' one specified in /etc/fstab'
else
print_info 1 ' root=/dev/ram0 real_root=/dev/$ROOT init=/linuxrc'
[ "${INITRD_SIZE}" -ge 4096 ] && print_info 1 " ramdisk=8192"
print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
print_info 1 ''
print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 ' one specified in /etc/fstab'
print_info 1 ''
print_info 1 "If you require Genkernel's hardware detection features; you MUST"
print_info 1 'tell your bootloader to use the provided initrd file. Otherwise;'
print_info 1 'substitute the root argument for the real_root argument if you are'
print_info 1 'not planning to use the initrd...'
fi
else
print_info 1 ''
print_info 1 'initrd compiled successfully!'
fi
print_info 1 ''
print_info 1 "Kernel compiled successfully!"
print_info 1 ''
print_info 1 "Required Kernel Parameters:"
print_info 1 ' root=/dev/ram0 real_root=/dev/$ROOT init=/linuxrc'
[ "${INITRD_SIZE}" -gt 4096 ] && print_info 1 " ramdisk_size=${INITRD_SIZE}"
print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
print_info 1 ''
print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 ' one specified in /etc/fstab'
print_info 1 ''
print_info 1 "You MUST also tell your bootloader to use the generated initrd."
print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug'
print_info 1 'is about the default genkernel configuration...'
print_info 1 ''
print_info 1 "Do NOT report kernel bugs (configs included) as genkernel bugs."
print_info 1 "Make sure you have the latest genkernel before reporting bugs."
print_info 1 ""
print_info 1 "For more information please see /usr/share/genkernel/README..."
print_info 1 'Make sure you have the latest genkernel before reporting bugs.'

@ -1,10 +1,5 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES="usb-ohci hid usb-storage"
MODULES_SCSI=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB="usb-ohci hid usb-storage"

@ -1,10 +1,7 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES="usb-ohci hid usb-storage"
MODULES_SCSI=""
MODULES_FS=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB="usb-ohci hid usb-storage"

@ -1,10 +1,5 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES=""
MODULES_SCSI=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB=""

@ -1,10 +1,5 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES=""
MODULES_SCSI=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB=""

@ -1,10 +1,5 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES=""
MODULES_SCSI=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB=""

@ -1,10 +1,5 @@
SCSI_MODULES=""
FIREWIRE_MODULES=""
ATARAID_MODULES=""
PCMCIA_MODULES=""
USB_MODULES=""
MODULES_SCSI=""
MODULES_FIREWIRE=""
MODULES_ATARAID=""
MODULES_PCMCIA=""
MODULES_USB=""

@ -1571,7 +1571,7 @@ CONFIG_MINIX_FS=m
CONFIG_VXFS_FS=m
CONFIG_NTFS_FS=m
# CONFIG_NTFS_DEBUG is not set
CONFIG_NTFS_RW=y
# CONFIG_NTFS_RW is not set
CONFIG_HPFS_FS=m
CONFIG_PROC_FS=y
CONFIG_DEVFS_FS=y

@ -358,7 +358,7 @@ CONFIG_SCSI_PROC_FS=y
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
CONFIG_CHR_DEV_ST=y
# CONFIG_CHR_DEV_OSST is not set
CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set
@ -1261,7 +1261,7 @@ CONFIG_UDF_FS=y
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
# CONFIG_NTFS_FS is not set
CONFIG_NTFS_FS=m
#
# Pseudo filesystems

@ -1,4 +1,4 @@
SCSI_MODULES="sd_mod sg sr_mod \
MODULES_SCSI="sd_mod sg sr_mod aic79xx \
aic7xxx aic7xxx_old BusLogic \
ncr53c8xx NCR53c406a \
initio advansys aha1740 aha1542 aha152x \
@ -11,7 +11,7 @@ aacraid sym53c8xx a100u2w cpqfc \
dmx3191d dpt_i2o imm in2000 ips qla1280 \
sim710 sym53c416"
FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2"
ATARAID_MODULES="ataraid pdcraid hptraid"
PCMCIA_MODULES="ide-cs"
USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage"
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_ATARAID="ataraid pdcraid hptraid"
MODULES_PCMCIA="ide-cs"
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage"

@ -1,7 +1,7 @@
SCSI_MODULES="3w-xxxx dpt_i2o mptscsih mptctl aic79xx"
#SCSI_MODULES="3w-xxxx sata_sil"
MODULES_SCSI="3w-xxxx dpt_i2o mptscsih mptctl aic79xx"
#MODULES_SCSI="3w-xxxx sata_sil"
#sata_sil sata_promise sata_via \
#SCSI_MODULES="sd_mod sg sr_mod \
#MODULES_SCSI="sd_mod sg sr_mod \
#aic7xxx aic7xxx_old BusLogic \
#ncr53c8xx NCR53c406a \
#initio advansys aha1740 aha1542 aha152x \
@ -15,11 +15,7 @@ SCSI_MODULES="3w-xxxx dpt_i2o mptscsih mptctl aic79xx"
#dmx3191d dpt_i2o imm in2000 ips qla1280 \
#qlogicfas qlogicfc qlogicisp \
FIREWIRE_MODULES="ieee1394 ohci1394 sbp2"
ATARAID_MODULES="ataraid pdcraid hptraid"
PCMCIA_MODULES="ide-cs"
USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage"
MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
MODULES_ATARAID="ataraid pdcraid hptraid"
MODULES_PCMCIA="ide-cs"
MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage"

Loading…
Cancel
Save