From 377a301fef4ca8a88030a12b878406649ce11a47 Mon Sep 17 00:00:00 2001 From: Brad House Date: Tue, 9 Dec 2003 02:12:36 +0000 Subject: [PATCH] need seperate toolkit for compilation of kernel and utils on sparc64 git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@7 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_cmdline.sh | 40 ++++++++++++++++------- gen_compile.sh | 76 ++++++++++++++++++++++++++++++-------------- gen_configkernel.sh | 6 ++-- gen_determineargs.sh | 27 ++++++++++++---- x86/config.sh | 12 ++++--- x86_64/config.sh | 10 ++++-- 6 files changed, 120 insertions(+), 51 deletions(-) diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 1431d0d..d5503a8 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -23,9 +23,12 @@ usage() { echo " --kerneldir= Location of kernel source" echo " --kernel-config= Kernel configuration file to use for compilation" echo " Low-Level Compile settings" - echo " --cc= Compiler to use (e.g. distcc)" - echo " --ld= Linker to use" - echo " --as= Assembler to use" + echo " --kernel-cc= Compiler to use for kernel (e.g. distcc)" + echo " --kernel-ld= Linker to use for kernel" + echo " --kernel-as= Assembler to use for kernel" + echo " --utils-cc= Compiler to use for utils (e.g. busybox, modutils)" + echo " --utils-ld= Linker to use for utils" + echo " --utils-as= Assembler to use for utils" echo " Internals" echo " --arch-override= Force to arch instead of autodetect (cross-compile?)" echo " --busybox-config= Busybox configuration file to use" @@ -49,18 +52,31 @@ parse_cmdline() { 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}" diff --git a/gen_compile.sh b/gen_compile.sh index 9e91dde..0638395 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -1,35 +1,63 @@ #!/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 @@ -54,22 +82,22 @@ compile_dep() { 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" } @@ -86,16 +114,16 @@ compile_busybox() { 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" @@ -118,9 +146,10 @@ compile_modutils() { [ ! -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" @@ -142,9 +171,10 @@ compile_module_init_tools() { [ ! -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" @@ -182,9 +212,9 @@ compile_dietlibc() { [ ! -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" diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 8368645..bcaff5a 100644 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -28,7 +28,7 @@ config_kernel() { if isTrue ${MRPROPER} then print_info 1 "kernel: running mrproper" - compile_generic "mrproper" + compile_generic "mrproper" kernel fi # If we're not cleaning, then we don't want to try to overwrite the configs there @@ -39,7 +39,7 @@ config_kernel() { cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die "could not copy config file" print_info 1 "kernel: running oldconfig" - yes "" | compile_generic "oldconfig" + yes "" | compile_generic "oldconfig" kernel if isTrue ${MENUCONFIG} then @@ -48,7 +48,7 @@ config_kernel() { fi print_info 1 "kernel: running clean" - compile_generic "clean" + compile_generic "clean" kernel else print_info 1 "kernel: skipping copy of config. CLEAN is OFF" fi diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 87a175f..b89c6c0 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -28,19 +28,34 @@ determine_real_args() { 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}"` diff --git a/x86/config.sh b/x86/config.sh index e5194b7..03fbffe 100644 --- a/x86/config.sh +++ b/x86/config.sh @@ -1,5 +1,5 @@ #!/bin/bash -# x86-config.sh +# x86/config.sh KERNEL_MAKE="bzImage" KERNEL_BINARY="arch/i386/boot/bzImage" @@ -8,9 +8,13 @@ KERNEL_BINARY="arch/i386/boot/bzImage" # can turn this flag on USE_DIETLIBC=0 -CC=gcc -AS=as -LD=ld +KERNEL_CC=gcc +KERNEL_AS=as +KERNEL_LD=ld + +UTILS_CC=gcc +UTILS_AS=as +UTILS_LD=ld COMPRESS_INITRD=yes diff --git a/x86_64/config.sh b/x86_64/config.sh index dc7ea6b..3007802 100644 --- a/x86_64/config.sh +++ b/x86_64/config.sh @@ -8,9 +8,13 @@ KERNEL_BINARY="arch/x86_64/boot/bzImage" # can turn this flag on USE_DIETLIBC=0 -CC=gcc -AS=as -LD=ld +KERNEL_CC=gcc +KERNEL_AS=as +KERNEL_LD=ld + +UTILS_CC=gcc +UTILS_AS=as +UTILS_LD=ld COMPRESS_INITRD=yes -- 2.26.2