9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] change in boot(8): `prog' boot method.
@ 2003-05-16 11:23 Fco.J.Ballesteros
  0 siblings, 0 replies; only message in thread
From: Fco.J.Ballesteros @ 2003-05-16 11:23 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1375 bytes --]

This change adds a new boot method: prog. The prog method simply runs
the named program. I think this can help to clean up a bit the boot process,
because at least now the same kernel can boot both from fossil (using a
script to run fs(3), venti, and fossil), from kfs, and from other file server.


Besides, I'd suggest changing all of fs(3), venti, and fossil to allow
them to get their configuration from either a environment variable
(like timezone) or a block in one of the devices they are using.  This
would save some compilations of the kernel just to change the
configuration.  Besides, there'd be no need to keep different kernels
for different configurations.

I'll do this change as well when I get some more time (I'm playing
with sections in 9load to define sections that should become the
contents of environment variables).



diff -n /n/dump/2003/0505/sys/src/9/boot /sys/src/9/boot
diff -n /n/dump/2003/0505/sys/src/9/boot/boot.h /sys/src/9/boot/boot.h
/n/dump/2003/0505/sys/src/9/boot/boot.h:72 a /sys/src/9/boot/boot.h:73,75
> extern void	configprog(Method*);
> extern int	connectprog(void);
>
diff -n /n/dump/2003/0505/sys/src/9/boot/bootmkfile /sys/src/9/boot/bootmkfile
/n/dump/2003/0505/sys/src/9/boot/bootmkfile:14 a /sys/src/9/boot/bootmkfile:15
> 	prog.$O\
Only in /sys/src/9/boot: prog.c

prog.c is attached.

hth

[-- Attachment #2: prog.c --]
[-- Type: text/plain, Size: 430 bytes --]

#include <u.h>
#include <libc.h>
#include <../boot/boot.h>

static char *file;

void
configprog(Method *mp)
{
	if(bootdisk != nil)
		file = bootdisk;
	else
		file = "#//boot/boot.rc";
}

int
connectprog(void)
{
	char **arg, **argp;
	int	pid;

	if(stat(file, statbuf, sizeof statbuf) < 0)
		return -1;

	print("prog %s...\n", file);
	execl(file, "boot.rc", nil);
	fatal("can't exec prog");
	return -1;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-16 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-16 11:23 [9fans] change in boot(8): `prog' boot method Fco.J.Ballesteros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).