scripts/build/kernel/linux.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Jan 05 23:02:43 2009 +0000 (2009-01-05)
changeset 1126 1ab3d2e08c8b
parent 1118 4567b323353e
child 1221 814d458b1878
permissions -rw-r--r--
Split CT_ExtractAndPatch in two: CT_Extract and CT_Patch:
- it is unworkable to have CT_ExtactAndPAtch cope with all those silly glibc addons:
- they can have 'short' (as 'ports') or 'long' (as glibc-ports-2.7) names
- patches are against eithe the short or long name, but non-uniformly use one or the other
- it is the reposibility of the component (glibc in this case) to handle corner cases such as those
- update all components to use the new functions

/trunk/scripts/build/tools/000-template.sh | 3 2 1 0 +-
/trunk/scripts/build/tools/100-libelf.sh | 3 2 1 0 +-
/trunk/scripts/build/tools/200-sstrip.sh | 3 2 1 0 +-
/trunk/scripts/build/kernel/linux.sh | 3 2 1 0 +-
/trunk/scripts/build/binutils.sh | 3 2 1 0 +-
/trunk/scripts/build/cc/gcc.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/000-template.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/100-dmalloc.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/400-ltrace.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/300-gdb.sh | 9 6 3 0 +++--
/trunk/scripts/build/debug/500-strace.sh | 7 3 4 0 ++--
/trunk/scripts/build/debug/200-duma.sh | 19 8 11 0 ++++------
/trunk/scripts/build/libc/glibc.sh | 14 12 2 0 ++++++-
/trunk/scripts/build/libc/uClibc.sh | 13 9 4 0 +++++--
/trunk/scripts/build/libc/eglibc.sh | 14 12 2 0 ++++++-
/trunk/scripts/build/gmp.sh | 3 2 1 0 +-
/trunk/scripts/build/mpfr.sh | 3 2 1 0 +-
/trunk/scripts/functions | 68 36 32 0 +++++++++++++++++++-----------------
18 files changed, 108 insertions(+), 69 deletions(-)
     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     # Nothing to do, keep the default value
     7     :
     8 }
     9 
    10 # Download the kernel
    11 do_kernel_get() {
    12     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_DIR}" != "y" ]; then
    13         CT_GetFile "linux-${CT_KERNEL_VERSION}" \
    14                    {ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2}
    15     fi
    16     return 0
    17 }
    18 
    19 # Extract kernel
    20 do_kernel_extract() {
    21     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_DIR}" != "y" ]; then
    22         CT_Extract "linux-${CT_KERNEL_VERSION}"
    23         CT_Patch "linux-${CT_KERNEL_VERSION}"
    24     fi
    25     return 0
    26 }
    27 
    28 # Wrapper to the actual headers install method
    29 do_kernel_headers() {
    30     CT_DoStep INFO "Installing kernel headers"
    31 
    32     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_DIR}" = "y" ]; then
    33         do_kernel_preinstalled
    34     else
    35         do_kernel_install
    36     fi
    37 
    38     CT_EndStep
    39 }
    40 
    41 # Install kernel headers using headers_install from kernel sources.
    42 do_kernel_install() {
    43     CT_DoLog DEBUG "Using kernel's headers_install"
    44 
    45     mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
    46     cd "${CT_BUILD_DIR}/build-kernel-headers"
    47 
    48     # Only starting with 2.6.18 does headers_install is usable. We only
    49     # have 2.6 version available, so only test for sublevel.
    50     k_sublevel=$(gawk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}/Makefile")
    51     [ ${k_sublevel} -ge 18 ] || CT_Abort "Kernel version >= 2.6.18 is needed to install kernel headers."
    52 
    53     V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
    54 
    55     CT_DoLog EXTRA "Installing kernel headers"
    56     CT_DoExecLog ALL                                    \
    57     make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"  \
    58          O=$(pwd)                                       \
    59          ARCH=${CT_KERNEL_ARCH}                         \
    60          INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
    61          ${V_OPT}                                       \
    62          headers_install
    63 
    64     if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
    65         CT_DoLog EXTRA "Checking installed headers"
    66         CT_DoExecLog ALL                                    \
    67         make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"  \
    68              O=$(pwd)                                       \
    69              ARCH=${CT_KERNEL_ARCH}                         \
    70              INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
    71              ${V_OPT}                                       \
    72              headers_check
    73         find "${CT_SYSROOT_DIR}" -type f -name '.check*' -exec rm {} \;
    74     fi
    75 }
    76 
    77 # Use preinstalled headers (most probably by using make headers_install in a
    78 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
    79 # as 2.4). In this case, simply copy the headers in place
    80 do_kernel_preinstalled() {
    81     CT_DoLog EXTRA "Copying preinstalled kernel headers"
    82 
    83     mkdir -p "${CT_SYSROOT_DIR}/usr"
    84     cd "${CT_KERNEL_LINUX_CUSTOM_DIR}"
    85     CT_DoExecLog ALL cp -rv include "${CT_SYSROOT_DIR}/usr"
    86 }