mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-22 17:54:52 +00:00
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).
This commit is contained in:
parent
3a0b4f259c
commit
b711616825
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83507
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue