diff options
Diffstat (limited to 'scripts/build/kernel/linux.sh')
-rw-r--r-- | scripts/build/kernel/linux.sh | 70 |
1 files changed, 27 insertions, 43 deletions
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh index d750ccc..3a2c95f 100644 --- a/scripts/build/kernel/linux.sh +++ b/scripts/build/kernel/linux.sh @@ -18,9 +18,25 @@ CT_DoKernelTupleValues() { # Download the kernel do_kernel_get() { local k_ver - if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" \ - -a "${CT_KERNEL_LINUX_CUSTOM}" != "y" \ - ]; then + local custom_name + + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then + return 0 + fi + + if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then + # Wee need to know the custom tarball extension, + # so we can cerate a properly-named symlink, which + # we use later on in 'extract' + case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in + *.tar.bz2) custom_name="linux-custom.tar.bz2";; + *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";; + *.tar) custom_name="linux-custom.tar";; + *) CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_TARBALL}'";; + esac + CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" \ + "${CT_SRC_DIR}/${custom_name}" + else # Not a custom tarball case "${CT_KERNEL_VERSION}" in 2.6.*.*|3.*.*) # 4-part versions (for 2.6 stables and long-terms), and @@ -44,54 +60,22 @@ do_kernel_get() { # Extract kernel do_kernel_extract() { - local tar_opt - if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then - 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 + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then + return 0 fi + # This also handles the custom tarball + CT_Extract "linux-${CT_KERNEL_VERSION}" + CT_Patch "linux" "${CT_KERNEL_VERSION}" } # Wrapper to the actual headers install method do_kernel_headers() { CT_DoStep INFO "Installing kernel headers" - if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then - do_kernel_install - else + if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then do_kernel_custom + else + do_kernel_install fi CT_EndStep |