Version bump. Closes bugs #34948, #37371, #41129, #41166, #42725, #42815,
authorTim Yamin <plasmaroo@gentoo.org>
Sun, 21 Mar 2004 16:20:26 +0000 (16:20 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Sun, 21 Mar 2004 16:20:26 +0000 (16:20 +0000)
#44127, #44556, and #44601.

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@98 67a159dc-881f-0410-a524-ba9dfbe2cb84

16 files changed:
README
TODO
gen_cmdline.sh
gen_compile.sh
gen_configkernel.sh
gen_determineargs.sh
gen_funcs.sh
gen_initrd.sh
generic/initrd.defaults
generic/initrd.scripts
generic/keymaps.tar.gz [new file with mode: 0644]
generic/linuxrc
generic/modprobe
genkernel
genkernel.conf
x86/modules_load

diff --git a/README b/README
index 1032972a3d16bf0cd005518709b50a91f99ac8fd..4ae8d6ddf901523fcd1abee7b0d1bc346077f98d 100644 (file)
--- 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 cbd810ae0ce0cbaa4fa81d8ac591a2e44c8ee2fb..72291a67b36a4884ecfcdd898adf1b1eef678841 100644 (file)
--- 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.
 
index 1a427004853b5239f254c6c45c1d2fe008c8697d..3dadab6c78dfb9c2bbca2d58cbbd88348b866a41 100755 (executable)
@@ -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=<outfile>   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=<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 "        --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-ld=<linker>    Linker 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 "       --utils-cc=<compiler>   Compiler to use for utils (e.g. busybox, modutils)"
-  echo "       --utils-ld=<linker>     Linker to use for utils"
+  echo "       --utils-cc=<compiler>   Compiler to use for utilities"
   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 "       --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 "       --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-bin=<file>    Don't compile busybox, use this _static_ bzip2'd binary"
-  echo "  Misc Settings"
-  echo "       --max-kernel-size=<k>   Maximum kernel size"
-  echo "       --max-initrd-size=<k>   Maximum initrd size"
-  echo "       --max-kernel-and-initrd-size=<k>        Maximum combined initrd + kernel size"
+  echo "       --busybox-bin=<file>    Don't compile busybox, use this _static_"
+  echo "                               bzip2'd binary"
+#  echo "  Misc Settings"
+#  echo "      --max-kernel-size=<k>   Maximum kernel size"
+#  echo "      --max-initrd-size=<k>   Maximum initrd size"
+#  echo "      --max-kernel-and-initrd-size=<k>        Maximum combined initrd + kernel size"
   echo "  Output Settings"
-  echo "        --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and initrd to."
-  echo "                                These will be renamed to simply 'kernel' and 'initrd'"
-  echo "                                inside the package without any path information."
-  echo "                                No modules outside of the initrd will be included"
-  echo ""
+  echo "        --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and initrd to"
+  echo "                                These will be renamed to simply 'kernel' and"
+  echo "                               'initrd' inside the package without any path"
+  echo "                                information. No modules outside of the initrd"
+  echo "                                will be included."
 }
 
 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
+}
index 8fdd3cf57a347406ce0a4ffd2a3d07cdf712a8b4..a5fa69313c98e86ff5c7ab57c5053b0c90a6dc6d 100644 (file)
@@ -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
 }
-
index a65c99766df9c7364bcfe96964c4612f83434a1e..eeb2c683c9c40347da2d9f321046dc81756d22cb 100644 (file)
@@ -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
 
 }
index f7e936156c0127e151d5db9960abc7d38636d4d4..e3deb19d8e676c45d9f6de6bfbd820515fa100e6 100644 (file)
@@ -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
 
index b7fd72a791d322e003e0550ba1d7504bb4eed642..d177a8183c6fb587b173ff90ceea8fcc616c088e 100755 (executable)
@@ -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
 }
 
index 7c3df9ccfafcad97653a47af7a0771657d37ea12..e7ddd3cb66bb4c7d6a581a1127f3a8832534602f 100644 (file)
@@ -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"
 }
-
index 2fe9c896b2a20edf871b0a6165fad19657e34a63..f7c0862980c96428fb9c542559219f777e4e69de 100644 (file)
@@ -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
-
-
index d454912fe0010fdd4a3661fe9db02d78dcb87f5c..d3e7041fa6907232e6734d706fd12b833820b92a 100644 (file)
@@ -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 (file)
index 0000000..975c3b2
Binary files /dev/null and b/generic/keymaps.tar.gz differ
index 000ce3de297e07c944301e0ea0684dedce660a29..d9db937fdb34742a6284c6e5a7e702e00fc50cd0 100644 (file)
@@ -8,13 +8,19 @@
 
 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 /proc
+mount -t proc proc /proc
 
 [ -n "$QUIET" ] && echo "0" > /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 >/dev/console 2>&1
 
+exec <dev/console >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
index 589efdd002ad68b75e3dd7237cef6e47f60d679f..9966e95b223de049e7e860ef332ef49c2fd7f891 100755 (executable)
@@ -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}"
index 7cd8aa2ed9ebb437ff0349a0b5b2221c58c3f512..672bd35303baa134ee657b6f4d23bc3aac04ce8e 100755 (executable)
--- 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..."
index 42adbff3675cf92bf0a6947eb0ef8f2aa14a048d..25b938f282a26c1a91b530f1321412c299cd2093 100755 (executable)
@@ -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"
-
index 809f4cd435e5969a0a63427095ded889af6eea40..e3418b5dfd0d1a5ff9145bfe13dcf01a0a973aa2 100644 (file)
@@ -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"
-