mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-04-19 00:26:55 +00:00
kernel/linux: allow headers from full custom source tree
Accept a local tarball name as the source of the Linux kernel headers, rather than forcing the user to use either an upstream tarball, or a local pre-installed headers tree.
This commit is contained in:
parent
f99f3208af
commit
c4933a400c
@ -83,6 +83,19 @@ config KERNEL_V_2_6_27_47
|
||||
See the original announcement by Adrian Bunk in the following mailing list
|
||||
entry: http://marc.info/?l=linux-kernel&m=122375909403298&w=2
|
||||
|
||||
config KERNEL_LINUX_CUSTOM
|
||||
bool
|
||||
prompt "custom tarball"
|
||||
help
|
||||
Use a local tarball of a complete kernel source tree.
|
||||
|
||||
config KERNEL_LINUX_CUSTOM_TARBALL
|
||||
string
|
||||
prompt "Path to custom tarball"
|
||||
depends on KERNEL_LINUX_CUSTOM
|
||||
help
|
||||
Enter here the path to the tarball of your full kernel tree.
|
||||
|
||||
endchoice
|
||||
|
||||
config KERNEL_VERSION
|
||||
@ -144,10 +157,16 @@ endif # KERNEL_LINUX_INSTALL
|
||||
|
||||
config KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||
bool
|
||||
prompt "custom, and/or pre-installed, headers tree"
|
||||
prompt "pre-installed headers tree"
|
||||
help
|
||||
If you have some kernel headers lying around, you can enter the path
|
||||
below.
|
||||
If you have some pre-installed kernel headers lying around, you can
|
||||
enter the path to these headers, below, they will be copied from
|
||||
there, and into the toolchain's sysroot.
|
||||
|
||||
Note:
|
||||
This will *not* let you use a complete kernel tree!
|
||||
If you want to use your own full kernel tree, then you want to
|
||||
say 'Y' to KERNEL_LINUX_INSTALL, above, and select KERNEL_LINUX_CUSTOM.
|
||||
|
||||
if KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||
|
||||
|
@ -17,7 +17,9 @@ CT_DoKernelTupleValues() {
|
||||
|
||||
# Download the kernel
|
||||
do_kernel_get() {
|
||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
|
||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" \
|
||||
-a "${CT_KERNEL_LINUX_CUSTOM}" != "y" \
|
||||
]; then
|
||||
CT_GetFile "linux-${CT_KERNEL_VERSION}" \
|
||||
{ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2}
|
||||
fi
|
||||
@ -25,9 +27,43 @@ do_kernel_get() {
|
||||
|
||||
# Extract kernel
|
||||
do_kernel_extract() {
|
||||
local tar_opt
|
||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
|
||||
CT_Extract "linux-${CT_KERNEL_VERSION}"
|
||||
CT_Patch "linux" "${CT_KERNEL_VERSION}"
|
||||
if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
|
||||
# We extract the custom linux tree into a directory with a
|
||||
# well-known name, and strip the leading directory component
|
||||
# of the extracted pathes. This is needed because we do not
|
||||
# know the value for this first component, because it is a
|
||||
# _custom_ tree.
|
||||
# Also, we have to protect from partial extraction using the
|
||||
# .extracting and .extracted locks (not using .patching and
|
||||
# .patched as we are *not* patching that kernel).
|
||||
|
||||
if [ -e "${CT_SRC_DIR}/.linux-custom.extracted" ]; then
|
||||
CT_DoLog DEBUG "Custom linux kernel tree already extracted"
|
||||
return 0
|
||||
fi
|
||||
|
||||
CT_TestAndAbort "Custom kernel tree partially extracted. Remove before resuming" -f "${CT_SRC_DIR}/.linux-custom.extracting"
|
||||
CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.linux-custom.extracting"
|
||||
CT_DoExecLog DEBUG mkdir "${CT_SRC_DIR}/linux-custom"
|
||||
|
||||
case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
|
||||
*.tar.bz2) tar_opt=-j;;
|
||||
*.tar.gz|*.tgz) tar_opt=-z;;
|
||||
*.tar) ;;
|
||||
*) CT_Abort "Don't know how to handle '${CT_KERNEL_LINUX_CUSTOM_TARBALL}': unknown extension";;
|
||||
esac
|
||||
CT_DoLog EXTRA "Extracting custom linux kernel"
|
||||
CT_DoExecLog ALL tar x -C "${CT_SRC_DIR}/linux-custom" \
|
||||
--strip-components 1 -v ${tar_opt} \
|
||||
-f "${CT_KERNEL_LINUX_CUSTOM_TARBALL}"
|
||||
|
||||
CT_DoExecLog ALL mv -v "${CT_SRC_DIR}/.linux-custom.extracting" "${CT_SRC_DIR}/.linux-custom.extracted"
|
||||
else
|
||||
CT_Extract "linux-${CT_KERNEL_VERSION}"
|
||||
CT_Patch "linux" "${CT_KERNEL_VERSION}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -46,17 +82,22 @@ do_kernel_headers() {
|
||||
|
||||
# Install kernel headers using headers_install from kernel sources.
|
||||
do_kernel_install() {
|
||||
local kernel_path
|
||||
|
||||
CT_DoLog DEBUG "Using kernel's headers_install"
|
||||
|
||||
mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
|
||||
cd "${CT_BUILD_DIR}/build-kernel-headers"
|
||||
|
||||
kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
|
||||
if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
|
||||
kernel_path="${CT_SRC_DIR}/linux-custom"
|
||||
fi
|
||||
V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
|
||||
|
||||
CT_DoLog EXTRA "Installing kernel headers"
|
||||
CT_DoExecLog ALL \
|
||||
make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
|
||||
O=$(pwd) \
|
||||
make -C "${kernel_path}" \
|
||||
O="${CT_BUILD_DIR}/build-kernel-headers" \
|
||||
ARCH=${CT_ARCH} \
|
||||
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
|
||||
${V_OPT} \
|
||||
@ -65,8 +106,8 @@ do_kernel_install() {
|
||||
if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
|
||||
CT_DoLog EXTRA "Checking installed headers"
|
||||
CT_DoExecLog ALL \
|
||||
make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
|
||||
O=$(pwd) \
|
||||
make -C "${kernel_path}" \
|
||||
O="${CT_BUILD_DIR}/build-kernel-headers" \
|
||||
ARCH=${CT_ARCH} \
|
||||
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
|
||||
${V_OPT} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user