4 compile_kernel_args() {
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}\""
24 if [ -n "${KERNEL_ARCH}" ]
26 ARGS="${ARGS} ARCH=\"${KERNEL_ARCH}\""
37 if [ -n "${UTILS_CROSS_COMPILE}" ]
39 UTILS_CC="${UTILS_CROSS_COMPILE}gcc"
40 UTILS_LD="${UTILS_CROSS_COMPILE}ld"
41 UTILS_AS="${UTILS_CROSS_COMPILE}as"
44 if [ "${UTILS_ARCH}" != '' ]
46 ARGS="ARCH=\"${UTILS_ARCH}\""
48 if [ "${UTILS_CC}" != '' ]
50 ARGS="CC=\"${UTILS_CC}\""
52 if [ "${UTILS_LD}" != '' ]
54 ARGS="${ARGS} LD=\"${UTILS_LD}\""
56 if [ "${UTILS_AS}" != '' ]
58 ARGS="${ARGS} AS=\"${UTILS_AS}\""
67 if [ "${UTILS_ARCH}" != '' ]
69 export ARCH="${UTILS_ARCH}"
71 if [ "${UTILS_CC}" != '' ]
73 export CC="${UTILS_CC}"
75 if [ "${UTILS_LD}" != '' ]
77 export LD="${UTILS_LD}"
79 if [ "${UTILS_AS}" != '' ]
81 export AS="${UTILS_AS}"
87 if [ "${UTILS_ARCH}" != '' ]
91 if [ "${UTILS_CC}" != '' ]
95 if [ "${UTILS_LD}" != '' ]
99 if [ "${UTILS_AS}" != '' ]
108 if [ "${KERNEL_CC}" != '' ]
110 export CC="${KERNEL_CC}"
112 if [ "${KERNEL_LD}" != '' ]
114 export LD="${KERNEL_LD}"
116 if [ "${KERNEL_AS}" != '' ]
118 export AS="${KERNEL_AS}"
120 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
122 export CROSS_COMPILE="${KERNEL_CROSS_COMPILE}"
128 if [ "${KERNEL_CC}" != '' ]
132 if [ "${KERNEL_LD}" != '' ]
136 if [ "${KERNEL_AS}" != '' ]
140 if [ "${KERNEL_CROSS_COMPILE}" != '' ]
147 if [ "${ARCH}" != '' ]
149 export ORIG_ARCH="${ARCH}"
153 export ORIG_CC="${CC}"
157 export ORIG_LD="${LD}"
161 export ORIG_AS="${AS}"
163 if [ "${CROSS_COMPILE}" != '' ]
165 export ORIG_CROSS_COMPILE="${CROSS_COMPILE}"
170 if [ "${ORIG_ARCH}" != '' ]
172 export ARCH="${ORIG_ARCH}"
175 if [ "${ORIG_CC}" != '' ]
177 export CC="${ORIG_CC}"
180 if [ "${ORIG_LD}" != '' ]
182 export LD="${ORIG_LD}"
185 if [ "${ORIG_AS}" != '' ]
187 export AS="${ORIG_AS}"
190 if [ "${ORIG_CROSS_COMPILE}" != '' ]
192 export CROSS_COMPILE="${ORIG_CROSS_COMPILE}"
193 unset ORIG_CROSS_COMPILE
201 if [ -d "${GK_SHARE}/patches/${util}/${version}" ]
203 print_info 1 "${util}: >> Applying patches..."
204 for i in ${GK_SHARE}/patches/${util}/${version}/*{diff,patch}
206 [ -f "${i}" ] || continue
210 patch -p${j} --backup-if-mismatch -f < "${i}" >/dev/null
217 if [ ${patch_success} -eq 1 ]
219 print_info 1 " - `basename ${i}`"
221 gen_die "could not apply patch ${i} for ${util}-${version}"
230 gen_die 'compile_generic(): improper usage!'
234 case "${argstype}" in
235 kernel|kernelruntask)
245 case "${argstype}" in
246 kernel|kernelruntask) ARGS="`compile_kernel_args`" ;;
247 utils) ARGS="`compile_utils_args`" ;;
252 # the eval usage is needed in the next set of code
253 # as ARGS can contain spaces and quotes, eg:
254 # ARGS='CC="ccache gcc"'
255 if [ "${argstype}" == 'kernelruntask' ]
257 # Silent operation, forced -j1
258 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1
259 eval ${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $*
261 elif [ "${LOGLEVEL}" -gt "1" ]
263 # Output to stdout and logfile
264 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
265 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE}
268 # Output to logfile only
269 print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1} $*" 1 0 1
270 eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
274 gen_die "Failed to compile the \"${target}\" target..."
279 case "${argstype}" in
280 kernel) unset_kernel_args ;;
281 utils) unset_utils_args ;;
286 print_info 1 " >> Compiling ${KV} modules..."
288 compile_generic modules kernel
289 export UNAME_MACHINE="${ARCH}"
290 [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
291 MAKEOPTS="${MAKEOPTS} -j1" compile_generic "modules_install" kernel
296 [ "${KERNEL_MAKE}" = '' ] &&
297 gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
299 local kernel_make_directive="${KERNEL_MAKE_DIRECTIVE}"
300 if [ "${KERNEL_MAKE_DIRECTIVE_OVERRIDE}" != "${DEFAULT_KERNEL_MAKE_DIRECTIVE_OVERRIDE}" ]; then
301 kernel_make_directive="${KERNEL_MAKE_DIRECTIVE_OVERRIDE}"
303 print_info 1 " >> Compiling ${KV} ${kernel_make_directive/_install/ [ install ]/}..."
304 compile_generic "${kernel_make_directive}" kernel
305 if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
307 print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
308 compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
311 local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL "${KERNEL_DIR}"/.config`
312 if [ -n "${firmware_in_kernel_line}" -a "${firmware_in_kernel_line}" != CONFIG_FIRMWARE_IN_KERNEL=y ]
314 print_info 1 " >> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..."
315 MAKEOPTS="${MAKEOPTS} -j1" compile_generic "firmware_install" kernel
317 print_info 1 " >> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..."
320 local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}})
321 local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2})
322 if [ -z "${tmp_kernel_binary}" ]
324 gen_die "Cannot locate kernel binary"
327 if isTrue "${CMD_INSTALL}"
329 copy_image_with_preserve "kernel" \
330 "${tmp_kernel_binary}" \
331 "kernel-${KNAME}-${ARCH}-${KV}"
333 copy_image_with_preserve "System.map" \
335 "System.map-${KNAME}-${ARCH}-${KV}"
337 if isTrue "${GENZIMAGE}"
339 copy_image_with_preserve "kernelz" \
340 "${tmp_kernel_binary2}" \
344 cp "${tmp_kernel_binary}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
345 gen_die "Could not copy the kernel binary to ${TMPDIR}!"
346 cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
347 gen_die "Could not copy System.map to ${TMPDIR}!"
348 if isTrue "${GENZIMAGE}"
350 cp "${tmp_kernel_binary2}" "${TMPDIR}/kernelz-${KV}" ||
351 gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
357 [ -f "${BUSYBOX_SRCTAR}" ] ||
358 gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
360 if [ -n "${BUSYBOX_CONFIG}" ]
362 [ -f "${BUSYBOX_CONFIG}" ] ||
363 gen_die "Could not find busybox config file: ${BUSYBOX_CONFIG}"
364 elif isTrue "${NETBOOT}" && [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")" ]
366 BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")"
367 elif isTrue "${NETBOOT}" && [ -f "${GK_SHARE}/netboot/busy-config" ]
369 BUSYBOX_CONFIG="${GK_SHARE}/netboot/busy-config"
370 elif [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")" ]
372 BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")"
373 elif [ -f "${GK_SHARE}/defaults/busy-config" ]
375 BUSYBOX_CONFIG="${GK_SHARE}/defaults/busy-config"
377 gen_die "Could not find a busybox config file"
380 # Delete cache if stored config's MD5 does not match one to be used
381 if [ -f "${BUSYBOX_BINCACHE}" ]
383 oldconfig_md5=$(tar -xjf "${BUSYBOX_BINCACHE}" -O .config.gk_orig 2>/dev/null | md5sum)
384 newconfig_md5=$(md5sum < "${BUSYBOX_CONFIG}")
385 if [ "${oldconfig_md5}" != "${newconfig_md5}" ]
387 print_info 1 "busybox: >> Removing stale cache..."
388 rm -rf "${BUSYBOX_BINCACHE}"
390 print_info 1 "busybox: >> Using cache"
394 if [ ! -f "${BUSYBOX_BINCACHE}" ]
397 rm -rf "${BUSYBOX_DIR}" > /dev/null
398 /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
399 gen_die 'Could not extract busybox source tarball!'
400 [ -d "${BUSYBOX_DIR}" ] ||
401 gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
402 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
403 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
405 apply_patches busybox ${BUSYBOX_VER}
406 print_info 1 'busybox: >> Configuring...'
407 yes '' 2>/dev/null | compile_generic oldconfig utils
409 print_info 1 'busybox: >> Compiling...'
410 compile_generic all utils
411 print_info 1 'busybox: >> Copying to cache...'
412 [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
413 gen_die 'Busybox executable does not exist!'
414 strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
415 gen_die 'Could not strip busybox binary!'
416 tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config .config.gk_orig ||
417 gen_die 'Could not create the busybox bincache!'
420 rm -rf "${BUSYBOX_DIR}" > /dev/null
425 if [ -f "${LVM_BINCACHE}" ]
427 print_info 1 "lvm: >> Using cache"
429 [ -f "${LVM_SRCTAR}" ] ||
430 gen_die "Could not find LVM source tarball: ${LVM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
432 rm -rf ${LVM_DIR} > /dev/null
433 /bin/tar -zxpf ${LVM_SRCTAR} ||
434 gen_die 'Could not extract LVM source tarball!'
435 [ -d "${LVM_DIR}" ] ||
436 gen_die 'LVM directory ${LVM_DIR} is invalid!'
438 apply_patches lvm ${LVM_VER}
439 print_info 1 'lvm: >> Configuring...'
441 ./configure --enable-static_link --prefix=${TEMP}/lvm \
442 --with-lvm1=internal --with-clvmd=none --with-cluster=none \
443 --disable-readline --disable-selinux --with-mirrors=internal \
444 --with-snapshots=internal --with-pool=internal >> ${LOGFILE} 2>&1 || \
445 gen_die 'Configure of lvm failed!'
446 print_info 1 'lvm: >> Compiling...'
447 compile_generic '' utils
448 compile_generic 'install' utils
451 print_info 1 ' >> Copying to bincache...'
452 strip "sbin/lvm.static" ||
453 gen_die 'Could not strip lvm.static!'
455 strip "sbin/dmsetup.static" ||
456 gen_die 'Could not strip dmsetup.static'
457 /bin/tar -cjf "${LVM_BINCACHE}" sbin/lvm.static sbin/dmsetup.static ||
458 gen_die 'Could not create binary cache'
461 rm -rf "${TEMP}/device-mapper" > /dev/null
462 rm -rf "${LVM_DIR}" lvm
467 if [ -f "${MDADM_BINCACHE}" ]
469 print_info 1 ' MDADM: Using cache'
471 [ -f "${MDADM_SRCTAR}" ] ||
472 gen_die "Could not find MDADM source tarball: ${MDADM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
474 rm -rf "${MDADM_DIR}" > /dev/null
475 /bin/tar -jxpf "${MDADM_SRCTAR}" ||
476 gen_die 'Could not extract MDADM source tarball!'
477 [ -d "${MDADM_DIR}" ] ||
478 gen_die 'MDADM directory ${MDADM_DIR} is invalid!'
481 apply_patches mdadm ${MDADM_VER}
482 sed -i "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = -Os:" Makefile
483 sed -i "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = -Os:" Makefile
484 sed -i "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" Makefile
485 sed -i "s/^# LDFLAGS = -static/LDFLAGS = -static/" Makefile
487 print_info 1 'mdadm: >> Compiling...'
488 compile_generic 'mdadm mdmon' utils
490 mkdir -p "${TEMP}/mdadm/sbin"
491 install -m 0755 -s mdadm "${TEMP}/mdadm/sbin/mdadm"
492 install -m 0755 -s mdmon "${TEMP}/mdadm/sbin/mdmon"
493 print_info 1 ' >> Copying to bincache...'
495 strip "sbin/mdadm" "sbin/mdmon" ||
496 gen_die 'Could not strip mdadm binaries!'
497 /bin/tar -cjf "${MDADM_BINCACHE}" sbin/mdadm sbin/mdmon ||
498 gen_die 'Could not create binary cache'
501 rm -rf "${MDADM_DIR}" mdadm
506 compile_device_mapper
507 if [ ! -f "${DMRAID_BINCACHE}" ]
509 [ -f "${DMRAID_SRCTAR}" ] ||
510 gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
512 rm -rf ${DMRAID_DIR} > /dev/null
513 /bin/tar -jxpf ${DMRAID_SRCTAR} ||
514 gen_die 'Could not extract DMRAID source tarball!'
515 [ -d "${DMRAID_DIR}" ] ||
516 gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
517 rm -rf "${TEMP}/device-mapper" > /dev/null
518 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
519 gen_die "Could not extract device-mapper binary cache!";
522 apply_patches dmraid ${DMRAID_VER}
523 print_info 1 'dmraid: >> Configuring...'
525 LDFLAGS="-L${TEMP}/device-mapper/lib" \
526 CFLAGS="-I${TEMP}/device-mapper/include" \
527 CPPFLAGS="-I${TEMP}/device-mapper/include" \
528 ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 ||
529 gen_die 'Configure of dmraid failed!'
531 # We dont necessarily have selinux installed yet... look into
532 # selinux global support in the future.
533 sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
534 ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile
535 mkdir -p "${TEMP}/dmraid"
536 print_info 1 'dmraid: >> Compiling...'
537 # Force dmraid to be built with -j1 for bug #188273
538 MAKEOPTS="${MAKEOPTS} -j1" compile_generic '' utils
539 #compile_generic 'install' utils
540 mkdir ${TEMP}/dmraid/sbin
541 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
542 print_info 1 ' >> Copying to bincache...'
544 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
545 gen_die 'Could not create binary cache'
548 rm -rf "${TEMP}/device-mapper" > /dev/null
549 rm -rf "${DMRAID_DIR}" dmraid
553 compile_device_mapper() {
554 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
556 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
557 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!"
559 rm -rf "${DEVICE_MAPPER_DIR}"
560 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
561 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
562 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
563 cd "${DEVICE_MAPPER_DIR}"
564 apply_patches device-mapper ${DEVICE_MAPPER_VER}
566 ./configure --prefix=${TEMP}/device-mapper --enable-static_link \
567 --disable-selinux >> ${LOGFILE} 2>&1 ||
568 gen_die 'Configuring device-mapper failed!'
569 print_info 1 'device-mapper: >> Compiling...'
570 compile_generic '' utils
571 compile_generic 'install' utils
572 print_info 1 ' >> Copying to cache...'
574 rm -rf "${TEMP}/device-mapper/man" ||
575 gen_die 'Could not remove manual pages!'
576 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
577 gen_die 'Could not strip dmsetup binary!'
578 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
579 gen_die 'Could not tar up the device-mapper binary!'
580 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
581 gen_die 'device-mapper cache not created!'
583 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
584 rm -rf "${TEMP}/device-mapper" > /dev/null
588 compile_e2fsprogs() {
589 if [ -f "${BLKID_BINCACHE}" ]
591 print_info 1 "blkid: >> Using cache"
593 [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
594 gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
596 rm -rf "${E2FSPROGS_DIR}"
597 tar -zxpf "${E2FSPROGS_SRCTAR}"
598 [ ! -d "${E2FSPROGS_DIR}" ] &&
599 gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
600 cd "${E2FSPROGS_DIR}"
601 apply_patches e2fsprogs ${E2FSPROGS_VER}
602 print_info 1 'e2fsprogs: >> Configuring...'
603 LDFLAGS=-static ./configure >> ${LOGFILE} 2>&1 ||
604 gen_die 'Configuring e2fsprogs failed!'
605 print_info 1 'e2fsprogs: >> Compiling...'
606 MAKE=${UTILS_MAKE} MAKEOPTS="${MAKEOPTS} -j1" compile_generic "" ""
607 print_info 1 'blkid: >> Copying to cache...'
608 [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
609 gen_die 'Blkid executable does not exist!'
610 strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
611 gen_die 'Could not strip blkid binary!'
612 bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
613 gen_die 'bzip2 compression of blkid failed!'
614 mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
615 gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
618 rm -rf "${E2FSPROGS_DIR}" > /dev/null
623 if [ ! -f "${FUSE_BINCACHE}" ]
625 [ ! -f "${FUSE_SRCTAR}" ] &&
626 gen_die "Could not find fuse source tarball: ${FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
629 tar -zxpf "${FUSE_SRCTAR}"
630 [ ! -d "${FUSE_DIR}" ] &&
631 gen_die "fuse directory ${FUSE_DIR} invalid"
633 apply_patches fuse ${FUSE_VER}
634 print_info 1 'fuse: >> Configuring...'
635 ./configure --disable-kernel-module --disable-example >> ${LOGFILE} 2>&1 ||
636 gen_die 'Configuring fuse failed!'
637 print_info 1 'fuse: >> Compiling...'
638 MAKE=${UTILS_MAKE} compile_generic "" ""
640 # Since we're linking statically against libfuse, we don't need to cache the .so
641 # print_info 1 'libfuse: >> Copying to cache...'
642 # [ -f "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ] ||
643 # gen_die 'libfuse.so does not exist!'
644 # strip "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ||
645 # gen_die 'Could not strip libfuse.so!'
646 # cd "${TEMP}/${FUSE_DIR}/lib/.libs"
647 # tar -cjf "${FUSE_BINCACHE}" libfuse*so* ||
648 # gen_die 'Could not create fuse bincache!'
651 # rm -rf "${FUSE_DIR}" > /dev/null
655 compile_unionfs_fuse() {
656 if [ ! -f "${UNIONFS_FUSE_BINCACHE}" ]
659 # We'll call compile_fuse() from here, since it's not needed directly by anything else
662 [ ! -f "${UNIONFS_FUSE_SRCTAR}" ] &&
663 gen_die "Could not find unionfs-fuse source tarball: ${UNIONFS_FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
665 rm -rf "${UNIONFS_FUSE_DIR}"
666 tar -jxpf "${UNIONFS_FUSE_SRCTAR}"
667 [ ! -d "${UNIONFS_FUSE_DIR}" ] &&
668 gen_die "unionfs-fuse directory ${UNIONFS_FUSE_DIR} invalid"
669 cd "${UNIONFS_FUSE_DIR}"
670 apply_patches unionfs-fuse ${UNIONFS_FUSE_VER}
671 print_info 1 'unionfs-fuse: >> Compiling...'
672 sed -i "/^\(CFLAGS\|CPPFLAGS\)/s:^\\(.*\\)$:\\1 -static -I${TEMP}/${FUSE_DIR}/include -L${TEMP}/${FUSE_DIR}/lib/.libs:" Makefile src/Makefile
673 sed -i "/^LIB = /s:^LIB = \(.*\)$:LIB = -static -L${TEMP}/${FUSE_DIR}/lib/.libs \1 -ldl -lrt:" Makefile src/Makefile
674 MAKE=${UTILS_MAKE} compile_generic "" ""
675 print_info 1 'unionfs-fuse: >> Copying to cache...'
676 [ -f "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ] ||
677 gen_die 'unionfs binary does not exist!'
678 strip "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
679 gen_die 'Could not strip unionfs binary!'
680 bzip2 "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
681 gen_die 'bzip2 compression of unionfs binary failed!'
682 mv "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs.bz2" "${UNIONFS_FUSE_BINCACHE}" ||
683 gen_die 'Could not copy the unionfs binary to the package directory, does the directory exist?'
686 rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
691 if [ ! -f "${ISCSI_BINCACHE}" ]
693 [ ! -f "${ISCSI_SRCTAR}" ] &&
694 gen_die "Could not find iSCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
696 rm -rf "${ISCSI_DIR}"
697 tar -zxpf "${ISCSI_SRCTAR}"
698 [ ! -d "${ISCSI_DIR}" ] &&
699 gen_die "ISCSI directory ${ISCSI_DIR} invalid"
700 print_info 1 'iSCSI: >> Compiling...'
701 cd "${TEMP}/${ISCSI_DIR}"
702 apply_patches iscsi ${ISCSI_VER}
704 # Only build userspace
705 print_info 1 'iSCSI: >> Configuring userspace...'
706 cd utils/open-isns || gen_die 'Could not enter open-isns dir'
707 # we currently have a patch that changes configure.ac
708 # once given patch is dropped, drop autoconf too
709 autoconf || gen_die 'Could not tweak open-iscsi configuration'
710 ./configure --without-slp >> ${LOGFILE} 2>&1 || gen_die 'Could not configure userspace'
711 cd ../.. || gen_die 'wtf?'
712 MAKE=${UTILS_MAKE} compile_generic "user" ""
714 # if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel
715 mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
716 for modname in iscsi_tcp libiscsi scsi_transport_iscsi
718 if [ -e "${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko" ]
720 cp ${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
724 cd "${TEMP}/initramfs-iscsi-temp/"
725 print_info 1 'iscsistart: >> Copying to cache...'
726 [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] ||
727 gen_die 'iscsistart executable does not exist!'
728 strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
729 gen_die 'Could not strip iscsistart binary!'
730 bzip2 "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
731 gen_die 'bzip2 compression of iscsistart failed!'
732 mv "${TEMP}/${ISCSI_DIR}/usr/iscsistart.bz2" "${ISCSI_BINCACHE}" ||
733 gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
736 rm -rf "${ISCSI_DIR}" > /dev/null
741 if [ -f "${GPG_BINCACHE}" ]
743 print_info 1 "gnupg: >> Using cache"
745 [ ! -f "${GPG_SRCTAR}" ] &&
746 gen_die "Could not find gnupg source tarball: ${GPG_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
749 tar -jxf "${GPG_SRCTAR}"
750 [ ! -d "${GPG_DIR}" ] &&
751 gen_die "gnupg directory ${GPG_DIR} invalid"
753 apply_patches gnupg ${GPG_VER}
754 print_info 1 'gnupg: >> Configuring...'
755 # --enable-minimal works, but it doesn't reduce the command length much.
756 # Given its history and the precision this needs, explicit is cleaner.
757 LDFLAGS='-static' CFLAGS='-Os' ./configure --prefix=/ \
758 --enable-static-rnd=linux --disable-dev-random --disable-asm \
759 --disable-selinux-support --disable-gnupg-iconv --disable-card-support \
760 --disable-agent-support --disable-bzip2 --disable-exec \
761 --disable-photo-viewers --disable-keyserver-helpers --disable-ldap \
762 --disable-hkp --disable-finger --disable-generic --disable-mailto \
763 --disable-keyserver-path --disable-dns-srv --disable-dns-pka \
764 --disable-dns-cert --disable-nls --disable-threads --disable-regex \
765 --disable-optimization --with-included-zlib --without-capabilities \
766 --without-tar --without-ldap --without-libcurl --without-mailprog \
767 --without-libpth-prefix --without-libiconv-prefix --without-libintl-prefix\
768 --without-zlib --without-bzip2 --without-libusb --without-readline \
769 >> ${LOGFILE} 2>&1 || gen_die 'Configuring gnupg failed!'
770 print_info 1 'gnupg: >> Compiling...'
771 compile_generic "" "utils"
772 print_info 1 'gnupg: >> Copying to cache...'
773 [ -f "${TEMP}/${GPG_DIR}/g10/gpg" ] ||
774 gen_die 'gnupg executable does not exist!'
775 strip "${TEMP}/${GPG_DIR}/g10/gpg" ||
776 gen_die 'Could not strip gpg binary!'
777 bzip2 -z -c "${TEMP}/${GPG_DIR}/g10/gpg" > "${GPG_BINCACHE}" ||
778 gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?'
781 rm -rf "${GPG_DIR}" > /dev/null