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_INSTALL}" = "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}
28 if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
29 CT_Extract "linux-${CT_KERNEL_VERSION}"
30 CT_Patch "linux" "${CT_KERNEL_VERSION}"
34 # Wrapper to the actual headers install method
36 CT_DoStep INFO "Installing kernel headers"
38 if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
47 # Install kernel headers using headers_install from kernel sources.
49 CT_DoLog DEBUG "Using kernel's headers_install"
51 mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
52 cd "${CT_BUILD_DIR}/build-kernel-headers"
54 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
56 CT_DoLog EXTRA "Installing kernel headers"
58 make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
61 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
65 if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
66 CT_DoLog EXTRA "Checking installed headers"
68 make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
71 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
74 find "${CT_SYSROOT_DIR}" -type f -name '.check*' -exec rm {} \;
78 # Use custom headers (most probably by using make headers_install in a
79 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
80 # as 2.4). In this case, simply copy the headers in place
84 CT_DoLog EXTRA "Installing custom kernel headers"
86 mkdir -p "${CT_SYSROOT_DIR}/usr"
87 cd "${CT_SYSROOT_DIR}/usr"
88 if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
89 case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
91 *.tgz) tar_opt=--gzip;;
92 *.tar.gz) tar_opt=--gzip;;
93 *.tar.bz2) tar_opt=--bzip2;;
94 *.tar.lzma) tar_opt=--lzma;;
96 CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
98 CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .