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 "${PAT}" -le '4' ]
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 "${PAT}" -le '4' ]
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 "${PAT}" -le '4' ] && 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}" != '' ]
240 cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" ||
241 gen_die 'Could not copy the kernelz binary to /boot!'
244 cp "${KERNEL_BINARY}" "${TEMP}/kernel-${KNAME}-${ARCH}-${KV}" ||
245 gen_die "Could not copy the kernel binary to ${TEMP}!"
246 cp "System.map" "${TEMP}/System.map-${KNAME}-${ARCH}-${KV}" ||
247 gen_die "Could not copy System.map to ${TEMP}!"
248 if [ "${KERNEL_BINARY_2}" != '' ]
250 cp "${KERNEL_BINARY_2}" "${TEMP}/kernelz-${KV}" ||
251 gen_die "Could not copy the kernelz binary to ${TEMP}!"
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"
272 if [ "${PAT}" -ge '6' ]
274 compile_generic unionfs2.6 kernel
276 compile_generic unionfs2.4 kernel
278 print_info 1 'unionfs: >> Copying to cache...'
280 mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
284 cp unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
286 cp unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
290 /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
291 gen_die 'Could not create unionfs modules binary cache'
294 rm -rf "${UNIONFS_DIR}" > /dev/null
295 rm -rf unionfs > /dev/null
299 compile_unionfs_utils() {
300 if [ ! -f "${UNIONFS_BINCACHE}" ]
302 [ -f "${UNIONFS_SRCTAR}" ] ||
303 gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
305 rm -rf ${UNIONFS_DIR} > /dev/null
306 rm -rf unionfs > /dev/null
307 mkdir -p unionfs/sbin
308 /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
309 gen_die 'Could not extract unionfs source tarball!'
310 [ -d "${UNIONFS_DIR}" ] ||
311 gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
313 print_info 1 'unionfs tools: >> Compiling...'
314 sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g'
315 compile_generic utils utils
317 print_info 1 'unionfs: >> Copying to cache...'
318 strip uniondbg unionctl
319 cp uniondbg ${TEMP}/unionfs/sbin/ ||
320 gen_die 'Could not copy the uniondbg binary to the tmp directory'
321 cp unionctl ${TEMP}/unionfs/sbin/ ||
322 gen_die 'Could not copy the unionctl binary to the tmp directory'
324 /bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
325 gen_die 'Could not create unionfs tools binary cache'
328 rm -rf "${UNIONFS_DIR}" > /dev/null
329 rm -rf unionfs > /dev/null
334 if [ ! -f "${BUSYBOX_BINCACHE}" ]
336 [ -f "${BUSYBOX_SRCTAR}" ] ||
337 gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
338 [ -f "${BUSYBOX_CONFIG}" ] ||
339 gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
341 rm -rf ${BUSYBOX_DIR} > /dev/null
342 /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
343 gen_die 'Could not extract busybox source tarball!'
344 [ -d "${BUSYBOX_DIR}" ] ||
345 gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
346 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
347 sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
349 print_info 1 'busybox: >> Configuring...'
350 yes '' 2>/dev/null | compile_generic oldconfig utils
351 print_info 1 'busybox: >> Compiling...'
352 compile_generic all utils
353 print_info 1 'busybox: >> Copying to cache...'
354 [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] ||
355 gen_die 'Busybox executable does not exist!'
356 strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
357 gen_die 'Could not strip busybox binary!'
358 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" ||
359 gen_die 'bzip2 compression of busybox failed!'
360 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" ||
361 gen_die 'Could not copy the busybox binary to the package directory, does the directory exist?'
364 rm -rf "${BUSYBOX_DIR}" > /dev/null
369 compile_device_mapper
370 if [ ! -f "${LVM2_BINCACHE}" ]
372 [ -f "${LVM2_SRCTAR}" ] ||
373 gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
375 rm -rf ${LVM2_DIR} > /dev/null
376 /bin/tar -zxpf ${LVM2_SRCTAR} ||
377 gen_die 'Could not extract LVM2 source tarball!'
378 [ -d "${LVM2_DIR}" ] ||
379 gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
380 rm -rf "${TEMP}/device-mapper" > /dev/null
381 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
382 gen_die "Could not extract device-mapper binary cache!";
385 print_info 1 'lvm2: >> Configuring...'
386 LDFLAGS="-L${TEMP}/device-mapper/lib" \
387 CFLAGS="-I${TEMP}/device-mapper/include" \
388 CPPFLAGS="-I${TEMP}/device-mapper/include" \
389 ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
390 gen_die 'Configure of lvm2 failed!'
391 print_info 1 'lvm2: >> Compiling...'
392 compile_generic '' utils
393 compile_generic 'install' utils
396 print_info 1 ' >> Copying to bincache...'
397 strip "sbin/lvm.static" ||
398 gen_die 'Could not strip lvm.static!'
399 /bin/tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
400 gen_die 'Could not create binary cache'
403 rm -rf "${TEMP}/device-mapper" > /dev/null
404 rm -rf "${LVM2_DIR}" lvm2
409 compile_device_mapper
410 if [ ! -f "${DMRAID_BINCACHE}" ]
412 [ -f "${DMRAID_SRCTAR}" ] ||
413 gen_die "Could not find DMRAID source tarball: ${DMRAID_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
415 rm -rf ${DMRAID_DIR} > /dev/null
416 /bin/tar -jxpf ${DMRAID_SRCTAR} ||
417 gen_die 'Could not extract DMRAID source tarball!'
418 [ -d "${DMRAID_DIR}" ] ||
419 gen_die 'DMRAID directory ${DMRAID_DIR} is invalid!'
420 rm -rf "${TEMP}/device-mapper" > /dev/null
421 /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
422 gen_die "Could not extract device-mapper binary cache!";
425 print_info 1 'dmraid: >> Configuring...'
427 LDFLAGS="-L${TEMP}/device-mapper/lib" \
428 CFLAGS="-I${TEMP}/device-mapper/include" \
429 CPPFLAGS="-I${TEMP}/device-mapper/include" \
430 ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
431 gen_die 'Configure of dmraid failed!'
432 mkdir -p "${TEMP}/dmraid"
433 print_info 1 'dmraid: >> Compiling...'
434 compile_generic '' utils
435 #compile_generic 'install' utils
436 mkdir ${TEMP}/dmraid/sbin
437 install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
438 print_info 1 ' >> Copying to bincache...'
440 /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
441 gen_die 'Could not create binary cache'
444 rm -rf "${TEMP}/device-mapper" > /dev/null
445 rm -rf "${DMRAID_DIR}" dmraid
450 # I've disabled dietlibc support for the time being since the
451 # version we use misses a few needed system calls.
454 if [ ! -f "${MODUTILS_BINCACHE}" ]
456 [ ! -f "${MODUTILS_SRCTAR}" ] &&
457 gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
459 rm -rf "${MODUTILS_DIR}"
460 /bin/tar -jxpf "${MODUTILS_SRCTAR}"
461 [ ! -d "${MODUTILS_DIR}" ] &&
462 gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
464 print_info 1 "modutils: >> Configuring..."
466 # if [ "${USE_DIETLIBC}" -eq '1' ]
468 # extract_dietlibc_bincache
469 # OLD_CC="${UTILS_CC}"
470 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
475 ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
476 gen_die 'Configuring modutils failed!'
479 print_info 1 'modutils: >> Compiling...'
480 compile_generic all utils
482 # if [ "${USE_DIETLIBC}" -eq '1' ]
484 # clean_dietlibc_bincache
485 # UTILS_CC="${OLD_CC}"
488 print_info 1 'modutils: >> Copying to cache...'
489 [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
490 gen_die 'insmod.static does not exist after the compilation of modutils!'
491 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
492 gen_die 'Could not strip insmod.static!'
493 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
494 gen_die 'Compression of insmod.static failed!'
495 mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
496 gen_die 'Could not move the compressed insmod binary to the package cache!'
499 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
503 compile_module_init_tools() {
504 # I've disabled dietlibc support for the time being since the
505 # version we use misses a few needed system calls.
508 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
510 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
511 gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
513 rm -rf "${MODULE_INIT_TOOLS_DIR}"
514 /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
515 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
516 gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
517 cd "${MODULE_INIT_TOOLS_DIR}"
518 print_info 1 'module-init-tools: >> Configuring'
520 # if [ "${USE_DIETLIBC}" -eq '1' ]
522 # extract_dietlibc_bincache
523 # OLD_CC="${UTILS_CC}"
524 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
528 ./configure >> ${DEBUGFILE} 2>&1 ||
529 gen_die 'Configure of module-init-tools failed!'
531 print_info 1 ' >> Compiling...'
532 compile_generic "all" utils
534 # if [ "${USE_DIETLIBC}" -eq '1' ]
536 # clean_dietlibc_bincache
537 # UTILS_CC="${OLD_CC}"
540 print_info 1 ' >> Copying to cache...'
541 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
542 gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
543 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
544 gen_die 'Could not strip insmod.static!'
545 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
546 gen_die 'Compression of insmod.static failed!'
547 [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
548 gen_die 'Could not find compressed insmod.static.bz2 binary!'
549 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
550 gen_die 'Could not move the compressed insmod binary to the package cache!'
553 rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
558 # I've disabled dietlibc support for the time being since the
559 # version we use misses a few needed system calls.
562 if [ ! -f "${DEVFSD_BINCACHE}" ]
564 [ ! -f "${DEVFSD_SRCTAR}" ] &&
565 gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
567 rm -rf "${DEVFSD_DIR}"
568 /bin/tar -jxpf "${DEVFSD_SRCTAR}"
569 [ ! -d "${DEVFSD_DIR}" ] &&
570 gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
573 # if [ "${USE_DIETLIBC}" -eq '1' ]
575 # extract_dietlibc_bincache
576 # OLD_CC="${UTILS_CC}"
577 # UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
580 print_info 1 'devfsd: >> Compiling...'
581 # if [ "${USE_DIETLIBC}" -eq '1' ]
583 # compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
585 compile_generic 'LDFLAGS=-static' utils
588 # if [ "${USE_DIETLIBC}" -eq '1' ]
590 # clean_dietlibc_bincache
591 # UTILS_CC="${OLD_CC}"
594 print_info 1 ' >> Copying to cache...'
595 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
596 strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
597 bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
598 [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
599 mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
601 # [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
602 # bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
603 # mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
606 rm -rf "${DEVFSD_DIR}" > /dev/null
610 compile_device_mapper() {
611 if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
613 [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
614 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!"
616 rm -rf "${DEVICE_MAPPER_DIR}"
617 /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
618 [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
619 gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
620 cd "${DEVICE_MAPPER_DIR}"
621 ./configure --prefix=${TEMP}/device-mapper --enable-static_link >> ${DEBUGFILE} 2>&1 ||
622 gen_die 'Configuring device-mapper failed!'
623 print_info 1 'device-mapper: >> Compiling...'
624 compile_generic '' utils
625 compile_generic 'install' utils
626 print_info 1 ' >> Copying to cache...'
628 rm -r "${TEMP}/device-mapper/man" ||
629 gen_die 'Could not remove manual pages!'
630 strip "${TEMP}/device-mapper/sbin/dmsetup" ||
631 gen_die 'Could not strip dmsetup binary!'
632 /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
633 gen_die 'Could not tar up the device-mapper binary!'
634 [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
635 gen_die 'device-mapper cache not created!'
637 rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
638 rm -rf "${TEMP}/device-mapper" > /dev/null
647 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
648 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
649 if ! isTrue "${BUILD_DIETLIBC}"
651 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
652 if [ "${TEMP}" != "${ORIGTEMP}" ]
654 print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
655 print_warning 1 ' is different to the original. Rebuilding.'
660 if [ "${BUILD_DIETLIBC}" -eq '1' ]
662 [ -f "${DIETLIBC_SRCTAR}" ] ||
663 gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
665 rm -rf "${DIETLIBC_DIR}" > /dev/null
666 /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
667 gen_die 'Could not extract dietlibc source tarball'
668 [ -d "${DIETLIBC_DIR}" ] ||
669 gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
671 print_info 1 "dietlibc: >> Compiling..."
672 compile_generic "prefix=${TEMP}/diet" utils
673 print_info 1 " >> Installing..."
674 compile_generic "prefix=${TEMP}/diet install" utils
675 print_info 1 " >> Copying to bincache..."
677 /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
678 gen_die 'Could not tar up the dietlibc binary!'
679 [ -f "${DIETLIBC_BINCACHE}" ] ||
680 gen_die 'Dietlibc cache not created!'
681 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
684 rm -rf "${DIETLIBC_DIR}" > /dev/null
685 rm -rf "${TEMP}/diet" > /dev/null
690 if [ ! -f "${UDEV_BINCACHE}" ]
693 rm -rf "${UDEV_DIR}" udev
694 [ ! -f "${UDEV_SRCTAR}" ] &&
695 gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
696 /bin/tar -jxpf "${UDEV_SRCTAR}" ||
697 gen_die 'Could not extract udev tarball'
698 [ ! -d "${UDEV_DIR}" ] &&
699 gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
702 print_info 1 'udev: >> Compiling...'
704 ln -snf "${KERNEL_DIR}" klibc/linux || gen_die "Could not link to ${KERNEL_DIR}"
705 if [ "${ARCH}" = 'um' ]
707 compile_generic "ARCH=um KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
708 elif [ "${ARCH}" = 'sparc64' ]
710 compile_generic "ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu- KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
712 compile_generic "KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
716 strip udev || gen_die 'Failed to strip the udev binary!'
718 print_info 1 ' >> Installing...'
719 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" ||
720 gen_die 'Could not create directory hierarchy'
721 install -m 0755 udev "${TEMP}/udev/sbin" ||
722 gen_die 'Could not install udev binary!'
723 install -m 0644 etc/udev/udev.conf "${TEMP}/udev/etc/udev" ||
724 gen_die 'Could not install udev configuration!'
725 install -m 0644 etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
726 gen_die 'Could not install udev rules!'
727 install -m 0644 etc/udev/udev.permissions "${TEMP}/udev/etc/udev/permissions.d/50-udev.permissions" ||
728 gen_die 'Could not install udev permissions!'
729 install -m 0755 extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts" ||
730 gen_die 'Could not install udev scripts!'
733 print_info 1 ' >> Copying to bincache...'
734 /bin/tar -cjf "${UDEV_BINCACHE}" * ||
735 gen_die 'Could not create binary cache'
738 rm -rf "${UDEV_DIR}" udev