echo " --kerneldir=<dir> Location of kernel source"
echo " --kernel-config=<file> Kernel configuration file to use for compilation"
echo " Low-Level Compile settings"
- echo " --cc=<compiler> Compiler to use (e.g. distcc)"
- echo " --ld=<linker> Linker to use"
- echo " --as=<assembler> Assembler to use"
+ echo " --kernel-cc=<compiler> Compiler to use for kernel (e.g. distcc)"
+ echo " --kernel-ld=<linker> Linker to use for kernel"
+ echo " --kernel-as=<assembler> Assembler to use for kernel"
+ echo " --utils-cc=<compiler> Compiler to use for utils (e.g. busybox, modutils)"
+ echo " --utils-ld=<linker> Linker to use for utils"
+ echo " --utils-as=<assembler> Assembler to use for utils"
echo " Internals"
echo " --arch-override=<arch> Force to arch instead of autodetect (cross-compile?)"
echo " --busybox-config=<file> Busybox configuration file to use"
for x in $*
do
case "${x}" in
- --cc*)
- CMD_CC=`parse_opt "${x}"`
- print_info 2 "CMD_CC: $CMD_CC"
+ --kernel-cc*)
+ CMD_KERNEL_CC=`parse_opt "${x}"`
+ print_info 2 "CMD_KERNEL_CC: $CMD_KERNEL_CC"
;;
- --ld*)
- CMD_LD=`parse_opt "${x}"`
- print_info 2 "CMD_LD: $CMD_LD"
+ --kernel-ld*)
+ CMD_KERNEL_LD=`parse_opt "${x}"`
+ print_info 2 "CMD_KERNEL_LD: $CMD_KERNEL_LD"
;;
- --as*)
- CMD_AS=`parse_opt "${x}"`
- print_info 2 "CMD_AS: $CMD_AS"
+ --kernel-as*)
+ CMD_KERNEL_AS=`parse_opt "${x}"`
+ print_info 2 "CMD_KERNEL_AS: $CMD_KERNEL_AS"
;;
+ --utils-cc*)
+ CMD_UTILS_CC=`parse_opt "${x}"`
+ print_info 2 "CMD_UTILS_CC: $CMD_UTILS_CC"
+ ;;
+ --utils-ld*)
+ CMD_UTILS_LD=`parse_opt "${x}"`
+ print_info 2 "CMD_UTILS_LD: $CMD_UTILS_LD"
+ ;;
+ --utils-as*)
+ CMD_UTILS_AS=`parse_opt "${x}"`
+ print_info 2 "CMD_UTILS_AS: $CMD_UTILS_AS"
+ ;;
+
--debuglevel*)
CMD_DEBUGLEVEL=`parse_opt "${x}"`
DEBUGLEVEL="${CMD_DEBUGLEVEL}"
#!/bin/bash
-compile_args()
+compile_kernel_args()
{
local ARGS
ARGS=""
- if [ "${CC}" != "" ]
+ if [ "${KERNEL_CC}" != "" ]
then
- ARGS="CC=\"${CC}\""
+ ARGS="CC=\"${KERNEL_CC}\""
fi
- if [ "${LD}" != "" ]
+ if [ "${KERNEL_LD}" != "" ]
then
- ARGS="${ARGS} LD=\"${LD}\""
+ ARGS="${ARGS} LD=\"${KERNEL_LD}\""
fi
- if [ "${AS}" != "" ]
+ if [ "${KERNEL_AS}" != "" ]
then
- ARGS="${ARGS} AS=\"${AS}\""
+ ARGS="${ARGS} AS=\"${KERNEL_AS}\""
fi
-
+
+ echo -n "${ARGS}"
+}
+
+compile_utils_args()
+{
+ local ARGS
+
+ ARGS=""
+ if [ "${UTILS_CC}" != "" ]
+ then
+ ARGS="CC=\"${UTILS_CC}\""
+ fi
+ if [ "${UTILS_LD}" != "" ]
+ then
+ ARGS="${ARGS} LD=\"${UTILS_LD}\""
+ fi
+
+ if [ "${UTILS_AS}" != "" ]
+ then
+ ARGS="${ARGS} AS=\"${UTILS_AS}\""
+ fi
+
echo -n "${ARGS}"
}
compile_generic() {
local RET
- if [ "$#" -lt "1" ]
+ if [ "$#" -lt "2" ]
then
gen_die "compile_generic(): improper usage"
fi
- ARGS=`compile_args`
+ if [ "${2}" = "kernel" ]
+ then
+ ARGS=`compile_kernel_args`
+ elif [ "${2}" = "utils" ]
+ then
+ ARGS=`compile_utils_args`
+ fi
if [ "${DEBUGLEVEL}" -gt "1" ]
then
else
print_info 1 "kernel: Making dependancies for linux ${KV}"
cd ${KERNEL_DIR}
- compile_generic "dep"
+ compile_generic "dep" kernel
fi
}
compile_modules() {
print_info 1 "kernel: Starting compile of linux ${KV} modules"
cd ${KERNEL_DIR}
- compile_generic "modules"
- compile_generic "modules_install"
+ compile_generic "modules" kernel
+ compile_generic "modules_install" kernel
}
compile_kernel() {
[ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined. Don't know how to compile kernel for arch."
cd ${KERNEL_DIR}
print_info 1 "kernel: Starting compile of linux ${KV} ${KERNEL_MAKE}"
- compile_generic "${KERNEL_MAKE}"
+ compile_generic "${KERNEL_MAKE}" kernel
cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy kernel binary to boot"
}
cd "${BUSYBOX_DIR}"
if [ "${USE_DIETLIBC}" -eq "1" ]
then
- OLD_CC="${CC}"
- CC="${TEMP}/diet/bin/diet ${CC}"
+ OLD_CC="${UTILS_CC}"
+ UTILS_CC="${TEMP}/diet/bin/diet ${CC}"
fi
print_info 1 "Busybox: make oldconfig"
- compile_generic "oldconfig"
+ compile_generic "oldconfig" utils
print_info 1 "Busybox: make all"
- compile_generic "all"
+ compile_generic "all" utils
if [ "${USE_DIETLIBC}" -eq "1" ]
then
- CC="${OLD_CC}"
+ UTILS_CC="${OLD_CC}"
fi
print_info 1 "Busybox: copying to bincache"
[ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] && gen_die "busybox executable does not exist after compile, error"
[ ! -d "${MODUTILS_DIR}" ] && gen_die "Modutils directory ${MODUTILS_DIR} invalid"
cd "${MODUTILS_DIR}"
print_info 1 "modutils: configure"
+ ARGS=`compile_utils_args`
${ARGS} ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configure of modutils failed"
print_info 1 "modutils: make all"
- compile_generic "all"
+ compile_generic "all" utils
print_info 1 "modutils: copying to bincache"
[ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] && gen_die "insmod.static does not exist after compilation of modutils"
strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "could not strip insmod.static"
[ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid"
cd "${MODULE_INIT_TOOLS_DIR}"
print_info 1 "module-init-tools: configure"
+ ARGS=`compile_utils_args`
${ARGS} ./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed"
print_info 1 "module-init-tools: make all"
- compile_generic "all"
+ compile_generic "all" utils
print_info 1 "module-init-tools: copying to bincache"
[ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] && gen_die "insmod.static does not exist after compilation of module-init-tools"
strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "could not strip insmod.static"
[ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid"
cd "${DIETLIBC_DIR}"
print_info 1 "Dietlibc: make"
- compile_generic "prefix=${TEMP}/diet"
+ compile_generic "prefix=${TEMP}/diet" utils
print_info 1 "Dietlibc: installing"
- compile_generic "prefix=${TEMP}/diet install"
+ compile_generic "prefix=${TEMP}/diet install" utils
print_info 1 "Dietlibc: copying to bincache"
cd ${TEMP}
tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin"
get_KV
- if [ "${CMD_CC}" != "" ]
+ if [ "${CMD_KERNEL_CC}" != "" ]
then
- CC="${CMD_CC}"
+ KERNEL_CC="${CMD_KERNEL_CC}"
fi
- if [ "${CMD_LD}" != "" ]
+ if [ "${CMD_KERNEL_LD}" != "" ]
then
- LD="${CMD_LD}"
+ KERNEL_LD="${CMD_KERNEL_LD}"
fi
- if [ "${CMD_AS}" != "" ]
+ if [ "${CMD_KERNEL_AS}" != "" ]
then
- AS="${CMD_AS}"
+ KERNEL_AS="${CMD_KERNEL_AS}"
+ fi
+
+ if [ "${CMD_UTILS_CC}" != "" ]
+ then
+ UTILS_CC="${CMD_UTILS_CC}"
+ fi
+
+ if [ "${CMD_UTILS_LD}" != "" ]
+ then
+ UTILS_LD="${CMD_UTILS_LD}"
+ fi
+
+ if [ "${CMD_UTILS_AS}" != "" ]
+ then
+ UTILS_AS="${CMD_UTILS_AS}"
fi
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`