8 if [ "${KERNEL_CC}" != '' ]
10 ARGS="CC=\"${KERNEL_CC}\""
12 if [ "${KERNEL_LD}" != '' ]
14 ARGS="${ARGS} LD=\"${KERNEL_LD}\""
16 if [ "${KERNEL_AS}" != '' ]
18 ARGS="${ARGS} AS=\"${KERNEL_AS}\""
21 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
23 ARGS="${ARGS} CROSS_COMPILE=\"${KERNEL_CROSS_COMPILE}\""
34 if [ "${UTILS_CC}" != '' ]
36 ARGS="CC=\"${UTILS_CC}\""
38 if [ "${UTILS_LD}" != '' ]
40 ARGS="${ARGS} LD=\"${UTILS_LD}\""
42 if [ "${UTILS_AS}" != '' ]
44 ARGS="${ARGS} AS=\"${UTILS_AS}\""
52 if [ "${UTILS_CC}" != '' ]
54 export CC="${UTILS_CC}"
56 if [ "${UTILS_LD}" != '' ]
58 export LD="${UTILS_LD}"
60 if [ "${UTILS_AS}" != '' ]
62 export AS="${UTILS_AS}"
68 if [ "${UTILS_CC}" != '' ]
72 if [ "${UTILS_LD}" != '' ]
76 if [ "${UTILS_AS}" != '' ]
84 if [ "${KERNEL_CC}" != '' ]
86 export CC="${KERNEL_CC}"
88 if [ "${KERNEL_LD}" != '' ]
90 export LD="${KERNEL_LD}"
92 if [ "${KERNEL_AS}" != '' ]
94 export AS="${KERNEL_AS}"
96 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
98 export CROSS_COMPILE="${KERNEL_CROSS_COMPILE}"
104 if [ "${KERNEL_CC}" != '' ]
108 if [ "${KERNEL_LD}" != '' ]
112 if [ "${KERNEL_AS}" != '' ]
116 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
125 gen_die 'compile_generic(): improper usage!'
127 if [ "${2}" = 'kernel' ] || [ "${2}" = 'runtask' ]
131 elif [ "${2}" = 'utils' ]
137 kernel) ARGS="`compile_kernel_args`" ;;
138 utils) ARGS="`compile_utils_args`" ;;
139 *) ARGS="" ;; # includes runtask
143 # the eval usage is needed in the next set of code
144 # as ARGS can contain spaces and quotes, eg:
145 # ARGS='CC="ccache gcc"'
146 if [ "${2}" == 'runtask' ]
148 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${1}" 1 0 1
149 eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${1}
151 elif [ "${DEBUGLEVEL}" -gt "1" ]
153 # Output to stdout and debugfile
154 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
155 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} 2>&1 | tee -a ${DEBUGFILE}
158 # Output to debugfile only
159 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
160 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} >> ${DEBUGFILE} 2>&1
163 [ "${RET}" -ne '0' ] &&
164 gen_die "Failed to compile the \"${1}\" target..."
168 if [ "${2}" = 'kernel' ]
171 elif [ "${2}" = 'utils' ]
177 extract_dietlibc_bincache() {
179 rm -rf "${TEMP}/diet" > /dev/null
180 /bin/tar -jxpf "${DIETLIBC_BINCACHE}" ||
181 gen_die 'Could not extract dietlibc bincache!'
182 [ ! -d "${TEMP}/diet" ] &&
183 gen_die "${TEMP}/diet directory not found!"
187 clean_dietlibc_bincache() {
189 rm -rf "${TEMP}/diet" > /dev/null
194 # Only run ``make dep'' for 2.4 kernels
195 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
197 print_info 1 "kernel: >> Making dependencies..."
199 compile_generic dep kernel
204 print_info 1 " >> Compiling ${KV} modules..."
206 compile_generic modules kernel
207 export UNAME_MACHINE="${ARCH}"
208 # On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures
209 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
211 MAKEOPTS_SAVE="${MAKEOPTS}"
212 MAKEOPTS="${MAKEOPTS_SAVE/-j?/-j1}"
214 [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
215 compile_generic "modules_install" kernel
216 [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] && MAKEOPTS="${MAKEOPTS_SAVE}"
222 [ "${KERNEL_MAKE}" = '' ] &&
223 gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
225 print_info 1 " >> Compiling ${KV} ${KERNEL_MAKE_DIRECTIVE/_install/ [ install ]/}..."
226 compile_generic "${KERNEL_MAKE_DIRECTIVE}" kernel
227 if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
229 print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
230 compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
232 if ! isTrue "${CMD_NOINSTALL}"
234 cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" ||
235 gen_die 'Could not copy the kernel binary to /boot!'
236 cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" ||
237 gen_die 'Could not copy System.map to /boot!'
238 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
240 cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" ||
241 gen_die 'Could not copy the kernelz binary to /boot!'
244 cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
245 gen_die "Could not copy the kernel binary to ${TMPDIR}!"
246 cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
247 gen_die "Could not copy System.map to ${TMPDIR}!"
248 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
250 cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
251 gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
256 compile_unionfs_modules() {
257 if [ ! -f "${UNIONFS_MODULES_BINCACHE}" ]
259 [ -f "${UNIONFS_SRCTAR}" ] ||
260 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
262 rm -rf ${UNIONFS_DIR} > /dev/null
263 rm -rf unionfs > /dev/null
265 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
266 gen_die 'Could not extract unionfs source tarball!'
267 [ -d "${UNIONFS_DIR}" ] ||
268 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
270 print_info 1 'unionfs modules: >> Compiling...'
271 sed -i Makefile -e "s|LINUXSRC =.*|LINUXSRC =${KERNEL_DIR}|g"
273 #Fix for hardened/selinux systems to have extened attributes
275 sed -i Makefile -e "s|# \(EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID\)|\1|g"
277 if [ "${PAT}" -ge '6' ]
279 # Setup the kernel sources to compile modules
281 compile_generic "modules_prepare" kernel
285 compile_generic unionfs2.6 kernel
287 compile_generic unionfs2.4 kernel
289 print_info 1 'unionfs: >> Copying to cache...'
291 mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
295 cp unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
297 cp unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
301 /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
302 gen_die 'Could not create unionfs modules binary cache'
305 rm -rf "${UNIONFS_DIR}" > /dev/null
306 rm -rf unionfs > /dev/null
310 compile_unionfs_utils() {
311 if [ ! -f "${UNIONFS_BINCACHE}" ]
313 [ -f "${UNIONFS_SRCTAR}" ] ||
314 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
316 rm -rf ${UNIONFS_DIR} > /dev/null
317 rm -rf unionfs > /dev/null
318 mkdir -p unionfs/sbin
319 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
320 gen_die 'Could not extract unionfs source tarball!'
321 [ -d "${UNIONFS_DIR}" ] ||
322 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
324 print_info 1 'unionfs tools: >> Compiling...'
325 sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g'
326 compile_generic utils utils
328 print_info 1 'unionfs: >> Copying to cache...'
329 strip uniondbg unionctl
330 cp uniondbg ${TEMP}/unionfs/sbin/ ||
331 gen_die 'Could not copy the uniondbg binary to the tmp directory'
332 cp unionctl ${TEMP}/unionfs/sbin/ ||
333 gen_die 'Could not copy the unionctl binary to the tmp directory'
335 /bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
336 gen_die 'Could not create unionfs tools binary cache'
339 rm -rf "${UNIONFS_DIR}" > /dev/null
340 rm -rf unionfs > /dev/null
345 if [ ! -f "${BUSYBOX_BINCACHE}" ]
347 [ -f "${BUSYBOX_SRCTAR}" ] ||
348 gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
349 [ -f "${BUSYBOX_CONFIG}" ] ||
350 gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
352 rm -rf ${BUSYBOX_DIR} > /dev/null
353 /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
354 gen_die 'Could not extract busybox source tarball!'
355 [ -d "${BUSYBOX_DIR}" ] ||
356 gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
357 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
358 sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
360 print_info 1 'busybox: >> Configuring...'
361 yes '' 2>/dev/null | compile_generic oldconfig utils
362 print_info 1 'busybox: >> Compiling...'
363 compile_generic all utils
364 print_info 1 'busybox: >> Copying to cache...'
365 [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
366 gen_die 'Busybox executable does not exist!'
367 strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
368 gen_die 'Could not strip busybox binary!'
369 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" ||
370 gen_die 'bzip2 compression of busybox failed!'
371 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" ||
372 gen_die 'Could not copy the busybox binary to the package directory, does the directory exist?'
375 rm -rf "${BUSYBOX_DIR}" > /dev/null
380 compile_device_mapper
381 if [ ! -f "${LVM2_BINCACHE}" ]
383 [ -f "${LVM2_SRCTAR}" ] ||
384 gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
386 rm -rf ${LVM2_DIR} > /dev/null
387 /bin/tar -zxpf ${LVM2_SRCTAR} ||
388 gen_die 'Could not extract LVM2 source tarball!'
389 [ -d "${LVM2_DIR}" ] ||
390 gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
391 rm -rf "${TEMP}/device-mapper" > /dev/null
392 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
393 gen_die "Could not extract device-mapper binary cache!";
396 print_info 1 'lvm2: >> Configuring...'
397 LDFLAGS="-L${TEMP}/device-mapper/lib" \
398 CFLAGS="-I${TEMP}/device-mapper/include" \
399 CPPFLAGS="-I${TEMP}/device-mapper/include" \
400 ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
401 gen_die 'Configure of lvm2 failed!'
402 print_info 1 'lvm2: >> Compiling...'
403 compile_generic '' utils
404 compile_generic 'install' utils
407 print_info 1 ' >> Copying to bincache...'
408 strip "sbin/lvm.static" ||
409 gen_die 'Could not strip lvm.static!'
410 /bin/tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
411 gen_die 'Could not create binary cache'
414 rm -rf "${TEMP}/device-mapper" > /dev/null
415 rm -rf "${LVM2_DIR}" lvm2
420 compile_device_mapper
421 if [ ! -f "${DMRAID_BINCACHE}" ]
423 [ -f "${DMRAID_SRCTAR}" ] ||
424 gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
426 rm -rf ${DMRAID_DIR} > /dev/null
427 /bin/tar -jxpf ${DMRAID_SRCTAR} ||
428 gen_die 'Could not extract DMRAID source tarball!'
429 [ -d "${DMRAID_DIR}" ] ||
430 gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
431 rm -rf "${TEMP}/device-mapper" > /dev/null
432 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
433 gen_die "Could not extract device-mapper binary cache!";
436 print_info 1 'dmraid: >> Configuring...'
438 LDFLAGS="-L${TEMP}/device-mapper/lib" \
439 CFLAGS="-I${TEMP}/device-mapper/include" \
440 CPPFLAGS="-I${TEMP}/device-mapper/include" \
441 ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
442 gen_die 'Configure of dmraid failed!'
443 mkdir -p "${TEMP}/dmraid"
444 print_info 1 'dmraid: >> Compiling...'
445 compile_generic '' utils
446 #compile_generic 'install' utils
447 mkdir ${TEMP}/dmraid/sbin
448 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
449 print_info 1 ' >> Copying to bincache...'
451 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
452 gen_die 'Could not create binary cache'
455 rm -rf "${TEMP}/device-mapper" > /dev/null
456 rm -rf "${DMRAID_DIR}" dmraid
461 # I've disabled dietlibc support for the time being since the
462 # version we use misses a few needed system calls.
465 if [ ! -f "${MODUTILS_BINCACHE}" ]
467 [ ! -f "${MODUTILS_SRCTAR}" ] &&
468 gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
470 rm -rf "${MODUTILS_DIR}"
471 /bin/tar -jxpf "${MODUTILS_SRCTAR}"
472 [ ! -d "${MODUTILS_DIR}" ] &&
473 gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
475 print_info 1 "modutils: >> Configuring..."
477 # if [ "${USE_DIETLIBC}" -eq '1' ]
479 # extract_dietlibc_bincache
480 # OLD_CC="${UTILS_CC}"
481 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
486 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
487 gen_die 'Configuring modutils failed!'
490 print_info 1 'modutils: >> Compiling...'
491 compile_generic all utils
493 # if [ "${USE_DIETLIBC}" -eq '1' ]
495 # clean_dietlibc_bincache
496 # UTILS_CC="${OLD_CC}"
499 print_info 1 'modutils: >> Copying to cache...'
500 [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
501 gen_die 'insmod.static does not exist after the compilation of modutils!'
502 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
503 gen_die 'Could not strip insmod.static!'
504 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
505 gen_die 'Compression of insmod.static failed!'
506 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
507 gen_die 'Could not move the compressed insmod binary to the package cache!'
510 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
514 compile_module_init_tools() {
515 # I've disabled dietlibc support for the time being since the
516 # version we use misses a few needed system calls.
519 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
521 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
522 gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
524 rm -rf "${MODULE_INIT_TOOLS_DIR}"
525 /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
526 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
527 gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
528 cd "${MODULE_INIT_TOOLS_DIR}"
529 print_info 1 'module-init-tools: >> Configuring'
531 # if [ "${USE_DIETLIBC}" -eq '1' ]
533 # extract_dietlibc_bincache
534 # OLD_CC="${UTILS_CC}"
535 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
539 ./configure >> ${DEBUGFILE} 2>&1 ||
540 gen_die 'Configure of module-init-tools failed!'
542 print_info 1 ' >> Compiling...'
543 compile_generic "all" utils
545 # if [ "${USE_DIETLIBC}" -eq '1' ]
547 # clean_dietlibc_bincache
548 # UTILS_CC="${OLD_CC}"
551 print_info 1 ' >> Copying to cache...'
552 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
553 gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
554 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
555 gen_die 'Could not strip insmod.static!'
556 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
557 gen_die 'Compression of insmod.static failed!'
558 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
559 gen_die 'Could not find compressed insmod.static.bz2 binary!'
560 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
561 gen_die 'Could not move the compressed insmod binary to the package cache!'
564 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
569 # I've disabled dietlibc support for the time being since the
570 # version we use misses a few needed system calls.
573 if [ ! -f "${DEVFSD_BINCACHE}" ]
575 [ ! -f "${DEVFSD_SRCTAR}" ] &&
576 gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
578 rm -rf "${DEVFSD_DIR}"
579 /bin/tar -jxpf "${DEVFSD_SRCTAR}"
580 [ ! -d "${DEVFSD_DIR}" ] &&
581 gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
584 # if [ "${USE_DIETLIBC}" -eq '1' ]
586 # extract_dietlibc_bincache
587 # OLD_CC="${UTILS_CC}"
588 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
591 print_info 1 'devfsd: >> Compiling...'
592 # if [ "${USE_DIETLIBC}" -eq '1' ]
594 # compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
596 compile_generic 'LDFLAGS=-static' utils
599 # if [ "${USE_DIETLIBC}" -eq '1' ]
601 # clean_dietlibc_bincache
602 # UTILS_CC="${OLD_CC}"
605 print_info 1 ' >> Copying to cache...'
606 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
607 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
608 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
609 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
610 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
612 # [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
613 # bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
614 # mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
617 rm -rf "${DEVFSD_DIR}" > /dev/null
621 compile_device_mapper() {
622 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
624 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
625 gen_die "Could not find device-mapper source tarball: ${DEVICE_MAPPER_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
627 rm -rf "${DEVICE_MAPPER_DIR}"
628 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
629 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
630 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
631 cd "${DEVICE_MAPPER_DIR}"
632 ./configure --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
633 gen_die 'Configuring device-mapper failed!'
634 print_info 1 'device-mapper: >> Compiling...'
635 compile_generic '' utils
636 compile_generic 'install' utils
637 print_info 1 ' >> Copying to cache...'
639 rm -r "${TEMP}/device-mapper/man" ||
640 gen_die 'Could not remove manual pages!'
641 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
642 gen_die 'Could not strip dmsetup binary!'
643 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
644 gen_die 'Could not tar up the device-mapper binary!'
645 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
646 gen_die 'device-mapper cache not created!'
648 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
649 rm -rf "${TEMP}/device-mapper" > /dev/null
658 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
659 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
660 if ! isTrue "${BUILD_DIETLIBC}"
662 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
663 if [ "${TEMP}" != "${ORIGTEMP}" ]
665 print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
666 print_warning 1 ' is different to the original. Rebuilding.'
671 if [ "${BUILD_DIETLIBC}" -eq '1' ]
673 [ -f "${DIETLIBC_SRCTAR}" ] ||
674 gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
676 rm -rf "${DIETLIBC_DIR}" > /dev/null
677 /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
678 gen_die 'Could not extract dietlibc source tarball'
679 [ -d "${DIETLIBC_DIR}" ] ||
680 gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
682 print_info 1 "dietlibc: >> Compiling..."
683 compile_generic "prefix=${TEMP}/diet" utils
684 print_info 1 " >> Installing..."
685 compile_generic "prefix=${TEMP}/diet install" utils
686 print_info 1 " >> Copying to bincache..."
688 /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
689 gen_die 'Could not tar up the dietlibc binary!'
690 [ -f "${DIETLIBC_BINCACHE}" ] ||
691 gen_die 'Dietlibc cache not created!'
692 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
695 rm -rf "${DIETLIBC_DIR}" > /dev/null
696 rm -rf "${TEMP}/diet" > /dev/null
701 if [ ! -f "${UDEV_BINCACHE}" ]
704 rm -rf "${UDEV_DIR}" udev
705 [ ! -f "${UDEV_SRCTAR}" ] &&
706 gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
707 /bin/tar -jxpf "${UDEV_SRCTAR}" ||
708 gen_die 'Could not extract udev tarball'
709 [ ! -d "${UDEV_DIR}" ] &&
710 gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
713 print_info 1 'udev: >> Compiling...'
715 ln -snf "${KERNEL_DIR}" klibc/linux || gen_die "Could not link to ${KERNEL_DIR}"
716 if [ "${ARCH}" = 'um' ]
718 compile_generic "ARCH=um KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
719 elif [ "${ARCH}" = 'sparc64' ]
721 compile_generic "ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu- KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
723 compile_generic "KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
727 strip udev || gen_die 'Failed to strip the udev binary!'
730 strip udevstart || gen_die 'Failed to strip the udevstart binary!'
735 strip udevsend || gen_die 'Failed to strip the udevsend binary!'
738 print_info 1 ' >> Installing...'
739 install -d "${TEMP}/udev/etc/udev" "${TEMP}/udev/sbin" "${TEMP}/udev/etc/udev/scripts" "${TEMP}/udev/etc/udev/rules.d" "${TEMP}/udev/etc/udev/permissions.d" ||
740 gen_die 'Could not create directory hierarchy'
741 install -m 0755 udev "${TEMP}/udev/sbin" ||
742 gen_die 'Could not install udev binary!'
746 install -m 0755 udevstart "${TEMP}/udev/sbin" ||
747 gen_die 'Could not install udevstart binary!'
752 install -m 0755 udevsend "${TEMP}/udev/sbin" ||
753 gen_die 'Could not install udevsend binary!'
756 install -m 0644 etc/udev/udev.conf "${TEMP}/udev/etc/udev" ||
757 gen_die 'Could not install udev configuration!'
758 install -m 0644 etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
759 gen_die 'Could not install udev rules!'
760 # install -m 0644 etc/udev/udev.permissions "${TEMP}/udev/etc/udev/permissions.d/50-udev.permissions" ||
761 # gen_die 'Could not install udev permissions!'
762 install -m 0755 extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts" ||
763 gen_die 'Could not install udev scripts!'
766 print_info 1 ' >> Copying to bincache...'
767 /bin/tar -cjf "${UDEV_BINCACHE}" * ||
768 gen_die 'Could not create binary cache'
771 rm -rf "${UDEV_DIR}" udev
775 compile_e2fsprogs() {
776 if [ ! -f "${BLKID_BINCACHE}" ]
778 [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
779 gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
781 rm -rf "${E2FSPROGS_DIR}"
782 tar -zxpf "${E2FSPROGS_SRCTAR}"
783 [ ! -d "${E2FSPROGS_DIR}" ] &&
784 gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
785 cd "${E2FSPROGS_DIR}"
786 print_info 1 'e2fsprogs: >> Configuring...'
787 ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
788 gen_die 'Configuring e2fsprogs failed!'
789 print_info 1 'e2fsprogs: >> Compiling...'
790 MAKE=${UTILS_MAKE} compile_generic "" ""
791 print_info 1 'blkid: >> Copying to cache...'
792 [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
793 gen_die 'Blkid executable does not exist!'
794 strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
795 gen_die 'Could not strip blkid binary!'
796 bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
797 gen_die 'bzip2 compression of blkid failed!'
798 mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
799 gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
802 rm -rf "${E2FSPROGS_DIR}" > /dev/null