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

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


## diffname boot/paq.c 2002/0412
## diff -e /dev/null /n/emeliedump/2002/0412/sys/src/9/boot/paq.c
0a
#include <u.h>
#include <libc.h>
#include <../boot/boot.h>

char *fparts[] =
{
	"add bootldr	0x0000000 0x0040000",
	"add params	0x0040000 0x0080000",
	"add kernel	0x0080000 0x0140000",
	"add user	0x0140000 0x0200000",
	"add ramdisk	0x0200000 0x0800000",
};

void
configpaq(Method*)
{
	int fd;
	int i;

	if(bind("#F", "/dev", MAFTER) < 0)
		fatal("bind #c");
	if(bind("#p", "/proc", MREPL) < 0)
		fatal("bind #p");
	fd = open("/dev/flash/flashctl", OWRITE);
	if(fd < 0)
		fatal("opening flashctl");
	for(i = 0; i < nelem(fparts); i++)
		if(fprint(fd, fparts[i]) < 0)
			fatal(fparts[i]);
	close(fd);
}

int
connectpaq(void)
{
	int  p[2];
	char **arg, **argp;

	print("paq...");
	if(pipe(p)<0)
		fatal("pipe");
	switch(fork()){
	case -1:
		fatal("fork");
	case 0:
		arg = malloc(10*sizeof(char*));
		argp = arg;
		*argp++ = "paqfs";
		*argp++ = "-v";
		*argp++ = "-i";
		*argp++ = "/dev/flash/ramdisk";
		*argp = 0;

		dup(p[0], 0);
		dup(p[1], 1);
		close(p[0]);
		close(p[1]);
		exec("/paqfs", arg);
		fatal("can't exec paqfs");
	default:
		break;
	}
	waitpid();

	close(p[1]);
	return p[0];
}
.
## diffname boot/paq.c 2002/1130
## diff -e /n/emeliedump/2002/0412/sys/src/9/boot/paq.c /n/emeliedump/2002/1130/sys/src/9/boot/paq.c
58c
		exec("/boot/paqfs", arg);
.
## diffname boot/paq.c 2003/0508
## diff -e /n/emeliedump/2002/1130/sys/src/9/boot/paq.c /n/emeliedump/2003/0508/sys/src/9/boot/paq.c
11c
	"add ramdisk	0x0200000 0x0c00000",
.

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].