kernel/linux: fix using custom location
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Oct 16 20:57:44 2012 +0200 (2012-10-16)
changeset 307937831a33e07e
parent 3078 2a616dab6531
child 3080 f4a0fc3d0aad
kernel/linux: fix using custom location

Currently, extract and patch are skipped as thus:
- using a custom directory of pre-installed headers
- a correctly named directory already exists

Otherwise, extract and patch are done.

The current second condition is wrong, because it allows the following
sequence to happen:
- a non-custom kernel is used
- a previous build only partially extracted the non-custom sources
- that p[revious build broke during extraction (eg. incomplete tarball...)
- a subsequent build will find a properly named directory, and will
thus skip extract and patch, which is wrong

Fix that by following the conditions in this table:

Type | Extract | Patch
----------------------+---------+-------
Pre-installed headers | N | N
custom directory | N | N
custom tarball | Y | N
mainstream tarball | Y | Y

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: David Holsgrove <david.holsgrove@xilinx.com>
scripts/build/kernel/linux.sh
     1.1 --- a/scripts/build/kernel/linux.sh	Mon Oct 15 16:59:11 2012 +1000
     1.2 +++ b/scripts/build/kernel/linux.sh	Tue Oct 16 20:57:44 2012 +0200
     1.3 @@ -59,13 +59,25 @@
     1.4  
     1.5  # Extract kernel
     1.6  do_kernel_extract() {
     1.7 -    # If using custom headers, or custom directory location, nothing to do
     1.8 -    if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y"    \
     1.9 -         -o -d "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" ]; then
    1.10 +    # If using a custom headers tree, nothing to do
    1.11 +    if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]
    1.12          return 0
    1.13      fi
    1.14 -   
    1.15 +
    1.16 +    # If using a custom directory location, nothing to do
    1.17 +    if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y"    \
    1.18 +         -a -d "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" ]; then
    1.19 +        return 0
    1.20 +    fi
    1.21 +
    1.22 +    # Otherwise, we're using either a mainstream tarball, or a custom
    1.23 +    # tarball; in either case, we need to extract
    1.24      CT_Extract "linux-${CT_KERNEL_VERSION}"
    1.25 +
    1.26 +    # If using a custom tarball, no need to patch
    1.27 +    if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
    1.28 +        return 0
    1.29 +    fi
    1.30      CT_Patch "linux" "${CT_KERNEL_VERSION}"
    1.31  }
    1.32