5 print_info 1 'Creating minimal kernel package'
6 rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
7 mkdir "${TEMP}/minkernpackage" || gen_die 'Could not make a directory for the kernel package!'
8 if [ "${CMD_KERNCACHE}" != "" ]
10 /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} kernel-${ARCH}-${KV}
11 /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} config-${ARCH}-${KV}
12 if [ "${KERNEL_BINARY_2}" != '' ]
14 /bin/tar -xj -C ${TEMP}/minkernpackage -f ${CMD_KERNCACHE} kernelz-${ARCH}-${KV}
18 cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!'
19 cp ".config" "${TEMP}/minkernpackage/config-${ARCH}-${KV}" || gen_die 'Could not the copy kernel config for the min kernel package!'
20 if [ "${KERNEL_BINARY_2}" != '' ]
22 cp "${KERNEL_BINARY_2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package"
26 if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ]
28 [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TMPDIR}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; }
30 [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TMPDIR}/initrd-${KV}" "${TEMP}/minkernpackage/initrd-${ARCH}-${KV}" || gen_die 'Could not copy the initrd for the kernel package!'; }
32 cd "${TEMP}/minkernpackage"
33 /bin/tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!'
34 cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
38 print_info 1 'Creating modules package'
39 rm -rf "${TEMP}/modulespackage" > /dev/null 2>&1
40 mkdir "${TEMP}/modulespackage" || gen_die 'Could not make a directory for the kernel package!'
42 if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ]
44 mkdir -p ${TEMP}/modulespackage/lib/modules
45 cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/modulespackage/lib/modules"
46 cd "${TEMP}/modulespackage"
47 /bin/tar -jcpf ${MODULESPACKAGE} * || gen_die 'Could not compress the modules package!'
49 print_info 1 "Could not create a modules package ${INSTALL_MOD_PATH}/lib/modules/${KV} was not found"
51 cd "${TEMP}" && rm -rf "${TEMP}/modulespackage" > /dev/null 2>&1
55 print_info 1 'Creating kernel cache'
56 rm -rf "${TEMP}/kerncache" > /dev/null 2>&1
57 mkdir "${TEMP}/kerncache" || gen_die 'Could not make a directory for the kernel cache!'
59 cp "${KERNEL_BINARY}" "${TEMP}/kerncache/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy kernel for the kernel package!'
60 cp "${KERNEL_DIR}/.config" "${TEMP}/kerncache/config-${ARCH}-${KV}"
61 cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}"
62 if [ "${KERNEL_BINARY_2}" != '' ]
64 cp "${KERNEL_BINARY_2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package"
67 echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config"
68 echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config"
69 echo "SUBLEVEL = ${SUB}" >> "${TEMP}/kerncache/kerncache.config"
70 echo "EXTRAVERSION = ${EXV}" >> "${TEMP}/kerncache/kerncache.config"
72 mkdir -p "${TEMP}/kerncache/lib/modules/"
74 if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ]
76 cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/kerncache/lib/modules"
79 cd "${TEMP}/kerncache"
80 /bin/tar -jcpf ${KERNCACHE} * || gen_die 'Could not compress the kernel package!'
81 cd "${TEMP}" && rm -rf "${TEMP}/kerncache" > /dev/null 2>&1
84 gen_kerncache_extract_kernel()
86 /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj
87 cp "${TEMP}/kernel-${ARCH}-${KV}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
88 if [ "${KERNEL_BINARY_2}" != '' ]
90 cp "${TEMP}/kernelz-${ARCH}-${KV}" "/boot/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
92 cp "${TEMP}/System.map-${ARCH}-${KV}" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to /boot!'
95 gen_kerncache_extract_modules()
97 if [ -e "${KERNCACHE}" ]
99 print_info 1 'Extracting kerncache kernel modules'
100 if [ "${INSTALL_MOD_PATH}" != '' ]
102 /bin/tar -xjf ${KERNCACHE} -C ${INSTALL_MOD_PATH} lib
104 /bin/tar -xjf ${KERNCACHE} -C / lib
109 gen_kerncache_is_valid()
112 if [ "${CMD_NO_KERNEL_SOURCES}" = '1' ]
116 # Can make this more secure ....
118 /bin/tar -xj -f ${KERNCACHE} -C ${TEMP}
119 if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${TEMP}/kernel-${ARCH}-${KV} ]
121 print_info 1 'Valid kernel cache found; no sources will be used'
125 if [ -e "${KERNCACHE}" ]
127 /bin/tar -xj -f ${KERNCACHE} -C ${TEMP}
128 if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e /${KERNEL_DIR}/.config ]
131 test1=$(md5sum ${TEMP}/config-${ARCH}-${KV} | cut -d " " -f 1)
132 test2=$(md5sum /${KERNEL_DIR}/.config | cut -d " " -f 1)
133 if [ "${test1}" == "${test2}" ]
137 print_info 1 "No kernel configuration change, skipping kernel build..."
144 export KERNCACHE_IS_VALID