5 if [ "${NO_KERNEL_SOURCES}" = '1' -a -e "${KERNCACHE}" ]
7 /bin/tar -xj -C ${TEMP} -f ${KERNCACHE} kerncache.config
8 if [ -e ${TEMP}/kerncache.config ]
10 VER=`grep ^VERSION\ \= ${TEMP}/kerncache.config | awk '{ print $3 };'`
11 PAT=`grep ^PATCHLEVEL\ \= ${TEMP}/kerncache.config | awk '{ print $3 };'`
12 SUB=`grep ^SUBLEVEL\ \= ${TEMP}/kerncache.config | awk '{ print $3 };'`
13 EXV=`grep ^EXTRAVERSION\ \= ${TEMP}/kerncache.config | sed -e "s/EXTRAVERSION =//" -e "s/ //g"`
14 LOV=`grep ^CONFIG_LOCALVERSION\= ${TEMP}/kerncache.config | sed -e "s/CONFIG_LOCALVERSION=\"\(.*\)\"/\1/"`
15 KV=${VER}.${PAT}.${SUB}${EXV}${LOV}
17 gen_die "Could not find kerncache.config in the kernel cache! Exiting."
20 # Configure the kernel
21 # If BUILD_KERNEL=0 then assume --no-clean, menuconfig is cleared
23 if [ ! -f "${KERNEL_DIR}"/Makefile ]
25 gen_die "Kernel Makefile (${KERNEL_DIR}/Makefile) missing. Maybe re-install the kernel sources."
28 VER=`grep ^VERSION\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
29 PAT=`grep ^PATCHLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
30 SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
31 EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'`
35 # Handle O= build directories
36 KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'`
37 [ -z "${KERNEL_SOURCE_DIR}" ] && gen_die "Deriving \${KERNEL_SOURCE_DIR} failed"
38 SUB=`grep ^SUBLEVEL\ \= ${KERNEL_SOURCE_DIR}/Makefile | awk '{ print $3 };'`
39 EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_SOURCE_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'`
43 #compile_generic prepare kernel > /dev/null 2>&1
45 [ -f "${KERNEL_DIR}/include/linux/version.h" ] && \
46 VERSION_SOURCE="${KERNEL_DIR}/include/linux/version.h"
47 [ -f "${KERNEL_DIR}/include/linux/utsrelease.h" ] && \
48 VERSION_SOURCE="${KERNEL_DIR}/include/linux/utsrelease.h"
49 # Handle new-style releases where version.h doesn't have UTS_RELEASE
50 if [ -f ${KERNEL_DIR}/include/config/kernel.release ]
52 UTS_RELEASE=`cat ${KERNEL_DIR}/include/config/kernel.release`
53 LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"`
54 KV=${VER}.${PAT}.${SUB}${EXV}${LOV}
55 elif [ -n "${VERSION_SOURCE}" ]
57 UTS_RELEASE=`grep UTS_RELEASE ${VERSION_SOURCE} | sed -e 's/#define UTS_RELEASE "\(.*\)"/\1/'`
58 LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"`
59 KV=${VER}.${PAT}.${SUB}${EXV}${LOV}
61 LCV=`grep ^CONFIG_LOCALVERSION= ${KERNEL_DIR}/.config | sed -r -e "s/.*=\"(.*)\"/\1/"`
62 KV=${VER}.${PAT}.${SUB}${EXV}${LCV}
67 determine_real_args() {
68 print_info 4 "Resolving config file, command line, and arch default settings."
70 # Config File Command Line Arch Default
71 # ----------- ------------ ------------
72 set_config_with_override 2 DEBUGFILE CMD_DEBUGFILE
73 set_config_with_override 2 KERNEL_DIR CMD_KERNEL_DIR "${DEFAULT_KERNEL_SOURCE}"
74 set_config_with_override 1 NO_KERNEL_SOURCES CMD_NO_KERNEL_SOURCES
75 set_config_with_override 2 KNAME CMD_KERNNAME "genkernel"
77 set_config_with_override 2 MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS"
78 set_config_with_override 2 KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE"
79 set_config_with_override 2 UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE"
80 set_config_with_override 2 KERNEL_CC CMD_KERNEL_CC "$DEFAULT_KERNEL_CC"
81 set_config_with_override 2 KERNEL_LD CMD_KERNEL_LD "$DEFAULT_KERNEL_LD"
82 set_config_with_override 2 KERNEL_AS CMD_KERNEL_AS "$DEFAULT_KERNEL_AS"
83 set_config_with_override 2 UTILS_CC CMD_UTILS_CC "$DEFAULT_UTILS_CC"
84 set_config_with_override 2 UTILS_LD CMD_UTILS_LD "$DEFAULT_UTILS_LD"
85 set_config_with_override 2 UTILS_AS CMD_UTILS_AS "$DEFAULT_UTILS_AS"
87 set_config_with_override 2 KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
88 set_config_with_override 2 UTILS_CROSS_COMPILE CMD_UTILS_CROSS_COMPILE
89 set_config_with_override 2 BOOTDIR CMD_BOOTDIR "/boot"
91 set_config_with_override 1 SPLASH CMD_SPLASH
92 set_config_with_override 1 POSTCLEAR CMD_POSTCLEAR
93 set_config_with_override 1 MRPROPER CMD_MRPROPER
94 set_config_with_override 1 MENUCONFIG CMD_MENUCONFIG
95 set_config_with_override 1 CLEAN CMD_CLEAN
97 set_config_with_override 2 MINKERNPACKAGE CMD_MINKERNPACKAGE
98 set_config_with_override 2 MODULESPACKAGE CMD_MODULESPACKAGE
99 set_config_with_override 2 KERNCACHE CMD_KERNCACHE
100 set_config_with_override 1 NORAMDISKMODULES CMD_NORAMDISKMODULES
101 set_config_with_override 1 ALLRAMDISKMODULES CMD_ALLRAMDISKMODULES
102 set_config_with_override 2 INITRAMFS_OVERLAY CMD_INITRAMFS_OVERLAY
103 set_config_with_override 1 MOUNTBOOT CMD_MOUNTBOOT
104 set_config_with_override 1 BUILD_STATIC CMD_STATIC
105 set_config_with_override 1 SAVE_CONFIG CMD_SAVE_CONFIG
106 set_config_with_override 1 SYMLINK CMD_SYMLINK
107 set_config_with_override 2 INSTALL_MOD_PATH CMD_INSTALL_MOD_PATH
108 set_config_with_override 1 OLDCONFIG CMD_OLDCONFIG
109 set_config_with_override 1 LVM CMD_LVM
110 set_config_with_override 1 EVMS CMD_EVMS
111 set_config_with_override 1 DMRAID CMD_DMRAID
112 set_config_with_override 1 ISCSI CMD_ISCSI
113 set_config_with_override 1 BUSYBOX CMD_BUSYBOX "yes"
114 set_config_with_override 1 UNIONFS CMD_UNIONFS
115 set_config_with_override 1 NETBOOT CMD_NETBOOT
116 set_config_with_override 2 REAL_ROOT CMD_REAL_ROOT
117 set_config_with_override 1 DISKLABEL CMD_DISKLABEL
118 set_config_with_override 1 LUKS CMD_LUKS
119 set_config_with_override 1 GPG CMD_GPG
120 set_config_with_override 1 MDADM CMD_MDADM
121 set_config_with_override 1 MULTIPATH CMD_MULTIPATH
122 set_config_with_override 1 FIRMWARE CMD_FIRMWARE
123 set_config_with_override 2 FIRMWARE_DIR CMD_FIRMWARE_DIR "/lib/firmware"
124 set_config_with_override 2 FIRMWARE_FILES CMD_FIRMWARE_FILES
125 set_config_with_override 1 INTEGRATED_INITRAMFS CMD_INTEGRATED_INITRAMFS
126 set_config_with_override 1 GENZIMAGE CMD_GENZIMAGE
127 set_config_with_override 1 KEYMAP CMD_KEYMAP "yes"
128 set_config_with_override 1 DOKEYMAPAUTO CMD_DOKEYMAPAUTO
129 set_config_with_override 2 BUSYBOX_CONFIG CMD_BUSYBOX_CONFIG
131 BOOTDIR=`arch_replace "${BOOTDIR}"`
132 BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
134 CACHE_DIR=`arch_replace "${CACHE_DIR}"`
135 BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
136 DEVICE_MAPPER_BINCACHE=`cache_replace "${DEVICE_MAPPER_BINCACHE}"`
137 LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
138 DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
139 ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
140 BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
141 FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
142 UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
143 GPG_BINCACHE=`cache_replace "${GPG_BINCACHE}"`
145 DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
146 BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
147 BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
148 DEVICE_MAPPER_BINCACHE=`arch_replace "${DEVICE_MAPPER_BINCACHE}"`
149 LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
150 DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
151 ISCSI_BINCACHE=`arch_replace "${ISCSI_BINCACHE}"`
152 BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
153 FUSE_BINCACHE=`arch_replace "${FUSE_BINCACHE}"`
154 UNIONFS_FUSE_BINCACHE=`arch_replace "${UNIONFS_FUSE_BINCACHE}"`
155 GPG_BINCACHE=`arch_replace "${GPG_BINCACHE}"`
157 if [ -n "${CMD_BOOTLOADER}" ]
159 BOOTLOADER="${CMD_BOOTLOADER}"
160 if [ "${CMD_BOOTLOADER}" != "${CMD_BOOTLOADER/:/}" ]
162 BOOTFS=`echo "${CMD_BOOTLOADER}" | cut -f2- -d:`
163 BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
167 if [ "${NO_KERNEL_SOURCES}" != "1" ]
169 if [ ! -d ${KERNEL_DIR} ]
171 gen_die "kernel source directory \"${KERNEL_DIR}\" was not found!"
175 if [ -z "${KERNCACHE}" ]
177 if [ "${KERNEL_DIR}" = '' -a "${NO_KERNEL_SOURCES}" != "1" ]
179 gen_die 'No kernel source directory!'
181 if [ ! -e "${KERNEL_DIR}" -a "${NO_KERNEL_SOURCES}" != "1" ]
183 gen_die 'No kernel source directory!'
186 if [ "${KERNEL_DIR}" = '' ]
188 gen_die 'Kernel Cache specified but no kernel tree to verify against!'
192 # Special case: If --no-clean is specified on the command line,
193 # imply --no-mrproper.
194 if [ "${CMD_CLEAN}" != '' ]
202 if [ -n "${MINKERNPACKAGE}" ]
204 mkdir -p `dirname ${MINKERNPACKAGE}`
207 if [ -n "${MODULESPACKAGE}" ]
209 mkdir -p `dirname ${MODULESPACKAGE}`
212 if [ -n "${KERNCACHE}" ]
214 mkdir -p `dirname ${KERNCACHE}`
217 if ! isTrue "${BUILD_RAMDISK}"
219 INTEGRATED_INITRAMFS=0