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."
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
}
KNAME="genkernel"
fi
- get_KV
-
if [ "${CMD_KERNEL_MAKE}" != '' ]
then
KERNEL_MAKE="${CMD_KERNEL_MAKE}"
else
DMRAID=0
fi
+ #get_KV has to be last
+ get_KV
}
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..."
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
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..."
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
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
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
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