8 if [ "${KERNEL_CC}" != "" ]
10 ARGS="CC=\"${KERNEL_CC}\""
12 if [ "${KERNEL_LD}" != "" ]
14 ARGS="${ARGS} LD=\"${KERNEL_LD}\""
17 if [ "${KERNEL_AS}" != "" ]
19 ARGS="${ARGS} AS=\"${KERNEL_AS}\""
30 if [ "${UTILS_CC}" != "" ]
32 ARGS="CC=\"${UTILS_CC}\""
34 if [ "${UTILS_LD}" != "" ]
36 ARGS="${ARGS} LD=\"${UTILS_LD}\""
39 if [ "${UTILS_AS}" != "" ]
41 ARGS="${ARGS} AS=\"${UTILS_AS}\""
49 if [ "${UTILS_CC}" != "" ]
51 export CC="${UTILS_CC}"
53 if [ "${UTILS_LD}" != "" ]
55 export LD="${UTILS_LD}"
57 if [ "${UTILS_AS}" != "" ]
59 export AS="${UTILS_AS}"
65 if [ "${UTILS_CC}" != "" ]
69 if [ "${UTILS_LD}" != "" ]
73 if [ "${UTILS_AS}" != "" ]
81 if [ "${KERNEL_CC}" != "" ]
83 export CC="${KERNEL_CC}"
85 if [ "${KERNEL_LD}" != "" ]
87 export LD="${KERNEL_LD}"
89 if [ "${KERNEL_AS}" != "" ]
91 export AS="${KERNEL_AS}"
97 if [ "${KERNEL_CC}" != "" ]
101 if [ "${KERNEL_LD}" != "" ]
105 if [ "${KERNEL_AS}" != "" ]
115 gen_die "compile_generic(): improper usage"
118 if [ "${2}" = "kernel" ]
121 elif [ "${2}" = "utils" ]
126 if [ "${DEBUGLEVEL}" -gt "1" ]
128 # Output to stdout and debugfile
129 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
130 ${MAKE} ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
133 # Output to debugfile only
134 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
135 ${MAKE} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
138 [ "${RET}" -ne "0" ] && gen_die "compile of failed"
140 if [ "${2}" = "kernel" ]
143 elif [ "${2}" = "utils" ]
150 extract_dietlibc_bincache() {
151 print_info 1 "extracting dietlibc bincache"
154 rm -rf "${TEMP}/diet" > /dev/null
155 tar -jxpf "${DIETLIBC_BINCACHE}" || gen_die "Could not extract dietlibc bincache"
156 [ ! -d "${TEMP}/diet" ] && gen_die "${TEMP}/diet directory not found"
160 clean_dietlibc_bincache() {
161 print_info 1 "cleaning up dietlibc bincache"
164 rm -rf "${TEMP}/diet" > /dev/null
170 # Only make dep for 2.4 kernels
171 if [ "${PAT}" -gt "4" ]
173 print_info 1 "kernel: skipping make dep for non 2.4 kernels"
175 print_info 1 "kernel: Making dependancies for linux ${KV}"
177 compile_generic "dep" kernel
182 print_info 1 "kernel: Starting compile of linux ${KV} modules"
184 compile_generic "modules" kernel
185 compile_generic "modules_install" kernel
189 [ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined. Don't know how to compile kernel for arch."
191 print_info 1 "kernel: Starting compile of linux ${KV} ${KERNEL_MAKE}"
192 compile_generic "${KERNEL_MAKE}" kernel
193 cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy kernel binary to boot"
197 if [ ! -f "${BUSYBOX_BINCACHE}" ]
199 [ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}"
200 [ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}"
202 rm -rf ${BUSYBOX_DIR} > /dev/null
203 tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball"
204 [ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} invalid"
205 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
207 # Busybox and dietlibc don't play nice right now
208 # if [ "${USE_DIETLIBC}" -eq "1" ]
210 # extract_dietlibc_bincache
211 # OLD_CC="${UTILS_CC}"
212 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
214 print_info 1 "Busybox: make oldconfig"
215 compile_generic "oldconfig" utils
216 print_info 1 "Busybox: make all"
217 compile_generic "all" utils
218 # Busybox and dietlibc don't play nice right now
219 # if [ "${USE_DIETLIBC}" -eq "1" ]
221 # clean_dietlibc_bincache
222 # UTILS_CC="${OLD_CC}"
224 print_info 1 "Busybox: copying to bincache"
225 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] && gen_die "busybox executable does not exist after compile, error"
226 strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox"
227 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "bzip2 compression of busybox failed"
228 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" ] && gen_die "could not find compressed busybox binary"
229 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die "could not copy busybox binary to arch package directory, does the directory exist?"
231 print_info 1 "Busybox: cleaning up"
233 rm -rf "${BUSYBOX_DIR}" > /dev/null
235 print_info 1 "Busybox: Found bincache at ${BUSYBOX_BINCACHE}"
241 if [ ! -f "${MODUTILS_BINCACHE}" ]
243 [ ! -f "${MODUTILS_SRCTAR}" ] && gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}"
245 rm -rf "${MODUTILS_DIR}"
246 tar -jxpf "${MODUTILS_SRCTAR}"
247 [ ! -d "${MODUTILS_DIR}" ] && gen_die "Modutils directory ${MODUTILS_DIR} invalid"
249 print_info 1 "modutils: configure"
251 if [ "${USE_DIETLIBC}" -eq "1" ]
253 extract_dietlibc_bincache
255 UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
259 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configure of modutils failed"
262 print_info 1 "modutils: make all"
263 compile_generic "all" utils
265 if [ "${USE_DIETLIBC}" -eq "1" ]
267 clean_dietlibc_bincache
271 print_info 1 "modutils: copying to bincache"
272 [ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] && gen_die "insmod.static does not exist after compilation of modutils"
273 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "could not strip insmod.static"
274 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "compression of insmod.static failed"
275 [ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
276 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" || gen_die "could not move compress binary to bincache"
278 print_info 1 "modutils: cleaning up"
280 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
282 print_info 1 "modutils: Found bincache at ${MODUTILS_BINCACHE}"
286 compile_module_init_tools() {
288 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
290 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] && gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
292 rm -rf "${MODULE_INIT_TOOLS_DIR}"
293 tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
294 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid"
295 cd "${MODULE_INIT_TOOLS_DIR}"
296 print_info 1 "module-init-tools: configure"
298 if [ "${USE_DIETLIBC}" -eq "1" ]
300 extract_dietlibc_bincache
302 UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
306 ./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed"
308 print_info 1 "module-init-tools: make all"
309 compile_generic "all" utils
311 if [ "${USE_DIETLIBC}" -eq "1" ]
313 clean_dietlibc_bincache
317 print_info 1 "module-init-tools: copying to bincache"
318 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] && gen_die "insmod.static does not exist after compilation of module-init-tools"
319 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "could not strip insmod.static"
320 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "compression of insmod.static failed"
321 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
322 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" || gen_die "could not move compressed binary to bincache"
324 print_info 1 "module-init-tools: cleaning up"
326 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
328 print_info 1 "module-init-tools: Found bincache at ${MODULE_INIT_TOOLS_BINCACHE}"
334 if [ ! -f "${DEVFSD_BINCACHE}" -o ! -f "${DEVFSD_CONF_BINCACHE}" ]
336 [ ! -f "${DEVFSD_SRCTAR}" ] && gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
338 rm -rf "${DEVFSD_DIR}"
339 tar -jxpf "${DEVFSD_SRCTAR}"
340 [ ! -d "${DEVFSD_DIR}" ] && gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
343 if [ "${USE_DIETLIBC}" -eq "1" ]
345 extract_dietlibc_bincache
347 UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
350 print_info 1 "devfsd: make all"
352 if [ "${USE_DIETLIBC}" -eq "1" ]
354 compile_generic "has_dlopen=0 has_rpcsvc=0" utils
356 compile_generic "LDFLAGS=-static" utils
359 if [ "${USE_DIETLIBC}" -eq "1" ]
361 clean_dietlibc_bincache
365 print_info 1 "devfsd: copying to bincache"
366 [ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] && gen_die "devfsd executable does not exist after compilation of devfsd"
367 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die "could not strip devfsd"
368 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die "compression of devfsd failed"
369 [ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] && gen_die "could not find compressed devfsd.bz2 binary"
370 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die "could not move compressed binary to bincache"
372 [ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] && gen_die "devfsd.conf does not exist after compilation of devfsd"
373 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die "compression of devfsd.conf failed"
374 [ ! -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" ] && gen_die "could not find compressed devfsd.conf.bz2 binary"
375 mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die "could not move compressed binary to bincache"
377 print_info 1 "devfsd: cleaning up"
379 rm -rf "${DEVFSD_DIR}" > /dev/null
381 print_info 1 "devfsd: Found bincache at ${DEVFSD_BINCACHE} and ${DEVFSD_CONF_BINCACHE}"
390 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
391 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
392 if [ "${BUILD_DIETLIBC}" -eq "0" ]
394 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
395 if [ "${TEMP}" != "${ORIGTEMP}" ]
397 print_info 1 "Dietlibc: Bincache exists, but current temp directory is different than original. Rebuilding."
402 if [ "${BUILD_DIETLIBC}" -eq "1" ]
404 [ ! -f "${DIETLIBC_SRCTAR}" ] && gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
406 rm -rf "${DIETLIBC_DIR}" > /dev/null
407 tar -jxpf ${DIETLIBC_SRCTAR} || gen_die "Could not extract dietlibc source tarball"
408 [ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid"
410 print_info 1 "Dietlibc: make"
411 compile_generic "prefix=${TEMP}/diet" utils
412 print_info 1 "Dietlibc: installing"
413 compile_generic "prefix=${TEMP}/diet install" utils
414 print_info 1 "Dietlibc: copying to bincache"
416 tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin"
417 [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "bincache not created"
418 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
420 print_info 1 "dietlibc: cleaning up"
422 rm -rf "${DIETLIBC_DIR}" > /dev/null
423 rm -rf "${TEMP}/diet" > /dev/null
425 print_info 1 "Dietlibc: Found bincache at ${DIETLIBC_BINCACHE}"