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}\""
26 ARGS="${ARGS} ARCH=\"${ARCH}\""
36 if [ "${UTILS_CC}" != '' ]
38 ARGS="CC=\"${UTILS_CC}\""
40 if [ "${UTILS_LD}" != '' ]
42 ARGS="${ARGS} LD=\"${UTILS_LD}\""
44 if [ "${UTILS_AS}" != '' ]
46 ARGS="${ARGS} AS=\"${UTILS_AS}\""
54 if [ "${UTILS_CC}" != '' ]
56 export CC="${UTILS_CC}"
58 if [ "${UTILS_LD}" != '' ]
60 export LD="${UTILS_LD}"
62 if [ "${UTILS_AS}" != '' ]
64 export AS="${UTILS_AS}"
70 if [ "${UTILS_CC}" != '' ]
74 if [ "${UTILS_LD}" != '' ]
78 if [ "${UTILS_AS}" != '' ]
86 if [ "${KERNEL_CC}" != '' ]
88 export CC="${KERNEL_CC}"
90 if [ "${KERNEL_LD}" != '' ]
92 export LD="${KERNEL_LD}"
94 if [ "${KERNEL_AS}" != '' ]
96 export AS="${KERNEL_AS}"
98 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
100 export CROSS_COMPILE="${KERNEL_CROSS_COMPILE}"
106 if [ "${KERNEL_CC}" != '' ]
110 if [ "${KERNEL_LD}" != '' ]
114 if [ "${KERNEL_AS}" != '' ]
118 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
127 gen_die 'compile_generic(): improper usage!'
129 if [ "${2}" = 'kernel' ] || [ "${2}" = 'runtask' ]
133 elif [ "${2}" = 'utils' ]
139 kernel) ARGS="`compile_kernel_args`" ;;
140 utils) ARGS="`compile_utils_args`" ;;
141 *) ARGS="" ;; # includes runtask
145 # the eval usage is needed in the next set of code
146 # as ARGS can contain spaces and quotes, eg:
147 # ARGS='CC="ccache gcc"'
148 if [ "${2}" == 'runtask' ]
150 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${1}" 1 0 1
151 eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${1}
153 elif [ "${DEBUGLEVEL}" -gt "1" ]
155 # Output to stdout and debugfile
156 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
157 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} 2>&1 | tee -a ${DEBUGFILE}
160 # Output to debugfile only
161 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
162 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} >> ${DEBUGFILE} 2>&1
165 [ "${RET}" -ne '0' ] &&
166 gen_die "Failed to compile the \"${1}\" target..."
170 if [ "${2}" = 'kernel' ]
173 elif [ "${2}" = 'utils' ]
179 extract_dietlibc_bincache() {
181 rm -rf "${TEMP}/diet" > /dev/null
182 /bin/tar -jxpf "${DIETLIBC_BINCACHE}" ||
183 gen_die 'Could not extract dietlibc bincache!'
184 [ ! -d "${TEMP}/diet" ] &&
185 gen_die "${TEMP}/diet directory not found!"
189 clean_dietlibc_bincache() {
191 rm -rf "${TEMP}/diet" > /dev/null
196 # Only run ``make dep'' for 2.4 kernels
197 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
199 print_info 1 "kernel: >> Making dependencies..."
201 compile_generic dep kernel
206 print_info 1 " >> Compiling ${KV} modules..."
208 compile_generic modules kernel
209 export UNAME_MACHINE="${ARCH}"
210 # On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures
211 if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
213 MAKEOPTS_SAVE="${MAKEOPTS}"
214 MAKEOPTS="${MAKEOPTS_SAVE/-j?/-j1}"
216 [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
217 compile_generic "modules_install" kernel
218 [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] && MAKEOPTS="${MAKEOPTS_SAVE}"
224 [ "${KERNEL_MAKE}" = '' ] &&
225 gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
227 print_info 1 " >> Compiling ${KV} ${KERNEL_MAKE_DIRECTIVE/_install/ [ install ]/}..."
228 compile_generic "${KERNEL_MAKE_DIRECTIVE}" kernel
229 if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
231 print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
232 compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
234 if ! isTrue "${CMD_NOINSTALL}"
236 cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" ||
237 gen_die 'Could not copy the kernel binary to /boot!'
238 cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" ||
239 gen_die 'Could not copy System.map to /boot!'
240 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
242 cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" ||
243 gen_die 'Could not copy the kernelz binary to /boot!'
246 cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
247 gen_die "Could not copy the kernel binary to ${TMPDIR}!"
248 cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
249 gen_die "Could not copy System.map to ${TMPDIR}!"
250 if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
252 cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
253 gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
258 compile_unionfs_modules() {
259 if [ ! -f "${UNIONFS_MODULES_BINCACHE}" ]
261 [ -f "${UNIONFS_SRCTAR}" ] ||
262 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
264 rm -rf ${UNIONFS_DIR} > /dev/null
265 rm -rf unionfs > /dev/null
267 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
268 gen_die 'Could not extract unionfs source tarball!'
269 [ -d "${UNIONFS_DIR}" ] ||
270 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
272 print_info 1 'unionfs modules: >> Compiling...'
273 sed -i Makefile -e "s|LINUXSRC =.*|LINUXSRC =${KERNEL_DIR}|g"
275 #Fix for hardened/selinux systems to have extened attributes
277 sed -i Makefile -e "s|# \(EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID\)|\1|g"
279 if [ "${PAT}" -ge '6' ]
281 # Setup the kernel sources to compile modules
283 compile_generic "modules_prepare" kernel
287 compile_generic unionfs2.6 kernel
289 compile_generic unionfs2.4 kernel
291 print_info 1 'unionfs: >> Copying to cache...'
293 mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
297 cp unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
299 cp unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
303 /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
304 gen_die 'Could not create unionfs modules binary cache'
307 rm -rf "${UNIONFS_DIR}" > /dev/null
308 rm -rf unionfs > /dev/null
312 compile_unionfs_utils() {
313 if [ ! -f "${UNIONFS_BINCACHE}" ]
315 [ -f "${UNIONFS_SRCTAR}" ] ||
316 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
318 rm -rf ${UNIONFS_DIR} > /dev/null
319 rm -rf unionfs > /dev/null
320 mkdir -p unionfs/sbin
321 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
322 gen_die 'Could not extract unionfs source tarball!'
323 [ -d "${UNIONFS_DIR}" ] ||
324 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
326 print_info 1 'unionfs tools: >> Compiling...'
327 sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g'
328 compile_generic utils utils
330 print_info 1 'unionfs: >> Copying to cache...'
331 strip uniondbg unionctl
332 cp uniondbg ${TEMP}/unionfs/sbin/ ||
333 gen_die 'Could not copy the uniondbg binary to the tmp directory'
334 cp unionctl ${TEMP}/unionfs/sbin/ ||
335 gen_die 'Could not copy the unionctl binary to the tmp directory'
337 /bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
338 gen_die 'Could not create unionfs tools binary cache'
341 rm -rf "${UNIONFS_DIR}" > /dev/null
342 rm -rf unionfs > /dev/null
347 if [ ! -f "${BUSYBOX_BINCACHE}" ]
349 [ -f "${BUSYBOX_SRCTAR}" ] ||
350 gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
351 [ -f "${BUSYBOX_CONFIG}" ] ||
352 gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
354 rm -rf ${BUSYBOX_DIR} > /dev/null
355 /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
356 gen_die 'Could not extract busybox source tarball!'
357 [ -d "${BUSYBOX_DIR}" ] ||
358 gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
359 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
360 sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
362 print_info 1 'busybox: >> Configuring...'
363 yes '' 2>/dev/null | compile_generic oldconfig utils
364 print_info 1 'busybox: >> Compiling...'
365 compile_generic all utils
366 print_info 1 'busybox: >> Copying to cache...'
367 [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
368 gen_die 'Busybox executable does not exist!'
369 strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
370 gen_die 'Could not strip busybox binary!'
371 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" ||
372 gen_die 'bzip2 compression of busybox failed!'
373 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" ||
374 gen_die 'Could not copy the busybox binary to the package directory, does the directory exist?'
377 rm -rf "${BUSYBOX_DIR}" > /dev/null
382 compile_device_mapper
383 if [ ! -f "${LVM2_BINCACHE}" ]
385 [ -f "${LVM2_SRCTAR}" ] ||
386 gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
388 rm -rf ${LVM2_DIR} > /dev/null
389 /bin/tar -zxpf ${LVM2_SRCTAR} ||
390 gen_die 'Could not extract LVM2 source tarball!'
391 [ -d "${LVM2_DIR}" ] ||
392 gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
393 rm -rf "${TEMP}/device-mapper" > /dev/null
394 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
395 gen_die "Could not extract device-mapper binary cache!";
398 print_info 1 'lvm2: >> Configuring...'
399 LDFLAGS="-L${TEMP}/device-mapper/lib" \
400 CFLAGS="-I${TEMP}/device-mapper/include" \
401 CPPFLAGS="-I${TEMP}/device-mapper/include" \
402 ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
403 gen_die 'Configure of lvm2 failed!'
404 print_info 1 'lvm2: >> Compiling...'
405 compile_generic '' utils
406 compile_generic 'install' utils
409 print_info 1 ' >> Copying to bincache...'
410 strip "sbin/lvm.static" ||
411 gen_die 'Could not strip lvm.static!'
412 /bin/tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
413 gen_die 'Could not create binary cache'
416 rm -rf "${TEMP}/device-mapper" > /dev/null
417 rm -rf "${LVM2_DIR}" lvm2
422 compile_device_mapper
423 if [ ! -f "${DMRAID_BINCACHE}" ]
425 [ -f "${DMRAID_SRCTAR}" ] ||
426 gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
428 rm -rf ${DMRAID_DIR} > /dev/null
429 /bin/tar -jxpf ${DMRAID_SRCTAR} ||
430 gen_die 'Could not extract DMRAID source tarball!'
431 [ -d "${DMRAID_DIR}" ] ||
432 gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
433 rm -rf "${TEMP}/device-mapper" > /dev/null
434 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
435 gen_die "Could not extract device-mapper binary cache!";
438 print_info 1 'dmraid: >> Configuring...'
440 LDFLAGS="-L${TEMP}/device-mapper/lib" \
441 CFLAGS="-I${TEMP}/device-mapper/include" \
442 CPPFLAGS="-I${TEMP}/device-mapper/include" \
443 ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
444 gen_die 'Configure of dmraid failed!'
446 #We dont necessarily have selinux installed yet .. look into selinux global support in the future.
447 sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
448 mkdir -p "${TEMP}/dmraid"
449 print_info 1 'dmraid: >> Compiling...'
450 compile_generic '' utils
451 #compile_generic 'install' utils
452 mkdir ${TEMP}/dmraid/sbin
453 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
454 print_info 1 ' >> Copying to bincache...'
456 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
457 gen_die 'Could not create binary cache'
460 rm -rf "${TEMP}/device-mapper" > /dev/null
461 rm -rf "${DMRAID_DIR}" dmraid
466 # I've disabled dietlibc support for the time being since the
467 # version we use misses a few needed system calls.
470 if [ ! -f "${MODUTILS_BINCACHE}" ]
472 [ ! -f "${MODUTILS_SRCTAR}" ] &&
473 gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
475 rm -rf "${MODUTILS_DIR}"
476 /bin/tar -jxpf "${MODUTILS_SRCTAR}"
477 [ ! -d "${MODUTILS_DIR}" ] &&
478 gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
480 print_info 1 "modutils: >> Configuring..."
482 # if [ "${USE_DIETLIBC}" -eq '1' ]
484 # extract_dietlibc_bincache
485 # OLD_CC="${UTILS_CC}"
486 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
491 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
492 gen_die 'Configuring modutils failed!'
495 print_info 1 'modutils: >> Compiling...'
496 compile_generic all utils
498 # if [ "${USE_DIETLIBC}" -eq '1' ]
500 # clean_dietlibc_bincache
501 # UTILS_CC="${OLD_CC}"
504 print_info 1 'modutils: >> Copying to cache...'
505 [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
506 gen_die 'insmod.static does not exist after the compilation of modutils!'
507 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
508 gen_die 'Could not strip insmod.static!'
509 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
510 gen_die 'Compression of insmod.static failed!'
511 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
512 gen_die 'Could not move the compressed insmod binary to the package cache!'
515 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
519 compile_module_init_tools() {
520 # I've disabled dietlibc support for the time being since the
521 # version we use misses a few needed system calls.
524 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
526 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
527 gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
529 rm -rf "${MODULE_INIT_TOOLS_DIR}"
530 /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
531 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
532 gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
533 cd "${MODULE_INIT_TOOLS_DIR}"
534 print_info 1 'module-init-tools: >> Configuring'
536 # if [ "${USE_DIETLIBC}" -eq '1' ]
538 # extract_dietlibc_bincache
539 # OLD_CC="${UTILS_CC}"
540 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
544 ./configure >> ${DEBUGFILE} 2>&1 ||
545 gen_die 'Configure of module-init-tools failed!'
547 print_info 1 ' >> Compiling...'
548 compile_generic "all" utils
550 # if [ "${USE_DIETLIBC}" -eq '1' ]
552 # clean_dietlibc_bincache
553 # UTILS_CC="${OLD_CC}"
556 print_info 1 ' >> Copying to cache...'
557 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
558 gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
559 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
560 gen_die 'Could not strip insmod.static!'
561 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
562 gen_die 'Compression of insmod.static failed!'
563 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
564 gen_die 'Could not find compressed insmod.static.bz2 binary!'
565 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
566 gen_die 'Could not move the compressed insmod binary to the package cache!'
569 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
574 # I've disabled dietlibc support for the time being since the
575 # version we use misses a few needed system calls.
578 if [ ! -f "${DEVFSD_BINCACHE}" ]
580 [ ! -f "${DEVFSD_SRCTAR}" ] &&
581 gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
583 rm -rf "${DEVFSD_DIR}"
584 /bin/tar -jxpf "${DEVFSD_SRCTAR}"
585 [ ! -d "${DEVFSD_DIR}" ] &&
586 gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
589 # if [ "${USE_DIETLIBC}" -eq '1' ]
591 # extract_dietlibc_bincache
592 # OLD_CC="${UTILS_CC}"
593 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
596 print_info 1 'devfsd: >> Compiling...'
597 # if [ "${USE_DIETLIBC}" -eq '1' ]
599 # compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
601 compile_generic 'LDFLAGS=-static' utils
604 # if [ "${USE_DIETLIBC}" -eq '1' ]
606 # clean_dietlibc_bincache
607 # UTILS_CC="${OLD_CC}"
610 print_info 1 ' >> Copying to cache...'
611 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
612 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
613 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
614 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
615 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
617 # [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
618 # bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
619 # mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
622 rm -rf "${DEVFSD_DIR}" > /dev/null
626 compile_device_mapper() {
627 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
629 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
630 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!"
632 rm -rf "${DEVICE_MAPPER_DIR}"
633 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
634 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
635 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
636 cd "${DEVICE_MAPPER_DIR}"
637 ./configure --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
638 gen_die 'Configuring device-mapper failed!'
639 print_info 1 'device-mapper: >> Compiling...'
640 compile_generic '' utils
641 compile_generic 'install' utils
642 print_info 1 ' >> Copying to cache...'
644 rm -r "${TEMP}/device-mapper/man" ||
645 gen_die 'Could not remove manual pages!'
646 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
647 gen_die 'Could not strip dmsetup binary!'
648 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
649 gen_die 'Could not tar up the device-mapper binary!'
650 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
651 gen_die 'device-mapper cache not created!'
653 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
654 rm -rf "${TEMP}/device-mapper" > /dev/null
663 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
664 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
665 if ! isTrue "${BUILD_DIETLIBC}"
667 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
668 if [ "${TEMP}" != "${ORIGTEMP}" ]
670 print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
671 print_warning 1 ' is different to the original. Rebuilding.'
676 if [ "${BUILD_DIETLIBC}" -eq '1' ]
678 [ -f "${DIETLIBC_SRCTAR}" ] ||
679 gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
681 rm -rf "${DIETLIBC_DIR}" > /dev/null
682 /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
683 gen_die 'Could not extract dietlibc source tarball'
684 [ -d "${DIETLIBC_DIR}" ] ||
685 gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
687 print_info 1 "dietlibc: >> Compiling..."
688 compile_generic "prefix=${TEMP}/diet" utils
689 print_info 1 " >> Installing..."
690 compile_generic "prefix=${TEMP}/diet install" utils
691 print_info 1 " >> Copying to bincache..."
693 /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
694 gen_die 'Could not tar up the dietlibc binary!'
695 [ -f "${DIETLIBC_BINCACHE}" ] ||
696 gen_die 'Dietlibc cache not created!'
697 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
700 rm -rf "${DIETLIBC_DIR}" > /dev/null
701 rm -rf "${TEMP}/diet" > /dev/null
706 rm -rf "${KLIBC_DIR}" klibc-build
707 [ ! -f "${KLIBC_SRCTAR}" ] &&
708 gen_die "Could not find klibc tarball: ${KLIBC_SRCTAR}"
709 /bin/tar -xpf "${KLIBC_SRCTAR}" ||
710 gen_die 'Could not extract klibc tarball'
711 [ ! -d "${KLIBC_DIR}" ] &&
712 gen_die "klibc tarball ${KLIBC_SRCTAR} is invalid"
714 print_info 1 'klibc: >> Compiling...'
715 ln -snf "${KERNEL_DIR}" linux || gen_die "Could not link to ${KERNEL_DIR}"
716 sed -i MCONFIG -e "s|prefix =.*|prefix = ${TEMP}/klibc-build|g"
717 # PPC fixup for 2.6.14
718 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
720 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
722 # Headers are moving around .. need to make them available
723 echo 'INCLUDE += -I$(KRNLSRC)/arch/$(ARCH)/include' >> MCONFIG
726 if [ "${ARCH}" = 'um' ]
728 compile_generic "ARCH=um" runtask
729 elif [ "${ARCH}" = 'sparc64' ]
731 compile_generic "ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu-" runtask
733 compile_generic "" runtask
735 compile_generic "install" runtask
739 if [ ! -f "${UDEV_BINCACHE}" ]
741 # PPC fixup for 2.6.14
742 # Headers are moving around .. need to make them available
743 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
745 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
748 echo 'Applying hack to workaround 2.6.14+ PPC header breakages...'
749 compile_generic 'include/asm' kernel
754 rm -rf "${UDEV_DIR}" udev
755 [ ! -f "${UDEV_SRCTAR}" ] &&
756 gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
757 /bin/tar -jxpf "${UDEV_SRCTAR}" ||
758 gen_die 'Could not extract udev tarball'
759 [ ! -d "${UDEV_DIR}" ] &&
760 gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
763 local extras="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware"
764 # No selinux support yet .. someday maybe
765 #use selinux && myconf="${myconf} USE_SELINUX=true"
766 print_info 1 'udev: >> Compiling...'
767 # PPC fixup for 2.6.14
768 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
770 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
772 # Headers are moving around .. need to make them available
773 echo "CFLAGS += -I${KERNEL_DIR}/arch/${ARCH}/include" >> Makefile
777 if [ "${ARCH}" = 'um' ]
779 compile_generic "EXTRAS=\"${extras}\" ARCH=um USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
780 elif [ "${ARCH}" = 'sparc64' ]
782 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
784 compile_generic "EXTRAS=\"${extras}\" USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
788 print_info 1 ' >> Installing...'
789 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"||
790 gen_die 'Could not create directory hierarchy'
792 install -c etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
793 gen_die 'Could not copy gentoo udev.rules to 50-udev.rules'
795 compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-config" runtask
796 compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-bin" runtask
797 install -c extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts"
798 install -c extras/scsi-devfs.sh "${TEMP}/udev/etc/udev/scripts"
799 install -c extras/raid-devfs.sh "${TEMP}/udev/etc/udev/scripts"
802 print_info 1 ' >> Copying to bincache...'
803 /bin/tar -cjf "${UDEV_BINCACHE}" * ||
804 gen_die 'Could not create binary cache'
807 rm -rf "${UDEV_DIR}" udev
809 # PPC fixup for 2.6.14
810 if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
812 if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
815 compile_generic 'archclean' kernel
822 compile_e2fsprogs() {
823 if [ ! -f "${BLKID_BINCACHE}" ]
825 [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
826 gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
828 rm -rf "${E2FSPROGS_DIR}"
829 tar -zxpf "${E2FSPROGS_SRCTAR}"
830 [ ! -d "${E2FSPROGS_DIR}" ] &&
831 gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
832 cd "${E2FSPROGS_DIR}"
833 print_info 1 'e2fsprogs: >> Configuring...'
834 ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
835 gen_die 'Configuring e2fsprogs failed!'
836 print_info 1 'e2fsprogs: >> Compiling...'
837 MAKE=${UTILS_MAKE} compile_generic "" ""
838 print_info 1 'blkid: >> Copying to cache...'
839 [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
840 gen_die 'Blkid executable does not exist!'
841 strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
842 gen_die 'Could not strip blkid binary!'
843 bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
844 gen_die 'bzip2 compression of blkid failed!'
845 mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
846 gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
849 rm -rf "${E2FSPROGS_DIR}" > /dev/null