|
|
1.1 ! root 1: #!/bin/rc ! 2: # ! 3: # this file configures a boot program (/boot) for a kernel. ! 4: # ! 5: if(! ~ $#* 1){ ! 6: echo usage: mkboot file >[1=2] ! 7: exit 1 ! 8: } ! 9: ! 10: cat <<'---' ! 11: #include <u.h> ! 12: #include <libc.h> ! 13: #include "../boot/boot.h" ! 14: ! 15: Method method[]={ ! 16: --- ! 17: ! 18: # ! 19: # configure all remote methods, i.e. all methods in the 'boot' section ! 20: # ! 21: # EXAMPLE ! 22: # boot ! 23: # incon ! 24: # 9600 ! 25: # 19200 ! 26: # ! 27: ../port/mkextract boot 0 $* | awk '{ ! 28: printf " { \"" "" $1 "\", "\ ! 29: "config" $1 ", "\ ! 30: "auth" $1 ", "\ ! 31: "connect" $1 ", " ! 32: print fieldn(2) " }," ! 33: } ! 34: ! 35: func fieldn(n, s,i) ! 36: { ! 37: s = $0 ! 38: while (n > 1) { ! 39: sub(/^[ \t]*/, "", s) ! 40: if (substr(s, 1, 1) == "\"") { ! 41: sub(/^"[^\"]*"/, "", s) ! 42: } else { ! 43: sub(/^[^ \t]*/, "", s) ! 44: } ! 45: n-- ! 46: } ! 47: sub(/^[ \t]*/, "", s) ! 48: if (substr(s, 1, 1) == "\"") { ! 49: i = index(substr(s, 2), "\"") ! 50: if (i > 0) ! 51: return substr(s, 1, i+1) ! 52: else ! 53: return s ! 54: } else { ! 55: sub(/[ \t].*/, "", s) ! 56: return s ! 57: } ! 58: }' ! 59: ! 60: cat <<'---' ! 61: { 0 }, ! 62: }; ! 63: --- ! 64: ! 65: awk ' ! 66: BEGIN { cpuflag = 0; bootprog = "boot"; bootdisk = "#w/sd0" } ! 67: $0 ~ "^boot" && $2=="cpu"\ ! 68: { cpuflag = 1 } ! 69: $0 ~ "^boot" && ($2=="bboot" || $2=="romboot" || $2=="dosboot")\ ! 70: { cpuflag = 1; bootprog = $2; } ! 71: $0 ~ "^boot" && NF==3\ ! 72: { bootdisk = $3 } ! 73: END { print "int cpuflag = " cpuflag ";" ! 74: if(cpuflag) ! 75: print "void (*pword)(int, Method*) = key;" ! 76: else ! 77: print "void (*pword)(int, Method*) = userpasswd;" ! 78: print "char* bootdisk = \"" bootdisk "\";" ! 79: print "extern void " bootprog "(int, char**);" ! 80: print "void" ! 81: print "main(int argc, char **argv)" ! 82: print "{" ! 83: print "\t" bootprog "(argc, argv);" ! 84: print "}" ! 85: } ! 86: ' $1 ! 87: ! 88: # ! 89: # configure in a cache file system if a 'cfs.root' appears in the ! 90: # 'misc' section ! 91: # ! 92: ../port/mkextract misc 0 $* | awk ' ! 93: BEGIN { cfs = 0 } ! 94: $1 == "cfs.root" { cfs = 1 } ! 95: END { if(cfs) ! 96: print "int (*cfs)(int) = cache;" ! 97: else ! 98: print "int (*cfs)(int) = 0;" ! 99: } ! 100: '
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.