Whamcloud - gitweb
Starting with 1.6.0 our kernel package will now actually be
[fs/lustre-release.git] / build / lbuild
index 3ac9cdf..988fbad 100755 (executable)
@@ -697,22 +697,53 @@ unpack_lustre
 if [ -z "$LINUX" ] ; then
     load_target
 
-    if (( $DO_SRC )) ; then
-        unpack_linux
-        if [ "$SERIES" ] ; then
+    if [ "$SERIES" ] ; then
+        if (( $DO_SRC )) ; then
+            unpack_linux
             patch_linux
             pack_linux
             clean_linux
+        fi
 
-            prep_kernel_build
-            clean_lustre
+        prep_kernel_build
+        clean_lustre
 
-            build_kernel
-        else
-            # can't build a kernel if we have no series for it (i.e. patchless)
+        build_kernel
+    else
+        # can't build a kernel if we have no series for it (i.e. patchless)
+        # but we still need the headers
+        use_unpacked_source=true
+        if $use_unpacked_source; then
+            unpack_linux
             LINUX=$(pwd)/linux
-            build_lustre
+            pushd $LINUX && {
+                # need a .config -- like a user would do
+                BOOTCONFIG="/boot/config-${lnxmaj}-${lnxrel}smp"
+                if [ -f $BOOTCONFIG ]; then
+                    cp $BOOTCONFIG .config
+                else
+                    fatal 1 "$BOOTCONFIG doesn't exist!  Help!"                
+                fi
+                # vendors like to taint the EXTRAVERSION in their kernel-source
+                # to differentiate a user-built kernel from their own
+                ed << EOF Makefile
+,s/^EXTRAVERSION =.*/EXTRAVERSION = -${lnxrel}smp/
+wq
+EOF
+                make oldconfig
+                make include/asm
+                make include/linux/version.h
+                make SUBDIRS=scripts
+            }
+            popd
+        else
+            LINUX=/lib/modules/${lnxmaj}-${lnxrel}smp/build
+            if [ ! -e $LINUX ]; then
+                fatal 1 "$LINUX does not exist!  Install a kernel-devel package!"
+            fi
         fi
+        CONFIGURE_FLAGS="$CONFIGURE_FLAGS --disable-server"
+        build_lustre
     fi
 else
     build_lustre