7 gen_die "compile_generic(): improper usage"
10 if [ "${DEBUGLEVEL}" -gt "1" ]
12 # Output to stdout and debugfile
13 ${MAKE} CC="${CC}" AS="${AS}" LD="${LD}" ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
16 # Output to debugfile only
17 ${MAKE} CC="${CC}" AS="${AS}" LD="${LD}" ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
20 [ "${RET}" -ne "0" ] && gen_die "compile of failed"
24 print_info 1 "kernel: Starting compile of linux ${KV} modules"
26 compile_generic "modules"
27 compile_generic "modules_install"
31 [ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined. Don't know how to compile kernel for arch."
33 print_info 1 "kernel: Starting compile of linux ${KV} ${KERNEL_MAKE}"
34 compile_generic "${KERNEL_MAKE}"
35 cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy kernel binary to boot"
39 if [ ! -f "${BUSYBOX_BINCACHE}" ]
41 [ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}"
42 [ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}"
44 rm -rf ${BUSYBOX_DIR} > /dev/null
45 tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball"
46 [ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} invalid"
47 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
49 if [ "${USE_DIETLIBC}" -eq "1" ]
52 CC="${TEMP}/diet/bin/diet ${CC}"
54 print_info 1 "Busybox: make oldconfig"
55 compile_generic "oldconfig"
56 print_info 1 "Busybox: make all"
58 if [ "${USE_DIETLIBC}" -eq "1" ]
62 print_info 1 "Busybox: copying to bincache"
63 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] && gen_die "busybox executable does not exist after compile, error"
64 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "bzip2 compression of busybox failed"
65 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" ] && gen_die "could not find compressed busybox binary"
66 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die "could not copy busybox binary to arch package directory, does the directory exist?"
68 print_info 1 "Busybox: Found bincache at ${BUSYBOX_BINCACHE}"
72 compile_module_init_tools() {
73 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
75 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] && gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_BINCACHE}"
77 rm -rf "${MODULE_INIT_TOOLS_DIR}"
78 tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
79 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid"
80 cd "${MODULE_INIT_TOOLS_DIR}"
81 print_info 1 "module-init-tools: configure"
82 ./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed"
83 print_info 1 "module-init-tools: make all"
85 print_info 1 "module-init-tools: copying to bincache"
86 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] && gen_die "insmod.static does not exist after compilation of module-init-tools"
87 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "compression of busybox failed"
88 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
89 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}"
91 print_info 1 "module-init-tools: Found bincache at ${MODULE_INIT_TOOLS_BINCACHE}"
100 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
101 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
102 if [ "${BUILD_DIETLIBC}" -eq "0" ]
104 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
105 if [ "${TEMP}" != "${ORIGTEMP}" ]
107 print_info 1 "Dietlibc: Bincache exists, but current temp directory is different than original. Rebuilding."
112 if [ "${BUILD_DIETLIBC}" -eq "1" ]
114 [ ! -f "${DIETLIBC_SRCTAR}" ] && gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
116 rm -rf ${DIETLIBC_DIR} > /dev/null
117 tar -jxpf ${DIETLIBC_SRCTAR} || gen_die "Could not extract dietlibc source tarball"
118 [ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid"
120 print_info 1 "Dietlibc: make"
121 compile_generic "prefix=${TEMP}/diet"
122 print_info 1 "Dietlibc: installing"
123 compile_generic "prefix=${TEMP}/diet install"
124 print_info 1 "Dietlibc: copying to bincache"
126 tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin"
127 [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "bincache not created"
128 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
130 print_info 1 "Dietlibc: Found bincache at ${DIETLIBC_BINCACHE}"