diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-05-20 20:13:13 +0000 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-05-20 20:13:13 +0000 |
commit | 45747a64532234fc700eca0712b5a81393ee9565 (patch) | |
tree | 6f639b60d370bb75e71bec560299d156ec81c643 /scripts/build/kernel/linux.sh | |
parent | 5a32a8b8e823c3286bc2bc764a0b134cc27ca762 (diff) | |
download | crosstool-ng-45747a64532234fc700eca0712b5a81393ee9565.tar.gz crosstool-ng-45747a64532234fc700eca0712b5a81393ee9565.tar.bz2 crosstool-ng-45747a64532234fc700eca0712b5a81393ee9565.zip |
Merge the uClinux/noMMU stuff back to /trunk:
- merge Linux and uClinux back to a single kernel
- add ARCH_USE_MMU and acquainted config options that
architectures can auto-select
- make binutils and elf2flt two "Binary utilities" that
go in a single common sub-{menu,directory} structure
-------- diffstat follows --------
/trunk/scripts/build/kernel/uclinux.sh | 2 0 2 0 -
/trunk/scripts/build/kernel/linux.sh | 206 204 2 0 +++++++++++++++++++++++++++++
/trunk/scripts/build/kernel/linux-common.sh | 198 0 198 0 ----------------------------
/trunk/scripts/build/binutils.sh | 232 0 232 0 --------------------------------
/trunk/scripts/build/elf2flt.sh | 150 0 150 0 ---------------------
/trunk/scripts/crosstool-NG.sh.in | 6 4 2 0 +
/trunk/config/kernel/linux.in | 249 249 0 0 +++++++++++++++++++++++++++++++++++
/trunk/config/kernel/linux.in-common | 252 0 252 0 -----------------------------------
/trunk/config/kernel/uclinux.in | 21 0 21 0 ---
/trunk/config/target.in | 23 22 1 0 +++
/trunk/config/elf2flt.in | 49 0 49 0 -------
/trunk/config/libc/glibc.in | 2 1 1 0
/trunk/config/libc/eglibc.in | 2 1 1 0
/trunk/config/config.in | 1 0 1 0 -
/trunk/config/arch/sh.in | 1 1 0 0 +
/trunk/config/arch/arm.in | 2 1 1 0
/trunk/config/arch/powerpc.in | 1 1 0 0 +
/trunk/config/arch/ia64.in | 1 1 0 0 +
/trunk/config/arch/alpha.in | 1 1 0 0 +
/trunk/config/arch/x86.in | 1 1 0 0 +
/trunk/config/arch/mips.in | 1 1 0 0 +
/trunk/config/arch/powerpc64.in | 1 1 0 0 +
22 files changed, 489 insertions(+), 913 deletions(-)
Diffstat (limited to 'scripts/build/kernel/linux.sh')
-rw-r--r-- | scripts/build/kernel/linux.sh | 103 |
1 files changed, 102 insertions, 1 deletions
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh index 0401c9ff..c545e7b4 100644 --- a/scripts/build/kernel/linux.sh +++ b/scripts/build/kernel/linux.sh @@ -1 +1,102 @@ -. ${CT_LIB_DIR}/scripts/build/kernel/linux-common.sh +# This file declares functions to install the kernel headers for linux +# Copyright 2007 Yann E. MORIN +# Licensed under the GPL v2. See COPYING in the root of this package + +CT_DoKernelTupleValues() { + if [ "${CT_ARCH_USE_MMU}" = "y" ]; then + CT_TARGET_KERNEL="linux" + else + CT_TARGET_KERNEL="uclinux" + fi +} + +# Download the kernel +do_kernel_get() { + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then + CT_GetFile "linux-${CT_KERNEL_VERSION}" \ + {ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2} + fi + return 0 +} + +# Extract kernel +do_kernel_extract() { + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then + CT_Extract "linux-${CT_KERNEL_VERSION}" + CT_Patch "linux-${CT_KERNEL_VERSION}" + fi + return 0 +} + +# Wrapper to the actual headers install method +do_kernel_headers() { + CT_DoStep INFO "Installing kernel headers" + + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then + do_kernel_custom + else + do_kernel_install + fi + + CT_EndStep +} + +# Install kernel headers using headers_install from kernel sources. +do_kernel_install() { + CT_DoLog DEBUG "Using kernel's headers_install" + + mkdir -p "${CT_BUILD_DIR}/build-kernel-headers" + cd "${CT_BUILD_DIR}/build-kernel-headers" + + # Only starting with 2.6.18 does headers_install is usable. We only + # have 2.6 version available, so only test for sublevel. + k_sublevel=$(awk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}/Makefile") + [ ${k_sublevel} -ge 18 ] || CT_Abort "Kernel version >= 2.6.18 is needed to install kernel headers." + + V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}" + + CT_DoLog EXTRA "Installing kernel headers" + CT_DoExecLog ALL \ + make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \ + O=$(pwd) \ + ARCH=${CT_KERNEL_ARCH} \ + INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ + ${V_OPT} \ + headers_install + + if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then + CT_DoLog EXTRA "Checking installed headers" + CT_DoExecLog ALL \ + make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \ + O=$(pwd) \ + ARCH=${CT_KERNEL_ARCH} \ + INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ + ${V_OPT} \ + headers_check + find "${CT_SYSROOT_DIR}" -type f -name '.check*' -exec rm {} \; + fi +} + +# Use custom headers (most probably by using make headers_install in a +# modified (read: customised) kernel tree, or using pre-2.6.18 headers, such +# as 2.4). In this case, simply copy the headers in place +do_kernel_custom() { + local tar_opt + + CT_DoLog EXTRA "Installing custom kernel headers" + + mkdir -p "${CT_SYSROOT_DIR}/usr" + cd "${CT_SYSROOT_DIR}/usr" + if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then + case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in + *.tar) ;; + *.tgz) tar_opt=--gzip;; + *.tar.gz) tar_opt=--gzip;; + *.tar.bz2) tar_opt=--bzip2;; + *.tar.lzma) tar_opt=--lzma;; + esac + CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH} + else + CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" . + fi +} |