Adding a set of patches submitted by Martin "Parmus" Parm; bugs #57748,
authorTim Yamin <plasmaroo@gentoo.org>
Wed, 21 Jul 2004 13:43:06 +0000 (13:43 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Wed, 21 Jul 2004 13:43:06 +0000 (13:43 +0000)
#57749, #57751, #57752, and #57761.

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

gen_cmdline.sh
gen_compile.sh
gen_determineargs.sh
gen_initrd.sh
gen_moddeps.sh
genkernel
genkernel.conf

index 54cc8b3c83d305263b0fa475b6df2839aa0580ba..87ae1b161005a471b4e63afaf4e39de010a5210e 100755 (executable)
@@ -21,6 +21,8 @@ longusage() {
   echo "       --no-menuconfig         Do not run menuconfig after oldconfig"
   echo "       --gconfig               Run gconfig after oldconfig"
   echo "       --xconfig               Run xconfig after oldconfig"
+  echo "       --save-config           Save the configuration to /etc/kernels"
+  echo "       --no-save-config        Don't save the configuration to /etc/kernels"
   echo "  Kernel Compile settings"
   echo "       --clean                 Run make clean before compilation"
   echo "       --mrproper              Run make mrproper before compilation"
@@ -38,6 +40,8 @@ longusage() {
   echo "  Kernel settings"
   echo "       --kerneldir=<dir>       Location of the kernel sources"
   echo "       --kernel-config=<file>  Kernel configuration file to use for compilation"
+  echo "       --module-prefix=<dir>   Prefix to kernel module destination, modules will"
+  echo "                               be installed in <prefix>/lib/modules"
   echo "  Low-Level Compile settings"
   echo "       --kernel-cc=<compiler>  Compiler to use for kernel (e.g. distcc)"
   echo "       --kernel-as=<assembler> Assembler to use for kernel"
@@ -48,11 +52,14 @@ longusage() {
   echo "       --utils-ld=<linker>     Linker to use for utils"
   echo "       --utils-make=<makeprog> GNU Make to use for utils"
   echo "       --makeopts=<makeopts>   Make options such as -j2, etc."
+  echo "       --mountboot             Mount /boot automatically"
+  echo "       --no-mountboot          Don't mount /boot automatically"  
   echo "  Initialization"
   echo "       --bootsplash=<theme>    Force bootsplash using <theme>."
   echo "       --do-keymap-auto        Forces keymap selection at boot."
   echo "       --no-lvm2               Don't add in LVM2 support."
   echo "  Internals"
+  echo "       --tempdir=<dir>   Location of Genkernel's temporary directory"
   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_"
@@ -124,6 +131,14 @@ parse_cmdline() {
                      CMD_MAKEOPTS=`parse_opt "$*"`
                      print_info 2 "CMD_MAKEOPTS: $CMD_MAKEOPTS"
              ;;
+             --mountboot)
+                     CMD_MOUNTBOOT=1
+                     print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT"
+             ;;
+             --no-mountboot)
+                     CMD_MOUNTBOOT=0
+                     print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT"
+             ;;
              --do-keymap-auto)
                      CMD_DOKEYMAPAUTO=1
                      print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO"
@@ -162,6 +177,14 @@ parse_cmdline() {
                      CMD_XCONFIG=1
                      print_info 2 "CMD_XCONFIG: $CMD_XCONFIG"
              ;;
+             --save-config)
+                     CMD_SAVE_CONFIG=1
+                     print_info 2 "CMD_SAVE_CONFIG: $CMD_SAVE_CONFIG"
+             ;;
+             --no-save-config)
+                     CMD_SAVE_CONFIG=0
+                     print_info 2 "CMD_SAVE_CONFIG: $CMD_SAVE_CONFIG"
+             ;;
              --mrproper)
                      CMD_MRPROPER=1
                      print_info 2 "CMD_MRPROPER: $CMD_MRPROPER"
@@ -214,6 +237,10 @@ parse_cmdline() {
                      CMD_CALLBACK=`parse_opt "$*"`
                      print_info 2 "CMD_CALLBACK: $CMD_CALLBACK/$*"
              ;;
+             --tempdir*)
+               TEMP=`parse_opt "$*"`
+               print_info 2 "TEMP: $TEMP"
+             ;; 
              --arch-override*)
                      CMD_ARCHOVERRIDE=`parse_opt "$*"`
                      print_info 2 "CMD_ARCHOVERRIDE: $CMD_ARCHOVERRIDE"
@@ -240,6 +267,10 @@ parse_cmdline() {
                      CMD_KERNEL_CONFIG=`parse_opt "$*"`
                      print_info 2 "CMD_KERNEL_CONFIG: $CMD_KERNEL_CONFIG"
              ;;
+             --module-prefix*)
+                     CMD_INSTALL_MOD_PATH=`parse_opt "$*"`
+                     print_info 2 "CMD_INSTALL_MOD_PATH: $CMD_INSTALL_MOD_PATH"
+             ;;
              --busybox-config*)
                      CMD_BUSYBOX_CONFIG=`parse_opt "$*"`
                      print_info 2 "CMD_BUSYBOX_CONFIG: $CMD_BUSYBOX_CONFIG"
index 256c109d791ee85b4a962b71bf09d5b8f65feafa..2d226f95317f38f6566397f786e964796d993afa 100644 (file)
@@ -184,11 +184,9 @@ compile_modules() {
                MAKEOPTS_SAVE="${MAKEOPTS}"
                MAKEOPTS='-j1'
        fi
+       [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
        compile_generic "modules_install" kernel
-       if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ]
-       then
-               MAKEOPTS="${MAKEOPTS_SAVE}"
-       fi
+       [ "${VER}" -eq '2' -a "${PAT}" -le '4' ] && MAKEOPTS="${MAKEOPTS_SAVE}"
        export MAKEOPTS
        unset UNAME_MACHINE
 }
@@ -206,8 +204,10 @@ compile_kernel() {
        if ! isTrue "${CMD_NOINSTALL}"
        then
                cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
+               cp "System.map" "/boot/System.map-${KV}" || gen_die 'Could not copy System.map to /boot!'
        else
                cp "${KERNEL_BINARY}" "${TEMP}/kernel-${KV}" || gen_die "Could not copy the kernel binary to ${TEMP}!"
+               cp "System.map" "${TEMP}/System.map-${KV}" || gen_die "Could not copy System.map to ${TEMP}!"
        fi
 }
 
index 74d7b1bbdb9f486a1c1fc960463efcb4a4a1af27..55053b279344b24d22608f5a0889b20fb728bedd 100644 (file)
@@ -137,4 +137,33 @@ determine_real_args() {
        then
                NOINITRDMODULES="${CMD_NOINITRDMODULES}"
        fi
+
+       if [ "${CMD_MOUNTBOOT}" != '' ]
+       then
+               MOUNTBOOT="${CMD_MOUNTBOOT}"
+       fi
+
+       if isTrue ${MOUNTBOOT}
+       then
+               MOUNTBOOT=1
+       else
+               MOUNTBOOT=0
+       fi
+
+       if [ "${CMD_SAVE_CONFIG}" != '' ]
+       then
+               SAVE_CONFIG="${CMD_SAVE_CONFIG}"
+       fi
+
+       if isTrue ${SAVE_CONFIG}
+       then
+               ${SAVE_CONFIG}=1
+       else
+               ${SAVE_CONFIG}=0
+       fi
+  
+       if [ "${CMD_INSTALL_MOD_PATH}" != '' ]
+       then
+               INSTALL_MOD_PATH="${CMD_INSTALL_MOD_PATH}"
+       fi
 }
index 93303f12d7bcbc881229a7bc7d700faaf4ef8c37..c933223c939ec23f8316cca8cd1b5e2ef7955385 100644 (file)
@@ -115,9 +115,15 @@ create_initrd_modules() {
        fi
 
        print_info 2 "initrd: >> Searching for modules..."
+       if [ "${INSTALL_MOD_PATH}" != '' ]
+       then
+         cd ${INSTALL_MOD_PATH}
+       else
+         cd /
+       fi
        for i in `gen_dep_list`
        do
-               mymod=`find /lib/modules/${KV} -name "${i}${MOD_EXT}" | head -n 1`
+               mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" | head -n 1`
                if [ -z "${mymod}" ]
                then
                        print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
@@ -127,7 +133,7 @@ create_initrd_modules() {
                cp -ax --parents "${mymod}" "${TEMP}/initrd-temp"
        done
 
-       cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp
+       cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initrd-temp
 
        mkdir -p "${TEMP}/initrd-temp/etc/modules"
        for group_modules in ${!MODULES_*}; do
index e03956c053cfa407269da2144dd451573a99bcee..51e4a572e4e6fa452ec07a514e5e4ca5e7f1f533 100644 (file)
@@ -8,7 +8,7 @@ modules_dep_list()
        else
                KEXT=".o"
        fi
-        cat /lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\:  -f2
+       cat ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\:  -f2
 }
 
 # Pass module deps list
index 0e196d0e4c086ff41158a1162ed425fd4b52bd85..06e294d86dfd4a7dda4ac881eaf6afa7911bdfe8 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -146,9 +146,12 @@ then
        # Compile modules
        compile_modules
 
-       print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
-       [ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels
-       cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
+       if [ ${SAVE_CONFIG} -eq 1 ]
+       then
+               print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
+               [ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
+               cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
+       fi
 fi
 
 # Run callback
index 25b938f282a26c1a91b530f1321412c299cd2093..1fb96732be0d39bb94978f5f830464639267039f 100755 (executable)
@@ -23,6 +23,10 @@ BOOTSPLASH="yes"
 # Mount /boot automatically if it isn't mounted?
 MOUNTBOOT="yes"
 
+# Save the new configuration in /etc/kernels upon
+# successfull compilation
+SAVE_CONFIG="yes"
+
 # Use Color output in Genkernel?
 USECOLOR="yes"