]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/xen/mkfile
bcm: flush out early boot messages on uart and screen initialization
[plan9front.git] / sys / src / 9 / xen / mkfile
1 CONF=xenpcf
2 CONFLIST=xenpcf
3
4 objtype=386
5 </$objtype/mkfile
6 p=9
7
8 KTZERO=0x80010000
9 KZERO=0x80000000
10 KPZERO=0x10000
11 PAE=yes
12
13 DEVS=`{rc ../port/mkdevlist $CONF}
14
15 PORT=\
16         alarm.$O\
17         alloc.$O\
18         allocb.$O\
19         auth.$O\
20         cache.$O\
21         chan.$O\
22         dev.$O\
23         edf.$O\
24         fault.$O\
25         page.$O\
26         parse.$O\
27         pgrp.$O\
28         portclock.$O\
29         print.$O\
30         proc.$O\
31         qio.$O\
32         qlock.$O\
33         rebootcmd.$O\
34         segment.$O\
35         sysfile.$O\
36         sysproc.$O\
37         taslock.$O\
38         tod.$O\
39         xalloc.$O\
40
41 XEN=\
42         xengrant.$O\
43         xentimer.$O\
44         xensystem.$O\
45
46 SCHED=`{ls -p xen-public/sched*.h >[2]/dev/null}
47 ARCH=`{test -d xen-public/arch-x86 && echo arch-x86/xen-x86_32.h arch-x86/xen.h || echo arch-x86_32.h }
48
49 XENHEADERS=\
50         $ARCH\
51         xen.h\
52         event_channel.h\
53         grant_table.h\
54         memory.h\
55         physdev.h\
56         $SCHED\
57         io/ring.h\
58         io/blkif.h\
59         io/console.h\
60         io/netif.h\
61         io/xenbus.h\
62         io/xs_wire.h\
63
64 OBJ=\
65         l.$O\
66         plan9l.$O\
67         xen.$O\
68         main.$O\
69         mmu.$O\
70         random.$O\
71         rdb.$O\
72         trap.$O\
73         $CONF.root.$O\
74         $CONF.rootc.$O\
75         $DEVS\
76         $PORT\
77         $XEN\
78
79 LIB=\
80         /$objtype/lib/libmemlayer.a\
81         /$objtype/lib/libmemdraw.a\
82         /$objtype/lib/libdraw.a\
83         /$objtype/lib/libip.a\
84         /$objtype/lib/libsec.a\
85         /$objtype/lib/libmp.a\
86         /$objtype/lib/libc.a\
87
88 ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
89 VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
90 SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
91
92 PAE=`{echo $PAE | sed 's/yes/yes[extended-cr3]/'}
93 XENELF='LOADER=generic,XEN_VER=xen-3.0,ELF_PADDR_OFFSET=0,VIRT_BASE='$KZERO',VIRT_ENTRY='$KTZERO',PAE='$PAE
94
95 #$p$CONF:       $CONF.c $OBJ $LIB xenbin.$cputype
96 #       $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
97 #       $LD -o $target.tmp -T$KTZERO -l $OBJ $CONF.$O $LIB
98 #       ./xenbin.$cputype <$target.tmp >$target
99 #       rm $target.tmp
100 #       size $target
101
102 $p$CONF:        $CONF.c $OBJ $LIB xenelf.$cputype
103         $CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
104         $LD -o $target.elf -H5 -T$KTZERO -P$KPZERO -l $OBJ $CONF.$O $LIB
105         ./xenelf.$cputype $target.elf $target __xen_guest ''$XENELF''
106         size $target
107
108 $p$CONF.gz: $p$CONF
109         #strip -o /fd/1 $p$CONF | gzip -9 > $p$CONF.gz
110         gzip -9 $p$CONF > $p$CONF.gz
111
112 install:V: $p$CONF $p$CONF.gz
113         cp $p$CONF $p$CONF.gz /$objtype/
114         # import lookout / /n/lookout && cp $p$CONF $p$CONF.gz /n/lookout/$objtype/
115
116 # copies generated by the rule below
117 PCHEADERS=uncached.h ethermii.h mp.h io.h
118
119 REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
120 ^($REPCH)\.h:R: '../pc/\1.h'
121         cp $prereq .
122
123 REPCC=`{../port/mkfilelist ../pc}
124 ^($REPCC)\.$O:R:        '../pc/\1.c'
125         $CC $CFLAGS -I. -. ../pc/$stem1.c
126
127 <../boot/bootmkfile
128 <../port/portmkfile
129 <|../port/mkbootrules $CONF
130
131 # we inherited these.. revisit.
132 $ETHER:         ../port/etherif.h ../port/netif.h
133 $SDEV:  ../port/sd.h
134 main.$O:        init.h reboot.h
135 trap.$O:        /sys/include/tos.h
136
137 %.$O:   /$objtype/include/u.h ../port/lib.h mem.h dat.h fns.h io.h ../port/error.h ../port/portdat.h ../port/portfns.h xendat.h xendefs.h
138
139 xendefs.h: xendat.h
140         grep '^#define[         ]+FLAT_' xendat.h >$target
141
142 xendat.h:
143         { echo '#define __i386__ __i386__'; \
144           echo '#define __XEN_INTERFACE_VERSION__ 0x00030201'; \
145           echo '#define XEN_GUEST_HANDLE_00030205(type) type *'; \
146           cat xen-public/^($XENHEADERS) } | \
147         ./cppx > $target
148
149 init.h: ../port/initcode.c ../pc/init9.c
150         $CC ../port/initcode.c
151         $CC ../pc/init9.c
152         $LD -l -R1 -o init.out init9.$O initcode.$O /386/lib/libc.a
153         {echo 'uchar initcode[]={'
154          strip -o /fd/1 init.out | xd -1x |
155                 sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
156          echo '};'} > init.h
157
158 reboot.h:       ../pc/rebootcode.s
159         $AS ../pc/rebootcode.s
160         $LD -l -s -T0x1000 -R4 -o reboot.out rebootcode.$O
161         {echo 'uchar rebootcode[]={'
162          xd -1x reboot.out |
163                 sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
164          echo '};'} > reboot.h
165
166 acid:V:
167         $CC -a -w main.c>acid
168
169 dpart: dpart.$O
170         $LD -o dpart dpart.$O
171
172 xenstore: xenstore.$O
173         $LD -o xenstore xenstore.$O
174
175 xenbin.$cputype xenelf.$cputype:        utilmkfile
176         mk -f utilmkfile $target
177
178 %.clean:V:
179         rm -f $stem.c [9bz]$stem [9bz]$stem.gz 9$stem.elf boot$stem.* reboot.h init.h xendat.h xendefs.h $PCHEADERS dpart xenbin.$cputype xenelf.$cputype xenstore
180
181