ref: c8cf0cee47914699e3e7c10a7b7501af94b53b4e
dir: /sys/src/9/boot/mkboot/
#!/bin/rc # # this file configures a boot program (/boot) for a kernel. # if(! ~ $#* 1){ echo usage: mkboot file >[1=2] exit 1 } cat <<'---' #include <u.h> #include <libc.h> #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