Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jul 1996 23:31:40 +0200
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        hackers@freebsd.org
Subject:   DEVFS
Message-ID:  <856.838243900@critter.tfs.com>
In-Reply-To: Your message of "Wed, 24 Jul 1996 14:22:40 PDT." <199607242122.OAA17286@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

Ok, I made the follwing changes, and now I can boot on devfs.  That
is, It screws up right after the adjkerntz because the vnode locking
seems to be hosed, but hey, we're getting further down the road.

I would love if somebody would help me get us to the point where
DEVFS can at least be a valid option for the adventurous, anybody
have a little time on their hands ?

This is to get init to mount DEVFS.  Keep a kernel without DEVFS
on your disk, in which case this is a no-op and your system still
works.

Index: init.c
===================================================================
RCS file: /home/ncvs/src/sbin/init/init.c,v
retrieving revision 1.11
diff -u -r1.11 init.c
--- init.c	1995/11/10 07:06:59	1.11
+++ init.c	1996/07/24 13:53:08
@@ -45,6 +45,7 @@
 #endif /* not lint */
 
 #include <sys/param.h>
+#include <sys/mount.h>
 #include <sys/sysctl.h>
 #include <sys/wait.h>
 
@@ -192,6 +193,9 @@
 		(void)fprintf(stderr, "init: already running\n");
 		exit (1);
 	}
+
+	/* Try to mount devfs */
+	mount(MOUNT_DEVFS, "/dev", MNT_NOEXEC|MNT_RDONLY, 0);
 
 	/*
 	 * Note that this does NOT open a file...

This is because the slice code doesn't register any devices with
DEVFS until they are opened.  This is pretty damn stupid in my
oppinion, because I have no way of opening something I dont have
a device-node for, do I ?

Index: wd.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/wd.c,v
retrieving revision 1.112
diff -u -r1.112 wd.c
--- wd.c	1996/07/23 21:51:46	1.112
+++ wd.c	1996/07/24 14:53:47
@@ -514,6 +514,24 @@
 			wd_registerdev(dvp->id_unit, lunit);
 #ifdef DEVFS
 			mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
+			du->dk_bdev = devfs_add_devswf(&wd_bdevsw, 0x50004,
+						       DV_BLK, UID_ROOT,
+						       GID_OPERATOR, 0640,
+						       "wd%ds4e", unit);
+			du->dk_bdev = devfs_add_devswf(&wd_cdevsw, 0x50004,
+						       DV_CHR, UID_ROOT,
+						       GID_OPERATOR, 0640,
+						       "rwd%ds4e", unit);
+
+			du->dk_bdev = devfs_add_devswf(&wd_bdevsw, 0,
+						       DV_BLK, UID_ROOT,
+						       GID_OPERATOR, 0640,
+						       "wd%da", unit);
+			du->dk_bdev = devfs_add_devswf(&wd_cdevsw, 0,
+						       DV_CHR, UID_ROOT,
+						       GID_OPERATOR, 0640,
+						       "rwd%da", unit);
+
 			du->dk_bdev = devfs_add_devswf(&wd_bdevsw, mynor,
 						       DV_BLK, UID_ROOT,
 						       GID_OPERATOR, 0640,

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



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