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

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
get_official_arch() { get_official_arch() {
if [ "${CMD_ARCHOVERRIDE}" != "" ] if [ "${CMD_ARCHOVERRIDE}" != '' ]
then then
ARCH=${CMD_ARCHOVERRIDE} ARCH=${CMD_ARCHOVERRIDE}
else else
@ -16,5 +16,5 @@ get_official_arch() {
fi fi
ARCH_CONFIG="${GK_SHARE}/${ARCH}/config.sh" 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}"
} }

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

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

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

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

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

@ -3,17 +3,17 @@
# create_initrd_loop(size) # create_initrd_loop(size)
create_initrd_loop() { create_initrd_loop() {
local inodes local inodes
[ "$#" -ne "1" ] && gen_die "invalid use of create_initrd_loop" [ "$#" -ne '1' ] && gen_die 'create_initrd_loop(): Not enough arguments!'
mkdir -p ${TEMP}/initrd-mount || gen_die "could not create loopback mount dir" mkdir -p ${TEMP}/initrd-mount || gen_die 'Could not create loopback mount directory!'
dd if=/dev/zero of=${TEMP}/initrd-loop bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 || gen_die "could not zero initrd-loop" 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-loop" >> "${DEBUGFILE}" 2>&1 || gen_die "could not format initrd-loop" mke2fs -F -N500 -q "${TEMP}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 || gen_die "Could not format initrd-${KV}!"
mount -t ext2 -o loop "${TEMP}/initrd-loop" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 || gen_die "could not mount initrd filesystem" 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() create_initrd_unmount_loop()
{ {
cd ${TEMP} 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() 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" bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" || gen_die "could not uncompress busybox"
chmod +x "${TEMP}/initrd-temp/bin/busybox" chmod +x "${TEMP}/initrd-temp/bin/busybox"
if [ "${NOINITRDMODULES}" = "" ] if [ "${NOINITRDMODULES}" = '' ]
then then
if [ "${PAT}" -gt "4" ] if [ "${PAT}" -gt "4" ]
then 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" # 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" # 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 \ 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 \ 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 \ 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() { create_initrd_modules() {
local group
local group_modules
if [ "${PAT}" -gt "4" ] if [ "${PAT}" -gt "4" ]
then then
MOD_EXT=".ko" MOD_EXT=".ko"
@ -115,11 +130,10 @@ create_initrd_modules() {
cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp
mkdir -p "${TEMP}/initrd-temp/etc/modules" mkdir -p "${TEMP}/initrd-temp/etc/modules"
print_list ${SCSI_MODULES} > "${TEMP}/initrd-temp/etc/modules/scsi" for group_modules in ${!MODULES_*}; do
print_list ${FIREWIRE_MODULES} > "${TEMP}/initrd-temp/etc/modules/firewire" group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
print_list ${ATARAID_MODULES} > "${TEMP}/initrd-temp/etc/modules/ataraid" print_list ${!group_modules} > "${TEMP}/initrd-temp/etc/modules/${group}"
print_list ${PCMCIA_MODULES} > "${TEMP}/initrd-temp/etc/modules/pcmcia" done
print_list ${USB_MODULES} > "${TEMP}/initrd-temp/etc/modules/usb"
} }
create_initrd_aux() { create_initrd_aux() {
@ -143,6 +157,14 @@ create_initrd_aux() {
else else
cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults" cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults"
fi 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" ] if [ -f "${GK_SHARE}/${ARCH}/modprobe" ]
then then
cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe"
@ -177,7 +199,7 @@ create_initrd() {
print_info 1 "initrd: >> Initializing..." print_info 1 "initrd: >> Initializing..."
create_base_initrd_sys create_base_initrd_sys
if [ "${NOINITRDMODULES}" = "" ] if [ "${NOINITRDMODULES}" = '' ]
then then
print_info 1 " >> Copying modules..." print_info 1 " >> Copying modules..."
create_initrd_modules create_initrd_modules
@ -203,8 +225,8 @@ create_initrd() {
if [ "${COMPRESS_INITRD}" ] if [ "${COMPRESS_INITRD}" ]
then then
gzip -f -9 ${TEMP}/initrd-loop gzip -f -9 ${TEMP}/initrd-${KV}
mv ${TEMP}/initrd-loop.gz ${TEMP}/initrd-loop mv ${TEMP}/initrd-${KV}.gz ${TEMP}/initrd-${KV}
fi fi
if [ "${BOOTSPLASH}" -eq "1" ] if [ "${BOOTSPLASH}" -eq "1" ]
@ -219,9 +241,9 @@ create_initrd() {
do do
if [ -f "/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg" ] if [ -f "/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg" ]
then 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 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 fi
done done
else else
@ -230,8 +252,6 @@ create_initrd() {
fi fi
if ! isTrue "${CMD_NOINSTALL}" if ! isTrue "${CMD_NOINSTALL}"
then then
cp ${TEMP}/initrd-loop /boot/initrd-${KV} || gen_die "Could not copy the initrd to /boot!" cp ${TEMP}/initrd-${KV} /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}!"
fi fi
} }

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

@ -2,12 +2,13 @@
gen_minkernpackage() gen_minkernpackage()
{ {
print_info 1 "Creating minkernpackage" print_info 1 'Creating kernel package'
rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1 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}" cd "${KERNEL_DIR}"
cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel" || gen_die "Could not copy kernel for minkernpackage" cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the kernel package!'
cp "/boot/initrd-${KV}" "${TEMP}/minkernpackage/initrd" || gen_die "Could not copy initrd for minkernpackage" [ "${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" 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.` KMAJOR=`echo $KV | cut -f1 -d.`
KMINOR=`echo $KV | cut -f2 -d.` KMINOR=`echo $KV | cut -f2 -d.`
KVER="${KMAJOR}.${KMINOR}" KVER="${KMAJOR}.${KMINOR}"
MISCOPTS="cdcache idebug detect" MISCOPTS='idebug detect'
HWOPTS="scsi firewire ataraid pcmcia usb keymap cache"
MY_HWOPTS="usb firewire" # 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 QUIET=1
ROOT_LINKS="bin sbin lib lib64 boot usr opt" ROOT_LINKS='bin sbin lib lib64 boot usr opt'
ROOT_TREES="etc root home var" ROOT_TREES='etc root home var'
INSMOD="insmod" INSMOD='insmod'
if [ "${KMINOR}" -gt "4" ] if [ "${KMINOR}" -gt '4' ]
then then
KSUFF=".ko" KSUFF='.ko'
else else
KSUFF=".o" KSUFF='.o'
fi fi
REAL_ROOT="" REAL_ROOT=''
CDROOT=0 CDROOT=0

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

Binary file not shown.

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

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

@ -1,27 +1,26 @@
#!/bin/bash #!/bin/bash
# Genkernel v3 # Genkernel v3
GK_V="3.0.2" GK_V='3.0.2b'
TEMP="/var/tmp/genkernel" TEMP='/var/tmp/genkernel'
small_die() { small_die() {
echo $1 echo $1
exit 1 exit 1
} }
source /etc/genkernel.conf || small_die "could not read /etc/genkernel.conf" 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 ${GK_BIN}/gen_funcs.sh || small_die "Could not read ${GK_BIN}/gen_funcs.sh"
clear_log clear_log
source ${GK_BIN}/gen_cmdline.sh || gen_die "could not read ${GK_BIN}/gen_cmdline.sh" 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_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_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_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_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_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_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" source ${GK_BIN}/gen_package.sh || gen_die "Could not read ${GK_BIN}/gen_package.sh"
BUILD_ALL=0
BUILD_KERNEL=0 BUILD_KERNEL=0
BUILD_INITRD=0 BUILD_INITRD=0
@ -32,7 +31,8 @@ do
parse_cmdline $Option parse_cmdline $Option
done 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 then
usage usage
exit 1 exit 1
@ -44,86 +44,96 @@ NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}${NORMAL}"
get_official_arch get_official_arch
# Read arch-specific config # Read arch-specific config
source ${ARCH_CONFIG} || gen_die "could not read ${ARCH_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 ${GK_SHARE}/${ARCH}/modules_load || gen_die "Could not read ${GK_SHARE}/${ARCH}/modules_load"
[ ! -f "${TEMP}" ] && mkdir -p "${TEMP}" [ ! -f "${TEMP}" ] && mkdir -p "${TEMP}"
# Based on genkernel.conf, arch-specific configs, and commandline options, # 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 determine_real_args
NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..." NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..."
echo echo
if ! has_loop if [ "${BUILD_INITRD}" -ne '0' ]
then then
modprobe loop 2>/dev/null
if ! has_loop if ! has_loop
then then
print_error 1 "Your kernel does not appear to have loop device support. " modprobe loop 2>/dev/null
print_error 1 "Please load loop support before running genkernel!" if ! has_loop
gen_die "Load loop support!" then
else print_error 1 'Your kernel does not appear to have loop device support.'
print_info 1 'loop: "loop" module loaded successfully...' 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
fi fi
# Check /boot is mounted # Check /boot is mounted
if ! grep -q "/boot" /proc/mounts if ! egrep -q ' /boot ' /proc/mounts
then then
if isTrue ${MOUNTBOOT} if egrep -q '^[^#].+ /boot ' /etc/fstab
then then
if ! mount /boot if isTrue ${MOUNTBOOT}
then then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!" if ! mount /boot
echo then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!"
echo
else
print_info 1 'mount: /boot mounted successfully!'
fi
else else
print_info 1 "mount: /boot mounted successfully!" print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted /boot partition detected!"
print_warning 1 ' Run ``mount /boot`` to mount it!'
echo
fi 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 fi
# Check whether another Genkernel is running # Check whether another Genkernel is running
GENPIDS="`ps -C genkernel --no-headers -o pid | wc -l`" GENPIDS="`ps -C genkernel --no-headers -o pid | wc -l`"
if [ "${GENPIDS}" -gt "3" ] if [ "${GENPIDS}" -gt '3' ]
then 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 "${BOLD}WARNING${NORMAL}: Another Genkernel instance is running under"
print_warning 1 " process ID${EX} " 0 print_warning 1 " process ID${EX} " 0
GENPIDS=`ps -C genkernel --no-headers -o pid` GENPIDS=`ps -C genkernel --no-headers -o pid`
echo -n ${GENPIDS} | sed -e "s/$$//; s/ /, /g" echo -n "${GENPIDS}" | sed -e "s/$$//; s/ /, /g"
echo "halting..." echo 'halting...'
echo 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! ]" print_info 1 "Press ^C to halt; ^D to continue [ ${BOLD}if${NORMAL} you know what you're doing! ]"
cat cat
echo echo
TEMP="/var/tmp/genkernel-`date | md5sum | cut -d\ -f1`" CTEMP="${TEMP}"
print_info 1 "thread: Running multiple genkernels may cause problems!" 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}..." print_info 1 "thread: Temporary files reallocated to ${TEMP}..."
echo echo
fi fi
# Configure kernel if [ ${BUILD_KERNEL} -eq 1 ]
config_kernel then
# Configure kernel
config_kernel
# Make deps # Make deps
compile_dep 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}" print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels [ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels
cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}" cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
fi
# Run callback # Run callback
if [ "${CMD_CALLBACK}" != "" ] if [ "${CMD_CALLBACK}" != "" ]
@ -156,51 +166,74 @@ then
print_info 1 "" 1 0 print_info 1 "" 1 0
fi fi
# Compile dietlibc if [ "${BUILD_INITRD}" -eq '1' ]
if [ "${USE_DIETLIBC}" = "1" ]
then then
compile_dietlibc # Compile dietlibc
fi if [ "${USE_DIETLIBC}" = '1' ]
then
compile_dietlibc
fi
# Compile Busybox # Compile Busybox
compile_busybox compile_busybox
# Only compile insmod if we're installing modules onto the initrd # Only compile insmod if we're installing modules onto the initrd
if [ "${NOINITRDMODULES}" = "" ] if [ "${NOINITRDMODULES}" = '' ]
then
if [ "${PAT}" -gt "4" ]
then then
# Compile module-init-tools if [ "${PAT}" -gt '4' ]
compile_module_init_tools then
else # Compile module-init-tools
compile_modutils compile_module_init_tools
else
compile_modutils
fi
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
if [ "${MINKERNPACKAGE}" != "" ] # Clean up...
[ -n "${CTEMP}" ] && rm -rf "${TEMP}"
if [ "${BUILD_KERNEL}" -eq '1' ]
then 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 fi
print_info 1 '' print_info 1 ''
print_info 1 "Kernel compiled successfully!" print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug'
print_info 1 '' print_info 1 'is about the default genkernel configuration...'
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 '' 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 "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..."

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

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

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

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

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

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

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

@ -358,7 +358,7 @@ CONFIG_SCSI_PROC_FS=y
# SCSI support type (disk, tape, CD-ROM) # SCSI support type (disk, tape, CD-ROM)
# #
CONFIG_BLK_DEV_SD=y 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_CHR_DEV_OSST is not set
CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set # CONFIG_BLK_DEV_SR_VENDOR is not set
@ -1261,7 +1261,7 @@ CONFIG_UDF_FS=y
CONFIG_FAT_FS=m CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m CONFIG_VFAT_FS=m
# CONFIG_NTFS_FS is not set CONFIG_NTFS_FS=m
# #
# Pseudo filesystems # 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 \ aic7xxx aic7xxx_old BusLogic \
ncr53c8xx NCR53c406a \ ncr53c8xx NCR53c406a \
initio advansys aha1740 aha1542 aha152x \ initio advansys aha1740 aha1542 aha152x \
@ -11,7 +11,7 @@ aacraid sym53c8xx a100u2w cpqfc \
dmx3191d dpt_i2o imm in2000 ips qla1280 \ dmx3191d dpt_i2o imm in2000 ips qla1280 \
sim710 sym53c416" sim710 sym53c416"
FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2" MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"
ATARAID_MODULES="ataraid pdcraid hptraid" MODULES_ATARAID="ataraid pdcraid hptraid"
PCMCIA_MODULES="ide-cs" MODULES_PCMCIA="ide-cs"
USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage" MODULES_USB="ehci-hcd uhci usb-ohci hid usb-storage"

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

Loading…
Cancel
Save