diff options
author | Tim Yamin <plasmaroo@gentoo.org> | 2005-04-22 17:02:55 +0000 |
---|---|---|
committer | Tim Yamin <plasmaroo@gentoo.org> | 2005-04-22 17:02:55 +0000 |
commit | c4e37560598d4dc59ef3619084f3822df71e8aef (patch) | |
tree | 1da2c49afce93c897c379d7d113d35341db5c799 /gen_package.sh | |
parent | fixed bug in scan delay so that it will work with both udev and devfs (diff) | |
download | genkernel-c4e37560598d4dc59ef3619084f3822df71e8aef.tar.gz genkernel-c4e37560598d4dc59ef3619084f3822df71e8aef.tar.bz2 genkernel-c4e37560598d4dc59ef3619084f3822df71e8aef.zip |
>> 3.2.0_beta1; now with extra froz-faktor <TM>.
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@190 67a159dc-881f-0410-a524-ba9dfbe2cb84
Diffstat (limited to 'gen_package.sh')
-rw-r--r-- | gen_package.sh | 152 |
1 files changed, 137 insertions, 15 deletions
diff --git a/gen_package.sh b/gen_package.sh index c62ccc27..0fb9fbfb 100644 --- a/gen_package.sh +++ b/gen_package.sh @@ -5,26 +5,148 @@ gen_minkernpackage() print_info 1 'Creating minimal kernel package' rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1 mkdir "${TEMP}/minkernpackage" || gen_die 'Could not make a directory for the kernel package!' - cd "${KERNEL_DIR}" - cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the kernel package!' - [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TEMP}/initrd-${KV}" "${TEMP}/minkernpackage/initrd-${KV}" || gen_die 'Could not copy the initrd for the kernel package!'; } + if [ "${CMD_KERNCACHE}" != "" ] + then + tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} kernel-${ARCH}-${KV} + tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} config-${ARCH}-${KV} + else + cd "${KERNEL_DIR}" + cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!' + cp ".config" "${TEMP}/kerncache/config-${ARCH}-${KV}" || gen_die 'Could not the copy kernel config for the min kernel package!' + fi + if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + then + [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TEMP}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; } + else + [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TEMP}/initrd-${KV}" "${TEMP}/minkernpackage/initrd-${ARCH}-${KV}" || gen_die 'Could not copy the initrd for the kernel package!'; } + fi cd "${TEMP}/minkernpackage" tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!' cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1 } +gen_modulespackage() +{ + print_info 1 'Creating modules package' + rm -rf "${TEMP}/modulespackage" > /dev/null 2>&1 + mkdir "${TEMP}/modulespackage" || gen_die 'Could not make a directory for the kernel package!' -gen_maxkernpackage() + if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ] + then + mkdir -p ${TEMP}/modulespackage/lib/modules + cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/modulespackage/lib/modules" + cd "${TEMP}/modulespackage" + tar -jcpf ${MODULESPACKAGE} * || gen_die 'Could not compress the modules package!' + else + print_info 1 "Could not create a modules package ${INSTALL_MOD_PATH}/lib/modules/${KV} was not found" + fi + cd "${TEMP}" && rm -rf "${TEMP}/modulespackage" > /dev/null 2>&1 +} +gen_kerncache() { - print_info 1 'Creating maximum kernel package' - rm -rf "${TEMP}/maxkernpackage" > /dev/null 2>&1 - mkdir "${TEMP}/maxkernpackage" || gen_die 'Could not make a directory for the kernel package!' + print_info 1 'Creating kernel cache' + rm -rf "${TEMP}/kerncache" > /dev/null 2>&1 + mkdir "${TEMP}/kerncache" || gen_die 'Could not make a directory for the kernel cache!' cd "${KERNEL_DIR}" - cp "${KERNEL_BINARY}" "${TEMP}/maxkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the kernel package!' - [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TEMP}/initrd-${KV}" "${TEMP}/maxkernpackage/initrd-${KV}" || gen_die 'Could not copy the initrd for the kernel package!'; } - cp "${KERNEL_DIR}/.config" "${TEMP}/maxkernpackage/kernel-config-${ARCH}-${KV}" - mkdir -p "${TEMP}/maxkernpackage/lib/modules/" - cp -r "/lib/modules/${KV}" "${TEMP}/maxkernpackage/lib/modules/" - cd "${TEMP}/maxkernpackage" - tar -jcpf ${MAXKERNPACKAGE} * || gen_die 'Could not compress the kernel package!' - cd "${TEMP}" && rm -rf "${TEMP}/maxkernpackage" > /dev/null 2>&1 + cp "${KERNEL_BINARY}" "${TEMP}/kerncache/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy kernel for the kernel package!' + cp "${KERNEL_DIR}/.config" "${TEMP}/kerncache/config-${ARCH}-${KV}" + cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}" + + echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config" + echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config" + echo "SUBLEVEL = ${SUB}" >> "${TEMP}/kerncache/kerncache.config" + echo "EXTRAVERSION = ${EXV}" >> "${TEMP}/kerncache/kerncache.config" + + mkdir -p "${TEMP}/kerncache/lib/modules/" + + if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ] + then + cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/kerncache/lib/modules" + fi + + cd "${TEMP}/kerncache" + tar -jcpf ${KERNCACHE} * || gen_die 'Could not compress the kernel package!' + cd "${TEMP}" && rm -rf "${TEMP}/kerncache" > /dev/null 2>&1 +} + +gen_kerncache_extract_kernel() +{ + [ -d ${tmp} ] && gen_die "temporary directory already exists! Exiting." + (umask 077 && mkdir ${tmp}) || { + gen_die "Could not create temporary directory! Exiting." + } + tar -f ${KERNCACHE} -C ${tmp} -xj + cp "${tmp}/kernel-${ARCH}-${KV}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || { + rm -r ${tmp} + gen_die 'Could not copy the kernel binary to /boot!' + } + cp "${tmp}/System.map-${ARCH}-${KV}" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || { + rm -r ${tmp} + gen_die 'Could not copy System.map to /boot!' + } + rm -r ${tmp} +} + +gen_kerncache_extract_modules() +{ + if [ -e "${KERNCACHE}" ] + then + print_info 1 'Extracting kerncache kernel modules' + if [ "${INSTALL_MOD_PATH}" != '' ] + then + tar xjf ${KERNCACHE} -C ${INSTALL_MOD_PATH} lib + else + tar xjf ${KERNCACHE} -C / lib + fi + fi +} + +gen_kerncache_is_valid() +{ + KERNCACHE_IS_VALID=0 + if [ "${CMD_NO_KERNEL_SOURCES}" = '1' ] + then + + BUILD_KERNEL=0 + # Can make this more secure .... + [ -d ${tmp} ] && gen_die "temporary directory already exists! Exiting." + (umask 077 && mkdir ${tmp}) || { + gen_die "Could not create temporary directory! Exiting." + } + + tar -xj -f ${KERNCACHE} -C ${tmp} + if [ -e ${tmp}/config-${ARCH}-${KV} -a -e ${tmp}/kernel-${ARCH}-${KV} ] + then + print_info 1 'Valid kernel cache found; no sources will be used' + KERNCACHE_IS_VALID=1 + fi + /bin/rm -r ${tmp} + else + if [ -e "${KERNCACHE}" ] + then + [ -d ${tmp} ] && gen_die "temporary directory already exists! Exiting." + (umask 077 && mkdir ${tmp}) || { + gen_die "Could not create temporary directory! Exiting." + + } + + tar -xj -f ${KERNCACHE} -C ${tmp} + if [ -e ${tmp}/config-${ARCH}-${KV} -a -e /${KERNEL_DIR}/.config ] + then + + test1=$(md5sum ${tmp}/config-${ARCH}-${KV} | cut -d " " -f 1) + test2=$(md5sum /${KERNEL_DIR}/.config | cut -d " " -f 1) + if [ "${test1}" == "${test2}" ] + then + + echo + print_info 1 "No kernel configuration change, skipping kernel build..." + echo + KERNCACHE_IS_VALID=1 + fi + fi + /bin/rm -r ${tmp} + fi + fi + export KERNCACHE_IS_VALID + return 1 } |