diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-06-16 17:35:07 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-06-16 17:35:07 +0200 |
commit | 5fa804d69fe1c1db6954217bca19637656e579b4 (patch) | |
tree | bd09c9bae06b7b997895a566e0584bb09e0a1219 | |
parent | 7cd1b102ee03d676b050319eaaefe73309b9b01c (diff) | |
download | plan9front-5fa804d69fe1c1db6954217bca19637656e579b4.tar.xz |
boot(8): simplify
-rw-r--r-- | sys/src/9/boot/boot.c | 1 | ||||
-rw-r--r-- | sys/src/9/boot/boot.h | 4 | ||||
-rw-r--r-- | sys/src/9/boot/bootrc | 25 | ||||
-rwxr-xr-x | sys/src/9/boot/mkboot | 27 |
4 files changed, 20 insertions, 37 deletions
diff --git a/sys/src/9/boot/boot.c b/sys/src/9/boot/boot.c index 5d876fa34..35cd482da 100644 --- a/sys/src/9/boot/boot.c +++ b/sys/src/9/boot/boot.c @@ -35,7 +35,6 @@ boot(int argc, char *argv[]) readfile("#e/cputype", cputype, sizeof(cputype)); setenv("bootdisk", bootdisk, 0); - setenv("cpuflag", cpuflag ? "1" : "0", 0); /* setup the boot namespace */ bind("/boot", "/bin", MAFTER); diff --git a/sys/src/9/boot/boot.h b/sys/src/9/boot/boot.h index 4e70a1f60..24273929e 100644 --- a/sys/src/9/boot/boot.h +++ b/sys/src/9/boot/boot.h @@ -3,13 +3,9 @@ enum { }; extern char* bootdisk; -extern char* rootdir; -extern int (*cfs)(int); -extern int cpuflag; extern void fatal(char*); extern int readfile(char*, char*, int); extern void run(char*, ...); extern void setenv(char*, char*, int); extern int writefile(char*, char*, int); -extern void boot(int, char **); diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc index 5fe86ee87..b064b8fd1 100644 --- a/sys/src/9/boot/bootrc +++ b/sys/src/9/boot/bootrc @@ -8,9 +8,9 @@ bind -q '#p' /proc for(i in S f k æ t) bind -a '#'^$i /dev >/dev/null >[2=1] -for(i in init sysname user nvram rootdir cfs bootdisk bootargs \ - nobootprompt debugfactotum \ - fs fsaddr auth authaddr){ +# make variables settable by copying them from #ec +for(i in init service sysname user nvram rootdir cfs bootdisk bootargs \ + nobootprompt debugfactotum fs fsaddr auth authaddr){ a=$$i $i=() rm -f '#e'/$i '#ec'/$i /env/$i @@ -75,7 +75,7 @@ fn main{ # authentication agent if(! test -f /srv/factotum){ x=(/boot/factotum -sfactotum) - if(~ $cpuflag 1){ + if(~ $service cpu){ x=($x -S) if(~ -k $ff) x=($x -k) @@ -118,7 +118,7 @@ fn main{ # compile init command if(~ $#init 0){ init=/$cputype/init - if(~ $cpuflag 1) + if(~ $service cpu) init=($init -c) if not init=($init -t) @@ -160,15 +160,24 @@ if(test -e '#u' && test -x /bin/usb/usbd){ # bind in an ip interface for(i in I l^(0 1 2 3)) bind -qa '#'$i /net - -configlocal # add partitions and binds +# add partitions and binds +configlocal # boot(8) command line arguments ff=() aa=() while(! ~ $#* 0){ if(~ $1 -*){ - if(! ~ $1 -u*){ + if(~ $1 -u*){ + if(~ $1 -u){ + user=$2 + shift + } + if not { + user=`{echo $1 | sed 's,^-u,,g'} + } + } + if not { if(~ $1 -*f*) ff=($ff -f) if(~ $1 -*k*) diff --git a/sys/src/9/boot/mkboot b/sys/src/9/boot/mkboot index 077a49d65..339a700a3 100755 --- a/sys/src/9/boot/mkboot +++ b/sys/src/9/boot/mkboot @@ -15,21 +15,14 @@ cat <<'---' --- awk ' - BEGIN { cpuflag = 0; bootprog = "boot"; bootdisk = "#S/sdC0/"; rootdir = "/root"; } + BEGIN { bootprog = "boot"; bootdisk = "/dev/sdC0/"; } $0 ~ "^boot" && $2=="cpu"\ - { cpuflag = 1 - if(NF == 4 && $3 == "boot") + { if(NF == 4 && $3 == "boot") bootdisk = $4 } - $0 ~ "^boot" && $2=="rootdir" && NF==3\ - { rootdir = $3 } - $0 ~ "^boot" && ($2=="bboot" || $2=="romboot" || $2=="dosboot")\ - { cpuflag = 1; bootprog = $2; } $0 ~ "^boot" && $2=="boot" && NF==3\ { bootdisk = $3 } - END { print "int cpuflag = " cpuflag ";" - print "char* rootdir = \"" rootdir "\";" - print "char* bootdisk = \"" bootdisk "\";" + END { print "char* bootdisk = \"" bootdisk "\";" print "extern void " bootprog "(int, char**);" print "void" print "main(int argc, char **argv)" @@ -38,17 +31,3 @@ awk ' print "}" } ' $1 - -# -# configure in a cache file system if a -# /386/bin/root appears in the bootdir section. -# -../port/mkextract bootdir 0 $* | awk ' - BEGIN { cfs = 0 } - $1 ~ "bin/cfs$" { cfs = 1 } - END { if(cfs) - print "int (*cfs)(int) = cache;" - else - print "int (*cfs)(int) = 0;" - } - ' |