]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/boot/mkboot
kernel: apply uintptr for ulong when a pointer is stored
[plan9front.git] / sys / src / 9 / boot / mkboot
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 ---
16
17 awk '
18         BEGIN   { bootprog = "boot"; bootdisk = "/dev/sdC0/"; }
19         $0 ~ "^boot" && $2=="cpu"\
20                 { if(NF == 4 && $3 == "boot")
21                         bootdisk = $4
22                 }
23         $0 ~ "^boot" && $2=="boot" && NF==3\
24                 { bootdisk = $3 }
25         END     { print "char* bootdisk = \"" bootdisk "\";"
26                   print "extern void " bootprog "(int, char**);"
27                   print "void"
28                   print "main(int argc, char **argv)"
29                   print "{"
30                   print "\t" bootprog "(argc, argv);"
31                   print "}"
32                 }
33 ' $1