From 5e44b9b03964a6e34a8ad5e0963bda250aa433a8 Mon Sep 17 00:00:00 2001 From: Tim Yamin Date: Wed, 21 Jul 2004 13:43:06 +0000 Subject: [PATCH] Adding a set of patches submitted by Martin "Parmus" Parm; bugs #57748, #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 | 31 +++++++++++++++++++++++++++++++ gen_compile.sh | 8 ++++---- gen_determineargs.sh | 29 +++++++++++++++++++++++++++++ gen_initrd.sh | 10 ++++++++-- gen_moddeps.sh | 2 +- genkernel | 9 ++++++--- genkernel.conf | 4 ++++ 7 files changed, 83 insertions(+), 10 deletions(-) diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 54cc8b3..87ae1b1 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -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= Location of the kernel sources" echo " --kernel-config= Kernel configuration file to use for compilation" + echo " --module-prefix= Prefix to kernel module destination, modules will" + echo " be installed in /lib/modules" echo " Low-Level Compile settings" echo " --kernel-cc= Compiler to use for kernel (e.g. distcc)" echo " --kernel-as= Assembler to use for kernel" @@ -48,11 +52,14 @@ longusage() { echo " --utils-ld= Linker to use for utils" echo " --utils-make= GNU Make to use for utils" echo " --makeopts= Make options such as -j2, etc." + echo " --mountboot Mount /boot automatically" + echo " --no-mountboot Don't mount /boot automatically" echo " Initialization" echo " --bootsplash= Force bootsplash using ." echo " --do-keymap-auto Forces keymap selection at boot." echo " --no-lvm2 Don't add in LVM2 support." echo " Internals" + echo " --tempdir= Location of Genkernel's temporary directory" 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_" @@ -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" diff --git a/gen_compile.sh b/gen_compile.sh index 256c109..2d226f9 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -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 } diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 74d7b1b..55053b2 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -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 } diff --git a/gen_initrd.sh b/gen_initrd.sh index 93303f1..c933223 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -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 diff --git a/gen_moddeps.sh b/gen_moddeps.sh index e03956c..51e4a57 100644 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -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 diff --git a/genkernel b/genkernel index 0e196d0..06e294d 100755 --- 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 diff --git a/genkernel.conf b/genkernel.conf index 25b938f..1fb9673 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -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" -- 2.26.2