vx32

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

commit 0bdabea5422f682ad0c1e90239fe1694e703a97c
parent f8c5ba9f4e23b3f842d8707786ab92c5c8dcff66
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Sat,  9 Oct 2010 22:16:09 +0200

optional compilation of boot files

Diffstat:
M.hgignore | 1+
Msrc/9vx/Makefrag | 34++++++++++++++++++++++++----------
Msrc/9vx/a/fns.h | 1+
Msrc/9vx/main.c | 46+---------------------------------------------
Asrc/9vx/mkbootinitc | 29+++++++++++++++++++++++++++++
5 files changed, 56 insertions(+), 55 deletions(-)

diff --git a/.hgignore b/.hgignore @@ -32,6 +32,7 @@ src/9vx/boot/rootfs.bz2 src/9vx/bootcode.S src/9vx/9660srv.S src/9vx/bzfs.S +src/9vx/bootinit.c src/9vx/fossil.S src/9vx/kfs.S src/9vx/rootfs.S diff --git a/src/9vx/Makefrag b/src/9vx/Makefrag @@ -22,6 +22,20 @@ PLAN9PCAP=nopcap PLAN9TAP=notap endif +# Boot files +# Do not remove: +# - bootcode, needed to boot +# - factotum, used by libauth +PLAN9BOOT=\ + 9660srv \ + bootcode \ + bzfs \ + factotum \ + fossil \ + kfs \ + rootfs \ + venti \ + # If you don't have/want X11 #PLAN9GUI=nogui @@ -51,11 +65,14 @@ $(BINDIR)/9vx: 9vx/9vx $(BINDIR)/%: ../bin/% $(INSTALL) $< $@ +9vx/bootinit.c: 9vx/mkbootinitc + 9vx/mkbootinitc $(PLAN9BOOT) >$@ + +PLAN9_BOOT_OBJS = $(patsubst %,9vx/%.o,$(PLAN9BOOT)) + PLAN9_OBJS = \ $(addprefix 9vx/, \ - 9660srv.o \ - bootcode.o \ - bzfs.o \ + bootinit.o \ conf.o \ devaudio.o \ devaudio-$(PLAN9AUDIO).o \ @@ -64,15 +81,11 @@ PLAN9_OBJS = \ devmouse.o \ devram.o \ devtab.o \ - factotum.o \ - fossil.o \ - kfs.o \ kprocdev.o \ label.o \ load.o \ main.o \ mmu.o \ - rootfs.o \ sched.o \ sdloop.o \ stub.o \ @@ -80,7 +93,6 @@ PLAN9_OBJS = \ time.o \ trap.o \ tty.o \ - venti.o \ vx32.o \ ) @@ -222,6 +234,7 @@ PLAN9_GUI_LIBS = $(PLAN9_$(PLAN9GUI)_LIBS) PLAN9_DEPS = \ $(PLAN9_OBJS) \ $(PLAN9_A_OBJS) \ + $(PLAN9_BOOT_OBJS) \ $(PLAN9_IP_OBJS) \ $(PLAN9_GUI_OBJS) \ 9vx/libsec/libsec.a \ @@ -252,7 +265,7 @@ PLAN9_DEPS = \ $(HOST_CC) -o $@ $< 9vx/9660srv.S: 9vx/data2s 9vx/9660srv.9 - ./9vx/data2s iso9660 < 9vx/9660srv.9 >$@_ && mv $@_ $@ + ./9vx/data2s _9660srv < 9vx/9660srv.9 >$@_ && mv $@_ $@ 9vx/bootcode.S: 9vx/data2s 9vx/bootcode.9 ./9vx/data2s boot < 9vx/bootcode.9 >$@_ && mv $@_ $@ @@ -306,9 +319,10 @@ CLEAN_FILES += \ 9vx/kerndate.h \ 9vx/a/errstr.h \ 9vx/9vx \ + 9vx/bootinit.c \ 9vx/data2s \ 9vx/9660srv.S \ - 9vx/bootcode.S \ + 9vx/boot.S \ 9vx/bzfs.S \ 9vx/factotum.S \ 9vx/fossil.S \ diff --git a/src/9vx/a/fns.h b/src/9vx/a/fns.h @@ -156,6 +156,7 @@ int xchgw(ushort*, int); #define dcflush(a, b) // Plan 9 VX additions +void bootinit(void); void gotolabel(Label*); int isuaddr(void*); void labelinit(Label *l, ulong pc, ulong sp); diff --git a/src/9vx/main.c b/src/9vx/main.c @@ -50,7 +50,7 @@ int abortonfault; int nocpuload; char* argv0; char* conffile = "9vx"; -char* defaultboot = "local!/boot/rootfs.bz2"; +char* defaultboot = "local!/boot/rootfs"; Conf conf; static Mach mach0; @@ -60,7 +60,6 @@ extern int tracekdev; extern int nuspace; static int singlethread; -static void bootinit(void); static void siginit(void); static void machkeyinit(void); @@ -290,49 +289,6 @@ confinit(void) conf.ialloc = 1<<20; } -static void -bootinit(void) -{ - /* - * libauth refuses to use anything but /boot/factotum - * to ask for keys, so we have to embed a factotum binary, - * even if we don't execute it to provide a file system. - * Also, maybe /boot/boot needs it. - * - * 9660srv, bzfs, factotum, fossil and venti are - * Plan9 386 executables. - * bootcode.9 is the file bootpcf.out obtained running - * mk in the ./boot/ directory from inside 9vx. - * - * TODO(yy): boot methods should be optional - */ - extern uchar iso9660code[]; - extern long iso9660len; - extern uchar bootcode[]; - extern long bootlen; - extern uchar bzfscode[]; - extern long bzfslen; - extern uchar factotumcode[]; - extern long factotumlen; - extern uchar fossilcode[]; - extern long fossillen; - extern uchar kfscode[]; - extern long kfslen; - extern uchar rootfscode[]; - extern long rootfslen; - extern uchar venticode[]; - extern long ventilen; - - addbootfile("9660srv", iso9660code, iso9660len); - addbootfile("boot", bootcode, bootlen); - addbootfile("bzfs", bzfscode, bzfslen); - addbootfile("factotum", factotumcode, factotumlen); - addbootfile("fossil", fossilcode, fossillen); - addbootfile("kfs", kfscode, kfslen); - addbootfile("rootfs.bz2", rootfscode, rootfslen); - addbootfile("venti", venticode, ventilen); -} - static uchar *sp; /* user stack of init proc */ static void init0(void); diff --git a/src/9vx/mkbootinitc b/src/9vx/mkbootinitc @@ -0,0 +1,29 @@ +#!/bin/sh + +echo '/* AUTOGENERATED BY mkbootinitc */ + +#include "u.h" +#include "lib.h" +#include "mem.h" +#include "dat.h" +#include "fns.h" + +void +bootinit(void) +{' + +echo $* | awk ' +{ + for(i = 1; i <= NF; i++){ + a[i] = ($i ~ "bootcode") ? "boot" : $i + b[i] = ($i ~ /^[0-9]/) ? "_"$i : a[i] + print " extern uchar "b[i]"code[];" + print " extern long "b[i]"len;" + } + print "" + for(i = 1; i <= NF; i++){ + print " addbootfile(\""a[i]"\", "b[i]"code, "b[i]"len);" + } +} +' +echo '}'