9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] fdisk/prep in bootdir.
@ 2003-11-09 17:28 ron minnich
  0 siblings, 0 replies; only message in thread
From: ron minnich @ 2003-11-09 17:28 UTC (permalink / raw)
  To: 9fans


Here's the trivial C program if you don't like /bin/rc in bootdir, but
don't mind fdisk and prep in there. Yeah yeah yeah doesn't use argv etc.,
it is just a fooling around thing. I think if we're really going to worry
about kernel boot image size, a lot more has to change than not putting rc
into bootdir.

This is working fine on my little EPIA nodes with CF.


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

/* get the disks set up */
/* later, we'll walk nvrtab and do all the nvr devices */
void
main(int argc, char *argv[])
{
        Waitmsg *kid;
        char errbuf[128];
        int fd;
        fd = open("/dev/sdC0/ctl", OWRITE);
        if (fd < 0) {
                errstr(errbuf, sizeof(errbuf));
                exits(errbuf);
	}

        if (fork() == 0) {
                dup(fd, 1);
                execl("/bin/disk/fdisk", "fdisk", "-p", "/dev/sdC0/data",
					0);
        }

        /* wait for that one to return */
        kid = wait();
        if (strlen(kid->msg)) {
                exits(kid->msg);
        }

        if (fork() == 0) {
                dup(fd, 1);
                execl("/bin/disk/prep", "prep", "-p", "/dev/sdC0/plan9",
				0);
        }
}



ron



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

only message in thread, other threads:[~2003-11-09 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-09 17:28 [9fans] fdisk/prep in bootdir ron minnich

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