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!'
444 #We dont necessarily have selinux installed yet .. look into selinux global support in the future.
445 sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
446 mkdir -p "${TEMP}/dmraid"
447 print_info 1 'dmraid: >> Compiling...'
448 compile_generic '' utils
449 #compile_generic 'install' utils
450 mkdir ${TEMP}/dmraid/sbin
451 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
452 print_info 1 ' >> Copying to bincache...'
454 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
455 gen_die 'Could not create binary cache'
458 rm -rf "${TEMP}/device-mapper" > /dev/null
459 rm -rf "${DMRAID_DIR}" dmraid
464 # I've disabled dietlibc support for the time being since the
465 # version we use misses a few needed system calls.
468 if [ ! -f "${MODUTILS_BINCACHE}" ]
470 [ ! -f "${MODUTILS_SRCTAR}" ] &&
471 gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
473 rm -rf "${MODUTILS_DIR}"
474 /bin/tar -jxpf "${MODUTILS_SRCTAR}"
475 [ ! -d "${MODUTILS_DIR}" ] &&
476 gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
478 print_info 1 "modutils: >> Configuring..."
480 # if [ "${USE_DIETLIBC}" -eq '1' ]
482 # extract_dietlibc_bincache
483 # OLD_CC="${UTILS_CC}"
484 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
489 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
490 gen_die 'Configuring modutils failed!'
493 print_info 1 'modutils: >> Compiling...'
494 compile_generic all utils
496 # if [ "${USE_DIETLIBC}" -eq '1' ]
498 # clean_dietlibc_bincache
499 # UTILS_CC="${OLD_CC}"
502 print_info 1 'modutils: >> Copying to cache...'
503 [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
504 gen_die 'insmod.static does not exist after the compilation of modutils!'
505 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
506 gen_die 'Could not strip insmod.static!'
507 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
508 gen_die 'Compression of insmod.static failed!'
509 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
510 gen_die 'Could not move the compressed insmod binary to the package cache!'
513 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
517 compile_module_init_tools() {
518 # I've disabled dietlibc support for the time being since the
519 # version we use misses a few needed system calls.
522 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
524 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
525 gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
527 rm -rf "${MODULE_INIT_TOOLS_DIR}"
528 /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
529 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
530 gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
531 cd "${MODULE_INIT_TOOLS_DIR}"
532 print_info 1 'module-init-tools: >> Configuring'
534 # if [ "${USE_DIETLIBC}" -eq '1' ]
536 # extract_dietlibc_bincache
537 # OLD_CC="${UTILS_CC}"
538 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
542 ./configure >> ${DEBUGFILE} 2>&1 ||
543 gen_die 'Configure of module-init-tools failed!'
545 print_info 1 ' >> Compiling...'
546 compile_generic "all" utils
548 # if [ "${USE_DIETLIBC}" -eq '1' ]
550 # clean_dietlibc_bincache
551 # UTILS_CC="${OLD_CC}"
554 print_info 1 ' >> Copying to cache...'
555 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
556 gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
557 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
558 gen_die 'Could not strip insmod.static!'
559 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
560 gen_die 'Compression of insmod.static failed!'
561 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
562 gen_die 'Could not find compressed insmod.static.bz2 binary!'
563 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
564 gen_die 'Could not move the compressed insmod binary to the package cache!'
567 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
572 # I've disabled dietlibc support for the time being since the
573 # version we use misses a few needed system calls.
576 if [ ! -f "${DEVFSD_BINCACHE}" ]
578 [ ! -f "${DEVFSD_SRCTAR}" ] &&
579 gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
581 rm -rf "${DEVFSD_DIR}"
582 /bin/tar -jxpf "${DEVFSD_SRCTAR}"
583 [ ! -d "${DEVFSD_DIR}" ] &&
584 gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
587 # if [ "${USE_DIETLIBC}" -eq '1' ]
589 # extract_dietlibc_bincache
590 # OLD_CC="${UTILS_CC}"
591 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
594 print_info 1 'devfsd: >> Compiling...'
595 # if [ "${USE_DIETLIBC}" -eq '1' ]
597 # compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
599 compile_generic 'LDFLAGS=-static' utils
602 # if [ "${USE_DIETLIBC}" -eq '1' ]
604 # clean_dietlibc_bincache
605 # UTILS_CC="${OLD_CC}"
608 print_info 1 ' >> Copying to cache...'
609 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
610 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
611 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
612 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
613 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
615 # [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
616 # bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
617 # mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
620 rm -rf "${DEVFSD_DIR}" > /dev/null
624 compile_device_mapper() {
625 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
627 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
628 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!"
630 rm -rf "${DEVICE_MAPPER_DIR}"
631 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
632 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
633 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
634 cd "${DEVICE_MAPPER_DIR}"
635 ./configure --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
636 gen_die 'Configuring device-mapper failed!'
637 print_info 1 'device-mapper: >> Compiling...'
638 compile_generic '' utils
639 compile_generic 'install' utils
640 print_info 1 ' >> Copying to cache...'
642 rm -r "${TEMP}/device-mapper/man" ||
643 gen_die 'Could not remove manual pages!'
644 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
645 gen_die 'Could not strip dmsetup binary!'
646 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
647 gen_die 'Could not tar up the device-mapper binary!'
648 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
649 gen_die 'device-mapper cache not created!'
651 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
652 rm -rf "${TEMP}/device-mapper" > /dev/null
661 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
662 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
663 if ! isTrue "${BUILD_DIETLIBC}"
665 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
666 if [ "${TEMP}" != "${ORIGTEMP}" ]
668 print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
669 print_warning 1 ' is different to the original. Rebuilding.'
674 if [ "${BUILD_DIETLIBC}" -eq '1' ]
676 [ -f "${DIETLIBC_SRCTAR}" ] ||
677 gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
679 rm -rf "${DIETLIBC_DIR}" > /dev/null
680 /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
681 gen_die 'Could not extract dietlibc source tarball'
682 [ -d "${DIETLIBC_DIR}" ] ||
683 gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
685 print_info 1 "dietlibc: >> Compiling..."
686 compile_generic "prefix=${TEMP}/diet" utils
687 print_info 1 " >> Installing..."
688 compile_generic "prefix=${TEMP}/diet install" utils
689 print_info 1 " >> Copying to bincache..."
691 /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
692 gen_die 'Could not tar up the dietlibc binary!'
693 [ -f "${DIETLIBC_BINCACHE}" ] ||
694 gen_die 'Dietlibc cache not created!'
695 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
698 rm -rf "${DIETLIBC_DIR}" > /dev/null
699 rm -rf "${TEMP}/diet" > /dev/null
704 rm -rf "${KLIBC_DIR}" klibc-build
705 [ ! -f "${KLIBC_SRCTAR}" ] &&
706 gen_die "Could not find klibc tarball: ${KLIBC_SRCTAR}"
707 /bin/tar -xpf "${KLIBC_SRCTAR}" ||
708 gen_die 'Could not extract klibc tarball'
709 [ ! -d "${KLIBC_DIR}" ] &&
710 gen_die "klibc tarball ${KLIBC_SRCTAR} is invalid"
712 if [ -f ${GK_SHARE}/pkg/byteswap.h ]
714 echo "Inserting byteswap.h into klibc"
715 cp "${GK_SHARE}/pkg/byteswap.h" "include/"
717 echo "${GK_SHARE}/pkg/byteswap.h not found"
719 print_info 1 'klibc: >> Compiling...'
720 ln -snf "${KERNEL_DIR}" linux || gen_die "Could not link to ${KERNEL_DIR}"
721 sed -i MCONFIG -e "s|prefix =.*|prefix = ${TEMP}/klibc-build|g"
722 # PPC fixup for 2.6.14
723 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
725 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
727 # Headers are moving around .. need to make them available
728 echo 'INCLUDE += -I$(KRNLSRC)/arch/$(ARCH)/include' >> MCONFIG
731 if [ "${ARCH}" = 'um' ]
733 compile_generic "ARCH=um" utils
734 elif [ "${ARCH}" = 'sparc64' ]
736 compile_generic "ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu-" utils
737 elif [ "${ARCH}" = 'x86' ]
739 compile_generic "ARCH=i386" utils
741 compile_generic "" utils
744 compile_generic "install" utils
748 if [ ! -f "${UDEV_BINCACHE}" ]
750 # PPC fixup for 2.6.14
751 # Headers are moving around .. need to make them available
752 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
754 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
757 echo 'Applying hack to workaround 2.6.14+ PPC header breakages...'
758 compile_generic 'include/asm' kernel
763 rm -rf "${UDEV_DIR}" udev
764 [ ! -f "${UDEV_SRCTAR}" ] &&
765 gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
766 /bin/tar -jxpf "${UDEV_SRCTAR}" ||
767 gen_die 'Could not extract udev tarball'
768 [ ! -d "${UDEV_DIR}" ] &&
769 gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
772 local extras="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware"
773 # No selinux support yet .. someday maybe
774 #use selinux && myconf="${myconf} USE_SELINUX=true"
775 print_info 1 'udev: >> Compiling...'
776 # PPC fixup for 2.6.14
777 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
779 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
781 # Headers are moving around .. need to make them available
782 echo "CFLAGS += -I${KERNEL_DIR}/arch/${ARCH}/include" >> Makefile
786 if [ "${ARCH}" = 'um' ]
788 compile_generic "EXTRAS=\"${extras}\" ARCH=um USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
789 elif [ "${ARCH}" = 'sparc64' ]
791 compile_generic "EXTRAS=\"${extras}\" ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu- USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
793 compile_generic "EXTRAS=\"${extras}\" USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
797 print_info 1 ' >> Installing...'
798 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" "${TEMP}/udev/etc/udev/extras" "${TEMP}/udev/etc" "${TEMP}/udev/sbin" "${TEMP}/udev/usr/" "${TEMP}/udev/usr/bin" "${TEMP}/udev/usr/sbin"||
799 gen_die 'Could not create directory hierarchy'
801 install -c etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
802 gen_die 'Could not copy gentoo udev.rules to 50-udev.rules'
804 compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-config" runtask
805 compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-bin" runtask
806 install -c extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts"
807 install -c extras/scsi-devfs.sh "${TEMP}/udev/etc/udev/scripts"
808 install -c extras/raid-devfs.sh "${TEMP}/udev/etc/udev/scripts"
811 print_info 1 ' >> Copying to bincache...'
812 /bin/tar -cjf "${UDEV_BINCACHE}" * ||
813 gen_die 'Could not create binary cache'
816 rm -rf "${UDEV_DIR}" udev
818 # PPC fixup for 2.6.14
819 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
821 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
824 compile_generic 'archclean' kernel
831 compile_e2fsprogs() {
832 if [ ! -f "${BLKID_BINCACHE}" ]
834 [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
835 gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
837 rm -rf "${E2FSPROGS_DIR}"
838 tar -zxpf "${E2FSPROGS_SRCTAR}"
839 [ ! -d "${E2FSPROGS_DIR}" ] &&
840 gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
841 cd "${E2FSPROGS_DIR}"
842 print_info 1 'e2fsprogs: >> Configuring...'
843 ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
844 gen_die 'Configuring e2fsprogs failed!'
845 print_info 1 'e2fsprogs: >> Compiling...'
846 MAKE=${UTILS_MAKE} compile_generic "" ""
847 print_info 1 'blkid: >> Copying to cache...'
848 [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
849 gen_die 'Blkid executable does not exist!'
850 strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
851 gen_die 'Could not strip blkid binary!'
852 bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
853 gen_die 'bzip2 compression of blkid failed!'
854 mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
855 gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
858 rm -rf "${E2FSPROGS_DIR}" > /dev/null