scripts/build/kernel/linux.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jan 29 22:55:35 2010 +0100 (2010-01-29)
changeset 1756 e855b2e1f3f8
parent 1746 5851a36db763
child 1901 bdb3a98e064b
permissions -rw-r--r--
kernel/linux: remove legacy check

Now, we only support building with Linux >=2.6.27.
Get rid of the code that depended on <2.6.18.
     1 # This file declares functions to install the kernel headers for linux
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 CT_DoKernelTupleValues() {
     6     if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
     7         CT_TARGET_KERNEL="linux"
     8     else
     9         CT_TARGET_KERNEL="uclinux"
    10     fi
    11 }
    12 
    13 # Download the kernel
    14 do_kernel_get() {
    15     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then
    16         CT_GetFile "linux-${CT_KERNEL_VERSION}" \
    17                    {ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2}
    18     fi
    19     return 0
    20 }
    21 
    22 # Extract kernel
    23 do_kernel_extract() {
    24     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then
    25         CT_Extract "linux-${CT_KERNEL_VERSION}"
    26         CT_Patch "linux-${CT_KERNEL_VERSION}"
    27     fi
    28     return 0
    29 }
    30 
    31 # Wrapper to the actual headers install method
    32 do_kernel_headers() {
    33     CT_DoStep INFO "Installing kernel headers"
    34 
    35     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
    36         do_kernel_custom
    37     else
    38         do_kernel_install
    39     fi
    40 
    41     CT_EndStep
    42 }
    43 
    44 # Install kernel headers using headers_install from kernel sources.
    45 do_kernel_install() {
    46     CT_DoLog DEBUG "Using kernel's headers_install"
    47 
    48     mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
    49     cd "${CT_BUILD_DIR}/build-kernel-headers"
    50 
    51     V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
    52 
    53     CT_DoLog EXTRA "Installing kernel headers"
    54     CT_DoExecLog ALL                                    \
    55     make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"  \
    56          O=$(pwd)                                       \
    57          ARCH=${CT_ARCH}                                \
    58          INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
    59          ${V_OPT}                                       \
    60          headers_install
    61 
    62     if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
    63         CT_DoLog EXTRA "Checking installed headers"
    64         CT_DoExecLog ALL                                    \
    65         make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"  \
    66              O=$(pwd)                                       \
    67              ARCH=${CT_ARCH}                                \
    68              INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
    69              ${V_OPT}                                       \
    70              headers_check
    71         find "${CT_SYSROOT_DIR}" -type f -name '.check*' -exec rm {} \;
    72     fi
    73 }
    74 
    75 # Use custom headers (most probably by using make headers_install in a
    76 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
    77 # as 2.4). In this case, simply copy the headers in place
    78 do_kernel_custom() {
    79     local tar_opt
    80 
    81     CT_DoLog EXTRA "Installing custom kernel headers"
    82 
    83     mkdir -p "${CT_SYSROOT_DIR}/usr"
    84     cd "${CT_SYSROOT_DIR}/usr"
    85     if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
    86         case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
    87             *.tar)      ;;
    88             *.tgz)      tar_opt=--gzip;;
    89             *.tar.gz)   tar_opt=--gzip;;
    90             *.tar.bz2)  tar_opt=--bzip2;;
    91             *.tar.lzma) tar_opt=--lzma;;
    92         esac
    93         CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
    94     else
    95         CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .
    96     fi
    97 }