1.1 --- a/config/kernel/linux.in Tue Jun 15 20:04:01 2010 +0200
1.2 +++ b/config/kernel/linux.in Thu Jun 17 18:30:09 2010 +0200
1.3 @@ -83,6 +83,19 @@
1.4 See the original announcement by Adrian Bunk in the following mailing list
1.5 entry: http://marc.info/?l=linux-kernel&m=122375909403298&w=2
1.6
1.7 +config KERNEL_LINUX_CUSTOM
1.8 + bool
1.9 + prompt "custom tarball"
1.10 + help
1.11 + Use a local tarball of a complete kernel source tree.
1.12 +
1.13 +config KERNEL_LINUX_CUSTOM_TARBALL
1.14 + string
1.15 + prompt "Path to custom tarball"
1.16 + depends on KERNEL_LINUX_CUSTOM
1.17 + help
1.18 + Enter here the path to the tarball of your full kernel tree.
1.19 +
1.20 endchoice
1.21
1.22 config KERNEL_VERSION
1.23 @@ -144,10 +157,16 @@
1.24
1.25 config KERNEL_LINUX_USE_CUSTOM_HEADERS
1.26 bool
1.27 - prompt "custom, and/or pre-installed, headers tree"
1.28 + prompt "pre-installed headers tree"
1.29 help
1.30 - If you have some kernel headers lying around, you can enter the path
1.31 - below.
1.32 + If you have some pre-installed kernel headers lying around, you can
1.33 + enter the path to these headers, below, they will be copied from
1.34 + there, and into the toolchain's sysroot.
1.35 +
1.36 + Note:
1.37 + This will *not* let you use a complete kernel tree!
1.38 + If you want to use your own full kernel tree, then you want to
1.39 + say 'Y' to KERNEL_LINUX_INSTALL, above, and select KERNEL_LINUX_CUSTOM.
1.40
1.41 if KERNEL_LINUX_USE_CUSTOM_HEADERS
1.42
2.1 --- a/scripts/build/kernel/linux.sh Tue Jun 15 20:04:01 2010 +0200
2.2 +++ b/scripts/build/kernel/linux.sh Thu Jun 17 18:30:09 2010 +0200
2.3 @@ -17,7 +17,9 @@
2.4
2.5 # Download the kernel
2.6 do_kernel_get() {
2.7 - if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
2.8 + if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" \
2.9 + -a "${CT_KERNEL_LINUX_CUSTOM}" != "y" \
2.10 + ]; then
2.11 CT_GetFile "linux-${CT_KERNEL_VERSION}" \
2.12 {ftp,http}://ftp.{de.,eu.,}kernel.org/pub/linux/kernel/v2.{6{,/testing},4,2}
2.13 fi
2.14 @@ -25,9 +27,43 @@
2.15
2.16 # Extract kernel
2.17 do_kernel_extract() {
2.18 + local tar_opt
2.19 if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
2.20 - CT_Extract "linux-${CT_KERNEL_VERSION}"
2.21 - CT_Patch "linux" "${CT_KERNEL_VERSION}"
2.22 + if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
2.23 + # We extract the custom linux tree into a directory with a
2.24 + # well-known name, and strip the leading directory component
2.25 + # of the extracted pathes. This is needed because we do not
2.26 + # know the value for this first component, because it is a
2.27 + # _custom_ tree.
2.28 + # Also, we have to protect from partial extraction using the
2.29 + # .extracting and .extracted locks (not using .patching and
2.30 + # .patched as we are *not* patching that kernel).
2.31 +
2.32 + if [ -e "${CT_SRC_DIR}/.linux-custom.extracted" ]; then
2.33 + CT_DoLog DEBUG "Custom linux kernel tree already extracted"
2.34 + return 0
2.35 + fi
2.36 +
2.37 + CT_TestAndAbort "Custom kernel tree partially extracted. Remove before resuming" -f "${CT_SRC_DIR}/.linux-custom.extracting"
2.38 + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.linux-custom.extracting"
2.39 + CT_DoExecLog DEBUG mkdir "${CT_SRC_DIR}/linux-custom"
2.40 +
2.41 + case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
2.42 + *.tar.bz2) tar_opt=-j;;
2.43 + *.tar.gz|*.tgz) tar_opt=-z;;
2.44 + *.tar) ;;
2.45 + *) CT_Abort "Don't know how to handle '${CT_KERNEL_LINUX_CUSTOM_TARBALL}': unknown extension";;
2.46 + esac
2.47 + CT_DoLog EXTRA "Extracting custom linux kernel"
2.48 + CT_DoExecLog ALL tar x -C "${CT_SRC_DIR}/linux-custom" \
2.49 + --strip-components 1 -v ${tar_opt} \
2.50 + -f "${CT_KERNEL_LINUX_CUSTOM_TARBALL}"
2.51 +
2.52 + CT_DoExecLog ALL mv -v "${CT_SRC_DIR}/.linux-custom.extracting" "${CT_SRC_DIR}/.linux-custom.extracted"
2.53 + else
2.54 + CT_Extract "linux-${CT_KERNEL_VERSION}"
2.55 + CT_Patch "linux" "${CT_KERNEL_VERSION}"
2.56 + fi
2.57 fi
2.58 }
2.59
2.60 @@ -46,17 +82,22 @@
2.61
2.62 # Install kernel headers using headers_install from kernel sources.
2.63 do_kernel_install() {
2.64 + local kernel_path
2.65 +
2.66 CT_DoLog DEBUG "Using kernel's headers_install"
2.67
2.68 mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
2.69 - cd "${CT_BUILD_DIR}/build-kernel-headers"
2.70
2.71 + kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
2.72 + if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
2.73 + kernel_path="${CT_SRC_DIR}/linux-custom"
2.74 + fi
2.75 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
2.76
2.77 CT_DoLog EXTRA "Installing kernel headers"
2.78 CT_DoExecLog ALL \
2.79 - make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
2.80 - O=$(pwd) \
2.81 + make -C "${kernel_path}" \
2.82 + O="${CT_BUILD_DIR}/build-kernel-headers" \
2.83 ARCH=${CT_ARCH} \
2.84 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
2.85 ${V_OPT} \
2.86 @@ -65,8 +106,8 @@
2.87 if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
2.88 CT_DoLog EXTRA "Checking installed headers"
2.89 CT_DoExecLog ALL \
2.90 - make -C "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" \
2.91 - O=$(pwd) \
2.92 + make -C "${kernel_path}" \
2.93 + O="${CT_BUILD_DIR}/build-kernel-headers" \
2.94 ARCH=${CT_ARCH} \
2.95 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
2.96 ${V_OPT} \