diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2011-08-14 19:59:02 +0200 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2011-08-14 19:59:02 +0200 |
commit | 59499a2cdadfbb28780eafca206f1b353c0cbd7c (patch) | |
tree | 5eb81e2ce29a1d9177378837754b8d7930166479 /scripts/build/kernel | |
parent | 47229f15af48b2cefc1a14ae9c22e3cfaf5b7d43 (diff) | |
download | crosstool-ng-59499a2cdadfbb28780eafca206f1b353c0cbd7c.tar.gz crosstool-ng-59499a2cdadfbb28780eafca206f1b353c0cbd7c.tar.bz2 crosstool-ng-59499a2cdadfbb28780eafca206f1b353c0cbd7c.zip |
kernel/linux: simplify custom tarball handling
Simplify the way the custom tarball is handled:
- fake version="custom"
- at download, simply link the custom tarball to:
"linux-custom.${custom_extension}"
- at extract, the above allows to simply extract "linux-${LINUX_VERSION}"
where LINUX_VERISON is set to the fake version="custom"
Not that much convoluted, in fact... :-/
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts/build/kernel')
-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 d750cccd..3a2c95fe 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 |