kernel/linux: use a custom kernel source directory
authorSinseman44 <sinseman44@gmail.com>
Thu Sep 22 22:49:38 2011 +0200 (2011-09-22)
changeset 2680b94e0f9d15a3
parent 2677 7df89370f805
child 2689 ced78fd59221
kernel/linux: use a custom kernel source directory

Allows using either a tarball or a directory as the custom kernel
source location.

Signed-off-by: Vincent BENOIT <sinseman44@gmail.com>
[yann.morin.1998@anciens.enib.fr: fix space damage, detailed commit message]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/kernel/linux.in
scripts/build/kernel/linux.sh
     1.1 --- a/config/kernel/linux.in	Wed Sep 21 22:42:35 2011 +0200
     1.2 +++ b/config/kernel/linux.in	Thu Sep 22 22:49:38 2011 +0200
     1.3 @@ -140,16 +140,17 @@
     1.4  
     1.5  config KERNEL_LINUX_CUSTOM
     1.6      bool
     1.7 -    prompt "custom tarball"
     1.8 +    prompt "custom tarball or directory"
     1.9      help
    1.10 -      Use a local tarball of a complete kernel source tree.
    1.11 +      Use a local tarball or local kernel directory of a complete kernel source tree.
    1.12  
    1.13 -config KERNEL_LINUX_CUSTOM_TARBALL
    1.14 +config KERNEL_LINUX_CUSTOM_LOCATION
    1.15      string
    1.16 -    prompt "Path to custom tarball"
    1.17 +    prompt "Path to custom source, tarball or directory"
    1.18      depends on KERNEL_LINUX_CUSTOM
    1.19      help
    1.20 -      Enter here the path to the tarball of your full kernel tree.
    1.21 +      Enter here the path to the tarball of your full kernel tree or
    1.22 +      kernel directory
    1.23  
    1.24  endchoice
    1.25  
     2.1 --- a/scripts/build/kernel/linux.sh	Wed Sep 21 22:42:35 2011 +0200
     2.2 +++ b/scripts/build/kernel/linux.sh	Thu Sep 22 22:49:38 2011 +0200
     2.3 @@ -25,17 +25,23 @@
     2.4      fi
     2.5  
     2.6      if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
     2.7 -        # Wee need to know the custom tarball extension,
     2.8 -        # so we can cerate a properly-named symlink, which
     2.9 -        # we use later on in 'extract'
    2.10 -        case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
    2.11 -            *.tar.bz2)      custom_name="linux-custom.tar.bz2";;
    2.12 -            *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
    2.13 -            *.tar)          custom_name="linux-custom.tar";;
    2.14 -            *)  CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_TARBALL}'";;
    2.15 -        esac
    2.16 -        CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_TARBALL}"  \
    2.17 -                                  "${CT_TARBALLS_DIR}/${custom_name}"
    2.18 +        if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
    2.19 +            # Wee need to know the custom tarball extension,
    2.20 +            # so we can create a properly-named symlink, which
    2.21 +            # we use later on in 'extract'
    2.22 +            case "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" in
    2.23 +                *.tar.bz2)      custom_name="linux-custom.tar.bz2";;
    2.24 +                *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
    2.25 +                *.tar)          custom_name="linux-custom.tar";;
    2.26 +                *)  CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_LOCATION}'";;
    2.27 +            esac
    2.28 +            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
    2.29 +                                      "${CT_TARBALLS_DIR}/${custom_name}"
    2.30 +        else
    2.31 +            custom_name="linux-custom"
    2.32 +            CT_DoExecLog DEBUG ln -s "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
    2.33 +                                      "${CT_SRC_DIR}/${custom_name}"
    2.34 +        fi
    2.35      else # Not a custom tarball
    2.36          case "${CT_KERNEL_VERSION}" in
    2.37              2.6.*.*|3.*.*)
    2.38 @@ -64,9 +70,11 @@
    2.39  
    2.40  # Extract kernel
    2.41  do_kernel_extract() {
    2.42 -    if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y"  ]; then
    2.43 +    if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" \
    2.44 +         -o -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
    2.45          return 0
    2.46      fi
    2.47 +   
    2.48      # This also handles the custom tarball
    2.49      CT_Extract "linux-${CT_KERNEL_VERSION}"
    2.50      CT_Patch "linux" "${CT_KERNEL_VERSION}"