2009-05-20 20:13:13 +00:00
|
|
|
# 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
|
|
|
|
|
2018-12-10 09:10:01 +00:00
|
|
|
CT_DoKernelTupleValues()
|
|
|
|
{
|
|
|
|
if [ -z "${CT_ARCH_USE_MMU}" ]; then
|
2012-09-26 07:09:23 +00:00
|
|
|
# Some no-mmu linux targets requires a -uclinux tuple (like m68k/cf),
|
2015-11-10 06:30:45 +00:00
|
|
|
# while others must have a -linux tuple. Other targets
|
2012-09-26 07:09:23 +00:00
|
|
|
# should be added here when someone starts to care about them.
|
|
|
|
case "${CT_ARCH}" in
|
2019-03-23 01:47:19 +00:00
|
|
|
arm*) CT_TARGET_KERNEL="linux" ;;
|
2020-04-23 03:25:04 +00:00
|
|
|
c6x|m68k|xtensa*) CT_TARGET_KERNEL="uclinux" ;;
|
2019-03-23 01:47:19 +00:00
|
|
|
*) CT_Abort "Unsupported no-mmu arch '${CT_ARCH}'"
|
2012-09-26 07:09:23 +00:00
|
|
|
esac
|
2009-05-20 20:13:13 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Download the kernel
|
2018-12-10 09:10:01 +00:00
|
|
|
do_kernel_get()
|
|
|
|
{
|
2017-05-30 05:32:38 +00:00
|
|
|
CT_Fetch LINUX
|
2009-05-20 20:13:13 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 05:54:29 +00:00
|
|
|
# Disable building relocs application - it needs <linux/types.h>
|
|
|
|
# on the host, which may not be present on Cygwin or MacOS; it
|
|
|
|
# needs <elf.h>, which again is not present on MacOS; and most
|
|
|
|
# important, we don't need it to install the headers.
|
|
|
|
# This is not done as a patch, since it varies from Linux version
|
|
|
|
# to version - patching each particular Linux version would be
|
|
|
|
# too cumbersome.
|
|
|
|
linux_disable_build_relocs()
|
|
|
|
{
|
2017-02-27 03:06:35 +00:00
|
|
|
sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile
|
2017-06-26 05:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract kernel
|
|
|
|
do_kernel_extract()
|
|
|
|
{
|
|
|
|
# TBD verify linux_disable_build_relocs is run
|
|
|
|
CT_ExtractPatch LINUX linux_disable_build_relocs
|
2009-05-20 20:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install kernel headers using headers_install from kernel sources.
|
2018-12-10 09:10:01 +00:00
|
|
|
do_kernel_headers()
|
|
|
|
{
|
2010-06-17 16:30:09 +00:00
|
|
|
local kernel_path
|
2014-01-01 18:14:20 +00:00
|
|
|
local kernel_arch
|
2010-06-17 16:30:09 +00:00
|
|
|
|
2015-11-26 11:43:03 +00:00
|
|
|
CT_DoStep INFO "Installing kernel headers"
|
2009-05-20 20:13:13 +00:00
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
|
|
|
|
|
2017-05-30 05:32:38 +00:00
|
|
|
kernel_path="${CT_SRC_DIR}/linux"
|
2009-05-20 20:13:13 +00:00
|
|
|
V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
|
|
|
|
|
2013-12-30 22:15:02 +00:00
|
|
|
kernel_arch="${CT_ARCH}"
|
2013-12-30 22:28:18 +00:00
|
|
|
case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
|
|
|
|
# ARM 64 (aka AArch64) is special
|
|
|
|
arm:64) kernel_arch="arm64";;
|
|
|
|
esac
|
2013-12-30 22:15:02 +00:00
|
|
|
|
2009-05-20 20:13:13 +00:00
|
|
|
CT_DoLog EXTRA "Installing kernel headers"
|
2016-11-18 00:57:28 +00:00
|
|
|
CT_DoExecLog ALL \
|
|
|
|
make -C "${kernel_path}" \
|
|
|
|
BASH="$(which bash)" \
|
|
|
|
HOSTCC="${CT_BUILD}-gcc" \
|
|
|
|
CROSS_COMPILE="${CT_TARGET}-" \
|
|
|
|
O="${CT_BUILD_DIR}/build-kernel-headers" \
|
|
|
|
ARCH=${kernel_arch} \
|
|
|
|
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
|
|
|
|
${V_OPT} \
|
2009-05-20 20:13:13 +00:00
|
|
|
headers_install
|
|
|
|
|
|
|
|
if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Checking installed headers"
|
2016-11-18 00:57:28 +00:00
|
|
|
CT_DoExecLog ALL \
|
|
|
|
make -C "${kernel_path}" \
|
|
|
|
BASH="$(which bash)" \
|
|
|
|
HOSTCC="${CT_BUILD}-gcc" \
|
|
|
|
CROSS_COMPILE="${CT_TARGET}-" \
|
|
|
|
O="${CT_BUILD_DIR}/build-kernel-headers" \
|
|
|
|
ARCH=${kernel_arch} \
|
|
|
|
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
|
|
|
|
${V_OPT} \
|
2009-05-20 20:13:13 +00:00
|
|
|
headers_check
|
|
|
|
fi
|
2010-12-22 21:41:51 +00:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
find "${CT_SYSROOT_DIR}" -type f \
|
|
|
|
\( -name '.install' \
|
|
|
|
-o -name '..install.cmd' \
|
|
|
|
-o -name '.check' \
|
|
|
|
-o -name '..check.cmd' \
|
|
|
|
\) \
|
|
|
|
-exec rm {} \;
|
2009-05-20 20:13:13 +00:00
|
|
|
|
2015-11-26 11:43:03 +00:00
|
|
|
CT_EndStep
|
2009-05-20 20:13:13 +00:00
|
|
|
}
|