Whamcloud - gitweb
* fix a tyop
[fs/lustre-release.git] / build / lbuild
index daeaa20..68930e6 100755 (executable)
@@ -301,8 +301,6 @@ load_target()
     . "$TARGET_FILE"
 
     [ "$KERNEL"  ] || fatal 1 "Target $TARGET did not specify a kernel."
-#    [ "$SERIES"  ] || fatal 1 "Target $TARGET did not specify a kernel patch series."
-#    [ "$CONFIG"  ] || fatal 1 "Target $TARGET did not specify a kernel config."
     [ "$VERSION" ] || fatal 1 "Target $TARGET did not specify a kernel version."
 
     if [ "$KERNELDIR" ] ; then
@@ -572,7 +570,8 @@ build_lustre()
     ./configure "--with-linux=${LINUX}" ${CONFIGURE_FLAGS}
 
     $RPMBUILD $targets -bb build/lustre.spec \
-        --define "_topdir $TOPDIR" || \
+        --define "_topdir $TOPDIR" \
+        --define "configure_flags --with-linux=${LINUX}" || \
         fatal 1 "Error building rpms for $BUILD_ARCHS."
 
     popd >/dev/null
@@ -699,17 +698,39 @@ unpack_lustre
 if [ -z "$LINUX" ] ; then
     load_target
 
-    if (( $DO_SRC )) ; then
-        unpack_linux
-        patch_linux
-        pack_linux
-        clean_linux
-    fi
+    if [ "$SERIES" ] ; then
+        if (( $DO_SRC )) ; then
+            unpack_linux
+            patch_linux
+            pack_linux
+            clean_linux
 
-    prep_kernel_build
-    clean_lustre
+            prep_kernel_build
+            clean_lustre
 
-    build_kernel
+            build_kernel
+        fi
+    else
+        # can't build a kernel if we have no series for it (i.e. patchless)
+        # but we still need the headers
+        unpack_linux
+        LINUX=$(pwd)/linux
+        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
+            make oldconfig
+            make include/asm
+            make include/linux/version.h
+            make SUBDIRS=scripts
+        }
+        popd
+        build_lustre
+    fi
 else
     build_lustre
 fi