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
5 CT_DoKernelTupleValues() {
6 if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
7 CT_TARGET_KERNEL="linux"
9 # Sometime, noMMU linux targets have a -uclinux tuple, while
10 # sometime it's -linux. We currently have only one noMMU linux
11 # target, and it uses -linux, so let's just use that. Time
12 # to fix that later...
13 # CT_TARGET_KERNEL="uclinux"
14 CT_TARGET_KERNEL="linux"
20 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then
21 CT_GetFile "linux-${CT_KERNEL_VERSION}" \
22 {ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2}
29 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then
30 CT_Extract "linux-${CT_KERNEL_VERSION}"
31 CT_Patch "linux" "${CT_KERNEL_VERSION}"
36 # Wrapper to the actual headers install method
38 CT_DoStep INFO "Installing kernel headers"
40 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
49 # Install kernel headers using headers_install from kernel sources.
51 CT_DoLog DEBUG "Using kernel's headers_install"
53 mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
54 cd "${CT_BUILD_DIR}/build-kernel-headers"
56 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
58 CT_DoLog EXTRA "Installing kernel headers"
60 make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
63 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
67 if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
68 CT_DoLog EXTRA "Checking installed headers"
70 make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
73 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
76 find "${CT_SYSROOT_DIR}" -type f -name '.check*' -exec rm {} \;
80 # Use custom headers (most probably by using make headers_install in a
81 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
82 # as 2.4). In this case, simply copy the headers in place
86 CT_DoLog EXTRA "Installing custom kernel headers"
88 mkdir -p "${CT_SYSROOT_DIR}/usr"
89 cd "${CT_SYSROOT_DIR}/usr"
90 if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
91 case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
93 *.tgz) tar_opt=--gzip;;
94 *.tar.gz) tar_opt=--gzip;;
95 *.tar.bz2) tar_opt=--bzip2;;
96 *.tar.lzma) tar_opt=--lzma;;
98 CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
100 CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .