Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/boot/dosboot.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname boot/dosboot.c 1992/0828
## diff -e /dev/null /n/bootesdump/1992/0828/sys/src/9/boot/dosboot.c
0a
#include <u.h>
#include <libc.h>
#include "../boot/boot.h"

int	printcol;

static void	dossrv(void);
static void	swapproc(void);

void
dosboot(void)
{
	int fd;

	open("#c/cons", OREAD);
	open("#c/cons", OWRITE);
	open("#c/cons", OWRITE);

	/*
	 *  start to dos file system server
	 */
	dossrv();
	sleep(1000);
	fd = open("#s/boot", ORDWR);
	if(fd < 0)
		fatal("open #s/boot");

	/*
	 *  pick a floppy and mount it as root
	 */
	if(bind("/", "/", MREPL) < 0)
		fatal("bind");
	if(mount(fd, "/", MAFTER|MCREATE, "#f/fd0disk", "") < 0)
		if(mount(fd, "/", MAFTER|MCREATE, "#f/fd1disk", "") < 0)
			if(mount(fd, "/", MAFTER|MCREATE, "#w/hd0dos", "") < 0)
				fatal("mount");
	close(fd);

	settime(1);
	swapproc();

	execl("/386/init", "init", "-mt", 0);
	fatal("/386/init");
}

static void
dossrv(void)
{
	print("dossrv...");
	if(bind("#c", "/dev", MREPL) < 0)
		fatal("bind #c");
	if(bind("#p", "/proc", MREPL) < 0)
		fatal("bind #p");
	switch(fork()){
	case -1:
		fatal("fork");
	case 0:
		execl("/cfs", "cfs", "boot", 0);
		fatal("can't exec cfs");
	default:
		break;
	}
}

static void
swapproc(void)
{
	int fd;

	fd = open("#c/swap", OWRITE);
	if(fd < 0){
		warning("opening #c/swap");
		return;
	}
	if(write(fd, "start", 5) <= 0)
		warning("starting swap kproc");
}
.
## diffname boot/dosboot.c 1993/0115
## diff -e /n/bootesdump/1992/0828/sys/src/9/boot/dosboot.c /n/bootesdump/1993/0115/sys/src/9/boot/dosboot.c
35c
			if(mount(fd, "/", MAFTER|MCREATE, "#H/hd0dos", "") < 0)
.
## diffname boot/dosboot.c 1993/0330
## diff -e /n/bootesdump/1993/0115/sys/src/9/boot/dosboot.c /n/bootesdump/1993/0330/sys/src/9/boot/dosboot.c
33,35c
	if(mount(fd, "/", MAFTER|MCREATE, "#f/fd0disk") < 0)
		if(mount(fd, "/", MAFTER|MCREATE, "#f/fd1disk") < 0)
			if(mount(fd, "/", MAFTER|MCREATE, "#H/hd0dos") < 0)
.
## diffname boot/dosboot.c 1997/0812
## diff -e /n/bootesdump/1993/0330/sys/src/9/boot/dosboot.c /n/emeliedump/1997/0812/sys/src/brazil/boot/dosboot.c
36c
				fatal("mount /");
.
32c
		fatal("bind /");
.
## diffname boot/dosboot.c 2000/0518
## diff -e /n/emeliedump/1997/0812/sys/src/brazil/boot/dosboot.c /n/emeliedump/2000/0518/sys/src/9/boot/dosboot.c
35c
			if(mount(fd, "/", MAFTER|MCREATE, "#S/sdC0/dos") < 0)
.
## diffname boot/dosboot.c 2001/0819
## diff -e /n/emeliedump/2000/0518/sys/src/9/boot/dosboot.c /n/emeliedump/2001/0819/sys/src/9/boot/dosboot.c
39c
	settime(1, -1);
.
33,35c
	if(mount(fd, -1, "/", MAFTER|MCREATE, "#f/fd0disk") < 0)
		if(mount(fd, -1, "/", MAFTER|MCREATE, "#f/fd1disk") < 0)
			if(mount(fd, -1, "/", MAFTER|MCREATE, "#S/sdC0/dos") < 0)
.
## diffname boot/dosboot.c 2001/1215 # deleted
## diff -e /n/emeliedump/2001/0819/sys/src/9/boot/dosboot.c /n/emeliedump/2001/1215/sys/src/9/boot/dosboot.c
1,77d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].