commit 20ea012a72b6ac29e98b85c0eded1e7d4c727a5b
parent 0e4ec991c4fdd064dc4f4bd211dffca99c98592b
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date: Wed, 29 Sep 2010 23:26:46 +0200
mkbootfs and bootfs.proto
Diffstat:
6 files changed, 106 insertions(+), 1 deletion(-)
diff --git a/.hgignore b/.hgignore
@@ -27,6 +27,8 @@ src/9vx/boot/*.[ch]
src/9vx/boot/*.orig
src/9vx/boot/libboot.a8
src/9vx/boot/bootcode.9
+src/9vx/boot/bootfs/*
+src/9vx/boot/rootfs.bz2
src/9vx/bootcode.S
src/9vx/9660srv.S
src/9vx/bzfs.S
diff --git a/bin/rcvx b/bin/rcvx
@@ -0,0 +1,13 @@
+#!/bin/sh
+# 9vxz: rc from the 9vx embeded image
+
+cmd="/386/bin/bind -a /386/bin /bin;
+ bind -a /rc/bin /bin;
+ cd '#Z"`pwd`"';
+ prompt=\$sysname'# ';
+ rc $*;
+ echo reboot > '#c/reboot'"
+# double quotes in cmd to pass it to rc -c
+cmd=`echo $cmd | sed "s;';'';g"`
+exec 9vx -g "init=/386/bin/rc -c '$cmd'
+ nobootprompt=local!/boot/rootfs.bz2"
diff --git a/src/9vx/boot/bootfs.proto b/src/9vx/boot/bootfs.proto
@@ -0,0 +1,40 @@
+$cputype
+ bin
+ 9660srv
+ awk
+ bind
+ bzfs
+ cat
+ dd
+ disk
+ fdisk
+ kfs
+ prep
+ dossrv
+ echo
+ fossil
+ fossil
+ grep
+ gunzip
+ hoc
+ ip
+ ipconfig
+ ls
+ mount
+ pwd
+ ramfs
+ rc
+ read
+ rm
+ sed
+ seq
+ srv
+ test
+ unmount
+ xd
+rc
+ lib
+ rcmain
+ bin
+ diskparts
+tmp
diff --git a/src/9vx/boot/mkbootfs b/src/9vx/boot/mkbootfs
@@ -0,0 +1,50 @@
+#!/bin/rc
+
+fn cmds {
+ if(! test -e /sys/lib/dist/bin/386/bzfs) {
+ @{
+ cd /sys/lib/dist/cmd
+ mk install
+ mk clean
+ }
+ }
+}
+
+fn bootraw {
+ proto=bootfs.proto
+ rm -rf bootfs
+ mkdir bootfs
+
+ # make files writable for now.
+ cat $proto | sed 's!d000!d775!;s!000!664!;s!555!775!;s!444!664!' > proto.cp
+ disk/mkfs -a proto.cp | disk/mkext -d bootfs
+ @{
+ cd bootfs/386/bin
+ strip * */* >[2]/dev/null || status=''
+ }
+ disk/mkfs -a -s bootfs proto.cp >boot.raw
+ rm proto.cp
+}
+
+fn bootbz2 {
+ /sys/lib/dist/bin/386/bflz -n 32 < boot.raw >boot.bflz
+ bzip2 -9 < boot.bflz >boot.bz2
+ rm boot.raw boot.bflz
+}
+
+fn rootbz2 {
+ {
+ echo bzfilesystem
+ cat boot.bz2
+ dd -if /dev/zero -bs 1024 -count 1 >[2]/dev/null
+ } >rootfs.bz2
+ ls -l rootfs.bz2
+ rm boot.bz2
+}
+
+cmds
+bind -a /sys/lib/dist/bin/386 /386/bin
+bootraw
+bootbz2
+rootbz2
+
diff --git a/src/9vx/main.c b/src/9vx/main.c
@@ -498,7 +498,7 @@ init0(void)
ksetenv("rootdir", "/root", 0);
ksetenv("service", "terminal", 0);
ksetenv("sysname", "vx32", 0);
- ksetenv("init", "/386/init -t", 0);
+// ksetenv("init", "/386/init -t", 0);
ksetenv("user", username, 0);
setinienv();
diff --git a/src/9vx/rootfs.bz2 b/src/9vx/rootfs.bz2
Binary files differ.