From e9608dbc9a5d0953faced3fe517a2559d362ed5b Mon Sep 17 00:00:00 2001
From: jacob <jacob>
Date: Sun, 19 Dec 2004 23:13:13 +0000
Subject: [PATCH] Move README.kernel-source to lustre-build

---
 build/README.kernel-source           | 74 ++++++++++++++++++++++++++++
 build/autoconf/lustre-build-linux.m4 | 10 ++--
 2 files changed, 79 insertions(+), 5 deletions(-)
 create mode 100644 build/README.kernel-source

diff --git a/build/README.kernel-source b/build/README.kernel-source
new file mode 100644
index 0000000000..0b88efe1a1
--- /dev/null
+++ b/build/README.kernel-source
@@ -0,0 +1,74 @@
+Lustre can currently build against Red Hat 2.4-style kernel-source
+RPMs.  All other kernel-source RPMs are *unsupported* at this time.
+
+Note that a Lustre-patched kernel is required for building Lustre; in
+most cases a kernel-source RPM from your Linux vendor will not contain
+the necessary patches.
+
+1.  kernel.h
+
+Building against a kernel-source RPM requires a special header.  On
+Red Hat systems, this file should be automatically created at boot
+time, and saved in /boot/kernel.h.
+
+ *** If you are not running Red Hat Linux, or are not booted into the
+ *** kernel you are trying to build against, you need to create this
+ *** file manually.
+
+ *** If you do not, the Lustre build may fail, or may fail to build
+ *** modules that work with your kernel.
+
+Here is an example /boot/kernel.h file.  If you are building on
+x86_64, the first defines should be __MODULE_KERNEL_x86_64, etc.  The
+other defines should be simple to figure out.
+
+/* This file is automatically generated at boot time. */
+#ifndef __BOOT_KERNEL_H_
+#define __BOOT_KERNEL_H_
+
+/* Kernel type i686-smp */
+
+#ifndef __MODULE_KERNEL_i686
+#define __MODULE_KERNEL_i686 1
+#endif
+
+#ifndef __BOOT_KERNEL_ENTERPRISE
+#define __BOOT_KERNEL_ENTERPRISE 0
+#endif
+
+#ifndef __BOOT_KERNEL_BIGMEM
+#define __BOOT_KERNEL_BIGMEM 0
+#endif
+
+#ifndef __BOOT_KERNEL_HUGEMEM
+#define __BOOT_KERNEL_HUGEMEM 0
+#endif
+
+#ifndef __BOOT_KERNEL_SMP
+#define __BOOT_KERNEL_SMP 1
+#endif
+
+#ifndef __BOOT_KERNEL_UP
+#define __BOOT_KERNEL_UP 0
+#endif
+
+#endif
+
+You should save this somewhere, and pass the location of this file to
+./configure using the --with-kernel-source-header option.
+
+2.  .config
+
+You will also need to tell Lustre about the .config file for your
+kernel.  The two likely locations of this file are
+/boot/config-$(uname -r), and /usr/src/linux-2.4/configs/.  You should
+pass the location of this file to Lustre using the --with-linux-config
+option.
+
+3.  An Example
+
+Here is an example for configuring Lustre:
+
+./configure --with-linux=/usr/src/linux-2.4.20-28.9_lustre.1.0.3 \
+--with-kernel-source-header=/boot/kernel.h \
+--with-linux-config=/boot/config-2.4.20-28.9_lustre.1.0.3smp
diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4
index 93201398a4..3aa2603f73 100644
--- a/build/autoconf/lustre-build-linux.m4
+++ b/build/autoconf/lustre-build-linux.m4
@@ -129,12 +129,12 @@ AC_CHECK_FILE([/boot/kernel.h],
 
 AC_ARG_WITH([kernel-source-header],
 	AC_HELP_STRING([--with-kernel-source-header=path],
-			[Use a different kernel version header.  Consult README.kernel-source for details.]),
+			[Use a different kernel version header.  Consult build/README.kernel-source for details.]),
 	[KERNEL_SOURCE_HEADER=$with_kernel_source_header])
 
 # ------------ .config exists ----------------
 AC_CHECK_FILE([$LINUX_CONFIG],[],
-	[AC_MSG_ERROR([Kernel config could not be found.  If you are building from a kernel-source rpm consult README.kernel-source])])
+	[AC_MSG_ERROR([Kernel config could not be found.  If you are building from a kernel-source rpm consult build/README.kernel-source])])
 
 # ----------- make dep run? ------------------
 AC_CHECK_FILES([$LINUX_OBJ/include/linux/autoconf.h
@@ -157,9 +157,9 @@ if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
 		[if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
 			AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
 			AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
-			AC_MSG_WARN([Consult README.kernel-source for details.])
+			AC_MSG_WARN([Consult build/README.kernel-source for details.])
 		fi],
-		[AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found.  Consult README.kernel-source for details.])])
+		[AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found.  Consult build/README.kernel-source for details.])])
 	EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
 fi
 
@@ -173,7 +173,7 @@ LB_LINUX_TRY_COMPILE([],[],[
 ],[
 	AC_MSG_RESULT([no])
 	AC_MSG_WARN([Consult config.log for details.])
-	AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
+	AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult build/README.kernel-source])
 	AC_MSG_ERROR([Kernel modules could not be built.])
 ])
 
-- 
GitLab