From 8ec05b8cbf03318ada7200df61875949afea3581 Mon Sep 17 00:00:00 2001 From: Eric Edgar Date: Thu, 16 Jun 2005 18:20:50 +0000 Subject: [PATCH] Localversion changes to kerncache, and added a sleep statement so modprobe loop has a chance to work git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@210 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_determineargs.sh | 22 ++++++++++++++++++---- gen_initramfs.sh | 6 +++--- gen_initrd.sh | 4 ++-- gen_moddeps.sh | 5 ++++- genkernel | 8 +++++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 2d79d54..826d4fc 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -14,7 +14,9 @@ get_KV() { PAT=`grep ^PATCHLEVEL\ \= ${tmp}/kerncache.config | awk '{ print $3 };'` SUB=`grep ^SUBLEVEL\ \= ${tmp}/kerncache.config | awk '{ print $3 };'` EXV=`grep ^EXTRAVERSION\ \= ${tmp}/kerncache.config | sed -e "s/EXTRAVERSION =//" -e "s/ //g"` - KV=${VER}.${PAT}.${SUB}${EXV} + LOV=`grep ^CONFIG_LOCALVERSION\= ${tmp}/kerncache.config | sed -e "s/CONFIG_LOCALVERSION=\"\(.*\)\"/\1/"` + KV=${VER}.${PAT}.${SUB}${EXV}${LOV} + else rm -r ${tmp} gen_die "Could not find kerncache.config in the kernel cache! Exiting." @@ -22,11 +24,23 @@ get_KV() { rm -r ${tmp} else + #configure the kernel + #if BUILD_KERNEL=0 then assume --no-clean, menuconfig is cleared, VER=`grep ^VERSION\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` PAT=`grep ^PATCHLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g"` - KV=${VER}.${PAT}.${SUB}${EXV} + cd ${KERNEL_DIR} + compile_generic prepare0 kernel > /dev/null 2>&1 + cd - > /dev/null 2>&1 + if [ -f ${KERNEL_DIR}/include/linux/version.h ] + then + UTS_RELEASE=`grep UTS_RELEASE ${KERNEL_DIR}/include/linux/version.h | sed -e 's/#define UTS_RELEASE "\(.*\)"/\1/'` + LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` + KV=${VER}.${PAT}.${SUB}${EXV}${LOV} + else + KV=${VER}.${PAT}.${SUB}${EXV} + fi fi } @@ -72,8 +86,6 @@ determine_real_args() { KNAME="genkernel" fi - get_KV - if [ "${CMD_KERNEL_MAKE}" != '' ] then KERNEL_MAKE="${CMD_KERNEL_MAKE}" @@ -331,4 +343,6 @@ determine_real_args() { else DMRAID=0 fi + #get_KV has to be last + get_KV } diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 09525e2..77cc2cc 100644 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -290,7 +290,7 @@ create_initramfs_modules() { mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}" 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}" 2>/dev/null| head -n 1 ` if [ -z "${mymod}" ] then print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..." @@ -300,8 +300,8 @@ create_initramfs_modules() { print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..." cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp" done - - cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp + + cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules" for group_modules in ${!MODULES_*}; do diff --git a/gen_initrd.sh b/gen_initrd.sh index 458212e..18ae940 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -217,7 +217,7 @@ create_initrd_modules() { 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}" 2>/dev/null| head -n 1` if [ -z "${mymod}" ] then print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..." @@ -227,7 +227,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 2>/dev/null mkdir -p "${TEMP}/initrd-temp/etc/modules" for group_modules in ${!MODULES_*}; do diff --git a/gen_moddeps.sh b/gen_moddeps.sh index 51e4a57..840b2ca 100644 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -8,7 +8,10 @@ modules_dep_list() else KEXT=".o" fi - cat ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2 + if [ -f ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep ] + then + cat ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\: -f2 + fi } # Pass module deps list diff --git a/genkernel b/genkernel index 72ebf4d..ef7fc2a 100755 --- a/genkernel +++ b/genkernel @@ -80,9 +80,10 @@ then if ! has_loop then modprobe loop 2>/dev/null + sleep 3 if ! has_loop then - print_error 1 'Your kernel does not appear to have loop device support.' + print_error 1 'The build-host kernel does not appear to have loop device support.' print_error 1 'Please load loop support before running genkernel!' gen_die 'Load loop support!' else @@ -154,15 +155,20 @@ then echo fi + KERNCACHE_IS_VALID=0 if [ "${KERNCACHE}" != "" ] then gen_kerncache_is_valid fi + if [ ${BUILD_KERNEL} -eq 1 -a "${KERNCACHE_IS_VALID}" == "0" ] then # Configure kernel config_kernel + + # KV may have changed due to the configuration + get_KV # Make deps compile_dep -- 2.26.2