#!/bin/rc # # this file configures a boot program (/boot) for a kernel. # if(! ~ $#* 1){ echo usage: mkboot file >[1=2] exit 1 } cat <<'---' #include #include #include "../boot/boot.h" --- awk ' BEGIN { bootprog = "boot"; bootdisk = "/dev/sdC0/"; } $0 ~ "^boot" && $2=="cpu"\ { if(NF == 4 && $3 == "boot") bootdisk = $4 } $0 ~ "^boot" && $2=="boot" && NF==3\ { bootdisk = $3 } END { print "char* bootdisk = \"" bootdisk "\";" print "extern void " bootprog "(int, char**);" print "void" print "main(int argc, char **argv)" print "{" print "\t" bootprog "(argc, argv);" print "}" } ' $1