vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit d4734645afb4add72279296e598ce89656ee7eb0
parent df4f91cae483f2f3e04066c85e97636009428f52
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Sun,  5 Sep 2010 13:42:36 +0200

generate bootcode.9 running mk from src/9vx/boot

Diffstat:
.hgignore | 1+
src/9vx/boot/aux.c.ed | 3+++
src/9vx/boot/boot.c.ed | 14++++++++++++++
src/9vx/boot/bootip.c.ed | 1+
src/9vx/boot/local.c.ed | 31+++++++++++++++++++++++++++++++
src/9vx/boot/mkfile | 27+++++++++++++++++++++++++++
src/9vx/bootcode.9 | 0
7 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/.hgignore b/.hgignore @@ -26,6 +26,7 @@ src/vxlinux/vxlinux src/9vx/9vx src/9vx/boot/*.[ch] src/9vx/boot/*.orig +src/9vx/boot/bootcode.9 src/9vx/bootcode.S src/9vx/fossil.S src/9vx/venti.S diff --git a/src/9vx/boot/aux.c.ed b/src/9vx/boot/aux.c.ed @@ -0,0 +1,3 @@ +/exits/-1;/exits/c + exits(smprint("boot: %s: %s\n", s, buf)); +. diff --git a/src/9vx/boot/boot.c.ed b/src/9vx/boot/boot.c.ed @@ -0,0 +1,14 @@ +/^$/a +char* localroot; +. +/fd = \(\*mp->connect\)/a + if(localroot){ + bind(localroot, "/", MAFTER); + srvcreate("boot", fd); + goto Init; + } +. +/cmd = getenv/i +Init: + cpuflag = (strcmp(getenv("service"), "cpu") == 0); +. diff --git a/src/9vx/boot/bootip.c.ed b/src/9vx/boot/bootip.c.ed @@ -0,0 +1 @@ +,g/w->msg/s,[^ ],// &, diff --git a/src/9vx/boot/local.c.ed b/src/9vx/boot/local.c.ed @@ -0,0 +1,31 @@ +/fatal\("open \/net\/ipifc\/clone for loopback"\)/s,[^ ],// &, +a + return; +. +/^connectlocal\(void\)/-1i +int +connectlocalroot(void) +{ + int fd; + char buf[1024]; + + snprint(buf, sizeof buf, "%s/%s/bin/rc", disk, cputype); + if(stat(buf, statbuf, sizeof statbuf) < 0) + return -1; + localroot = disk; + + /* create working fd for /srv/boot */ + fd = open("#~/mntloop", ORDWR); + if(fd < 0){ + print("open #~/mntloop: %r\n"); + return -1; + } + write(fd, disk, strlen(disk)); + return fd; +} + +. +/fd = connectlocal/i + if((fd = connectlocalroot()) < 0) +. +/fd = connectlocalkfs/s,[^ ],// &, diff --git a/src/9vx/boot/mkfile b/src/9vx/boot/mkfile @@ -0,0 +1,27 @@ +SRC9=/sys/src/9 +BOOT=$SRC9/boot +CWD=`{pwd} + +EDFILES=`{ls *.ed} +SRCFILES=${EDFILES:%.ed=%} + +bootcode.9: files + cd $SRC9 ;\ + bind -bc $CWD $SRC9/boot; \ + cd pc; \ + mk bootpcf.out 'CONF=pcf' && \ + mv bootpcf.out $CWD/bootcode.9 + unmount $CWD $SRC9/boot + +files:V: $SRCFILES + +([^/]+)\.([ch]):R: \1.\2.ed \1.\2.orig + { cat $stem1.$stem2.ed; \ + echo w $stem1.$stem2; \ + } | ed - $stem1.$stem2.orig + +%.orig: $BOOT/% + cp $BOOT/$stem $stem.orig + +clean:V: + rm -f bootcode.9 *.[ch] *.orig diff --git a/src/9vx/bootcode.9 b/src/9vx/bootcode.9 Binary files differ.