When using custom Linux kernel headers, allow using a tarball.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Mar 03 18:43:38 2009 +0000 (2009-03-03)
changeset 1221814d458b1878
parent 1220 63d8500c8fc1
child 1222 c7558c696cc4
When using custom Linux kernel headers, allow using a tarball.

/trunk/scripts/build/kernel/linux.sh | 19 16 3 0 ++++++++++++++++---
/trunk/config/kernel/linux.in | 35 26 9 0 ++++++++++++++++++++++++++---------
2 files changed, 42 insertions(+), 12 deletions(-)
config/kernel/linux.in
scripts/build/kernel/linux.sh
     1.1 --- a/config/kernel/linux.in	Tue Mar 03 17:50:53 2009 +0000
     1.2 +++ b/config/kernel/linux.in	Tue Mar 03 18:43:38 2009 +0000
     1.3 @@ -286,20 +286,37 @@
     1.4  
     1.5  config KERNEL_LINUX_USE_CUSTOM_DIR
     1.6      bool
     1.7 -    prompt "Use custom directory"
     1.8 +    prompt "Use custom headers"
     1.9      help
    1.10        If you have some kernel headers lying around, you can enter the path
    1.11        below.
    1.12  
    1.13 -config KERNEL_LINUX_CUSTOM_DIR
    1.14 +if KERNEL_LINUX_USE_CUSTOM_DIR
    1.15 +
    1.16 +config KERNEL_LINUX_CUSTOM_IS_TARBALL
    1.17 +    bool
    1.18 +    prompt "This is a tarball"
    1.19 +    default n
    1.20 +    help
    1.21 +      If you say 'n' here, the path below is expected to point to a directory
    1.22 +      containing readily prepared headers
    1.23 +      
    1.24 +      If you say 'y' here, then the path below is expected to point to a
    1.25 +      tarball of such a directory.
    1.26 +      
    1.27 +      Eg., if your headers are available in: /foo/bar/buz/my_hdrs/include,
    1.28 +      say 'n' here, and enter: /foo/bar/buz/my_hdrs below.
    1.29 +      
    1.30 +      Now, passing a tarball around is easier than passing a directory, so
    1.31 +      if you want to, you can make a tarball of /foo/bar/buz/my_hdrs/include,
    1.32 +      say 'y' here, and enter the path to this tarball below.
    1.33 +
    1.34 +config KERNEL_LINUX_CUSTOM_PATH
    1.35      string
    1.36 -    prompt "Where are those custom headers?"
    1.37 -    depends on KERNEL_LINUX_USE_CUSTOM_DIR
    1.38 +    prompt "Path to custom headers directory/tarball"
    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 +      See KERNEL_LINUX_CUSTOM_IS_TARBALL, above.
    1.46 +
    1.47 +endif # KERNEL_LINUX_USE_CUSTOM_DIR
    1.48  
    1.49  endchoice
     2.1 --- a/scripts/build/kernel/linux.sh	Tue Mar 03 17:50:53 2009 +0000
     2.2 +++ b/scripts/build/kernel/linux.sh	Tue Mar 03 18:43:38 2009 +0000
     2.3 @@ -78,9 +78,22 @@
     2.4  # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
     2.5  # as 2.4). In this case, simply copy the headers in place
     2.6  do_kernel_preinstalled() {
     2.7 -    CT_DoLog EXTRA "Copying preinstalled kernel headers"
     2.8 +    local tar_opt
     2.9 +
    2.10 +    CT_DoLog EXTRA "Installing custom kernel headers"
    2.11  
    2.12      mkdir -p "${CT_SYSROOT_DIR}/usr"
    2.13 -    cd "${CT_KERNEL_LINUX_CUSTOM_DIR}"
    2.14 -    CT_DoExecLog ALL cp -rv include "${CT_SYSROOT_DIR}/usr"
    2.15 +    cd "${CT_SYSROOT_DIR}/usr"
    2.16 +    if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
    2.17 +        case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
    2.18 +            *.tar)      ;;
    2.19 +            *.tgz)      tar_opt=--gzip;;
    2.20 +            *.tar.gz)   tar_opt=--gzip;;
    2.21 +            *.tar.bz2)  tar_opt=--bzip2;;
    2.22 +            *.tar.lzma) tar_opt=--lzma;;
    2.23 +        esac
    2.24 +        CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
    2.25 +    else
    2.26 +        CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .
    2.27 +    fi
    2.28  }