diff options
author | peter <peter@FreeBSD.org> | 2001-09-15 11:15:22 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-09-15 11:15:22 +0000 |
commit | 3a353f88b012a3f07611ed902a705cb21f717a8b (patch) | |
tree | d67a6071be1f58b9ee60d00f902b2c18df061cfc /sys | |
parent | 01ee11f4089db73bd35056711623d696d285dc94 (diff) | |
download | FreeBSD-src-3a353f88b012a3f07611ed902a705cb21f717a8b.zip FreeBSD-src-3a353f88b012a3f07611ed902a705cb21f717a8b.tar.gz |
In the devfs case, have initproc attempt the easy cases of mounting /dev.
This works if /dev exists, or if / is read/write (nfsroot). If it is
too hard, leave it up to init -d (which will probably fail if /dev does
not exist, but there isn't much else we can do short of making a union
mount on /).
This means we get a proper /dev if you boot a 5.x kernel on a 4.x world,
which I happen to do often (the ramdisks on our install netboot servers
have 4.x userland worlds on them).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/init_main.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 62d1655..2d2a9e7 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -475,6 +475,7 @@ start_init(void *dummy) char *ucp, **uap, *arg0, *arg1; struct thread *td; struct proc *p; + int init_does_devfs = 0; mtx_lock(&Giant); @@ -492,6 +493,21 @@ start_init(void *dummy) VREF(p->p_fd->fd_rdir); VOP_UNLOCK(rootvnode, 0, td); + if (devfs_present) { + /* + * For disk based systems, we probably cannot do this yet + * since the fs will be read-only. But a NFS root + * might be ok. It is worth a shot. + */ + error = vn_mkdir("/dev", 0700, UIO_SYSSPACE, td); + if (error == EEXIST) + error = 0; + if (error == 0) + error = vfs_mount(td, "devfs", "/dev", 0, 0); + if (error != 0) + init_does_devfs = 1; + } + /* * Need just enough stack to hold the faked-up "execve()" arguments. */ @@ -541,7 +557,7 @@ start_init(void *dummy) (void)subyte(--ucp, 'C'); options = 1; #endif - if (devfs_present) { + if (init_does_devfs) { (void)subyte(--ucp, 'd'); options = 1; } |