Version bump. Closes bugs #34948, #37371, #41129, #41166, #42725, #42815,

#44127, #44556, and #44601.


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

@ -1,63 +1,45 @@
VERY EXPERIMENTAL
seems to work so far on amd64 and x86
DEPENDANCIES: DEPENDANCIES:
- bootsplash - GCC and binutils
- gcc/binutils - GNU Bash
- bash
INSTALLATION:
put genkernel.conf in /etc
put genkernel executable in /usr/bin
put the rest of the files and directories in /usr/share/genkernel
USAGE:
See http://www.gentoo.org/doc/en/genkernel.xml or
issue ``genkernel --help''.
PORTING: PORTING:
To port to other arches:
To port to other arches: # cd /usr/share/genkernel
# cp -Rp x86 ${myarch}
cd /usr/share/genkernel # mkdir /usr/share/genkernel/pkg/${myarch}
cp -Rp x86 ${myarch}
mkdir /usr/share/genkernel/pkg/${myarch}
modify what is needed in the /usr/share/genkernel/${myarch}
directory, this is all the arch-specific stuff, as well
as a generic kernel-config
Modify what is needed in the /usr/share/genkernel/${myarch}
directory, as well making a generic kernel-config.
IMPORTANT KERNEL NOTES: IMPORTANT KERNEL NOTES:
- You MUST have devfs turned on at this time, but you MUST NOT - You MUST have /dev/pts turned on.
have "Automatically mount at boot" option turned on. - If you want Bootsplash, you MUST have VESAFB enabled for 2.6,
- You MUST have /dev/pts turned on
- If you want Bootsplash, you MUST have VESAFB enabled for 2.6,
other framebuffers won't work. You MUST also enable other framebuffers won't work. You MUST also enable
"video mode selection support" and "Framebuffer Console support" "video mode selection support" and "Framebuffer Console support"
- To build a kernel with GenKernel you must have - To build a kernel with Genkernel you must have
"Block devices->Loopback device support" "Block devices->Loopback device support"
"Block devices->RAM disk support" "Block devices->RAM disk support"
- To boot genkernel properly, the kernel config must have - To boot genkernel properly, the kernel config must have
RAM disk support and Initial RAM disk support. You should RAM disk support and Initial RAM disk support. You should
also set your "Default RAM disk size to 8192" also set your "Default RAM disk size to 8192"
BOOTING A KERNEL WITH INITRD: BOOTING A KERNEL WITH INITRD:
GRUB: GRUB:
real_root= needs to point to your root partition real_root= needs to point to your root partition
root= needs to point to the ramdisk (should stay at /dev/ram0) root= needs to point to the ramdisk (should stay at /dev/ram0)
init= needs to point to the linuxrc file to execute on the ramdisk init= needs to point to the linuxrc file to execute on the ramdisk
vga= should be the resolution you want your screen at 0x317 indicates vga= should be the resolution you want your screen. 0x317 is
1024x768 - 16bpp and you'll get a pretty bootsplash if configured properly 1024x768 - 16bpp and you'll get a pretty bootsplash if
configured properly
GRUB EXAMPLE ENTRY: GRUB EXAMPLE ENTRY:
title=Linux 2.6.0 genkernel title=2.6.0 [ Genkernel ]
root (hd0,0) root (hd0,0)
kernel (hd0,0)/boot/kernel-2.6.0-gentoo root=/dev/ram0 init=/linuxrc real_root=/dev/hda3 vga=0x317 kernel (hd0,0)/boot/kernel-2.6.0-gentoo root=/dev/ram0 init=/linuxrc real_root=/dev/hda3 vga=0x317
initrd (hd0,0)/boot/initrd-2.6.0-gentoo initrd (hd0,0)/boot/initrd-2.6.0-gentoo

@ -1,8 +1,4 @@
- add LVM2 support, so people that have their root partitions - Add LVM2 support, so people that have their root partitions
LVM2-ized can boot. LVM2-ized can boot.
- bump busybox version to _pre5 which has initial 2.6 insmod - Need configs for other currently-unsupported arches.
and devfsd support. Provide configurable options to allow
building real devfsd or using busybox devfsd, and likewise
for insmod.
- need configs for other arches

@ -1,21 +1,27 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
echo "GenKernel ${GK_V} [options] command" echo "Gentoo Linux Genkernel ${GK_V}"
echo "Available Commands: " echo "Usage: "
echo " genkernel [options] action"
echo
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 kernel and modules (not done yet)"
echo " initrd Build only initrd (not done yet)" echo " initrd Build only initrd (not done yet)"
echo "" echo
echo "Available Options: " echo "Available Options: "
echo " Debug settings" echo " Debug settings"
echo " --debuglevel=<0-5> Debug Verbosity Level" echo " --debuglevel=<0-5> Debug Verbosity Level"
echo " --debugfile=<outfile> Output file for debug info" echo " --debugfile=<outfile> Output file for debug info"
echo " --color Output debug in color" echo " --color Output debug in color"
echo " --no-color Do not output debug in color" echo " --no-color Do not output debug in color"
echo " Kernel Configuration settings"
echo " --menuconfig Run menuconfig after oldconfig"
echo " --no-menuconfig Do not run menuconfig after oldconfig"
echo " --gconfig Run gconfig after oldconfig"
echo " --xconfig Run xconfig after oldconfig"
echo " Kernel Compile settings" echo " Kernel Compile settings"
echo " --menuconfig Run menu config after oldconfig"
echo " --no-menuconfig Do no run menu config after oldconfig"
echo " --mrproper Run make mrproper before compilation" echo " --mrproper Run make mrproper before compilation"
echo " --clean Run make clean before compilation" echo " --clean Run make clean before compilation"
echo " --no-clean Do not run make clean before compilation" echo " --no-clean Do not run make clean before compilation"
@ -24,33 +30,40 @@ usage() {
echo " --no-bootsplash Do not use bootsplash" echo " --no-bootsplash Do not use bootsplash"
echo " --install Install kernel after building" echo " --install Install kernel after building"
echo " --no-install Do not install kernel after building" echo " --no-install Do not install kernel after building"
echo " --kerneldir=<dir> Location of kernel source" 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"
echo " compiled."
echo " Kernel settings"
echo " --kerneldir=<dir> Location of the kernel sources"
echo " --kernel-config=<file> Kernel configuration file to use for compilation" echo " --kernel-config=<file> Kernel configuration file to use for compilation"
echo " --no-initrdmodules Don't copy modules to initrd"
echo " Low-Level Compile settings" echo " Low-Level Compile settings"
echo " --kernel-cc=<compiler> Compiler to use for kernel (e.g. distcc)" echo " --kernel-cc=<compiler> Compiler to use for kernel (e.g. distcc)"
echo " --kernel-ld=<linker> Linker to use for kernel"
echo " --kernel-as=<assembler> Assembler to use for kernel" echo " --kernel-as=<assembler> Assembler to use for kernel"
echo " --kernel-ld=<linker> Linker to use for kernel"
echo " --kernel-make=<makeprg> GNU Make to use for kernel" echo " --kernel-make=<makeprg> GNU Make to use for kernel"
echo " --utils-cc=<compiler> Compiler to use for utils (e.g. busybox, modutils)" echo " --utils-cc=<compiler> Compiler to use for utilities"
echo " --utils-ld=<linker> Linker to use for utils"
echo " --utils-as=<assembler> Assembler to use for utils" echo " --utils-as=<assembler> Assembler to use for utils"
echo " --utils-ld=<linker> Linker to use for utils"
echo " --utils-make=<makeprog> GNU Make to use for utils" echo " --utils-make=<makeprog> GNU Make to use for utils"
echo " --makeopts=<makeopts> Make Opts such as -j2, etc" echo " --makeopts=<makeopts> Make options such as -j2, etc."
echo " Initialization"
echo " --do-keymap-auto Forces keymap selection at boot."
echo " Internals" echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect (cross-compile?)" 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_ bzip2'd binary" echo " --busybox-bin=<file> Don't compile busybox, use this _static_"
echo " Misc Settings" echo " bzip2'd binary"
echo " --max-kernel-size=<k> Maximum kernel size" # echo " Misc Settings"
echo " --max-initrd-size=<k> Maximum initrd size" # echo " --max-kernel-size=<k> Maximum kernel size"
echo " --max-kernel-and-initrd-size=<k> Maximum combined initrd + 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 to"
echo " These will be renamed to simply 'kernel' and 'initrd'" echo " These will be renamed to simply 'kernel' and"
echo " inside the package without any path information." echo " 'initrd' inside the package without any path"
echo " No modules outside of the initrd will be included" echo " information. No modules outside of the initrd"
echo "" echo " will be included."
} }
parse_opt() { parse_opt() {
@ -62,51 +75,62 @@ parse_opt() {
} }
parse_cmdline() { parse_cmdline() {
for x in $* case "$*" in
do
case "${x}" in
--kernel-cc*) --kernel-cc*)
CMD_KERNEL_CC=`parse_opt "${x}"` CMD_KERNEL_CC=`parse_opt "$*"`
print_info 2 "CMD_KERNEL_CC: $CMD_KERNEL_CC" print_info 2 "CMD_KERNEL_CC: $CMD_KERNEL_CC"
;; ;;
--kernel-ld*) --kernel-ld*)
CMD_KERNEL_LD=`parse_opt "${x}"` CMD_KERNEL_LD=`parse_opt "$*"`
print_info 2 "CMD_KERNEL_LD: $CMD_KERNEL_LD" print_info 2 "CMD_KERNEL_LD: $CMD_KERNEL_LD"
;; ;;
--kernel-as*) --kernel-as*)
CMD_KERNEL_AS=`parse_opt "${x}"` CMD_KERNEL_AS=`parse_opt "$*"`
print_info 2 "CMD_KERNEL_AS: $CMD_KERNEL_AS" print_info 2 "CMD_KERNEL_AS: $CMD_KERNEL_AS"
;; ;;
--kernel-make*) --kernel-make*)
CMD_KERNEL_MAKE=`parse_opt "${x}"` CMD_KERNEL_MAKE=`parse_opt "$*"`
print_info 2 "CMD_KERNEL_MAKE: $CMD_KERNEL_MAKE" print_info 2 "CMD_KERNEL_MAKE: $CMD_KERNEL_MAKE"
;; ;;
--utils-cc*) --utils-cc*)
CMD_UTILS_CC=`parse_opt "${x}"` CMD_UTILS_CC=`parse_opt "$*"`
print_info 2 "CMD_UTILS_CC: $CMD_UTILS_CC" print_info 2 "CMD_UTILS_CC: $CMD_UTILS_CC"
;; ;;
--utils-ld*) --utils-ld*)
CMD_UTILS_LD=`parse_opt "${x}"` CMD_UTILS_LD=`parse_opt "$*"`
print_info 2 "CMD_UTILS_LD: $CMD_UTILS_LD" print_info 2 "CMD_UTILS_LD: $CMD_UTILS_LD"
;; ;;
--utils-as*) --utils-as*)
CMD_UTILS_AS=`parse_opt "${x}"` CMD_UTILS_AS=`parse_opt "$*"`
print_info 2 "CMD_UTILS_AS: $CMD_UTILS_AS" print_info 2 "CMD_UTILS_AS: $CMD_UTILS_AS"
;; ;;
--utils-make*) --utils-make*)
CMD_UTILS_MAKE=`parse_opt "${x}"` CMD_UTILS_MAKE=`parse_opt "$*"`
print_info 2 "CMD_UTILS_MAKE: $CMD_UTILS_MAKE" print_info 2 "CMD_UTILS_MAKE: $CMD_UTILS_MAKE"
;; ;;
--makeopts*) --makeopts*)
CMD_MAKEOPTS=`parse_opt "${x}"` CMD_MAKEOPTS=`parse_opt "$*"`
print_info 2 "CMD_MAKEOPTS: $CMD_MAKEOPTS" print_info 2 "CMD_MAKEOPTS: $CMD_MAKEOPTS"
;; ;;
--do-keymap-auto)
CMD_DOKEYMAPAUTO=1
print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO"
;;
--debuglevel*) --debuglevel*)
CMD_DEBUGLEVEL=`parse_opt "${x}"` CMD_DEBUGLEVEL=`parse_opt "$*"`
DEBUGLEVEL="${CMD_DEBUGLEVEL}" DEBUGLEVEL="${CMD_DEBUGLEVEL}"
print_info 2 "CMD_DEBUGLEVEL: $CMD_DEBUGLEVEL" print_info 2 "CMD_DEBUGLEVEL: $CMD_DEBUGLEVEL"
;; ;;
--menuconfig) --menuconfig)
TERM_LINES=`stty -a | head -n 1 | cut -d\ -f5 | cut -d\; -f1`
TERM_COLUMNS=`stty -a | head -n 1 | cut -d\ -f7 | cut -d\; -f1`
if [[ TERM_LINES -lt 19 || TERM_COLUMNS -lt 80 ]]
then
echo "Error: You need a terminal with at least 80 columns"
echo " and 19 lines for --menuconfig; try --nomenuconfig..."
exit 1
fi
CMD_MENUCONFIG=1 CMD_MENUCONFIG=1
print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG" print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG"
;; ;;
@ -114,6 +138,14 @@ parse_cmdline() {
CMD_MENUCONFIG=0 CMD_MENUCONFIG=0
print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG" print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG"
;; ;;
--gconfig)
CMD_GCONFIG=1
print_info 2 "CMD_GCONFIG: $CMD_GCONFIG"
;;
--xconfig)
CMD_XCONFIG=1
print_info 2 "CMD_XCONFIG: $CMD_XCONFIG"
;;
--mrproper) --mrproper)
CMD_MRPROPER=1 CMD_MRPROPER=1
print_info 2 "CMD_MRPROPER: $CMD_MRPROPER" print_info 2 "CMD_MRPROPER: $CMD_MRPROPER"
@ -150,8 +182,12 @@ parse_cmdline() {
CMD_NOINITRDMODULES=1 CMD_NOINITRDMODULES=1
print_info 2 "CMD_NOINITRDMODULES: $CMD_NOINITRDMODULES" print_info 2 "CMD_NOINITRDMODULES: $CMD_NOINITRDMODULES"
;; ;;
--callback*)
CMD_CALLBACK=`parse_opt "$*"`
print_info 2 "CMD_CALLBACK: $CMD_CALLBACK/$*"
;;
--arch-override*) --arch-override*)
CMD_ARCHOVERRIDE=`parse_opt "${x}"` CMD_ARCHOVERRIDE=`parse_opt "$*"`
print_info 2 "CMD_ARCHOVERRIDE: $CMD_ARCHOVERRIDE" print_info 2 "CMD_ARCHOVERRIDE: $CMD_ARCHOVERRIDE"
;; ;;
--color) --color)
@ -163,39 +199,39 @@ parse_cmdline() {
print_info 2 "CMD_USECOLOR: $CMD_USECOLOR" print_info 2 "CMD_USECOLOR: $CMD_USECOLOR"
;; ;;
--debugfile*) --debugfile*)
CMD_DEBUGFILE=`parse_opt "${x}"` CMD_DEBUGFILE=`parse_opt "$*"`
print_info 2 "CMD_DEBUGFILE: $CMD_DEBUGFILE" print_info 2 "CMD_DEBUGFILE: $CMD_DEBUGFILE"
;; ;;
--kerneldir*) --kerneldir*)
CMD_KERNELDIR=`parse_opt "${x}"` CMD_KERNELDIR=`parse_opt "$*"`
print_info 2 "CMD_KERNELDIR: $CMD_KERNELDIR" print_info 2 "CMD_KERNELDIR: $CMD_KERNELDIR"
;; ;;
--kernel-config*) --kernel-config*)
CMD_KERNEL_CONFIG=`parse_opt "${x}"` CMD_KERNEL_CONFIG=`parse_opt "$*"`
print_info 2 "CMD_KERNEL_CONFIG: $CMD_KERNEL_CONFIG" print_info 2 "CMD_KERNEL_CONFIG: $CMD_KERNEL_CONFIG"
;; ;;
--busybox-config*) --busybox-config*)
CMD_BUSYBOX_CONFIG=`parse_opt "${x}"` CMD_BUSYBOX_CONFIG=`parse_opt "$*"`
print_info 2 "CMD_BUSYBOX_CONFIG: $CMD_BUSYBOX_CONFIG" print_info 2 "CMD_BUSYBOX_CONFIG: $CMD_BUSYBOX_CONFIG"
;; ;;
--busybox-bin*) --busybox-bin*)
CMD_BUSYBOX_BIN=`parse_opt "${x}"` 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*) --max-kernel-size*)
CMD_MAX_KERNEL_SIZE=`parse_opt "${x}"` CMD_MAX_KERNEL_SIZE=`parse_opt "$*"`
print_info 2 "MAX_KERNEL_SIZE: $CMD_MAX_KERNEL_SIZE" print_info 2 "MAX_KERNEL_SIZE: $CMD_MAX_KERNEL_SIZE"
;; ;;
--max-initrd-size*) --max-initrd-size*)
CMD_MAX_INITRD_SIZE=`parse_opt "${x}"` CMD_MAX_INITRD_SIZE=`parse_opt "$*"`
print_info 2 "MAX_INITRD_SIZE: $CMD_MAX_INITRD_SIZE" print_info 2 "MAX_INITRD_SIZE: $CMD_MAX_INITRD_SIZE"
;; ;;
--max-kernel-and-initrd-size*) --max-kernel-and-initrd-size*)
CMD_MAX_KERNEL_AND_INITRD_SIZE=`parse_opt "${x}"` CMD_MAX_KERNEL_AND_INITRD_SIZE=`parse_opt "$*"`
print_info 2 "MAX_KERNEL_AND_INITRD_SIZE: $CMD_MAX_KERNEL_AND_INITRD_SIZE" print_info 2 "MAX_KERNEL_AND_INITRD_SIZE: $CMD_MAX_KERNEL_AND_INITRD_SIZE"
;; ;;
--minkernpackage*) --minkernpackage*)
CMD_MINKERNPACKAGE=`parse_opt "${x}"` CMD_MINKERNPACKAGE=`parse_opt "$*"`
print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE" print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE"
;; ;;
all) all)
@ -213,7 +249,4 @@ parse_cmdline() {
;; ;;
esac esac
done
} }

@ -115,29 +115,36 @@ compile_generic() {
gen_die "compile_generic(): improper usage" gen_die "compile_generic(): improper usage"
fi fi
if [ "${2}" = "kernel" ] CMAKEOPTS=${MAKEOPTS}
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 [ "${DEBUGLEVEL}" -gt "1" ] if [ "${2}" == "runtask" ]
then
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
${MAKE} -s ${CMAKEOPTS} ${1}
RET=$?
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} ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE} ${MAKE} ${CMAKEOPTS} ${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} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1 ${MAKE} ${CMAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
RET=$? RET=$?
fi fi
[ "${RET}" -ne "0" ] && gen_die "compile of ${1} failed" [ "${RET}" -ne "0" ] && gen_die "Failed to compile the \"${1}\" target..."
unset MAKE unset MAKE
if [ "${2}" = "kernel" ] if [ "${2}" = "kernel" ]
@ -151,38 +158,33 @@ compile_generic() {
} }
extract_dietlibc_bincache() { extract_dietlibc_bincache() {
print_info 1 "extracting dietlibc bincache" print_info 1 "dietlibc: >> Extracting cache..."
CURR_DIR=`pwd`
cd "${TEMP}" cd "${TEMP}"
rm -rf "${TEMP}/diet" > /dev/null rm -rf "${TEMP}/diet" > /dev/null
tar -jxpf "${DIETLIBC_BINCACHE}" || gen_die "Could not extract dietlibc bincache" tar -jxpf "${DIETLIBC_BINCACHE}" || gen_die "Could not extract dietlibc bincache!"
[ ! -d "${TEMP}/diet" ] && gen_die "${TEMP}/diet directory not found" [ ! -d "${TEMP}/diet" ] && gen_die "${TEMP}/diet directory not found!"
cd "${CURR_DIR}" cd - > /dev/null
} }
clean_dietlibc_bincache() { clean_dietlibc_bincache() {
print_info 1 "cleaning up dietlibc bincache"
CURR_DIR=`pwd`
cd "${TEMP}" cd "${TEMP}"
rm -rf "${TEMP}/diet" > /dev/null rm -rf "${TEMP}/diet" > /dev/null
cd "${CURR_DIR}" cd - > /dev/null
} }
compile_dep() { compile_dep() {
# Only make dep for 2.4 kernels # Only run ``make dep'' for 2.4 kernels
if [ "${PAT}" -gt "4" ] if [ "${VER}" -eq "2" ] && [ "${PAT}" -le "4" ]
then then
print_info 1 "kernel: skipping make dep for non 2.4 kernels" print_info 1 "kernel: >> Making dependencies..."
else
print_info 1 "kernel: Making dependencies for linux ${KV}"
cd ${KERNEL_DIR} cd ${KERNEL_DIR}
compile_generic "dep" kernel compile_generic "dep" kernel
fi fi
} }
compile_modules() { compile_modules() {
print_info 1 "kernel: Starting compile of linux ${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}"
@ -196,27 +198,32 @@ compile_modules() {
} }
compile_kernel() { compile_kernel() {
[ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined. Don't know how to compile kernel for arch." [ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined - I don't know how to compile kernel for this arch."
cd ${KERNEL_DIR} cd ${KERNEL_DIR}
print_info 1 "kernel: Starting compile of linux ${KV} ${KERNEL_MAKE_DIRECTIVE}" 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 "kernel: Starting suppliment compile of linux ${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
cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy kernel binary to boot" if ! isTrue "${CMD_NOINSTALL}"
then
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
} }
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} 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
@ -226,9 +233,9 @@ 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: make oldconfig" print_info 1 "busybox: >> Configuring..."
yes "" | compile_generic "oldconfig" utils yes "" | compile_generic "oldconfig" utils
print_info 1 "Busybox: make all" 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" ]
@ -236,18 +243,17 @@ compile_busybox() {
# clean_dietlibc_bincache # clean_dietlibc_bincache
# UTILS_CC="${OLD_CC}" # UTILS_CC="${OLD_CC}"
# fi # fi
print_info 1 "Busybox: copying to bincache" 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 after compile, error"
strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox" strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox"
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" [ ! -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?" 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: cleaning up"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${BUSYBOX_DIR}" > /dev/null rm -rf "${BUSYBOX_DIR}" > /dev/null
else else
print_info 1 "Busybox: Found bincache at ${BUSYBOX_BINCACHE}" print_info 1 "busybox: Found cache at ${BUSYBOX_BINCACHE}"
fi fi
} }
@ -255,13 +261,13 @@ compile_modutils() {
local ARGS local ARGS
if [ ! -f "${MODUTILS_BINCACHE}" ] if [ ! -f "${MODUTILS_BINCACHE}" ]
then then
[ ! -f "${MODUTILS_SRCTAR}" ] && gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}" [ ! -f "${MODUTILS_SRCTAR}" ] && gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${MODUTILS_DIR}" rm -rf "${MODUTILS_DIR}"
tar -jxpf "${MODUTILS_SRCTAR}" tar -jxpf "${MODUTILS_SRCTAR}"
[ ! -d "${MODUTILS_DIR}" ] && gen_die "Modutils directory ${MODUTILS_DIR} invalid" [ ! -d "${MODUTILS_DIR}" ] && gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
cd "${MODUTILS_DIR}" cd "${MODUTILS_DIR}"
print_info 1 "modutils: configure" print_info 1 "modutils: >> Configuring..."
if [ "${USE_DIETLIBC}" -eq "1" ] if [ "${USE_DIETLIBC}" -eq "1" ]
then then
@ -271,10 +277,11 @@ compile_modutils() {
fi fi
export_utils_args export_utils_args
./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configure of modutils failed" export ARCH=${ARCH}
./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configuring modutils failed!"
unset_utils_args unset_utils_args
print_info 1 "modutils: make all" print_info 1 "modutils: >> Compiling..."
compile_generic "all" utils compile_generic "all" utils
if [ "${USE_DIETLIBC}" -eq "1" ] if [ "${USE_DIETLIBC}" -eq "1" ]
@ -283,18 +290,17 @@ compile_modutils() {
UTILS_CC="${OLD_CC}" UTILS_CC="${OLD_CC}"
fi fi
print_info 1 "modutils: copying to bincache" 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 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" [ ! -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" mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" || gen_die "could not move compress binary to bincache"
print_info 1 "modutils: cleaning up"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
else else
print_info 1 "modutils: Found bincache at ${MODUTILS_BINCACHE}" print_info 1 "modutils: Found cache at ${MODUTILS_BINCACHE}"
fi fi
} }
@ -308,7 +314,7 @@ 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: configure" print_info 1 "module-init-tools: >> Configuring"
if [ "${USE_DIETLIBC}" -eq "1" ] if [ "${USE_DIETLIBC}" -eq "1" ]
then then
@ -320,7 +326,7 @@ compile_module_init_tools() {
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 "module-init-tools: make all" print_info 1 " >> Compiling..."
compile_generic "all" utils compile_generic "all" utils
if [ "${USE_DIETLIBC}" -eq "1" ] if [ "${USE_DIETLIBC}" -eq "1" ]
@ -329,18 +335,17 @@ compile_module_init_tools() {
UTILS_CC="${OLD_CC}" UTILS_CC="${OLD_CC}"
fi fi
print_info 1 "module-init-tools: copying to bincache" 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 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 compressed binary to bincache"
print_info 1 "module-init-tools: cleaning up"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
else else
print_info 1 "module-init-tools: Found bincache at ${MODULE_INIT_TOOLS_BINCACHE}" print_info 1 "module-init-tools: Found cache at ${MODULE_INIT_TOOLS_BINCACHE}"
fi fi
} }
@ -362,7 +367,7 @@ compile_devfsd() {
UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}" UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
fi fi
print_info 1 "devfsd: make all" print_info 1 "devfsd: >> Compiling..."
if [ "${USE_DIETLIBC}" -eq "1" ] if [ "${USE_DIETLIBC}" -eq "1" ]
then then
@ -377,7 +382,7 @@ compile_devfsd() {
UTILS_CC="${OLD_CC}" UTILS_CC="${OLD_CC}"
fi fi
print_info 1 "devfsd: copying to bincache" 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 "devfsd executable does not exist after 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"
@ -389,11 +394,10 @@ compile_devfsd() {
[ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" ] && gen_die "could not find compressed devfsd.conf.bz2 binary" [ ! -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" mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die "could not move compressed binary to bincache"
print_info 1 "devfsd: cleaning up"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${DEVFSD_DIR}" > /dev/null # rm -rf "${DEVFSD_DIR}" > /dev/null
else else
print_info 1 "devfsd: Found bincache at ${DEVFSD_BINCACHE} and ${DEVFSD_CONF_BINCACHE}" print_info 1 "devfsd: Found cache at ${DEVFSD_BINCACHE} and ${DEVFSD_CONF_BINCACHE}..."
fi fi
} }
@ -409,7 +413,8 @@ compile_dietlibc() {
ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"` ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
if [ "${TEMP}" != "${ORIGTEMP}" ] if [ "${TEMP}" != "${ORIGTEMP}" ]
then then
print_info 1 "Dietlibc: Bincache exists, but current temp directory is different than original. Rebuilding." print_warning 1 "dietlibc: Bincache exists, but current temp directory"
print_warning 1 " is different than original. Rebuilding."
BUILD_DIETLIBC=1 BUILD_DIETLIBC=1
fi fi
fi fi
@ -422,22 +427,20 @@ compile_dietlibc() {
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} invalid"
cd "${DIETLIBC_DIR}" cd "${DIETLIBC_DIR}"
print_info 1 "Dietlibc: make" print_info 1 "dietlibc: >> Compiling..."
compile_generic "prefix=${TEMP}/diet" utils compile_generic "prefix=${TEMP}/diet" utils
print_info 1 "Dietlibc: installing" print_info 1 " >> Installing..."
compile_generic "prefix=${TEMP}/diet install" utils compile_generic "prefix=${TEMP}/diet install" utils
print_info 1 "Dietlibc: copying to bincache" print_info 1 " >> Copying to bincache..."
cd ${TEMP} cd ${TEMP}
tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin" tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up the dietlibc binary!"
[ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "bincache not created" [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "Dietlibc cache not created!"
echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}" echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
print_info 1 "Dietlibc: cleaning up"
cd "${TEMP}" cd "${TEMP}"
rm -rf "${DIETLIBC_DIR}" > /dev/null rm -rf "${DIETLIBC_DIR}" > /dev/null
rm -rf "${TEMP}/diet" > /dev/null rm -rf "${TEMP}/diet" > /dev/null
else else
print_info 1 "Dietlibc: Found bincache at ${DIETLIBC_BINCACHE}" print_info 1 "dietlibc: Found cache at ${DIETLIBC_BINCACHE}"
fi fi
} }

@ -20,20 +20,17 @@ determine_config_file() {
then then
KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config" KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config"
else else
gen_die "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() {
print_info 1 "kernel: configuring source"
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 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
@ -41,24 +38,48 @@ config_kernel() {
# or we might screw up something someone is trying to test. # or we might screw up something someone is trying to test.
if isTrue ${CLEAN} if isTrue ${CLEAN}
then then
print_info 1 "kernel: using config from ${KERNEL_CONFIG} -- prev backed up to .config.bak" print_info 1 "config: Using config from ${KERNEL_CONFIG}"
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 config file"
print_info 1 "kernel: running oldconfig" print_info 1 " >> Running oldconfig..."
yes "" | compile_generic "oldconfig" kernel yes "" | compile_generic "oldconfig" kernel
print_info 1 "kernel: running clean" print_info 1 "kernel: >> Cleaning..."
compile_generic "clean" kernel compile_generic "clean" kernel
else else
print_info 1 "kernel: skipping copy of config. CLEAN is OFF" 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 "kernel: running menuconfig" print_info 1 "config: >> Invoking menuconfig..."
make menuconfig compile_generic menuconfig runtask
[ "$?" != "0" ] && gen_die "menuconfig failed" [ "$?" != "0" ] && gen_die "Error: menuconfig failed."
elif isTrue ${CMD_GCONFIG}
then
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..."
CMD_GCONFIG=0
CMD_XCONFIG=1
else
print_info 1 "config: >> Invoking gconfig..."
compile_generic gconfig kernel
[ "$?" != "0" ] && gen_die "Error: gconfig failed."
CMD_XCONFIG=0
fi
fi
if isTrue ${CMD_XCONFIG}
then
print_info 1 "config: >> Invoking xconfig..."
compile_generic xconfig kernel
[ "$?" != "0" ] && gen_die "Error: xconfig failed."
fi fi
} }

@ -1,10 +1,6 @@
#!/bin/bash #!/bin/bash
get_KV() { get_KV() {
# don't want VER local anymore, used when finding kernelconfig to use
# local VER
# don't want PAT local anymore, used in initrd
# local PAT
local SUB local SUB
local EXV local EXV
@ -32,7 +28,7 @@ determine_real_args() {
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

@ -33,15 +33,15 @@ then
WARN=$'\e[33;01m' WARN=$'\e[33;01m'
BAD=$'\e[31;01m' BAD=$'\e[31;01m'
NORMAL=$'\e[0m' NORMAL=$'\e[0m'
HILITE=$'\e[36;01m' BOLD=$'\e[0;01m'
BRACKET=$'\e[34;01m' UNDER=$'\e[4m'
else else
GOOD="" GOOD=""
WARN="" WARN=""
BAD="" BAD=""
NORMAL="" NORMAL=""
HILITE="" BOLD=""
BRACKET="" UNDER=""
fi fi
@ -124,11 +124,16 @@ print_info() {
# 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=${STRR//${BAD}/}
STRR=${STRR//${BOLD}/}
STRR=${STRR//${NORMAL}/}
if [ "${PREFIXLINE}" = "1" ] if [ "${PREFIXLINE}" = "1" ]
then then
STR="* ${2}" STR="* ${STRR}"
else else
STR="${2}" STR="${STRR}"
fi fi
if [ "${NEWLINE}" = "0" ] if [ "${NEWLINE}" = "0" ]
@ -142,6 +147,16 @@ print_info() {
return 0 return 0
} }
print_error()
{
GOOD=${BAD} print_info "$@"
}
print_warning()
{
GOOD=${WARN} print_info "$@"
}
# var_replace(var_name, var_value, string) # var_replace(var_name, var_value, string)
# $1 = variable name # $1 = variable name
# $2 = variable value # $2 = variable value
@ -163,13 +178,31 @@ clear_log() {
gen_die() { gen_die() {
if [ "$#" -gt "0" ] if [ "$#" -gt "0" ]
then then
print_info 1 "gen_die(): ${1}" print_error 1 "ERROR: ${1}"
fi fi
print_info 1 "Please see ${DEBUGFILE} for more info on failures" echo
print_info 1 "" print_info 1 "-- Grepping log... --"
print_info 1 "DO NOT REPORT KERNEL COMPILE FAILURES AS GENKERNEL BUGS!" echo
print_info 1 ""
print_info 1 "Report real genkernel bugs to bugs.gentoo.org" 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}
else
grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${DEBUGFILE}
fi
echo
print_info 1 "-- End log... --"
echo
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 "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 ''
exit 1 exit 1
} }

@ -31,8 +31,6 @@ create_base_initrd_sys() {
mkdir -p ${TEMP}/initrd-temp/proc mkdir -p ${TEMP}/initrd-temp/proc
mkdir -p ${TEMP}/initrd-temp/temp mkdir -p ${TEMP}/initrd-temp/temp
mkdir -p ${TEMP}/initrd-temp/.initrd mkdir -p ${TEMP}/initrd-temp/.initrd
mkdir -p ${TEMP}/initrd-temp/new_root
mkdir -p ${TEMP}/initrd-temp/keymaps
ln -s bin ${TEMP}/initrd-temp/sbin ln -s bin ${TEMP}/initrd-temp/sbin
ln -s ../bin ${TEMP}/initrd-temp/usr/bin ln -s ../bin ${TEMP}/initrd-temp/usr/bin
ln -s ../bin ${TEMP}/initrd-temp/usr/sbin ln -s ../bin ${TEMP}/initrd-temp/usr/sbin
@ -44,7 +42,6 @@ create_base_initrd_sys() {
echo "REGISTER .* MKNEWCOMPAT" >> ${TEMP}/initrd-temp/etc/devfsd.conf echo "REGISTER .* MKNEWCOMPAT" >> ${TEMP}/initrd-temp/etc/devfsd.conf
echo "UNREGISTER .* RMNEWCOMPAT" >> ${TEMP}/initrd-temp/etc/devfsd.conf echo "UNREGISTER .* RMNEWCOMPAT" >> ${TEMP}/initrd-temp/etc/devfsd.conf
cd ${TEMP}/initrd-temp/dev cd ${TEMP}/initrd-temp/dev
MAKEDEV std MAKEDEV std
MAKEDEV console MAKEDEV console
@ -78,10 +75,10 @@ create_base_initrd_sys() {
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 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 \
xargs yes zcat chmod chown cut kill killall; do xargs yes zcat chmod chown cut kill killall; do
rm -f ${TEMP}/initrd-temp/bin/$i > /dev/null rm -f ${TEMP}/initrd-temp/bin/$i > /dev/null
ln ${TEMP}/initrd-temp/bin/busybox ${TEMP}/initrd-temp/bin/$i || gen_die "could not link ${i}" ln ${TEMP}/initrd-temp/bin/busybox ${TEMP}/initrd-temp/bin/$i || gen_die "Busybox error: could not link ${i}!"
done done
} }
@ -101,16 +98,17 @@ create_initrd_modules() {
else else
MOD_EXT=".o" MOD_EXT=".o"
fi fi
print_info 2 "initrd: >> Searching for modules..."
for i in `gen_dep_list` for i in `gen_dep_list`
do do
print_info 2 "$i : module searching" 1 0
mymod=`find /lib/modules/${KV} -name "${i}${MOD_EXT}"` mymod=`find /lib/modules/${KV} -name "${i}${MOD_EXT}"`
if [ -z "${mymod}" ] if [ -z "${mymod}" ]
then then
print_info 2 "Warning : ${i}${MOD_EXT} not found; skipping..." print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
continue; continue;
fi fi
print_info 2 "copying ${mymod} to initrd" print_info 2 "initrd: >> Copying ${i}${MOD_EXT}..."
cp -ax --parents "${mymod}" "${TEMP}/initrd-temp" cp -ax --parents "${mymod}" "${TEMP}/initrd-temp"
done done
@ -151,12 +149,19 @@ create_initrd_aux() {
else else
cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe"
fi fi
if isTrue $CMD_DOKEYMAPAUTO
then
echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initrd-temp/etc/initrd.defaults
fi
mkdir -p "${TEMP}/initrd-temp/lib/keymaps"
tar -C "${TEMP}/initrd-temp/lib/keymaps" -zxf "${GK_SHARE}/generic/keymaps.tar.gz"
cd ${TEMP}/initrd-temp/sbin && ln -s ../linuxrc init
cd ${OLDPWD}
chmod +x "${TEMP}/initrd-temp/linuxrc" chmod +x "${TEMP}/initrd-temp/linuxrc"
chmod +x "${TEMP}/initrd-temp/etc/initrd.scripts" chmod +x "${TEMP}/initrd-temp/etc/initrd.scripts"
chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults" chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults"
chmod +x "${TEMP}/initrd-temp/sbin/modprobe" chmod +x "${TEMP}/initrd-temp/sbin/modprobe"
} }
calc_initrd_size() { calc_initrd_size() {
@ -169,35 +174,31 @@ calc_initrd_size() {
create_initrd() { create_initrd() {
local MOD_EXT local MOD_EXT
print_info 1 "initrd: creating base system" print_info 1 "initrd: >> Initializing..."
create_base_initrd_sys create_base_initrd_sys
if [ "${NOINITRDMODULES}" = "" ] if [ "${NOINITRDMODULES}" = "" ]
then then
print_info 1 "initrd: copying modules" print_info 1 " >> Copying modules..."
create_initrd_modules create_initrd_modules
else else
print_info 1 "initrd: not copying modules" print_info 1 "initrd: Not copying modules..."
fi fi
print_info 1 "initrd: copying auxilary files" print_info 1 " >> Copying auxilary files..."
create_initrd_aux create_initrd_aux
print_info 1 "initrd: calculating initrd size"
INITRD_CALC_SIZE=`calc_initrd_size` INITRD_CALC_SIZE=`calc_initrd_size`
print_info 1 "initrd: calculated size ${INITRD_CALC_SIZE} + 100k slop for fs overhead"
INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 100` INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 100`
print_info 1 " :: Size is at ${INITRD_SIZE}K"
print_info 1 "initrd: real size ${INITRD_SIZE}" print_info 1 " >> Creating loopback filesystem..."
print_info 1 "initrd: creating loopback filesystem"
create_initrd_loop ${INITRD_SIZE} create_initrd_loop ${INITRD_SIZE}
print_info 1 "initrd: moving initrd fs to loopback" print_info 1 " >> Moving initrd files to the loopback..."
move_initrd_to_loop move_initrd_to_loop
print_info 1 "initrd: cleaning up and compressing initrd" print_info 1 " >> Cleaning up and compressing the initrd..."
create_initrd_unmount_loop create_initrd_unmount_loop
if [ "${COMPRESS_INITRD}" ] if [ "${COMPRESS_INITRD}" ]
@ -208,12 +209,28 @@ create_initrd() {
if [ "${BOOTSPLASH}" -eq "1" ] if [ "${BOOTSPLASH}" -eq "1" ]
then then
print_info 1 "initrd: copying bootsplash" if [ -x /sbin/splash ]
/sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-800x600.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 800x600 bootsplash" then
/sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1024x768.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1024x768 bootsplash" [ -z "${BOOTSPLASH_THEME}" ] && source /etc/conf.d/bootsplash.conf
/sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1280x1024.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1280x1024 bootsplash" [ -z "${BOOTSPLASH_THEME}" ] && BOOTSPLASH_THEME=default
/sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1600x1200.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1600x1200 bootsplash" print_info 1 " >> Installing bootsplash [ using the ${BOOTSPLASH_THEME} theme ]..."
for bootRes in '800x600' '1024x768' '1280x1024' '1600x1200'
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!"
else
print_info 1 "splash: Did not find a bootplash for the ${bootRes} resolution..."
fi
done
else
print_warning 1 " >> No bootsplash detected; skipping!"
fi
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}!"
fi fi
cp ${TEMP}/initrd-loop /boot/initrd-${KV} || gen_die "could not copy initrd to boot"
} }

@ -1,30 +1,30 @@
#!/bin/ash #!/bin/ash
PATH=/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/sbin:/usr/bin:/sbin:/bin
BACK_UP="\033[1K\033[0G" BACK_UP="\033[1K\033[0G"
HILITE="\033[1m"
NORMAL="\033[0m" NORMAL="\033[0m"
WARN="\033[1m" WARN="\033[33;1m"
BAD="\033[1m" BAD="\033[31;1m"
BOLD="\033[1m"
GOOD="\033[32;1m"
KV="`uname -r`" 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="cdcache idebug detect"
HWOPTS="scsi firewire ataraid pcmcia usb" HWOPTS="scsi firewire ataraid pcmcia usb keymap"
MY_HWOPTS="usb firewire" MY_HWOPTS="usb firewire"
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"
if [ "${KMINOR}" -gt "4" ] if [ "${KMINOR}" -gt "4" ]
then then
KSUFF=".ko" KSUFF=".ko"
INSMOD="insmod"
else else
KSUFF=".o" KSUFF=".o"
INSMOD="insmod"
fi fi
REAL_ROOT="" REAL_ROOT=""
CDROOT=0 CDROOT=0

@ -1,5 +1,6 @@
#!/bin/ash #!/bin/ash
. /etc/initrd.defaults
backup() { backup() {
echo -ne "\033[0G\033[0K" echo -ne "\033[0G\033[0K"
} }
@ -14,17 +15,17 @@ parse_opt() {
modules_scan() { modules_scan() {
local MODS local MODS
[ -d /etc/modules/${1} ] || touch /etc/modules/${1}
MODS=`cat /etc/modules/${1}` MODS=`cat /etc/modules/${1}`
for x in ${MODS} for x in ${MODS}
do do
echo -ne "${HILITE}---- Scanning for ${x}..." echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..."
# MODULE=`find /lib/modules -name "${x}.$KSUFF"` modprobe ${x} -n
modprobe ${x}
# > /dev/null 2>&1
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
backup backup
echo -e "${GOOD}---- Detected ${x} hardware${NORMAL}" echo -e "${GOOD} ::${NORMAL} Detected ${x} hardware..."
continue continue
fi fi
backup backup
@ -37,7 +38,7 @@ findcdmount() {
then then
for x in $* for x in $*
do do
echo -e "${HILITE}---- Attempting to mount CD -- ${x}${NORMAL}" echo -e "${GOOD}>>${NORMAL} Attempting to mount CD:- ${x}"
mount -t iso9660 -r ${x} /newroot/mnt/cdrom > /dev/null 2>&1 mount -t iso9660 -r ${x} /newroot/mnt/cdrom > /dev/null 2>&1
if [ "$?" = "0" ] if [ "$?" = "0" ]
then then
@ -47,7 +48,7 @@ findcdmount() {
done done
if [ "${REAL_ROOT}" != "" ] if [ "${REAL_ROOT}" != "" ]
then then
echo -e "${HILITE}---- CD medium found on $1${NORMAL}" echo -e "${GOOD}>>${NORMAL} CD medium found on $1"
fi fi
fi fi
} }

Binary file not shown.

@ -8,13 +8,19 @@
USE_DEVFS_NORMAL=1 USE_DEVFS_NORMAL=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'."
exit 1
fi
mount -o remount,rw / mount -o remount,rw /
mount /proc mount -t proc proc /proc
[ -n "$QUIET" ] && echo "0" > /proc/sys/kernel/printk [ -n "$QUIET" ] && echo "0" > /proc/sys/kernel/printk
echo "${GOOD} Gentoo initrd startup..."
echo "STEP 1: Command-line parsing"
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
for x in ${CMDLINE} for x in ${CMDLINE}
@ -61,17 +67,41 @@ done
if [ -d "/lib/modules" ] if [ -d "/lib/modules" ]
then then
echo "STEP 2: Module loading" echo -e "${GOOD}>>${NORMAL}${BOLD} Loading modules...${NORMAL}"
# Load appropriate kernel modules # Load appropriate kernel modules
for x in $MY_HWOPTS for modules in $MY_HWOPTS
do do
modules_scan $x modules_scan $modules
eval DO_`echo $modules | sed 's/-//'`=1
done done
else else
echo "STEP 2: Skipping module load. No modules in initrd" echo -e "${GREEN}>>${NORMAL}${BOLD} Skipping module load; no modules in the initrd!${NORMAL}"
fi
chooseKeymap() {
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading keymaps...${NORMAL}"
cat /lib/keymaps/keymapList
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" = "" ]
then
echo -e "${GOOD}>>${NORMAL}${BOLD} Loading default US keymap...${NORMAL}"
loadkmap < /lib/keymaps/us.map
else
echo -e "${BAD}!! ${NORMAL}${BOLD}Sorry, but keymap ''${keymap}'' is invalid!${NORMAL}"
chooseKeymap
fi
}
if [ "${DO_keymap}" ]
then
chooseKeymap
fi fi
echo "STEP 3: Mounting necessary filesystems per boot options" echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting filesystems...${NORMAL}"
mkdir /newroot mkdir /newroot
if [ "${CDROOT}" -eq "1" ] if [ "${CDROOT}" -eq "1" ]
@ -89,10 +119,8 @@ then
findcdmount /newroot/dev/ide/cd/* findcdmount /newroot/dev/ide/cd/*
fi fi
if [ "${REAL_ROOT}" = "" ] if [ "${REAL_ROOT}" = "" ]
then then
echo "Dropping to shell so you can fix your shit"
exec /bin/ash exec /bin/ash
# Undo stuff # Undo stuff
@ -115,7 +143,7 @@ then
devfsd /dev -np devfsd /dev -np
fi fi
echo "STEP 4: Determining root device" echo -e "${GOOD}>>${NORMAL}${BOLD} Determining root device...${NORMAL}"
while true while true
do do
@ -126,40 +154,39 @@ do
then then
/bin/ash /bin/ash
#set REAL_ROOT to "" so we get a prompt for the real root after the shell exits.
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 "Root block device 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 ": " 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}" ]
then then
got_good_root=1 got_good_root=1
else else
echo -e "${BAD}>>${NORMAL} Block device ${REAL_ROOT} is not a valid root device..."
REAL_ROOT="" REAL_ROOT=""
got_good_root=0 got_good_root=0
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 "STEP 4a: Mounting root" 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 "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
@ -167,27 +194,25 @@ do
done done
[ -n "$QUIET" ] && echo "6" > /proc/sys/kernel/printk [ -n "$QUIET" ] && echo "6" > /proc/sys/kernel/printk
echo "STEP 5: Finishing up"
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 "STEP 5a: filling tmpfs filesystem" echo -e "${GOOD}>>${NORMAL}${BOLD} Filling tmpfs...${NORMAL}"
cd /newroot cd /newroot
# Failsafe if some idiot didn't set loop type # Failsafe if some idiot didn't set loop type
if [ "${LOOPTYPE}" = "" ] if [ "${LOOPTYPE}" = "" ]
then then
echo "YOU FORGOT TO SPECIFY LOOPTYPE TRYING TO AUTODETECT" echo -e "${WARN}** ${NORMAL}${BOLD}Warning: loop type unspecified!${NORMAL}"
if [ "${LOOP}" = "/livecd.loop" ] if [ "${LOOP}" = "/livecd.loop" ]
then then
LOOPTYPE="normal" LOOPTYPE="normal"
@ -203,7 +228,6 @@ then
else else
LOOPTYPE="noloop" LOOPTYPE="noloop"
fi fi
echo "DETECTED LOOPTYPE: $LOOPTYPE"
fi fi
if [ "${LOOPTYPE}" = "normal" ] if [ "${LOOPTYPE}" = "normal" ]
@ -213,7 +237,7 @@ 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 "STEP 5a1: mounting loop filesystem" echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting loop filesystem...${NORMAL}"
mount -t ext2 -o loop,ro /newroot/mnt/cdrom/${LOOP} /newroot/mnt/livecd mount -t ext2 -o loop,ro /newroot/mnt/cdrom/${LOOP} /newroot/mnt/livecd
if [ "$?" != "0" ] if [ "$?" != "0" ]
then then
@ -226,7 +250,7 @@ then
then then
check_loop check_loop
mount -o bind /newroot/dev /dev mount -o bind /newroot/dev /dev
echo "STEP 5a1: mounting squashfs filesystem" echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting squashfs filesystem...${NORMAL}"
mount -t squashfs -o loop,ro /newroot/mnt/cdrom/${LOOP} /newroot/mnt/livecd mount -t squashfs -o loop,ro /newroot/mnt/cdrom/${LOOP} /newroot/mnt/livecd
if [ "$?" != "0" ] if [ "$?" != "0" ]
then then
@ -238,8 +262,8 @@ then
elif [ "${LOOPTYPE}" = "gcloop" ] elif [ "${LOOPTYPE}" = "gcloop" ]
then then
check_loop check_loop
echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting gcloop filesystem...${NORMAL}"
mount -o bind /newroot/dev /dev mount -o bind /newroot/dev /dev
echo "STEP 5a1: mounting gcloop (ext2) filesystem"
echo " " | losetup -E 19 -e ucl-0 -p0 /newroot/dev/loop0 /newroot/mnt/cdrom/${LOOP} echo " " | losetup -E 19 -e ucl-0 -p0 /newroot/dev/loop0 /newroot/mnt/cdrom/${LOOP}
if [ "$?" != "0" ] if [ "$?" != "0" ]
then then
@ -258,7 +282,7 @@ then
FS_LOCATION="mnt/cdrom" FS_LOCATION="mnt/cdrom"
fi fi
echo "STEP 5a2: filling filesystem" echo "${GOOD}>>${NORMAL}${BOLD} Filling filesystem...${NORMAL}"
for x in ${ROOT_LINKS} for x in ${ROOT_LINKS}
do do
ln -s "${FS_LOCATION}/${x}" "${x}" ln -s "${FS_LOCATION}/${x}" "${x}"
@ -267,63 +291,47 @@ then
chmod 1777 tmp chmod 1777 tmp
(cd /newroot/${FS_LOCATION}; cp -a ${ROOT_TREES} /newroot) (cd /newroot/${FS_LOCATION}; cp -a ${ROOT_TREES} /newroot)
else else
echo "STEP 5b: setting up stuff for pivot_root"
mkdir -p /newroot/tmp/.initrd mkdir -p /newroot/tmp/.initrd
fi fi
echo "STEP 5c: redirect console" [ ! -e /newroot/dev/console ] && mknod /newroot/dev/console c 5 1
console=/newroot/dev/console echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting"
[ ! -e "$console" ] && mknod $console c 5 1
exec < $console > $console 2>&1 || echo "CONSOLE REDIRECTION FAILED, /dev ON ROOT DOES NOT CONTAIN console !!!"
echo "STEP 6: pivot_root and exec/chroot real init"
cd /newroot cd /newroot
pivot_root . tmp/.initrd 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 then
# must mount a new devfs before we can umount /tmp/.initrd/proc || echo '*: Failed to unmount the initrd /proc!'
# umount the old one for some reason mount -n --move /tmp/.initrd/dev dev || echo '*: Failed to move over the /dev tree!'
mount -t proc proc /proc rm /tmp/.initrd/dev -rf || '*: Failed to remove the initrd /dev!'
mount -t devfs devfs /dev
umount /tmp/.initrd/proc || echo "COULD NOT UMOUNT tmp/.initrd/proc !!!"
umount /tmp/.initrd/dev || echo "COULD NOT UMOUNT tmp/.initrd/dev !!!"
# at this point it lets us umount the new
# devfs, don't know why, just does, stop
# asking questions!
umount /dev
umount /proc
cp -f /etc/mtab /etc/mtab.initrd-here > /dev/null 2>&1
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
echo "STEP 6a: clean up mounts"
mount -t proc proc /proc mount -t proc proc /proc
umount /tmp/.initrd/proc > /dev/null 2>&1 || echo "COULD NOT UMOUNT /tmp/.initrd/proc !!!" umount /tmp/.initrd/proc > /dev/null 2>&1 || echo "*: Failed to unmount /tmp/.initrd/proc!"
umount /dev > /dev/null 2>&1 umount /dev > /dev/null 2>&1
umount /proc > /dev/null 2>&1 umount /proc > /dev/null 2>&1
fi fi
echo -n '.'
# /usr/src/linux/Documentation/initrd.txt # /usr/src/linux/Documentation/initrd.txt
# here's the line it says we should do: # here's the line it says we should do:
# exec chroot . /sbin/init </dev/console >/dev/console 2>&1 # exec chroot . /sbin/init </dev/console >/dev/console 2>&1
exec <dev/console >dev/console 2>&1
echo '.'
exec chroot . /bin/sh <<- EOF exec chroot . /bin/sh <<- EOF
umount /tmp/.initrd || echo "UMOUNT of /tmp/.initrd FAILED!!!" && /sbin/blockdev --flushbufs /dev/ram0 umount /tmp/.initrd || echo "*: Failed to unmount the initrd!"
echo "INIT: starting /sbin/init ${CMDLINE}" /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
exec /sbin/init ${CMDLINE} exec /sbin/init
EOF EOF
# exec chroot . /sbin/init ${CMDLINE} < /dev/console > /dev/console 2>&1 echo "A fatal error has probably occured since /sbin/init did not"
echo "IF YOU ARE SEEING THIS MESSAGE, A FATAL ERROR HAS OCCURRED" echo "boot correctly. Trying to open a shell..."
echo "MOST LIKELY /sbin/init DOES NOT EXIST, ATTEMPTING TO DROP" echo
echo "YOU TO A SHELL"
exec /bin/bash exec /bin/bash
exec /bin/sh exec /bin/sh
exec /bin/ash exec /bin/ash

@ -1,36 +1,23 @@
#!/bin/ash #!/bin/ash
#KV=`uname -r`
#KMAJOR=`echo ${KV} | cut -d. -f1`
#KMINOR=`echo ${KV} | cut -d. -f2`
#INSMOD="insmod.static"
#if [ "${KMINOR}" -gt "4" ]
#then
# KEXT=".ko"
#else
# KEXT=".o"
#fi
. /etc/initrd.defaults . /etc/initrd.defaults
usage() usage()
{ {
echo "modprobe gentoo script v1.0"
echo "Usage:" echo "Usage:"
echo " modprobe moduleprefix" echo " modprobe moduleprefix"
echo "" echo
echo "Ex:" echo "Ex:"
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 [ "$#" != "1" ] if [ "$#" -lt "1" ]
then then
echo "modules_dep_list(): improper usage" echo "modules_dep_list(): improper usage"
exit 1 exit 1
@ -91,7 +78,10 @@ modprobe2()
local modlist local modlist
local ret local ret
if [ "$#" != "1" ] local echoAppend
local echoFlags
if [ "$#" -lt "1" ]
then then
echo "modprobe(): improper usage" echo "modprobe(): improper usage"
exit 1 exit 1
@ -99,8 +89,8 @@ modprobe2()
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 "no such module found" echo "module not found..."
exit 1 exit 2
fi fi
modlist=`modules_dep_list ${1}` modlist=`modules_dep_list ${1}`
if [ "${modlist}" != "" -a "${modlist}" != " " ] if [ "${modlist}" != "" -a "${modlist}" != " " ]
@ -109,7 +99,6 @@ modprobe2()
else else
deps="" deps=""
fi fi
# echo "$1 -- DEPS='${deps}'"
# Make sure we don't do any endless loops! # Make sure we don't do any endless loops!
LOADED_MODULES="${LOADED_MODULES} ${1}" LOADED_MODULES="${LOADED_MODULES} ${1}"
@ -119,30 +108,30 @@ modprobe2()
then then
if [ "${x}" != "" -a "${x}" != " " ] if [ "${x}" != "" -a "${x}" != " " ]
then then
# echo "loading dep: ${x}" modprobe2 "${x}" -n
modprobe2 "${x}"
fi fi
else else
filler=1 filler=1
# echo "skipping ${x}, module already loaded by us"
fi fi
done done
# echo "running insmod on '${real_path}'"
${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
echo "module ${real_path} loaded" echoAppend=" loaded..."
[ "${2}" = "-n" ] && echoFlags="-n" && echoAppend=", "
echo ${echoFlags} "${1}${echoAppend}"
fi fi
return $ret return $ret
} }
if [ "$#" != "1" ] if [ "$#" -lt "1" ]
then then
usage usage
fi fi
[ -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}"

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Genkernel v3 # Genkernel v3
GK_V="3.0.1" GK_V="3.0.2_rc1"
TEMP="/var/tmp/genkernel" TEMP="/var/tmp/genkernel"
small_die() { small_die() {
@ -25,8 +25,12 @@ BUILD_ALL=0
BUILD_KERNEL=0 BUILD_KERNEL=0
BUILD_INITRD=0 BUILD_INITRD=0
# Parse all command line options, and load into memory # Parse all command line options...
parse_cmdline $* while [ $# -gt 0 ]
do
Option=$1; shift
parse_cmdline $Option
done
if [ "${BUILD_ALL}" -eq 0 -a "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ] if [ "${BUILD_ALL}" -eq 0 -a "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ]
then then
@ -34,7 +38,7 @@ then
exit 1 exit 1
fi fi
print_info 1 "GenKernel v${GK_V}" 1 0 NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}"
# Set ${ARCH} # Set ${ARCH}
get_official_arch get_official_arch
@ -49,14 +53,52 @@ source ${GK_SHARE}/${ARCH}/modules_load || gen_die "could not read ${GK_SHARE}/$
# get the real args for use. # get the real args for use.
determine_real_args determine_real_args
print_info 1 "ARCH: ${ARCH}" NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${WARN}${KV}${BOLD} for ${WARN}${ARCH}${BOLD}..."
print_info 1 "KERNEL VER: ${KV}" echo
if ! has_loop if ! has_loop
then then
print_info 1 "Your kernel does not appear to have loop device support. " print_error print_info 1 "Your kernel does not appear to have loop device support. "
print_info 1 "Please 'modprobe loop' if it is a module before running genkernel" print_error print_info 1 "Please 'modprobe loop' if it is a module before running genkernel"
gen_die "----Load loop support----" gen_die "Load loop support!"
fi
# Check /boot is mounted
if ! grep -q "/boot" /proc/mounts
then
if isTrue ${MOUNTBOOT}
then
if ! mount /boot
then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!"
echo
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
# Check whether another Genkernel is running
GENPIDS="`ps -C genkernel --no-headers -o pid | wc -l`"
if [ "${GENPIDS}" -gt "3" ]
then
[ "${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
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!"
print_info 1 "thread: Temporary files reallocated to ${TEMP}..."
echo
fi fi
# Configure kernel # Configure kernel
@ -75,6 +117,37 @@ print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-
[ ! -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}"
# Run callback
if [ "${CMD_CALLBACK}" != "" ]
then
print_info 1 "" 1 0
print_info 1 "Preparing to run callback: \"${CMD_CALLBACK}\"" 0
CALLBACK_ESCAPE=0
CALLBACK_COUNT=0
trap "CALLBACK_ESCAPE=1" TERM KILL INT QUIT ABRT
while [[ ${CALLBACK_ESCAPE} -eq 0 && ${CALLBACK_COUNT} -lt 5 ]]
do
sleep 1; echo -n '.';
let CALLBACK_COUNT=${CALLBACK_COUNT}+1
done
if [ "${CALLBACK_ESCAPE}" -eq 0 ]
then
echo
echo
eval ${CMD_CALLBACK} | tee -a ${DEBUGFILE}
echo
print_info 1 "<<< Callback exit status: $?"
else
echo
print_info 1 ">>> Callback cancelled..."
fi
trap - TERM KILL INT QUIT ABRT
print_info 1 "" 1 0
fi
# Compile dietlibc # Compile dietlibc
if [ "${USE_DIETLIBC}" = "1" ] if [ "${USE_DIETLIBC}" = "1" ]
then then
@ -106,20 +179,19 @@ then
gen_minkernpackage gen_minkernpackage
fi fi
print_info 1 " " print_info 1 ''
print_info 1 " "
print_info 1 "Kernel compiled successfully!" print_info 1 "Kernel compiled successfully!"
print_info 1 "Required Kernel Params:" print_info 1 ''
print_info 1 " : root=/dev/ram0 init=/linuxrc real_root=/dev/\$ROOT" print_info 1 "Required Kernel Parameters:"
print_info 1 " where \$ROOT is the devicenode for your root partition as" print_info 1 ' root=/dev/ram0 real_root=/dev/$ROOT init=/linuxrc'
print_info 1 " you should have specified in /etc/fstab" print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
print_info 1 "" print_info 1 ''
print_info 1 "You MUST tell your bootloader to use the generated initrd" print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 "" print_info 1 ' one specified in /etc/fstab'
print_info 1 "Recommended Kernel Params:" print_info 1 ''
print_info 1 " : vga=0x317 splash=verbose" 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 "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 ""
print_info 1 "For more info see /usr/share/genkernel/README" print_info 1 "For more information please see /usr/share/genkernel/README..."

@ -1,4 +1,4 @@
# GenKernel Configuration File v3.0 # Genkernel Configuration File
# ===========GENKERNEL BASIC CONFIGURATION============= # ===========GENKERNEL BASIC CONFIGURATION=============
@ -17,25 +17,21 @@ MRPROPER="yes"
# Copy bootsplash into the initrd image? # Copy bootsplash into the initrd image?
BOOTSPLASH="yes" BOOTSPLASH="yes"
# Should we _not_ install the kernel into the default
# locations?
NOINSTALL="yes"
# Override the arch detection? # Override the arch detection?
# available params "x86", "amd64", "ppc", "sparc"
# ARCH_OVERRIDE="x86" # ARCH_OVERRIDE="x86"
# Mount /boot automatically if it isn't mounted?
MOUNTBOOT="yes"
# Use Color output in Genkernel? # Use Color output in Genkernel?
USECOLOR="yes" USECOLOR="yes"
# =========GENKERNEL LOCATION CONFIGURATION============ # =========GENKERNEL LOCATION CONFIGURATION============
# Variables: # Variables:
# %%ARCH%% - Final determined architecture # %%ARCH%% - Final determined architecture
# Default share directory location # Default share directory location
GK_SHARE="/usr/share/genkernel" GK_SHARE="/usr/share/genkernel"
#GK_SHARE="/home/brad/Desktop/genkernel"
# Location of helper-scripts # Location of helper-scripts
#GK_BIN="${GK_SHARE}/bin" #GK_BIN="${GK_SHARE}/bin"
@ -83,4 +79,3 @@ DEVFSD_SRCTAR="${GK_SHARE}/pkg/devfsd-${DEVFSD_VER}.tar.bz2"
DEVFSD_DIR="devfsd" DEVFSD_DIR="devfsd"
DEVFSD_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-${DEVFSD_VER}-%%ARCH%%.bz2" DEVFSD_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-${DEVFSD_VER}-%%ARCH%%.bz2"
DEVFSD_CONF_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-conf-${DIETLIBC_VER}-%%ARCH%%.bz2" DEVFSD_CONF_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-conf-${DIETLIBC_VER}-%%ARCH%%.bz2"

@ -12,10 +12,6 @@ dmx3191d dpt_i2o imm in2000 ips qla1280 \
sim710 sym53c416" sim710 sym53c416"
FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2" FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2"
ATARAID_MODULES="ataraid pdcraid hptraid" ATARAID_MODULES="ataraid pdcraid hptraid"
PCMCIA_MODULES="ide-cs" PCMCIA_MODULES="ide-cs"
USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage" USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage"

Loading…
Cancel
Save