Add an option for those having the kernel headers pre-installed from a customised local tree.
In that case, neither download, nor extract, nor patch.
1.1 --- a/config/kernel_linux.in Wed Apr 11 17:55:03 2007 +0000
1.2 +++ b/config/kernel_linux.in Wed Apr 11 21:26:03 2007 +0000
1.3 @@ -28,18 +28,25 @@
1.4 You do NOT want this. It's badly broken because it leaks kernel internals
1.5 to userspace.
1.6
1.7 +config KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR
1.8 + bool
1.9 + prompt "Use custom directory"
1.10 + help
1.11 + If you have some kernel headers lying around, you can enter the path
1.12 + below.
1.13 +
1.14 endchoice
1.15
1.16 config KERNEL
1.17 string
1.18 - default "linux" if KERNEL_LINUX_HEADERS_INSTALL || KERNEL_LINUX_HEADERS_COPY
1.19 + default "linux" if ! KERNEL_LINUX_HEADERS_SANITISED
1.20 default "linux-libc-headers" if KERNEL_LINUX_HEADERS_SANITISED
1.21
1.22 config KERNEL_VERSION_SEE_EXTRAVERSION
1.23 bool
1.24 prompt "See extra versions"
1.25 default n
1.26 - depends on ! KERNEL_LINUX_HEADERS_SANITISED
1.27 + depends on KERNEL_LINUX_HEADERS_COPY || KERNEL_LINUX_HEADERS_INSTALL
1.28 help
1.29 See extra versions (kernel with 4 numbers, eg 2.6.19.1).
1.30
1.31 @@ -61,6 +68,19 @@
1.32 source config/kernel_linux_headers_sanitised.in
1.33 endif
1.34
1.35 +config KERNEL_LINUX_HEADERS_CUSTOM_DIR
1.36 + string
1.37 + prompt "Where are those custom headers?"
1.38 + depends on KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR
1.39 + help
1.40 + Enter the base directory where the headers are to be found.
1.41 +
1.42 + Eg. if the headers are in /some/place/include, then enter /some/place.
1.43 + This is the same path you entered when you typed:
1.44 + make INSTALL_HDR_PATH=/some/place headers_install
1.45 +
1.46 +if ! KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR
1.47 +
1.48 choice
1.49 bool
1.50 prompt "Kernel verbosity:"
1.51 @@ -100,3 +120,5 @@
1.52 Path to the kernel configuration file.
1.53
1.54 You _must_ provide one (for now).
1.55 +
1.56 +endif
2.1 --- a/scripts/build/kernel_linux.sh Wed Apr 11 17:55:03 2007 +0000
2.2 +++ b/scripts/build/kernel_linux.sh Wed Apr 11 21:26:03 2007 +0000
2.3 @@ -6,7 +6,9 @@
2.4 do_kernel_check_config() {
2.5 CT_DoStep INFO "Checking kernel configuration"
2.6
2.7 - CT_TestOrAbort "You did not provide a kernel config file!" -n "${CT_KERNEL_LINUX_CONFIG_FILE}" -a -f "${CT_KERNEL_LINUX_CONFIG_FILE}"
2.8 + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then
2.9 + CT_TestOrAbort "You did not provide a kernel config file!" -n "${CT_KERNEL_LINUX_CONFIG_FILE}" -a -f "${CT_KERNEL_LINUX_CONFIG_FILE}"
2.10 + fi
2.11
2.12 CT_EndStep
2.13 }
2.14 @@ -15,34 +17,39 @@
2.15 do_kernel_headers() {
2.16 CT_DoStep INFO "Installing kernel headers"
2.17
2.18 - # We need to enter this directory to find the kernel version strings
2.19 - cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}"
2.20 - if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then
2.21 - k_version=`awk '/^VERSION =/ { print $3 }' Makefile`
2.22 - k_patchlevel=`awk '/^PATCHLEVEL =/ { print $3 }' Makefile`
2.23 - k_sublevel=`awk '/^SUBLEVEL =/ { print $3 }' Makefile`
2.24 - k_extraversion=`awk '/^EXTRAVERSION =/ { print $3 }' Makefile`
2.25 + # Special case when using pre-installed headers
2.26 + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then
2.27 + do_kernel_preinstalled
2.28 else
2.29 - k_version=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 1`
2.30 - k_patchlevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 2`
2.31 - k_sublevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 3`
2.32 - k_extraversion=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 4`
2.33 - fi
2.34 + # We need to enter this directory to find the kernel version strings
2.35 + cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}"
2.36 + if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then
2.37 + k_version=`awk '/^VERSION =/ { print $3 }' Makefile`
2.38 + k_patchlevel=`awk '/^PATCHLEVEL =/ { print $3 }' Makefile`
2.39 + k_sublevel=`awk '/^SUBLEVEL =/ { print $3 }' Makefile`
2.40 + k_extraversion=`awk '/^EXTRAVERSION =/ { print $3 }' Makefile`
2.41 + else
2.42 + k_version=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 1`
2.43 + k_patchlevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 2`
2.44 + k_sublevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 3`
2.45 + k_extraversion=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 4`
2.46 + fi
2.47
2.48 - case "${k_version}.${k_patchlevel}" in
2.49 - 2.2|2.4|2.6) ;;
2.50 - *) CT_Abort "Unsupported kernel version \"linux-${k_version}.${k_patchlevel}\".";;
2.51 - esac
2.52 + case "${k_version}.${k_patchlevel}" in
2.53 + 2.2|2.4|2.6) ;;
2.54 + *) CT_Abort "Unsupported kernel version \"linux-${k_version}.${k_patchlevel}\".";;
2.55 + esac
2.56
2.57 - # Kernel version that support verbosity will use this, others will ignore it:
2.58 - V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
2.59 + # Kernel version that support verbosity will use this, others will ignore it:
2.60 + V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
2.61
2.62 - if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL}" = "y" ]; then
2.63 - do_kernel_install
2.64 - elif [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" = "y" ]; then
2.65 - do_kernel_sanitised
2.66 - else [ "${CT_KERNEL_LINUX_HEADERS_COPY}" = "y" ];
2.67 - do_kernel_copy
2.68 + if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL}" = "y" ]; then
2.69 + do_kernel_install
2.70 + elif [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" = "y" ]; then
2.71 + do_kernel_sanitised
2.72 + else [ "${CT_KERNEL_LINUX_HEADERS_COPY}" = "y" ];
2.73 + do_kernel_copy
2.74 + fi
2.75 fi
2.76
2.77 CT_EndStep
2.78 @@ -146,3 +153,14 @@
2.79 cp -rv include/linux "${CT_HEADERS_DIR}" 2>&1 |CT_DoLog DEBUG
2.80 cp -rv include/asm-${CT_KERNEL_ARCH} "${CT_HEADERS_DIR}/asm" 2>&1 |CT_DoLog DEBUG
2.81 }
2.82 +
2.83 +# Use preinstalled headers (most probably by using make headers_install in a
2.84 +# modified (read: customised) kernel tree). In this case, simply copy
2.85 +# the headers in place
2.86 +do_kernel_preinstalled() {
2.87 + CT_DoLog EXTRA "Copying preinstalled kernel headers"
2.88 +
2.89 + mkdir -p "${CT_SYSROOT_DIR}/usr"
2.90 + cd "${CT_KERNEL_LINUX_HEADERS_CUSTOM_DIR}"
2.91 + cp -rv include "${CT_SYSROOT_DIR}/usr" 2>&1 |CT_DoLog DEBUG
2.92 +}
3.1 --- a/scripts/getExtractPatch.sh Wed Apr 11 17:55:03 2007 +0000
3.2 +++ b/scripts/getExtractPatch.sh Wed Apr 11 21:26:03 2007 +0000
3.3 @@ -232,12 +232,14 @@
3.4 CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
3.5
3.6 # Kernel: for now, I don't care about cygwin.
3.7 - CT_GetFile "${CT_KERNEL_FILE}" \
3.8 - ftp://ftp.kernel.org/pub/linux/kernel/v2.6 \
3.9 - ftp://ftp.kernel.org/pub/linux/kernel/v2.4 \
3.10 - ftp://ftp.kernel.org/pub/linux/kernel/v2.2 \
3.11 - ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing \
3.12 - http://ep09.pld-linux.org/~mmazur/linux-libc-headers
3.13 + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then
3.14 + CT_GetFile "${CT_KERNEL_FILE}" \
3.15 + ftp://ftp.kernel.org/pub/linux/kernel/v2.6 \
3.16 + ftp://ftp.kernel.org/pub/linux/kernel/v2.4 \
3.17 + ftp://ftp.kernel.org/pub/linux/kernel/v2.2 \
3.18 + ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing \
3.19 + http://ep09.pld-linux.org/~mmazur/linux-libc-headers
3.20 + fi
3.21
3.22 # binutils
3.23 CT_GetFile "${CT_BINUTILS_FILE}" \
3.24 @@ -313,7 +315,9 @@
3.25 if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then
3.26 CT_DoStep INFO "Extracting and patching toolchain components"
3.27
3.28 - CT_ExtractAndPatch "${CT_KERNEL_FILE}"
3.29 + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then
3.30 + CT_ExtractAndPatch "${CT_KERNEL_FILE}"
3.31 + fi
3.32 CT_ExtractAndPatch "${CT_BINUTILS_FILE}"
3.33 CT_ExtractAndPatch "${CT_CC_CORE_FILE}"
3.34 CT_ExtractAndPatch "${CT_CC_FILE}"