diff mbox

[1,of,2] kernel/linux: add a check for existance of linux-custom tarball

Message ID 722db80eb1f5c5189699.1367666987@NX5000
State New
Headers show

Commit Message

Jerzy Grzegorek May 4, 2013, 11:29 a.m. UTC
# HG changeset patch
# User "Jerzy Grzegorek" <jerzy.grzegorek@trzebnica.net>
# Date 1367665469 -7200
# Node ID 722db80eb1f5c5189699ae471a52c78366dccf78
# Parent  285b83c60e29fe0b733404b22cfd743b926d47ad
kernel/linux: add a check for existance of linux-custom tarball

Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net>


--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 285b83c60e29 -r 722db80eb1f5 scripts/build/kernel/linux.sh
--- a/scripts/build/kernel/linux.sh	Fri May 03 15:36:11 2013 +0000
+++ b/scripts/build/kernel/linux.sh	Sat May 04 13:04:29 2013 +0200
@@ -23,37 +23,50 @@ 
     local custom_name
     local rel_dir
     local korg_base mirror_base
+    local kernel_version
 
     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y"  ]; then
         return 0
     fi
 
     if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
+        # linux-custom
+        # example: /dir/linux-3.4.tar.xz -> 3.4.tar.xz
+        kernel_version="${CT_KERNEL_LINUX_CUSTOM_LOCATION##*-}"
+        # example: 3.4.tar.xz -> 3.4.tar
+        kernel_version="${kernel_version%.*}"
+        # example: 3.4.tar -> 3.4
+        kernel_version="${kernel_version%.*}"
+    else
+        kernel_version="${CT_KERNEL_VERSION}"
+    fi
+
+    case "${kernel_version}" in
+        2.6.*.*|3.*.*)
+            # 4-part versions (for 2.6 stables and long-terms), and
+            # 3-part versions (for 3.x.y stables and long-terms),
+            # we need to trash the last digit
+            k_ver="${kernel_version%.*}"
+            ;;
+        2.6.*|3.*)
+            # 3-part version (for 2.6.x initial releases), and 2-part
+            # versions (for 3.x initial releases), use all of it
+            k_ver="${kernel_version}"
+            ;;
+    esac
+    case "${kernel_version}" in
+        2.6.*)  rel_dir=v2.6;;
+        3.*)    rel_dir=v3.x;;
+    esac
+    korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
+    CT_GetFile "linux-${kernel_version}"            \
+               "${korg_base}"                       \
+               "${korg_base}/longterm/v${k_ver}"    \
+               "${korg_base}/longterm"
+
+    if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
         CT_GetCustom "linux" "${CT_KERNEL_VERSION}"     \
                      "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
-    else # Not a custom tarball
-        case "${CT_KERNEL_VERSION}" in
-            2.6.*.*|3.*.*)
-                # 4-part versions (for 2.6 stables and long-terms), and
-                # 3-part versions (for 3.x.y stables and long-terms),
-                # we need to trash the last digit
-                k_ver="${CT_KERNEL_VERSION%.*}"
-                ;;
-            2.6.*|3.*)
-                # 3-part version (for 2.6.x initial releases), and 2-part
-                # versions (for 3.x initial releases), use all of it
-                k_ver="${CT_KERNEL_VERSION}"
-                ;;
-        esac
-        case "${CT_KERNEL_VERSION}" in
-            2.6.*)  rel_dir=v2.6;;
-            3.*)    rel_dir=v3.x;;
-        esac
-        korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
-        CT_GetFile "linux-${CT_KERNEL_VERSION}"         \
-                   "${korg_base}"                       \
-                   "${korg_base}/longterm/v${k_ver}"    \
-                   "${korg_base}/longterm"
     fi
 }