Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 1996 23:38:10 -0330 (NST)
From:      Adam Migus <amigus@cs.mun.ca>
To:        questions@freebsd.org
Subject:   Diskless FreeBSD
Message-ID:  <199603190308.XAA00862@maple.cs.mun.ca>

next in thread | raw e-mail | index | archive | help
Hi,
	I have been trying with some success to implement diskless freebsd over
the local campus network and have had to patch numerous files to get any
results here are the patches so far:

nfs_vfsops.c:

--- ./nfs/nfs_vfsops.c.orig	Sat Mar 16 23:12:36 1996
+++ ./nfs/nfs_vfsops.c	Sat Mar 16 23:13:00 1996
@@ -96,7 +96,13 @@
  * server for a diskless/dataless machine. It is initialized below just
  * to ensure that it is allocated to initialized data (.data not .bss).
  */
-struct nfs_diskless nfs_diskless = { 0 };
+
+#ifdef DISKLESS_CLIENT
+extern struct nfs_diskless nfs_diskless;
+#else
+struct nfs_diskless nfsdiskless = { 0 };
+#endif /* DISKLESS_CLIENT */
+
 int nfs_diskless_valid = 0;
 
 extern u_long nfs_procids[NFS_NPROCS];


vm_swap.c:

--- ./vm/vm_swap.c.orig	Sat Mar 16 23:12:36 1996
+++ ./vm/vm_swap.c	Sat Mar 16 23:13:00 1996
@@ -53,11 +53,17 @@
  * Indirect driver for multi-controller paging.
  */
 
+#ifndef DISKLESS_CLIENT
 #ifndef NSWAPDEV
 #define NSWAPDEV	4
-#endif
+#endif /* NSWAPDEV */
 static struct swdevt should_be_malloced[NSWAPDEV];
 struct swdevt *swdevt = should_be_malloced;
+#else
+#undef NSWAPDEV
+#define NSWAPDEV	1
+#endif /* DISKLESS_CLIENT */
+
 struct vnode *swapdev_vp;
 int nswap;			/* first block after the interleaved devs */
 int nswdev = NSWAPDEV;

swapkernel.c:

--- compile/DISKLESS/swapkernel.c.orig	Mon Mar 18 20:17:44 1996
+++ compile/DISKLESS/swapkernel.c	Mon Mar 18 23:32:46 1996
@@ -1,8 +1,57 @@
+#ifndef DISKLESS_CLIENT
+#define DISKLESS_CLIENT
+#endif /* DISKLESS_CLIENT */
+
+#ifndef NFS
+#define NFS
+#endif /* NFS */
+
+#ifndef KERNEL
+#define KERNEL
+#endif /* KERNEL */
+
+#ifndef NSWAPDEV
+#define NSWAPDEV 1
+#endif /* NSWAPDEV */
+
 #include <sys/param.h>
 #include <sys/conf.h>
+#include <sys/socket.h>
+#include <sys/mount.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <nfs/nfsv2.h>
+#include <nfs/nfsdiskless.h>
+
+extern int nfs_mountroot();
+int (*mountroot)() = nfs_mountroot;
+
+dev_t	rootdev = NODEV;
+dev_t	argdev  = NODEV;
+dev_t	dumpdev = NODEV;
+
+static struct swdevt swdevt_real[NSWAPDEV] = {
+	{ (dev_t)NODEV,    0,  20000 },
+};
+
+struct swdevt *swdevt = swdevt_real;
+
+/* this is not enough seems i need to fill the ifaliasreq structure */
+/* struct nfs_diskless nfs_diskless = { 0 }; */
+
+#define MYADDRESS 0x86,0x99,0x52,0x2 /* 134.153.82.2 */
+#define MYBROADCAST 0x86,0x99,0x52,0xff /* 134.153.82.255 */
+#define MYNETMASK 0xff,0xff,0xff,0x0 /* 255.255.255.0 */
 
-dev_t	rootdev = makedev(0, 0x00000000);		/* wd0a */
-dev_t	dumpdev = NODEV;			/* unconfigured */
+/* do enough ifconfiging to talk to the card */
+struct nfs_diskless nfs_diskless = {
+	{ { 'e', 'd', '0', '\0', },
+	{ 0x10, 0x2, { 0x0, 0x0, MYADDRESS }, },
+	{ 0x10, 0x2, { 0x0, 0x0, MYBROADCAST }, },
+	{ 0x10, 0x2, MYNETMASK, },
+ 	},
+};
 
 void
 setconf()

After all this i do have a kerenl that will boot, mount the root and swap
filesystems and run but reboots the machine without warning after the swap
file have filled to 69632 bytes everytime.  I have debugging enabled but
the kernel doesnt even panic it just reboots!
I guess i am asking is all this nessesary and if it isn't what to do and
if it is what I should and shouldn't do to cure this problem and avoid
anymore.

PS. if i do get this figured out and can deduce a sain way to organize this
i don't mind submitting any code for future releases.

Let me know, thanks

-- 
_______________________________________________
|      Adam Migus  amigus@cs.mun.ca           |
|      Computer Science, Memorial University  |
-----------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603190308.XAA00862>