From a8b01f062d0808f300308e9232b60097363d9f4d Mon Sep 17 00:00:00 2001 From: Tim Yamin Date: Sun, 21 Mar 2004 16:20:26 +0000 Subject: [PATCH] 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 --- README | 86 ++++----- TODO | 8 +- gen_cmdline.sh | 391 ++++++++++++++++++++++------------------ gen_compile.sh | 121 +++++++------ gen_configkernel.sh | 47 +++-- gen_determineargs.sh | 6 +- gen_funcs.sh | 63 +++++-- gen_initrd.sh | 73 +++++--- generic/initrd.defaults | 16 +- generic/initrd.scripts | 15 +- generic/keymaps.tar.gz | Bin 0 -> 17487 bytes generic/linuxrc | 132 +++++++------- generic/modprobe | 43 ++--- genkernel | 118 +++++++++--- genkernel.conf | 13 +- x86/modules_load | 4 - 16 files changed, 639 insertions(+), 497 deletions(-) create mode 100644 generic/keymaps.tar.gz diff --git a/README b/README index 1032972..4ae8d6d 100644 --- a/README +++ b/README @@ -1,63 +1,45 @@ -VERY EXPERIMENTAL -seems to work so far on amd64 and x86 - DEPENDANCIES: -- bootsplash -- gcc/binutils -- 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 - + - GCC and binutils + - GNU Bash +USAGE: + See http://www.gentoo.org/doc/en/genkernel.xml or + issue ``genkernel --help''. PORTING: + To port to other arches: -To port to other arches: - -cd /usr/share/genkernel -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 + # cd /usr/share/genkernel + # cp -Rp x86 ${myarch} + # mkdir /usr/share/genkernel/pkg/${myarch} + Modify what is needed in the /usr/share/genkernel/${myarch} + directory, as well making a generic kernel-config. IMPORTANT KERNEL NOTES: -- You MUST have devfs turned on at this time, but you MUST NOT - have "Automatically mount at boot" option turned on. -- 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 - "video mode selection support" and "Framebuffer Console support" -- To build a kernel with GenKernel you must have - "Block devices->Loopback device support" - "Block devices->RAM disk support" -- To boot genkernel properly, the kernel config must have - RAM disk support and Initial RAM disk support. You should - also set your "Default RAM disk size to 8192" - + - 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 + "video mode selection support" and "Framebuffer Console support" + - To build a kernel with Genkernel you must have + "Block devices->Loopback device support" + "Block devices->RAM disk support" + - To boot genkernel properly, the kernel config must have + RAM disk support and Initial RAM disk support. You should + also set your "Default RAM disk size to 8192" BOOTING A KERNEL WITH INITRD: -GRUB: -real_root= needs to point to your root partition -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 -vga= should be the resolution you want your screen at 0x317 indicates - 1024x768 - 16bpp and you'll get a pretty bootsplash if configured properly - - -GRUB EXAMPLE ENTRY: -title=Linux 2.6.0 genkernel -root (hd0,0) -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 - + GRUB: + real_root= needs to point to your root partition + 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 + vga= should be the resolution you want your screen. 0x317 is + 1024x768 - 16bpp and you'll get a pretty bootsplash if + configured properly + + GRUB EXAMPLE ENTRY: + title=2.6.0 [ Genkernel ] + root (hd0,0) + 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 diff --git a/TODO b/TODO index cbd810a..72291a6 100644 --- a/TODO +++ b/TODO @@ -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. -- bump busybox version to _pre5 which has initial 2.6 insmod - and devfsd support. Provide configurable options to allow - building real devfsd or using busybox devfsd, and likewise - for insmod. -- need configs for other arches +- Need configs for other currently-unsupported arches. diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 1a42700..3dadab6 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -1,21 +1,27 @@ #!/bin/bash usage() { - echo "GenKernel ${GK_V} [options] command" - echo "Available Commands: " - echo " all Build all steps" - echo " kernel Build only kernel and modules (not done yet)" - echo " initrd Build only initrd (not done yet)" - echo "" + echo "Gentoo Linux Genkernel ${GK_V}" + echo "Usage: " + echo " genkernel [options] action" + echo + echo "Available Actions: " + echo " all Build all steps" + echo " kernel Build only kernel and modules (not done yet)" + echo " initrd Build only initrd (not done yet)" + echo echo "Available Options: " echo " Debug settings" echo " --debuglevel=<0-5> Debug Verbosity Level" echo " --debugfile= Output file for debug info" echo " --color 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 " --menuconfig Run menu config after oldconfig" - echo " --no-menuconfig Do no run menu config after oldconfig" echo " --mrproper Run make mrproper before compilation" echo " --clean 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 " --install Install kernel after building" echo " --no-install Do not install kernel after building" - echo " --kerneldir= 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= Location of the kernel sources" echo " --kernel-config= 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 to use for kernel (e.g. distcc)" - echo " --kernel-ld= Linker to use for kernel" echo " --kernel-as= Assembler to use for kernel" + echo " --kernel-ld= Linker to use for kernel" echo " --kernel-make= GNU Make to use for kernel" - echo " --utils-cc= Compiler to use for utils (e.g. busybox, modutils)" - echo " --utils-ld= Linker to use for utils" + echo " --utils-cc= Compiler to use for utilities" echo " --utils-as= Assembler to use for utils" + echo " --utils-ld= Linker to use for utils" echo " --utils-make= GNU Make to use for utils" - echo " --makeopts= Make Opts such as -j2, etc" + echo " --makeopts= Make options such as -j2, etc." + echo " Initialization" + echo " --do-keymap-auto Forces keymap selection at boot." echo " Internals" - echo " --arch-override= Force to arch instead of autodetect (cross-compile?)" + echo " --arch-override= Force to arch instead of autodetect" echo " --busybox-config= Busybox configuration file to use" - echo " --busybox-bin= Don't compile busybox, use this _static_ bzip2'd binary" - echo " Misc Settings" - echo " --max-kernel-size= Maximum kernel size" - echo " --max-initrd-size= Maximum initrd size" - echo " --max-kernel-and-initrd-size= Maximum combined initrd + kernel size" + echo " --busybox-bin= Don't compile busybox, use this _static_" + echo " bzip2'd binary" +# echo " Misc Settings" +# echo " --max-kernel-size= Maximum kernel size" +# echo " --max-initrd-size= Maximum initrd size" +# echo " --max-kernel-and-initrd-size= Maximum combined initrd + kernel size" echo " Output Settings" - echo " --minkernpackage= File to output a .tar.bz2'd kernel and initrd to." - echo " These will be renamed to simply 'kernel' and 'initrd'" - echo " inside the package without any path information." - echo " No modules outside of the initrd will be included" - echo "" + echo " --minkernpackage= File to output a .tar.bz2'd kernel and initrd to" + echo " These will be renamed to simply 'kernel' and" + echo " 'initrd' inside the package without any path" + echo " information. No modules outside of the initrd" + echo " will be included." } parse_opt() { @@ -62,158 +75,178 @@ parse_opt() { } parse_cmdline() { - for x in $* - do - case "${x}" in - --kernel-cc*) - CMD_KERNEL_CC=`parse_opt "${x}"` - print_info 2 "CMD_KERNEL_CC: $CMD_KERNEL_CC" - ;; - --kernel-ld*) - CMD_KERNEL_LD=`parse_opt "${x}"` - print_info 2 "CMD_KERNEL_LD: $CMD_KERNEL_LD" - ;; - --kernel-as*) - CMD_KERNEL_AS=`parse_opt "${x}"` - print_info 2 "CMD_KERNEL_AS: $CMD_KERNEL_AS" - ;; - --kernel-make*) - CMD_KERNEL_MAKE=`parse_opt "${x}"` - print_info 2 "CMD_KERNEL_MAKE: $CMD_KERNEL_MAKE" - ;; - --utils-cc*) - CMD_UTILS_CC=`parse_opt "${x}"` - print_info 2 "CMD_UTILS_CC: $CMD_UTILS_CC" - ;; - --utils-ld*) - CMD_UTILS_LD=`parse_opt "${x}"` - print_info 2 "CMD_UTILS_LD: $CMD_UTILS_LD" - ;; - --utils-as*) - CMD_UTILS_AS=`parse_opt "${x}"` - print_info 2 "CMD_UTILS_AS: $CMD_UTILS_AS" - ;; - --utils-make*) - CMD_UTILS_MAKE=`parse_opt "${x}"` - print_info 2 "CMD_UTILS_MAKE: $CMD_UTILS_MAKE" - ;; - --makeopts*) - CMD_MAKEOPTS=`parse_opt "${x}"` - print_info 2 "CMD_MAKEOPTS: $CMD_MAKEOPTS" - ;; - --debuglevel*) - CMD_DEBUGLEVEL=`parse_opt "${x}"` - DEBUGLEVEL="${CMD_DEBUGLEVEL}" - print_info 2 "CMD_DEBUGLEVEL: $CMD_DEBUGLEVEL" - ;; - --menuconfig) - CMD_MENUCONFIG=1 - print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG" - ;; - --no-menuconfig) - CMD_MENUCONFIG=0 - print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG" - ;; - --mrproper) - CMD_MRPROPER=1 - print_info 2 "CMD_MRPROPER: $CMD_MRPROPER" - ;; - --no-mrproper) - CMD_MRPROPER=0 - print_info 2 "CMD_MRPROPER: $CMD_MRPROPER" - ;; - --clean) - CMD_CLEAN=1 - print_info 2 "CMD_CLEAN: $CMD_CLEAN" - ;; - --no-clean) - CMD_CLEAN=0 - print_info 2 "CMD_CLEAN: $CMD_CLEAN" - ;; - --bootsplash) - CMD_BOOTSPLASH=1 - print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH" - ;; - --no-bootsplash) - CMD_BOOTSPLASH=0 - print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH" - ;; - --install) - CMD_NOINSTALL=0 - print_info 2 "CMD_NOINSTALL: $CMD_NOINSTALL" - ;; - --no-install) - CMD_NOINSTALL=1 - print_info 2 "CMD_NOINSTALL: $CMD_NOINSTALL" - ;; - --no-initrdmodules) - CMD_NOINITRDMODULES=1 - print_info 2 "CMD_NOINITRDMODULES: $CMD_NOINITRDMODULES" - ;; - --arch-override*) - CMD_ARCHOVERRIDE=`parse_opt "${x}"` - print_info 2 "CMD_ARCHOVERRIDE: $CMD_ARCHOVERRIDE" - ;; - --color) - CMD_USECOLOR=1 - print_info 2 "CMD_USECOLOR: $CMD_USECOLOR" - ;; - --no-color) - CMD_USECOLOR=0 - print_info 2 "CMD_USECOLOR: $CMD_USECOLOR" - ;; - --debugfile*) - CMD_DEBUGFILE=`parse_opt "${x}"` - print_info 2 "CMD_DEBUGFILE: $CMD_DEBUGFILE" - ;; - --kerneldir*) - CMD_KERNELDIR=`parse_opt "${x}"` - print_info 2 "CMD_KERNELDIR: $CMD_KERNELDIR" - ;; - --kernel-config*) - CMD_KERNEL_CONFIG=`parse_opt "${x}"` - print_info 2 "CMD_KERNEL_CONFIG: $CMD_KERNEL_CONFIG" - ;; - --busybox-config*) - CMD_BUSYBOX_CONFIG=`parse_opt "${x}"` - print_info 2 "CMD_BUSYBOX_CONFIG: $CMD_BUSYBOX_CONFIG" - ;; - --busybox-bin*) - CMD_BUSYBOX_BIN=`parse_opt "${x}"` - print_info 2 "CMD_BUSYBOX_BIN: $CMD_BUSYBOX_BIN" - ;; - --max-kernel-size*) - CMD_MAX_KERNEL_SIZE=`parse_opt "${x}"` - print_info 2 "MAX_KERNEL_SIZE: $CMD_MAX_KERNEL_SIZE" - ;; - --max-initrd-size*) - CMD_MAX_INITRD_SIZE=`parse_opt "${x}"` - print_info 2 "MAX_INITRD_SIZE: $CMD_MAX_INITRD_SIZE" - ;; - --max-kernel-and-initrd-size*) - CMD_MAX_KERNEL_AND_INITRD_SIZE=`parse_opt "${x}"` - print_info 2 "MAX_KERNEL_AND_INITRD_SIZE: $CMD_MAX_KERNEL_AND_INITRD_SIZE" - ;; - --minkernpackage*) - CMD_MINKERNPACKAGE=`parse_opt "${x}"` - print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE" - ;; - all) - BUILD_ALL=1 - ;; - initrd) - BUILD_INITRD=1 - ;; - kernel) - BUILD_KERNEL=1 - ;; - --help) - usage - exit 1 - ;; - - esac - done -} + case "$*" in + --kernel-cc*) + CMD_KERNEL_CC=`parse_opt "$*"` + print_info 2 "CMD_KERNEL_CC: $CMD_KERNEL_CC" + ;; + --kernel-ld*) + CMD_KERNEL_LD=`parse_opt "$*"` + print_info 2 "CMD_KERNEL_LD: $CMD_KERNEL_LD" + ;; + --kernel-as*) + CMD_KERNEL_AS=`parse_opt "$*"` + print_info 2 "CMD_KERNEL_AS: $CMD_KERNEL_AS" + ;; + --kernel-make*) + CMD_KERNEL_MAKE=`parse_opt "$*"` + print_info 2 "CMD_KERNEL_MAKE: $CMD_KERNEL_MAKE" + ;; + --utils-cc*) + CMD_UTILS_CC=`parse_opt "$*"` + print_info 2 "CMD_UTILS_CC: $CMD_UTILS_CC" + ;; + --utils-ld*) + CMD_UTILS_LD=`parse_opt "$*"` + print_info 2 "CMD_UTILS_LD: $CMD_UTILS_LD" + ;; + --utils-as*) + CMD_UTILS_AS=`parse_opt "$*"` + print_info 2 "CMD_UTILS_AS: $CMD_UTILS_AS" + ;; + --utils-make*) + CMD_UTILS_MAKE=`parse_opt "$*"` + print_info 2 "CMD_UTILS_MAKE: $CMD_UTILS_MAKE" + ;; + --makeopts*) + CMD_MAKEOPTS=`parse_opt "$*"` + print_info 2 "CMD_MAKEOPTS: $CMD_MAKEOPTS" + ;; + --do-keymap-auto) + CMD_DOKEYMAPAUTO=1 + print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO" + ;; + --debuglevel*) + CMD_DEBUGLEVEL=`parse_opt "$*"` + DEBUGLEVEL="${CMD_DEBUGLEVEL}" + print_info 2 "CMD_DEBUGLEVEL: $CMD_DEBUGLEVEL" + ;; + --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 + print_info 2 "CMD_MENUCONFIG: $CMD_MENUCONFIG" + ;; + --no-menuconfig) + CMD_MENUCONFIG=0 + 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) + CMD_MRPROPER=1 + print_info 2 "CMD_MRPROPER: $CMD_MRPROPER" + ;; + --no-mrproper) + CMD_MRPROPER=0 + print_info 2 "CMD_MRPROPER: $CMD_MRPROPER" + ;; + --clean) + CMD_CLEAN=1 + print_info 2 "CMD_CLEAN: $CMD_CLEAN" + ;; + --no-clean) + CMD_CLEAN=0 + print_info 2 "CMD_CLEAN: $CMD_CLEAN" + ;; + --bootsplash) + CMD_BOOTSPLASH=1 + print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH" + ;; + --no-bootsplash) + CMD_BOOTSPLASH=0 + print_info 2 "CMD_BOOTSPLASH: $CMD_BOOTSPLASH" + ;; + --install) + CMD_NOINSTALL=0 + print_info 2 "CMD_NOINSTALL: $CMD_NOINSTALL" + ;; + --no-install) + CMD_NOINSTALL=1 + print_info 2 "CMD_NOINSTALL: $CMD_NOINSTALL" + ;; + --no-initrdmodules) + CMD_NOINITRDMODULES=1 + print_info 2 "CMD_NOINITRDMODULES: $CMD_NOINITRDMODULES" + ;; + --callback*) + CMD_CALLBACK=`parse_opt "$*"` + print_info 2 "CMD_CALLBACK: $CMD_CALLBACK/$*" + ;; + --arch-override*) + CMD_ARCHOVERRIDE=`parse_opt "$*"` + print_info 2 "CMD_ARCHOVERRIDE: $CMD_ARCHOVERRIDE" + ;; + --color) + CMD_USECOLOR=1 + print_info 2 "CMD_USECOLOR: $CMD_USECOLOR" + ;; + --no-color) + CMD_USECOLOR=0 + print_info 2 "CMD_USECOLOR: $CMD_USECOLOR" + ;; + --debugfile*) + CMD_DEBUGFILE=`parse_opt "$*"` + print_info 2 "CMD_DEBUGFILE: $CMD_DEBUGFILE" + ;; + --kerneldir*) + CMD_KERNELDIR=`parse_opt "$*"` + print_info 2 "CMD_KERNELDIR: $CMD_KERNELDIR" + ;; + --kernel-config*) + CMD_KERNEL_CONFIG=`parse_opt "$*"` + print_info 2 "CMD_KERNEL_CONFIG: $CMD_KERNEL_CONFIG" + ;; + --busybox-config*) + CMD_BUSYBOX_CONFIG=`parse_opt "$*"` + print_info 2 "CMD_BUSYBOX_CONFIG: $CMD_BUSYBOX_CONFIG" + ;; + --busybox-bin*) + CMD_BUSYBOX_BIN=`parse_opt "$*"` + print_info 2 "CMD_BUSYBOX_BIN: $CMD_BUSYBOX_BIN" + ;; + --max-kernel-size*) + CMD_MAX_KERNEL_SIZE=`parse_opt "$*"` + print_info 2 "MAX_KERNEL_SIZE: $CMD_MAX_KERNEL_SIZE" + ;; + --max-initrd-size*) + CMD_MAX_INITRD_SIZE=`parse_opt "$*"` + print_info 2 "MAX_INITRD_SIZE: $CMD_MAX_INITRD_SIZE" + ;; + --max-kernel-and-initrd-size*) + CMD_MAX_KERNEL_AND_INITRD_SIZE=`parse_opt "$*"` + print_info 2 "MAX_KERNEL_AND_INITRD_SIZE: $CMD_MAX_KERNEL_AND_INITRD_SIZE" + ;; + --minkernpackage*) + CMD_MINKERNPACKAGE=`parse_opt "$*"` + print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE" + ;; + all) + BUILD_ALL=1 + ;; + initrd) + BUILD_INITRD=1 + ;; + kernel) + BUILD_KERNEL=1 + ;; + --help) + usage + exit 1 + ;; + esac +} diff --git a/gen_compile.sh b/gen_compile.sh index 8fdd3cf..a5fa693 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -115,29 +115,36 @@ compile_generic() { gen_die "compile_generic(): improper usage" fi - if [ "${2}" = "kernel" ] + CMAKEOPTS=${MAKEOPTS} + if [ "${2}" = "kernel" ] || [ "${2}" = "runtask" ] then export_kernel_args MAKE=${KERNEL_MAKE} + [ "${2}" = "runtask" ] && CMAKEOPTS=${MAKEOPTS/-j?/-j1} elif [ "${2}" = "utils" ] then export_utils_args MAKE=${UTILS_MAKE} 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 # Output to stdout and debugfile 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=$? else # Output to debugfile only print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1 - ${MAKE} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1 + ${MAKE} ${CMAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1 RET=$? fi - [ "${RET}" -ne "0" ] && gen_die "compile of ${1} failed" + [ "${RET}" -ne "0" ] && gen_die "Failed to compile the \"${1}\" target..." unset MAKE if [ "${2}" = "kernel" ] @@ -151,38 +158,33 @@ compile_generic() { } extract_dietlibc_bincache() { - print_info 1 "extracting dietlibc bincache" - CURR_DIR=`pwd` + print_info 1 "dietlibc: >> Extracting cache..." cd "${TEMP}" rm -rf "${TEMP}/diet" > /dev/null - tar -jxpf "${DIETLIBC_BINCACHE}" || gen_die "Could not extract dietlibc bincache" - [ ! -d "${TEMP}/diet" ] && gen_die "${TEMP}/diet directory not found" - cd "${CURR_DIR}" + tar -jxpf "${DIETLIBC_BINCACHE}" || gen_die "Could not extract dietlibc bincache!" + [ ! -d "${TEMP}/diet" ] && gen_die "${TEMP}/diet directory not found!" + cd - > /dev/null } clean_dietlibc_bincache() { - print_info 1 "cleaning up dietlibc bincache" - CURR_DIR=`pwd` cd "${TEMP}" rm -rf "${TEMP}/diet" > /dev/null - cd "${CURR_DIR}" + cd - > /dev/null } compile_dep() { - # Only make dep for 2.4 kernels - if [ "${PAT}" -gt "4" ] + # Only run ``make dep'' for 2.4 kernels + if [ "${VER}" -eq "2" ] && [ "${PAT}" -le "4" ] then - print_info 1 "kernel: skipping make dep for non 2.4 kernels" - else - print_info 1 "kernel: Making dependencies for linux ${KV}" + print_info 1 "kernel: >> Making dependencies..." cd ${KERNEL_DIR} compile_generic "dep" kernel fi } compile_modules() { - print_info 1 "kernel: Starting compile of linux ${KV} modules" + print_info 1 " >> Compiling ${KV} modules..." cd ${KERNEL_DIR} compile_generic "modules" kernel export UNAME_MACHINE="${ARCH}" @@ -196,27 +198,32 @@ compile_modules() { } 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} - 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 if [ "${KERNEL_MAKE_DIRECTIVE_2}" != "" ] 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 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() { if [ ! -f "${BUSYBOX_BINCACHE}" ] then - [ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}" - [ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}" + [ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!" + [ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!" cd "${TEMP}" rm -rf ${BUSYBOX_DIR} > /dev/null - tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball" - [ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} invalid" + tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball!" + [ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} is invalid!" cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config" cd "${BUSYBOX_DIR}" # Busybox and dietlibc don't play nice right now @@ -226,9 +233,9 @@ compile_busybox() { # OLD_CC="${UTILS_CC}" # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}" # fi - print_info 1 "Busybox: make oldconfig" + print_info 1 "busybox: >> Configuring..." yes "" | compile_generic "oldconfig" utils - print_info 1 "Busybox: make all" + print_info 1 "busybox: >> Compiling..." compile_generic "all" utils # Busybox and dietlibc don't play nice right now # if [ "${USE_DIETLIBC}" -eq "1" ] @@ -236,18 +243,17 @@ compile_busybox() { # clean_dietlibc_bincache # UTILS_CC="${OLD_CC}" # 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" strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox" bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "bzip2 compression of busybox failed" [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" ] && gen_die "could not find compressed busybox binary" mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die "could not copy busybox binary to arch package directory, does the directory exist?" - print_info 1 "Busybox: cleaning up" cd "${TEMP}" rm -rf "${BUSYBOX_DIR}" > /dev/null else - print_info 1 "Busybox: Found bincache at ${BUSYBOX_BINCACHE}" + print_info 1 "busybox: Found cache at ${BUSYBOX_BINCACHE}" fi } @@ -255,13 +261,13 @@ compile_modutils() { local ARGS if [ ! -f "${MODUTILS_BINCACHE}" ] 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}" rm -rf "${MODUTILS_DIR}" 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}" - print_info 1 "modutils: configure" + print_info 1 "modutils: >> Configuring..." if [ "${USE_DIETLIBC}" -eq "1" ] then @@ -271,10 +277,11 @@ compile_modutils() { fi 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 - print_info 1 "modutils: make all" + print_info 1 "modutils: >> Compiling..." compile_generic "all" utils if [ "${USE_DIETLIBC}" -eq "1" ] @@ -283,18 +290,17 @@ compile_modutils() { UTILS_CC="${OLD_CC}" 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" strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "could not strip insmod.static" bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "compression of insmod.static failed" [ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary" mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" || gen_die "could not move compress binary to bincache" - print_info 1 "modutils: cleaning up" cd "${TEMP}" rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null else - print_info 1 "modutils: Found bincache at ${MODUTILS_BINCACHE}" + print_info 1 "modutils: Found cache at ${MODUTILS_BINCACHE}" fi } @@ -308,7 +314,7 @@ compile_module_init_tools() { tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}" [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid" cd "${MODULE_INIT_TOOLS_DIR}" - print_info 1 "module-init-tools: configure" + print_info 1 "module-init-tools: >> Configuring" if [ "${USE_DIETLIBC}" -eq "1" ] then @@ -320,7 +326,7 @@ compile_module_init_tools() { export_utils_args ./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed" unset_utils_args - print_info 1 "module-init-tools: make all" + print_info 1 " >> Compiling..." compile_generic "all" utils if [ "${USE_DIETLIBC}" -eq "1" ] @@ -329,18 +335,17 @@ compile_module_init_tools() { UTILS_CC="${OLD_CC}" 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" strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "could not strip insmod.static" bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "compression of insmod.static failed" [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary" mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" || gen_die "could not move compressed binary to bincache" - print_info 1 "module-init-tools: cleaning up" cd "${TEMP}" rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null 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 } @@ -362,7 +367,7 @@ compile_devfsd() { UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}" fi - print_info 1 "devfsd: make all" + print_info 1 "devfsd: >> Compiling..." if [ "${USE_DIETLIBC}" -eq "1" ] then @@ -377,7 +382,7 @@ compile_devfsd() { UTILS_CC="${OLD_CC}" 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" strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die "could not strip devfsd" 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" 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}" - rm -rf "${DEVFSD_DIR}" > /dev/null + # rm -rf "${DEVFSD_DIR}" > /dev/null 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 } @@ -409,7 +413,8 @@ compile_dietlibc() { ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"` if [ "${TEMP}" != "${ORIGTEMP}" ] 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 fi fi @@ -422,22 +427,20 @@ compile_dietlibc() { tar -jxpf ${DIETLIBC_SRCTAR} || gen_die "Could not extract dietlibc source tarball" [ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid" cd "${DIETLIBC_DIR}" - print_info 1 "Dietlibc: make" + print_info 1 "dietlibc: >> Compiling..." compile_generic "prefix=${TEMP}/diet" utils - print_info 1 "Dietlibc: installing" + print_info 1 " >> Installing..." compile_generic "prefix=${TEMP}/diet install" utils - print_info 1 "Dietlibc: copying to bincache" + print_info 1 " >> Copying to bincache..." cd ${TEMP} - tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin" - [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "bincache not created" + tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up the dietlibc binary!" + [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "Dietlibc cache not created!" echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}" - print_info 1 "Dietlibc: cleaning up" cd "${TEMP}" rm -rf "${DIETLIBC_DIR}" > /dev/null rm -rf "${TEMP}/diet" > /dev/null else - print_info 1 "Dietlibc: Found bincache at ${DIETLIBC_BINCACHE}" + print_info 1 "dietlibc: Found cache at ${DIETLIBC_BINCACHE}" fi } - diff --git a/gen_configkernel.sh b/gen_configkernel.sh index a65c997..eeb2c68 100644 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -20,20 +20,17 @@ determine_config_file() { then KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config" else - gen_die "no kernel config specified, or file not found" + gen_die "Error: No kernel config specified, or file not found!" fi } config_kernel() { - print_info 1 "kernel: configuring source" - determine_config_file - - cd "${KERNEL_DIR}" || gen_die "could not switch to kernel directory" + cd "${KERNEL_DIR}" || gen_die "Could not switch to the kernel directory!" if isTrue ${MRPROPER} then - print_info 1 "kernel: running mrproper" + print_info 1 "kernel: >> Running mrproper..." compile_generic "mrproper" kernel fi @@ -41,24 +38,48 @@ config_kernel() { # or we might screw up something someone is trying to test. if isTrue ${CLEAN} 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_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 - print_info 1 "kernel: running clean" + print_info 1 "kernel: >> Cleaning..." compile_generic "clean" kernel 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 if isTrue ${MENUCONFIG} then - print_info 1 "kernel: running menuconfig" - make menuconfig - [ "$?" != "0" ] && gen_die "menuconfig failed" + print_info 1 "config: >> Invoking menuconfig..." + compile_generic menuconfig runtask + [ "$?" != "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 } diff --git a/gen_determineargs.sh b/gen_determineargs.sh index f7e9361..e3deb19 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -1,10 +1,6 @@ #!/bin/bash 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 EXV @@ -32,7 +28,7 @@ determine_real_args() { else KERNEL_DIR=${DEFAULT_KERNEL_SOURCE} fi - [ "${KERNEL_DIR}" = "" ] && gen_die "no kernel source directory" + [ "${KERNEL_DIR}" = "" ] && gen_die "No kernel source directory!" get_KV diff --git a/gen_funcs.sh b/gen_funcs.sh index b7fd72a..d177a81 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -25,23 +25,23 @@ isTrue() { if isTrue ${USECOLOR} then # COLS="`stty size 2> /dev/null`" -# COLS="`getcols ${COLS}`" -# COLS=$((${COLS} - 7)) -# ENDCOL=$'\e[A\e['${COLS}'G' # Now, ${ENDCOL} will move us to the end of the +# COLS="`getcols ${COLS}`" +# COLS=$((${COLS} - 7)) +# ENDCOL=$'\e[A\e['${COLS}'G' # Now, ${ENDCOL} will move us to the end of the # column; irregardless of character width GOOD=$'\e[32;01m' WARN=$'\e[33;01m' BAD=$'\e[31;01m' NORMAL=$'\e[0m' - HILITE=$'\e[36;01m' - BRACKET=$'\e[34;01m' + BOLD=$'\e[0;01m' + UNDER=$'\e[4m' else GOOD="" WARN="" BAD="" NORMAL="" - HILITE="" - BRACKET="" + BOLD="" + UNDER="" fi @@ -124,11 +124,16 @@ print_info() { # STRUCTURE DATA TO BE OUTPUT TO FILE, AND OUTPUT IT if [ "${SCRPRINT}" -eq "1" -o "${FORCEFILE}" -eq "1" ] then + STRR=${2//${WARN}/} + STRR=${STRR//${BAD}/} + STRR=${STRR//${BOLD}/} + STRR=${STRR//${NORMAL}/} + if [ "${PREFIXLINE}" = "1" ] then - STR="* ${2}" + STR="* ${STRR}" else - STR="${2}" + STR="${STRR}" fi if [ "${NEWLINE}" = "0" ] @@ -142,6 +147,16 @@ print_info() { return 0 } +print_error() +{ + GOOD=${BAD} print_info "$@" +} + +print_warning() +{ + GOOD=${WARN} print_info "$@" +} + # var_replace(var_name, var_value, string) # $1 = variable name # $2 = variable value @@ -163,13 +178,31 @@ clear_log() { gen_die() { if [ "$#" -gt "0" ] then - print_info 1 "gen_die(): ${1}" + print_error 1 "ERROR: ${1}" + fi + echo + print_info 1 "-- Grepping log... --" + echo + + 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 - print_info 1 "Please see ${DEBUGFILE} for more info on failures" - print_info 1 "" - print_info 1 "DO NOT REPORT KERNEL COMPILE FAILURES AS GENKERNEL BUGS!" - print_info 1 "" - print_info 1 "Report real genkernel bugs to bugs.gentoo.org" + 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 } diff --git a/gen_initrd.sh b/gen_initrd.sh index 7c3df9c..e7ddd3c 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -31,8 +31,6 @@ create_base_initrd_sys() { mkdir -p ${TEMP}/initrd-temp/proc mkdir -p ${TEMP}/initrd-temp/temp 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/usr/bin 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 "UNREGISTER .* RMNEWCOMPAT" >> ${TEMP}/initrd-temp/etc/devfsd.conf - cd ${TEMP}/initrd-temp/dev MAKEDEV std MAKEDEV console @@ -78,10 +75,10 @@ create_base_initrd_sys() { for i in '[' ash basename cat chroot clear cp dirname echo env false find \ grep gunzip gzip ln ls loadkmap losetup lsmod mkdir mknod more mount mv \ - pivot_root ps awk pwd rm rmdir rmmod 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 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 } @@ -101,16 +98,17 @@ create_initrd_modules() { else MOD_EXT=".o" fi + + print_info 2 "initrd: >> Searching for modules..." for i in `gen_dep_list` do - print_info 2 "$i : module searching" 1 0 mymod=`find /lib/modules/${KV} -name "${i}${MOD_EXT}"` if [ -z "${mymod}" ] then - print_info 2 "Warning : ${i}${MOD_EXT} not found; skipping..." + print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..." continue; fi - print_info 2 "copying ${mymod} to initrd" + print_info 2 "initrd: >> Copying ${i}${MOD_EXT}..." cp -ax --parents "${mymod}" "${TEMP}/initrd-temp" done @@ -151,12 +149,19 @@ create_initrd_aux() { else cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" 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/etc/initrd.scripts" chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults" chmod +x "${TEMP}/initrd-temp/sbin/modprobe" - } calc_initrd_size() { @@ -169,35 +174,31 @@ calc_initrd_size() { create_initrd() { local MOD_EXT - print_info 1 "initrd: creating base system" + print_info 1 "initrd: >> Initializing..." create_base_initrd_sys if [ "${NOINITRDMODULES}" = "" ] then - print_info 1 "initrd: copying modules" + print_info 1 " >> Copying modules..." create_initrd_modules else - print_info 1 "initrd: not copying modules" + print_info 1 "initrd: Not copying modules..." fi - print_info 1 "initrd: copying auxilary files" + print_info 1 " >> Copying auxilary files..." create_initrd_aux - print_info 1 "initrd: calculating 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` + print_info 1 " :: Size is at ${INITRD_SIZE}K" - print_info 1 "initrd: real size ${INITRD_SIZE}" - - print_info 1 "initrd: creating loopback filesystem" + print_info 1 " >> Creating loopback filesystem..." 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 - print_info 1 "initrd: cleaning up and compressing initrd" + print_info 1 " >> Cleaning up and compressing the initrd..." create_initrd_unmount_loop if [ "${COMPRESS_INITRD}" ] @@ -208,12 +209,28 @@ create_initrd() { if [ "${BOOTSPLASH}" -eq "1" ] then - print_info 1 "initrd: copying bootsplash" - /sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-800x600.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 800x600 bootsplash" - /sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1024x768.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1024x768 bootsplash" - /sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1280x1024.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1280x1024 bootsplash" - /sbin/splash -s -f /etc/bootsplash/default/config/bootsplash-1600x1200.cfg >> ${TEMP}/initrd-loop || gen_die "could not copy 1600x1200 bootsplash" + if [ -x /sbin/splash ] + then + [ -z "${BOOTSPLASH_THEME}" ] && source /etc/conf.d/bootsplash.conf + [ -z "${BOOTSPLASH_THEME}" ] && BOOTSPLASH_THEME=default + 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 - cp ${TEMP}/initrd-loop /boot/initrd-${KV} || gen_die "could not copy initrd to boot" } - diff --git a/generic/initrd.defaults b/generic/initrd.defaults index 2fe9c89..f7c0862 100644 --- a/generic/initrd.defaults +++ b/generic/initrd.defaults @@ -1,30 +1,30 @@ #!/bin/ash + PATH=/usr/sbin:/usr/bin:/sbin:/bin BACK_UP="\033[1K\033[0G" -HILITE="\033[1m" NORMAL="\033[0m" -WARN="\033[1m" -BAD="\033[1m" +WARN="\033[33;1m" +BAD="\033[31;1m" +BOLD="\033[1m" +GOOD="\033[32;1m" + KV="`uname -r`" KMAJOR=`echo $KV | cut -f1 -d.` KMINOR=`echo $KV | cut -f2 -d.` KVER="${KMAJOR}.${KMINOR}" MISCOPTS="cdcache idebug detect" -HWOPTS="scsi firewire ataraid pcmcia usb" +HWOPTS="scsi firewire ataraid pcmcia usb keymap" MY_HWOPTS="usb firewire" QUIET=1 ROOT_LINKS="bin sbin lib lib64 boot usr opt" ROOT_TREES="etc root home var" +INSMOD="insmod" if [ "${KMINOR}" -gt "4" ] then KSUFF=".ko" - INSMOD="insmod" else KSUFF=".o" - INSMOD="insmod" fi REAL_ROOT="" CDROOT=0 - - diff --git a/generic/initrd.scripts b/generic/initrd.scripts index d454912..d3e7041 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -1,5 +1,6 @@ #!/bin/ash +. /etc/initrd.defaults backup() { echo -ne "\033[0G\033[0K" } @@ -14,17 +15,17 @@ parse_opt() { modules_scan() { local MODS + [ -d /etc/modules/${1} ] || touch /etc/modules/${1} + MODS=`cat /etc/modules/${1}` for x in ${MODS} do - echo -ne "${HILITE}---- Scanning for ${x}..." -# MODULE=`find /lib/modules -name "${x}.$KSUFF"` - modprobe ${x} -# > /dev/null 2>&1 + echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..." + modprobe ${x} -n if [ $? -eq 0 ] then backup - echo -e "${GOOD}---- Detected ${x} hardware${NORMAL}" + echo -e "${GOOD} ::${NORMAL} Detected ${x} hardware..." continue fi backup @@ -37,7 +38,7 @@ findcdmount() { then for x in $* 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 if [ "$?" = "0" ] then @@ -47,7 +48,7 @@ findcdmount() { done if [ "${REAL_ROOT}" != "" ] then - echo -e "${HILITE}---- CD medium found on $1${NORMAL}" + echo -e "${GOOD}>>${NORMAL} CD medium found on $1" fi fi } diff --git a/generic/keymaps.tar.gz b/generic/keymaps.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..975c3b2256faad7ff981cd73ad9e0044ff105f7f GIT binary patch literal 17487 zcmZ6yc|25a_&-ec;f1UrAxW}Fc8x+IOPho;MWSqF$?k;gTL>i#B}+nOOK45eP60r(^P~7wS>QdL^suV3=x!LeE8lLPC>a0F<^>wSVpmqL3>w+`qLr;%O z(xH6SzZ-pnYfK+~(n;%*Nc(;3Msa4BRJUeSzGsI-)Tz|tUPfn&yCm=j4Wp@3h4fe3lBt&FN@d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L8_-N*;c;}Y|L7fEB{V^{uqDmzpL-nCExx7CpJO) zR&jp)|77zLu#&4nyZ(hQ{VHz>vi9nvo&Uqn{D1!BPyCgT-4>!h`3^ArI-gzvHdpOR z{S)g3rkC@-{|7l_)l@D0%%>T>4GgdUZ#IsBh=nh{&mgnl@AFM2|0hrWTpt*`w@P#3 zujiltgN-*8di7uY*L0A$^1^@dcK@eC*{|(Cr~H5V6liP7&VaZsE4G9QKl)4lm79V5 zqbB(8f5gVH{&#XQ@16eNocXfnLUowwm-((c+J7DAGMGDiSzG^9=cPaNH_rRNAxP`W zH14ZjM^*1W<(?Jx=|OT>%HPu73&N^v11?ASYG-~f4NF*Lx8Z13>ddS9895t+v_kd7 zPkXOvDQ!6$oA^~*`^!e)LIUxyuvJs1W^D|(?smF0wKsItnmZBmF0Za;i{eYVtA*`IIJzFqP3+0Zga|AqNIJF8Qhd{~yI_MF}D(^XAlc5+m2 zT>0iC&iJdD+iC>kizCBwUt~t)wJ9!0RqHjHdN%V{du$K8^`kSNd={H$wTX7F+% zXQtm#^+coFt!MNkdx~=MJpU(}&yF|sGCeESeMI4O*PMqu+Tj}ceOIUXxb2QyoG?w} zyv8%7^K%ZeCmG!8JU>Tb#has|Rd /proc/sys/kernel/printk -echo "${GOOD} Gentoo initrd startup..." -echo "STEP 1: Command-line parsing" CMDLINE=`cat /proc/cmdline` # Scan CMDLINE for any specified real_root= or cdroot arguments for x in ${CMDLINE} @@ -61,17 +67,41 @@ done if [ -d "/lib/modules" ] then - echo "STEP 2: Module loading" + echo -e "${GOOD}>>${NORMAL}${BOLD} Loading modules...${NORMAL}" # Load appropriate kernel modules - for x in $MY_HWOPTS + for modules in $MY_HWOPTS do - modules_scan $x + modules_scan $modules + eval DO_`echo $modules | sed 's/-//'`=1 done 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 -echo "STEP 3: Mounting necessary filesystems per boot options" +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 + +echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting filesystems...${NORMAL}" mkdir /newroot if [ "${CDROOT}" -eq "1" ] @@ -89,10 +119,8 @@ then findcdmount /newroot/dev/ide/cd/* fi - if [ "${REAL_ROOT}" = "" ] then - echo "Dropping to shell so you can fix your shit" exec /bin/ash # Undo stuff @@ -115,7 +143,7 @@ then devfsd /dev -np fi -echo "STEP 4: Determining root device" +echo -e "${GOOD}>>${NORMAL}${BOLD} Determining root device...${NORMAL}" while true do @@ -126,40 +154,39 @@ do then /bin/ash - #set REAL_ROOT to "" so we get a prompt for the real root after the shell exits. REAL_ROOT="" got_good_root=0 continue elif [ "${REAL_ROOT}" = "" ] then - #no REAL_ROOT determined/specified. Prompt user for root block device. - echo "Root block device unspecified or not detected." - echo "Please specify a device to boot, or \"shell\" for a shell." - echo -n ": " + # No REAL_ROOT determined/specified. Prompt user for root block device. + echo -e "${BAD}>>${NORMAL} The root block device is unspecified or not detected." + echo " Please specify a device to boot, or \"shell\" for a shell." + echo -n "boot() :: " read REAL_ROOT got_good_root=0 elif [ -b "${REAL_ROOT}" ] then got_good_root=1 else + echo -e "${BAD}>>${NORMAL} Block device ${REAL_ROOT} is not a valid root device..." REAL_ROOT="" got_good_root=0 fi done - if [ "${CDROOT}" -eq "1" -a "${got_good_root}" = "1" ] then break else - echo "STEP 4a: Mounting root" + echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting root...${NORMAL}" mount -o rw ${REAL_ROOT} /newroot if [ "$?" = "0" ] then break else - echo "Could not mount specified ROOT, try again" + echo -e "${BAD}>> ${NORMAL}Could not mount specified ROOT, try again" got_good_root=0 REAL_ROOT="" fi @@ -167,27 +194,25 @@ do done [ -n "$QUIET" ] && echo "6" > /proc/sys/kernel/printk -echo "STEP 5: Finishing up" - check_loop() { if [ "${LOOP}" = "" -o ! -e "mnt/cdrom/${LOOP}" ] then echo "Invalid loop location: ${LOOP}" - echo "please export LOOP with a valid location, or reboot and pass a proper loop=" - echo "kernel command line" + echo "Please export LOOP with a valid location, or reboot and pass a proper loop=..." + echo "kernel command line!" /bin/ash fi } if [ "${CDROOT}" = "1" ] then - echo "STEP 5a: filling tmpfs filesystem" + echo -e "${GOOD}>>${NORMAL}${BOLD} Filling tmpfs...${NORMAL}" cd /newroot # Failsafe if some idiot didn't set loop type if [ "${LOOPTYPE}" = "" ] then - echo "YOU FORGOT TO SPECIFY LOOPTYPE TRYING TO AUTODETECT" + echo -e "${WARN}** ${NORMAL}${BOLD}Warning: loop type unspecified!${NORMAL}" if [ "${LOOP}" = "/livecd.loop" ] then LOOPTYPE="normal" @@ -203,7 +228,6 @@ then else LOOPTYPE="noloop" fi - echo "DETECTED LOOPTYPE: $LOOPTYPE" fi if [ "${LOOPTYPE}" = "normal" ] @@ -213,7 +237,7 @@ then # bind-mount /dev/ so that loop devices can be found 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 if [ "$?" != "0" ] then @@ -226,7 +250,7 @@ then then check_loop 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 if [ "$?" != "0" ] then @@ -238,8 +262,8 @@ then elif [ "${LOOPTYPE}" = "gcloop" ] then check_loop + echo -e "${GOOD}>>${NORMAL}${BOLD} Mounting gcloop filesystem...${NORMAL}" 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} if [ "$?" != "0" ] then @@ -258,7 +282,7 @@ then FS_LOCATION="mnt/cdrom" fi - echo "STEP 5a2: filling filesystem" + echo "${GOOD}>>${NORMAL}${BOLD} Filling filesystem...${NORMAL}" for x in ${ROOT_LINKS} do ln -s "${FS_LOCATION}/${x}" "${x}" @@ -267,63 +291,47 @@ then chmod 1777 tmp (cd /newroot/${FS_LOCATION}; cp -a ${ROOT_TREES} /newroot) else - echo "STEP 5b: setting up stuff for pivot_root" mkdir -p /newroot/tmp/.initrd fi -echo "STEP 5c: redirect console" -console=/newroot/dev/console -[ ! -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" - +[ ! -e /newroot/dev/console ] && mknod /newroot/dev/console c 5 1 +echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting" cd /newroot pivot_root . tmp/.initrd +echo -n '.' if [ "${USE_DEVFS_NORMAL}" -eq "1" -a "${CDROOT}" -eq "0" ] then - # must mount a new devfs before we can - # umount the old one for some reason - mount -t proc proc /proc - 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 - + umount /tmp/.initrd/proc || echo '*: Failed to unmount the initrd /proc!' + mount -n --move /tmp/.initrd/dev dev || echo '*: Failed to move over the /dev tree!' + rm /tmp/.initrd/dev -rf || '*: Failed to remove the initrd /dev!' elif [ "${CDROOT}" -eq "1" ] then # If automount at boot was on with devfs, we'll want to umount it # also umount proc - echo "STEP 6a: clean up mounts" 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 /proc > /dev/null 2>&1 fi +echo -n '.' # /usr/src/linux/Documentation/initrd.txt # here's the line it says we should do: # exec chroot . /sbin/init /dev/console 2>&1 +exec dev/console 2>&1 +echo '.' exec chroot . /bin/sh <<- EOF - umount /tmp/.initrd || echo "UMOUNT of /tmp/.initrd FAILED!!!" && /sbin/blockdev --flushbufs /dev/ram0 - echo "INIT: starting /sbin/init ${CMDLINE}" - exec /sbin/init ${CMDLINE} + umount /tmp/.initrd || echo "*: Failed to unmount the initrd!" + /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1 + exec /sbin/init EOF -# exec chroot . /sbin/init ${CMDLINE} < /dev/console > /dev/console 2>&1 -echo "IF YOU ARE SEEING THIS MESSAGE, A FATAL ERROR HAS OCCURRED" -echo "MOST LIKELY /sbin/init DOES NOT EXIST, ATTEMPTING TO DROP" -echo "YOU TO A SHELL" - +echo "A fatal error has probably occured since /sbin/init did not" +echo "boot correctly. Trying to open a shell..." +echo exec /bin/bash exec /bin/sh exec /bin/ash diff --git a/generic/modprobe b/generic/modprobe index 589efdd..9966e95 100755 --- a/generic/modprobe +++ b/generic/modprobe @@ -1,36 +1,23 @@ #!/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 usage() { - echo "modprobe gentoo script v1.0" echo "Usage:" echo " modprobe moduleprefix" - echo "" + echo echo "Ex:" echo " modprobe eepro100" - echo "" - echo "Note: Do not pass the suffix to modprobe" + echo + echo "Note: Do not pass the suffix to modprobe!" exit 1 } # Pass module name to this function modules_dep_list() { - if [ "$#" != "1" ] + if [ "$#" -lt "1" ] then echo "modules_dep_list(): improper usage" exit 1 @@ -91,7 +78,10 @@ modprobe2() local modlist local ret - if [ "$#" != "1" ] + local echoAppend + local echoFlags + + if [ "$#" -lt "1" ] then echo "modprobe(): improper usage" exit 1 @@ -99,8 +89,8 @@ modprobe2() real_path=`real_mod_path ${1}` if [ "${real_path}" = "" -o "${real_path}" = " " ] then - echo "no such module found" - exit 1 + echo "module not found..." + exit 2 fi modlist=`modules_dep_list ${1}` if [ "${modlist}" != "" -a "${modlist}" != " " ] @@ -109,7 +99,6 @@ modprobe2() else deps="" fi -# echo "$1 -- DEPS='${deps}'" # Make sure we don't do any endless loops! LOADED_MODULES="${LOADED_MODULES} ${1}" @@ -119,30 +108,30 @@ modprobe2() then if [ "${x}" != "" -a "${x}" != " " ] then -# echo "loading dep: ${x}" - modprobe2 "${x}" + modprobe2 "${x}" -n fi else filler=1 -# echo "skipping ${x}, module already loaded by us" fi done -# echo "running insmod on '${real_path}'" ${INSMOD} ${real_path} > /dev/null 2>&1 ret=$? if [ "$ret" -eq "0" ] then - echo "module ${real_path} loaded" + echoAppend=" loaded..." + [ "${2}" = "-n" ] && echoFlags="-n" && echoAppend=", " + echo ${echoFlags} "${1}${echoAppend}" fi return $ret } -if [ "$#" != "1" ] +if [ "$#" -lt "1" ] then usage fi +[ -f "/modules.cache" ] || touch /modules.cache for x in `cat /modules.cache` do LOADED_MODULES="${LOADED_MODULES} ${x}" diff --git a/genkernel b/genkernel index 7cd8aa2..672bd35 100755 --- a/genkernel +++ b/genkernel @@ -1,7 +1,7 @@ #!/bin/bash # Genkernel v3 -GK_V="3.0.1" +GK_V="3.0.2_rc1" TEMP="/var/tmp/genkernel" small_die() { @@ -25,8 +25,12 @@ BUILD_ALL=0 BUILD_KERNEL=0 BUILD_INITRD=0 -# Parse all command line options, and load into memory -parse_cmdline $* +# Parse all command line options... +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 ] then @@ -34,7 +38,7 @@ then exit 1 fi -print_info 1 "GenKernel v${GK_V}" 1 0 +NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}" # Set ${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. determine_real_args -print_info 1 "ARCH: ${ARCH}" -print_info 1 "KERNEL VER: ${KV}" +NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${WARN}${KV}${BOLD} for ${WARN}${ARCH}${BOLD}..." +echo if ! has_loop then - 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" - gen_die "----Load loop support----" + print_error print_info 1 "Your kernel does not appear to have loop device support. " + print_error print_info 1 "Please 'modprobe loop' if it is a module before running genkernel" + 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 # 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 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 if [ "${USE_DIETLIBC}" = "1" ] then @@ -106,20 +179,19 @@ then gen_minkernpackage fi -print_info 1 " " -print_info 1 " " +print_info 1 '' print_info 1 "Kernel compiled successfully!" -print_info 1 "Required Kernel Params:" -print_info 1 " : root=/dev/ram0 init=/linuxrc real_root=/dev/\$ROOT" -print_info 1 " where \$ROOT is the devicenode for your root partition as" -print_info 1 " you should have specified in /etc/fstab" -print_info 1 "" -print_info 1 "You MUST tell your bootloader to use the generated initrd" -print_info 1 "" -print_info 1 "Recommended Kernel Params:" -print_info 1 " : vga=0x317 splash=verbose" -print_info 1 "" +print_info 1 '' +print_info 1 "Required Kernel Parameters:" +print_info 1 ' root=/dev/ram0 real_root=/dev/$ROOT init=/linuxrc' +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 "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 info see /usr/share/genkernel/README" +print_info 1 "For more information please see /usr/share/genkernel/README..." diff --git a/genkernel.conf b/genkernel.conf index 42adbff..25b938f 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -1,4 +1,4 @@ -# GenKernel Configuration File v3.0 +# Genkernel Configuration File # ===========GENKERNEL BASIC CONFIGURATION============= @@ -17,25 +17,21 @@ MRPROPER="yes" # Copy bootsplash into the initrd image? BOOTSPLASH="yes" -# Should we _not_ install the kernel into the default -# locations? -NOINSTALL="yes" - # Override the arch detection? -# available params "x86", "amd64", "ppc", "sparc" # ARCH_OVERRIDE="x86" +# Mount /boot automatically if it isn't mounted? +MOUNTBOOT="yes" + # Use Color output in Genkernel? USECOLOR="yes" - # =========GENKERNEL LOCATION CONFIGURATION============ # Variables: # %%ARCH%% - Final determined architecture # Default share directory location GK_SHARE="/usr/share/genkernel" -#GK_SHARE="/home/brad/Desktop/genkernel" # Location of helper-scripts #GK_BIN="${GK_SHARE}/bin" @@ -83,4 +79,3 @@ DEVFSD_SRCTAR="${GK_SHARE}/pkg/devfsd-${DEVFSD_VER}.tar.bz2" DEVFSD_DIR="devfsd" DEVFSD_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-${DEVFSD_VER}-%%ARCH%%.bz2" DEVFSD_CONF_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-conf-${DIETLIBC_VER}-%%ARCH%%.bz2" - diff --git a/x86/modules_load b/x86/modules_load index 809f4cd..e3418b5 100644 --- a/x86/modules_load +++ b/x86/modules_load @@ -12,10 +12,6 @@ dmx3191d dpt_i2o imm in2000 ips qla1280 \ sim710 sym53c416" FIREWIRE_MODULES="ieee1394 ohci1394 eth1394 sbp2" - ATARAID_MODULES="ataraid pdcraid hptraid" - PCMCIA_MODULES="ide-cs" - USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage" - -- 2.26.2