# HG changeset patch # User "Yann E. MORIN" # Date 1176326763 0 # Node ID 21bcbfde80944bfd300ae3da2388144b35b871c8 # Parent 776370226eafeeb6b3db81f902df3ccf846fe223 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. diff -r 776370226eaf -r 21bcbfde8094 config/kernel_linux.in --- a/config/kernel_linux.in Wed Apr 11 17:55:03 2007 +0000 +++ b/config/kernel_linux.in Wed Apr 11 21:26:03 2007 +0000 @@ -28,18 +28,25 @@ You do NOT want this. It's badly broken because it leaks kernel internals to userspace. +config KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR + bool + prompt "Use custom directory" + help + If you have some kernel headers lying around, you can enter the path + below. + endchoice config KERNEL string - default "linux" if KERNEL_LINUX_HEADERS_INSTALL || KERNEL_LINUX_HEADERS_COPY + default "linux" if ! KERNEL_LINUX_HEADERS_SANITISED default "linux-libc-headers" if KERNEL_LINUX_HEADERS_SANITISED config KERNEL_VERSION_SEE_EXTRAVERSION bool prompt "See extra versions" default n - depends on ! KERNEL_LINUX_HEADERS_SANITISED + depends on KERNEL_LINUX_HEADERS_COPY || KERNEL_LINUX_HEADERS_INSTALL help See extra versions (kernel with 4 numbers, eg 2.6.19.1). @@ -61,6 +68,19 @@ source config/kernel_linux_headers_sanitised.in endif +config KERNEL_LINUX_HEADERS_CUSTOM_DIR + string + prompt "Where are those custom headers?" + depends on KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR + help + Enter the base directory where the headers are to be found. + + Eg. if the headers are in /some/place/include, then enter /some/place. + This is the same path you entered when you typed: + make INSTALL_HDR_PATH=/some/place headers_install + +if ! KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR + choice bool prompt "Kernel verbosity:" @@ -100,3 +120,5 @@ Path to the kernel configuration file. You _must_ provide one (for now). + +endif diff -r 776370226eaf -r 21bcbfde8094 scripts/build/kernel_linux.sh --- a/scripts/build/kernel_linux.sh Wed Apr 11 17:55:03 2007 +0000 +++ b/scripts/build/kernel_linux.sh Wed Apr 11 21:26:03 2007 +0000 @@ -6,7 +6,9 @@ do_kernel_check_config() { CT_DoStep INFO "Checking kernel configuration" - CT_TestOrAbort "You did not provide a kernel config file!" -n "${CT_KERNEL_LINUX_CONFIG_FILE}" -a -f "${CT_KERNEL_LINUX_CONFIG_FILE}" + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then + CT_TestOrAbort "You did not provide a kernel config file!" -n "${CT_KERNEL_LINUX_CONFIG_FILE}" -a -f "${CT_KERNEL_LINUX_CONFIG_FILE}" + fi CT_EndStep } @@ -15,34 +17,39 @@ do_kernel_headers() { CT_DoStep INFO "Installing kernel headers" - # We need to enter this directory to find the kernel version strings - cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}" - if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then - k_version=`awk '/^VERSION =/ { print $3 }' Makefile` - k_patchlevel=`awk '/^PATCHLEVEL =/ { print $3 }' Makefile` - k_sublevel=`awk '/^SUBLEVEL =/ { print $3 }' Makefile` - k_extraversion=`awk '/^EXTRAVERSION =/ { print $3 }' Makefile` + # Special case when using pre-installed headers + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then + do_kernel_preinstalled else - k_version=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 1` - k_patchlevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 2` - k_sublevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 3` - k_extraversion=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 4` - fi + # We need to enter this directory to find the kernel version strings + cd "${CT_SRC_DIR}/${CT_KERNEL_FILE}" + if [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" != "y" ]; then + k_version=`awk '/^VERSION =/ { print $3 }' Makefile` + k_patchlevel=`awk '/^PATCHLEVEL =/ { print $3 }' Makefile` + k_sublevel=`awk '/^SUBLEVEL =/ { print $3 }' Makefile` + k_extraversion=`awk '/^EXTRAVERSION =/ { print $3 }' Makefile` + else + k_version=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 1` + k_patchlevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 2` + k_sublevel=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 3` + k_extraversion=`echo "${CT_KERNEL_VERSION}." |cut -d . -f 4` + fi - case "${k_version}.${k_patchlevel}" in - 2.2|2.4|2.6) ;; - *) CT_Abort "Unsupported kernel version \"linux-${k_version}.${k_patchlevel}\".";; - esac + case "${k_version}.${k_patchlevel}" in + 2.2|2.4|2.6) ;; + *) CT_Abort "Unsupported kernel version \"linux-${k_version}.${k_patchlevel}\".";; + esac - # Kernel version that support verbosity will use this, others will ignore it: - V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}" + # Kernel version that support verbosity will use this, others will ignore it: + V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}" - if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL}" = "y" ]; then - do_kernel_install - elif [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" = "y" ]; then - do_kernel_sanitised - else [ "${CT_KERNEL_LINUX_HEADERS_COPY}" = "y" ]; - do_kernel_copy + if [ "${CT_KERNEL_LINUX_HEADERS_INSTALL}" = "y" ]; then + do_kernel_install + elif [ "${CT_KERNEL_LINUX_HEADERS_SANITISED}" = "y" ]; then + do_kernel_sanitised + else [ "${CT_KERNEL_LINUX_HEADERS_COPY}" = "y" ]; + do_kernel_copy + fi fi CT_EndStep @@ -146,3 +153,14 @@ cp -rv include/linux "${CT_HEADERS_DIR}" 2>&1 |CT_DoLog DEBUG cp -rv include/asm-${CT_KERNEL_ARCH} "${CT_HEADERS_DIR}/asm" 2>&1 |CT_DoLog DEBUG } + +# Use preinstalled headers (most probably by using make headers_install in a +# modified (read: customised) kernel tree). In this case, simply copy +# the headers in place +do_kernel_preinstalled() { + CT_DoLog EXTRA "Copying preinstalled kernel headers" + + mkdir -p "${CT_SYSROOT_DIR}/usr" + cd "${CT_KERNEL_LINUX_HEADERS_CUSTOM_DIR}" + cp -rv include "${CT_SYSROOT_DIR}/usr" 2>&1 |CT_DoLog DEBUG +} diff -r 776370226eaf -r 21bcbfde8094 scripts/getExtractPatch.sh --- a/scripts/getExtractPatch.sh Wed Apr 11 17:55:03 2007 +0000 +++ b/scripts/getExtractPatch.sh Wed Apr 11 21:26:03 2007 +0000 @@ -232,12 +232,14 @@ CT_DoStep INFO "Retrieving needed toolchain components' tarballs" # Kernel: for now, I don't care about cygwin. - CT_GetFile "${CT_KERNEL_FILE}" \ - ftp://ftp.kernel.org/pub/linux/kernel/v2.6 \ - ftp://ftp.kernel.org/pub/linux/kernel/v2.4 \ - ftp://ftp.kernel.org/pub/linux/kernel/v2.2 \ - ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing \ - http://ep09.pld-linux.org/~mmazur/linux-libc-headers + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then + CT_GetFile "${CT_KERNEL_FILE}" \ + ftp://ftp.kernel.org/pub/linux/kernel/v2.6 \ + ftp://ftp.kernel.org/pub/linux/kernel/v2.4 \ + ftp://ftp.kernel.org/pub/linux/kernel/v2.2 \ + ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing \ + http://ep09.pld-linux.org/~mmazur/linux-libc-headers + fi # binutils CT_GetFile "${CT_BINUTILS_FILE}" \ @@ -313,7 +315,9 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then CT_DoStep INFO "Extracting and patching toolchain components" - CT_ExtractAndPatch "${CT_KERNEL_FILE}" + if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then + CT_ExtractAndPatch "${CT_KERNEL_FILE}" + fi CT_ExtractAndPatch "${CT_BINUTILS_FILE}" CT_ExtractAndPatch "${CT_CC_CORE_FILE}" CT_ExtractAndPatch "${CT_CC_FILE}"