8 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
10 ARGS="${ARGS} CROSS_COMPILE=\"${KERNEL_CROSS_COMPILE}\""
12 if [ "${KERNEL_CC}" != '' ]
14 ARGS="CC=\"${KERNEL_CC}\""
16 if [ "${KERNEL_LD}" != '' ]
18 ARGS="${ARGS} LD=\"${KERNEL_LD}\""
20 if [ "${KERNEL_AS}" != '' ]
22 ARGS="${ARGS} AS=\"${KERNEL_AS}\""
33 if [ "${UTILS_ARCH}" != '' ]
35 ARGS="ARCH=\"${UTILS_ARCH}\""
37 if [ "${UTILS_CC}" != '' ]
39 ARGS="CC=\"${UTILS_CC}\""
41 if [ "${UTILS_LD}" != '' ]
43 ARGS="${ARGS} LD=\"${UTILS_LD}\""
45 if [ "${UTILS_AS}" != '' ]
47 ARGS="${ARGS} AS=\"${UTILS_AS}\""
56 if [ "${UTILS_ARCH}" != '' ]
58 export ARCH="${UTILS_ARCH}"
60 if [ "${UTILS_CC}" != '' ]
62 export CC="${UTILS_CC}"
64 if [ "${UTILS_LD}" != '' ]
66 export LD="${UTILS_LD}"
68 if [ "${UTILS_AS}" != '' ]
70 export AS="${UTILS_AS}"
76 if [ "${UTILS_ARCH}" != '' ]
80 if [ "${UTILS_CC}" != '' ]
84 if [ "${UTILS_LD}" != '' ]
88 if [ "${UTILS_AS}" != '' ]
97 if [ "${KERNEL_CC}" != '' ]
99 export CC="${KERNEL_CC}"
101 if [ "${KERNEL_LD}" != '' ]
103 export LD="${KERNEL_LD}"
105 if [ "${KERNEL_AS}" != '' ]
107 export AS="${KERNEL_AS}"
109 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
111 export CROSS_COMPILE="${KERNEL_CROSS_COMPILE}"
117 if [ "${KERNEL_CC}" != '' ]
121 if [ "${KERNEL_LD}" != '' ]
125 if [ "${KERNEL_AS}" != '' ]
129 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
136 if [ "${ARCH}" != '' ]
138 export ORIG_ARCH="${ARCH}"
142 export ORIG_CC="${CC}"
146 export ORIG_LD="${LD}"
150 export ORIG_AS="${AS}"
152 if [ "${CROSS_COMPILE}" != '' ]
154 export ORIG_CROSS_COMPILE="${CROSS_COMPILE}"
159 if [ "${ORIG_ARCH}" != '' ]
161 export ARCH="${ORIG_ARCH}"
164 if [ "${ORIG_CC}" != '' ]
166 export CC="${ORIG_CC}"
169 if [ "${ORIG_LD}" != '' ]
171 export LD="${ORIG_LD}"
174 if [ "${ORIG_AS}" != '' ]
176 export AS="${ORIG_AS}"
179 if [ "${ORIG_CROSS_COMPILE}" != '' ]
181 export CROSS_COMPILE="${ORIG_CROSS_COMPILE}"
182 unset ORIG_CROSS_COMPILE
189 gen_die 'compile_generic(): improper usage!'
191 if [ "${2}" = 'kernel' ] || [ "${2}" = 'runtask' ]
195 elif [ "${2}" = 'utils' ]
201 kernel) ARGS="`compile_kernel_args`" ;;
202 utils) ARGS="`compile_utils_args`" ;;
203 *) ARGS="" ;; # includes runtask
207 # the eval usage is needed in the next set of code
208 # as ARGS can contain spaces and quotes, eg:
209 # ARGS='CC="ccache gcc"'
210 if [ "${2}" == 'runtask' ]
212 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${1}" 1 0 1
213 eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${1}
215 elif [ "${DEBUGLEVEL}" -gt "1" ]
217 # Output to stdout and debugfile
218 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
219 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} 2>&1 | tee -a ${DEBUGFILE}
222 # Output to debugfile only
223 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
224 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} >> ${DEBUGFILE} 2>&1
227 [ "${RET}" -ne '0' ] &&
228 gen_die "Failed to compile the \"${1}\" target..."
232 if [ "${2}" = 'kernel' ]
235 elif [ "${2}" = 'utils' ]
241 extract_dietlibc_bincache() {
243 rm -rf "${TEMP}/diet" > /dev/null
244 /bin/tar -jxpf "${DIETLIBC_BINCACHE}" ||
245 gen_die 'Could not extract dietlibc bincache!'
246 [ ! -d "${TEMP}/diet" ] &&
247 gen_die "${TEMP}/diet directory not found!"
251 clean_dietlibc_bincache() {
253 rm -rf "${TEMP}/diet" > /dev/null
258 # Only run ``make dep'' for 2.4 kernels
259 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
261 print_info 1 "kernel: >> Making dependencies..."
263 compile_generic dep kernel
268 print_info 1 " >> Compiling ${KV} modules..."
270 compile_generic modules kernel
271 export UNAME_MACHINE="${ARCH}"
272 # On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures
273 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
275 MAKEOPTS_SAVE="${MAKEOPTS}"
276 MAKEOPTS="${MAKEOPTS_SAVE/-j?/-j1}"
278 [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
279 compile_generic "modules_install" kernel
280 [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] && MAKEOPTS="${MAKEOPTS_SAVE}"
286 [ "${KERNEL_MAKE}" = '' ] &&
287 gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
289 print_info 1 " >> Compiling ${KV} ${KERNEL_MAKE_DIRECTIVE/_install/ [ install ]/}..."
290 compile_generic "${KERNEL_MAKE_DIRECTIVE}" kernel
291 if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
293 print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
294 compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
296 if ! isTrue "${CMD_NOINSTALL}"
298 cp "${KERNEL_BINARY}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
299 gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
300 cp "System.map" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
301 gen_die 'Could not copy System.map to ${BOOTDIR}!'
302 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
304 cp "${KERNEL_BINARY_2}" "${BOOTDIR}/kernelz-${KV}" ||
305 gen_die 'Could not copy the kernelz binary to ${BOOTDIR}!'
308 cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
309 gen_die "Could not copy the kernel binary to ${TMPDIR}!"
310 cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
311 gen_die "Could not copy System.map to ${TMPDIR}!"
312 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
314 cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
315 gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
320 compile_unionfs_modules() {
321 if [ ! -f "${UNIONFS_MODULES_BINCACHE}" ]
323 [ -f "${UNIONFS_SRCTAR}" ] ||
324 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
326 rm -rf ${UNIONFS_DIR} > /dev/null
327 rm -rf unionfs > /dev/null
329 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
330 gen_die 'Could not extract unionfs source tarball!'
331 [ -d "${UNIONFS_DIR}" ] ||
332 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
334 print_info 1 'unionfs modules: >> Compiling...'
335 echo "LINUXSRC=${KERNEL_DIR}" >> fistdev.mk
336 echo 'TOPINC=-I$(LINUXSRC)/include' >> fistdev.mk
337 echo "MODDIR= /lib/modules/${KV}" >> fistdev.mk
338 echo "KERNELVERSION=${KV}" >> fistdev.mk
339 # Fix for hardened/selinux systems to have extened attributes
340 # per r2d2's request. Also add -DUNIONFS_UNSUPPORTED for 2.6.16
341 echo "EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID -DUNIONFS_UNSUPPORTED" \
343 # Here we do something really nasty and disable debugging, along with
344 # change our default CFLAGS
345 echo "UNIONFS_DEBUG_CFLAG=-DUNIONFS_NDEBUG" >> fistdev.mk
346 echo "UNIONFS_OPT_CFLAG= -O2 -pipe" >> fistdev.mk
348 if [ "${PAT}" -ge '6' ]
352 # Compile unionfs module within the unionfs
353 # environment not within the kernelsrc dir
356 gen_die 'unionfs is only supported on 2.6 targets'
358 print_info 1 'unionfs: >> Copying to cache...'
360 mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
364 cp unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
366 cp unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
370 /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
371 gen_die 'Could not create unionfs modules binary cache'
374 rm -rf "${UNIONFS_DIR}" > /dev/null
375 rm -rf unionfs > /dev/null
379 compile_unionfs_utils() {
380 if [ ! -f "${UNIONFS_BINCACHE}" ]
382 [ -f "${UNIONFS_SRCTAR}" ] ||
383 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
385 rm -rf ${UNIONFS_DIR} > /dev/null
386 rm -rf unionfs > /dev/null
387 mkdir -p unionfs/sbin
388 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
389 gen_die 'Could not extract unionfs source tarball!'
390 [ -d "${UNIONFS_DIR}" ] ||
391 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
393 print_info 1 'unionfs tools: >> Compiling...'
394 sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g'
395 compile_generic utils utils
397 print_info 1 'unionfs: >> Copying to cache...'
398 strip uniondbg unionctl
399 cp uniondbg ${TEMP}/unionfs/sbin/ ||
400 gen_die 'Could not copy the uniondbg binary to the tmp directory'
401 cp unionctl ${TEMP}/unionfs/sbin/ ||
402 gen_die 'Could not copy the unionctl binary to the tmp directory'
404 /bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
405 gen_die 'Could not create unionfs tools binary cache'
408 rm -rf "${UNIONFS_DIR}" > /dev/null
409 rm -rf unionfs > /dev/null
414 if [ ! -f "${BUSYBOX_BINCACHE}" ]
416 [ -f "${BUSYBOX_SRCTAR}" ] ||
417 gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
418 [ -f "${BUSYBOX_CONFIG}" ] ||
419 gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
421 rm -rf ${BUSYBOX_DIR} > /dev/null
422 /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
423 gen_die 'Could not extract busybox source tarball!'
424 [ -d "${BUSYBOX_DIR}" ] ||
425 gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
426 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
427 sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
429 print_info 1 'busybox: >> Configuring...'
430 yes '' 2>/dev/null | compile_generic oldconfig utils
431 print_info 1 'busybox: >> Compiling...'
432 compile_generic all utils
433 print_info 1 'busybox: >> Copying to cache...'
434 [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
435 gen_die 'Busybox executable does not exist!'
436 strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
437 gen_die 'Could not strip busybox binary!'
438 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" ||
439 gen_die 'bzip2 compression of busybox failed!'
440 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" ||
441 gen_die 'Could not copy the busybox binary to the package directory, does the directory exist?'
444 rm -rf "${BUSYBOX_DIR}" > /dev/null
449 compile_device_mapper
450 if [ ! -f "${LVM2_BINCACHE}" ]
452 [ -f "${LVM2_SRCTAR}" ] ||
453 gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
455 rm -rf ${LVM2_DIR} > /dev/null
456 /bin/tar -zxpf ${LVM2_SRCTAR} ||
457 gen_die 'Could not extract LVM2 source tarball!'
458 [ -d "${LVM2_DIR}" ] ||
459 gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
460 rm -rf "${TEMP}/device-mapper" > /dev/null
461 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
462 gen_die "Could not extract device-mapper binary cache!";
465 print_info 1 'lvm2: >> Configuring...'
466 LDFLAGS="-L${TEMP}/device-mapper/lib" \
467 CFLAGS="-I${TEMP}/device-mapper/include" \
468 CPPFLAGS="-I${TEMP}/device-mapper/include" \
469 ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
470 gen_die 'Configure of lvm2 failed!'
471 print_info 1 'lvm2: >> Compiling...'
472 compile_generic '' utils
473 compile_generic 'install' utils
476 print_info 1 ' >> Copying to bincache...'
477 strip "sbin/lvm.static" ||
478 gen_die 'Could not strip lvm.static!'
479 /bin/tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
480 gen_die 'Could not create binary cache'
483 rm -rf "${TEMP}/device-mapper" > /dev/null
484 rm -rf "${LVM2_DIR}" lvm2
489 compile_device_mapper
490 if [ ! -f "${DMRAID_BINCACHE}" ]
492 [ -f "${DMRAID_SRCTAR}" ] ||
493 gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
495 rm -rf ${DMRAID_DIR} > /dev/null
496 /bin/tar -jxpf ${DMRAID_SRCTAR} ||
497 gen_die 'Could not extract DMRAID source tarball!'
498 [ -d "${DMRAID_DIR}" ] ||
499 gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
500 rm -rf "${TEMP}/device-mapper" > /dev/null
501 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
502 gen_die "Could not extract device-mapper binary cache!";
505 print_info 1 'dmraid: >> Configuring...'
507 LDFLAGS="-L${TEMP}/device-mapper/lib" \
508 CFLAGS="-I${TEMP}/device-mapper/include" \
509 CPPFLAGS="-I${TEMP}/device-mapper/include" \
510 ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
511 gen_die 'Configure of dmraid failed!'
513 #We dont necessarily have selinux installed yet .. look into selinux global support in the future.
514 sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
515 mkdir -p "${TEMP}/dmraid"
516 print_info 1 'dmraid: >> Compiling...'
517 compile_generic '' utils
518 #compile_generic 'install' utils
519 mkdir ${TEMP}/dmraid/sbin
520 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
521 print_info 1 ' >> Copying to bincache...'
523 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
524 gen_die 'Could not create binary cache'
527 rm -rf "${TEMP}/device-mapper" > /dev/null
528 rm -rf "${DMRAID_DIR}" dmraid
533 # I've disabled dietlibc support for the time being since the
534 # version we use misses a few needed system calls.
537 if [ ! -f "${MODUTILS_BINCACHE}" ]
539 [ ! -f "${MODUTILS_SRCTAR}" ] &&
540 gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
542 rm -rf "${MODUTILS_DIR}"
543 /bin/tar -jxpf "${MODUTILS_SRCTAR}"
544 [ ! -d "${MODUTILS_DIR}" ] &&
545 gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
547 print_info 1 "modutils: >> Configuring..."
549 # if [ "${USE_DIETLIBC}" -eq '1' ]
551 # extract_dietlibc_bincache
552 # OLD_CC="${UTILS_CC}"
553 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
558 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
559 gen_die 'Configuring modutils failed!'
562 print_info 1 'modutils: >> Compiling...'
563 compile_generic all utils
565 # if [ "${USE_DIETLIBC}" -eq '1' ]
567 # clean_dietlibc_bincache
568 # UTILS_CC="${OLD_CC}"
571 print_info 1 'modutils: >> Copying to cache...'
572 [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
573 gen_die 'insmod.static does not exist after the compilation of modutils!'
574 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
575 gen_die 'Could not strip insmod.static!'
576 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
577 gen_die 'Compression of insmod.static failed!'
578 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
579 gen_die 'Could not move the compressed insmod binary to the package cache!'
582 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
586 compile_module_init_tools() {
587 # I've disabled dietlibc support for the time being since the
588 # version we use misses a few needed system calls.
591 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
593 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
594 gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
596 rm -rf "${MODULE_INIT_TOOLS_DIR}"
597 /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
598 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
599 gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
600 cd "${MODULE_INIT_TOOLS_DIR}"
601 print_info 1 'module-init-tools: >> Configuring'
603 # if [ "${USE_DIETLIBC}" -eq '1' ]
605 # extract_dietlibc_bincache
606 # OLD_CC="${UTILS_CC}"
607 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
611 ./configure >> ${DEBUGFILE} 2>&1 ||
612 gen_die 'Configure of module-init-tools failed!'
614 print_info 1 ' >> Compiling...'
615 compile_generic "all" utils
617 # if [ "${USE_DIETLIBC}" -eq '1' ]
619 # clean_dietlibc_bincache
620 # UTILS_CC="${OLD_CC}"
623 print_info 1 ' >> Copying to cache...'
624 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
625 gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
626 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
627 gen_die 'Could not strip insmod.static!'
628 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
629 gen_die 'Compression of insmod.static failed!'
630 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
631 gen_die 'Could not find compressed insmod.static.bz2 binary!'
632 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
633 gen_die 'Could not move the compressed insmod binary to the package cache!'
636 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
641 # I've disabled dietlibc support for the time being since the
642 # version we use misses a few needed system calls.
645 if [ ! -f "${DEVFSD_BINCACHE}" ]
647 [ ! -f "${DEVFSD_SRCTAR}" ] &&
648 gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
650 rm -rf "${DEVFSD_DIR}"
651 /bin/tar -jxpf "${DEVFSD_SRCTAR}"
652 [ ! -d "${DEVFSD_DIR}" ] &&
653 gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
656 # if [ "${USE_DIETLIBC}" -eq '1' ]
658 # extract_dietlibc_bincache
659 # OLD_CC="${UTILS_CC}"
660 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
663 print_info 1 'devfsd: >> Compiling...'
664 # if [ "${USE_DIETLIBC}" -eq '1' ]
666 # compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
668 compile_generic 'LDFLAGS=-static' utils
671 # if [ "${USE_DIETLIBC}" -eq '1' ]
673 # clean_dietlibc_bincache
674 # UTILS_CC="${OLD_CC}"
677 print_info 1 ' >> Copying to cache...'
678 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
679 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
680 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
681 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
682 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
684 # [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
685 # bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
686 # mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
689 rm -rf "${DEVFSD_DIR}" > /dev/null
693 compile_device_mapper() {
694 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
696 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
697 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!"
699 rm -rf "${DEVICE_MAPPER_DIR}"
700 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
701 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
702 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
703 cd "${DEVICE_MAPPER_DIR}"
704 ./configure --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
705 gen_die 'Configuring device-mapper failed!'
706 print_info 1 'device-mapper: >> Compiling...'
707 compile_generic '' utils
708 compile_generic 'install' utils
709 print_info 1 ' >> Copying to cache...'
711 rm -r "${TEMP}/device-mapper/man" ||
712 gen_die 'Could not remove manual pages!'
713 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
714 gen_die 'Could not strip dmsetup binary!'
715 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
716 gen_die 'Could not tar up the device-mapper binary!'
717 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
718 gen_die 'device-mapper cache not created!'
720 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
721 rm -rf "${TEMP}/device-mapper" > /dev/null
730 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
731 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
732 if ! isTrue "${BUILD_DIETLIBC}"
734 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
735 if [ "${TEMP}" != "${ORIGTEMP}" ]
737 print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
738 print_warning 1 ' is different to the original. Rebuilding.'
743 if [ "${BUILD_DIETLIBC}" -eq '1' ]
745 [ -f "${DIETLIBC_SRCTAR}" ] ||
746 gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
748 rm -rf "${DIETLIBC_DIR}" > /dev/null
749 /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
750 gen_die 'Could not extract dietlibc source tarball'
751 [ -d "${DIETLIBC_DIR}" ] ||
752 gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
754 print_info 1 "dietlibc: >> Compiling..."
755 compile_generic "prefix=${TEMP}/diet" utils
756 print_info 1 " >> Installing..."
757 compile_generic "prefix=${TEMP}/diet install" utils
758 print_info 1 " >> Copying to bincache..."
760 /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
761 gen_die 'Could not tar up the dietlibc binary!'
762 [ -f "${DIETLIBC_BINCACHE}" ] ||
763 gen_die 'Dietlibc cache not created!'
764 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
767 rm -rf "${DIETLIBC_DIR}" > /dev/null
768 rm -rf "${TEMP}/diet" > /dev/null
773 rm -rf "${KLIBC_DIR}" klibc-build
774 [ ! -f "${KLIBC_SRCTAR}" ] &&
775 gen_die "Could not find klibc tarball: ${KLIBC_SRCTAR}"
776 /bin/tar jxpf "${KLIBC_SRCTAR}" ||
777 gen_die 'Could not extract klibc tarball'
778 [ ! -d "${KLIBC_DIR}" ] &&
779 gen_die "klibc tarball ${KLIBC_SRCTAR} is invalid"
781 if [ -f ${GK_SHARE}/pkg/klibc-1.1.16-sparc2.patch ]
784 ${GK_SHARE}/pkg/klibc-1.1.16-sparc2.patch \
785 || gen_die "Failed patching klibc"
787 if [ -f "${GK_SHARE}/pkg/klibc-1.2.1-nostdinc-flags.patch" ]
790 ${GK_SHARE}/pkg/klibc-1.2.1-nostdinc-flags.patch \
791 || gen_die "Failed patching klibc"
794 # Don't install to "//lib" fix
795 sed -e 's:SHLIBDIR = /lib:SHLIBDIR = $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib:' -i scripts/Kbuild.install
796 print_info 1 'klibc: >> Compiling...'
797 ln -snf "${KERNEL_DIR}" linux || gen_die "Could not link to ${KERNEL_DIR}"
798 sed -i Makefile -e "s|prefix = /usr|prefix = ${TEMP}/klibc-build|g"
799 if [ "${UTILS_ARCH}" != '' ]
801 sed -i Makefile -e "s|export ARCH.*|export ARCH := ${UTILS_ARCH}|g"
803 if [ "${ARCH}" = 'um' ]
805 compile_generic "ARCH=um" utils
806 elif [ "${ARCH}" = 'x86' ]
808 compile_generic "ARCH=i386" utils
809 elif [ "${UTILS_CROSS_COMPILE}" != '' ]
811 compile_generic "CROSS=${UTILS_CROSS_COMPILE}" utils
813 compile_generic "" utils
816 compile_generic "install" utils
820 if [ ! -f "${UDEV_BINCACHE}" ]
822 # PPC fixup for 2.6.14
823 # Headers are moving around .. need to make them available
824 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
826 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
829 echo 'Applying hack to workaround 2.6.14+ PPC header breakages...'
830 compile_generic 'include/asm' kernel
835 rm -rf "${UDEV_DIR}" udev
836 [ ! -f "${UDEV_SRCTAR}" ] &&
837 gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
838 /bin/tar -jxpf "${UDEV_SRCTAR}" ||
839 gen_die 'Could not extract udev tarball'
840 [ ! -d "${UDEV_DIR}" ] &&
841 gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
844 local extras="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware"
845 # No selinux support yet .. someday maybe
846 #use selinux && myconf="${myconf} USE_SELINUX=true"
847 print_info 1 'udev: >> Compiling...'
849 if [ "${UTILS_ARCH}" = 'sparc' ]
851 echo "CFLAGS += -mcpu=v8 -mtune=v8" >> Makefile
853 # PPC fixup for 2.6.14
854 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
856 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
858 # Headers are moving around .. need to make them available
859 echo "CFLAGS += -I${KERNEL_DIR}/arch/${ARCH}/include" >> Makefile
863 if [ "${ARCH}" = 'um' ]
865 compile_generic "EXTRAS=\"${extras}\" ARCH=um USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" utils
867 # This *needs* to be runtask, or else it breakson most
868 # architectures. -- wolf31o2
869 compile_generic "EXTRAS=\"${extras}\" USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
873 print_info 1 ' >> Installing...'
874 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"||
875 gen_die 'Could not create directory hierarchy'
877 install -c etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
878 gen_die 'Could not copy gentoo udev.rules to 50-udev.rules'
880 # compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-config" utils
881 # compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-bin" utils
882 # We are going to install our files by hand. Why are we doing this?
883 # Well, the udev ebuild does so, and I tend to think that Greg
884 # Kroah-Hartman knows what he's doing with regards to udev.
885 for i in udev udevd udevsend udevstart udevtrigger
887 install -D $i "${TEMP}/udev/sbin"
889 install -c extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts"
890 install -c extras/scsi-devfs.sh "${TEMP}/udev/etc/udev/scripts"
891 install -c extras/raid-devfs.sh "${TEMP}/udev/etc/udev/scripts"
894 print_info 1 ' >> Copying to bincache...'
895 /bin/tar -cjf "${UDEV_BINCACHE}" * ||
896 gen_die 'Could not create binary cache'
899 rm -rf "${UDEV_DIR}" udev
901 # PPC fixup for 2.6.14
902 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
904 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
907 compile_generic 'archclean' kernel
914 compile_e2fsprogs() {
915 if [ ! -f "${BLKID_BINCACHE}" ]
917 [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
918 gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
920 rm -rf "${E2FSPROGS_DIR}"
921 tar -zxpf "${E2FSPROGS_SRCTAR}"
922 [ ! -d "${E2FSPROGS_DIR}" ] &&
923 gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
924 cd "${E2FSPROGS_DIR}"
925 print_info 1 'e2fsprogs: >> Configuring...'
926 ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
927 gen_die 'Configuring e2fsprogs failed!'
928 print_info 1 'e2fsprogs: >> Compiling...'
929 MAKE=${UTILS_MAKE} compile_generic "" ""
930 print_info 1 'blkid: >> Copying to cache...'
931 [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
932 gen_die 'Blkid executable does not exist!'
933 strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
934 gen_die 'Could not strip blkid binary!'
935 bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
936 gen_die 'bzip2 compression of blkid failed!'
937 mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
938 gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
941 rm -rf "${E2FSPROGS_DIR}" > /dev/null