summaryrefslogtreecommitdiff
path: root/sys/src/9/xen/mkfile
blob: befd7aed903437ef54ab4f0808bc8f8109cb8392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
CONF=xenpcf
CONFLIST=xenpcf

objtype=386
</$objtype/mkfile
p=9

KTZERO=0x80010000
KZERO=0x80000000
KPZERO=0x10000
PAE=yes

DEVS=`{rc ../port/mkdevlist $CONF}

PORT=\
	alarm.$O\
	alloc.$O\
	allocb.$O\
	auth.$O\
	cache.$O\
	chan.$O\
	dev.$O\
	edf.$O\
	fault.$O\
	iomap.$O\
	page.$O\
	parse.$O\
	pgrp.$O\
	portclock.$O\
	print.$O\
	proc.$O\
	qio.$O\
	qlock.$O\
	rebootcmd.$O\
	segment.$O\
	sysfile.$O\
	sysproc.$O\
	taslock.$O\
	tod.$O\
	xalloc.$O\
	userinit.$O\

XEN=\
	xengrant.$O\
	xentimer.$O\
	xensystem.$O\

SCHED=`{ls -p xen-public/sched*.h >[2]/dev/null}
ARCH=`{test -d xen-public/arch-x86 && echo arch-x86/xen-x86_32.h arch-x86/xen.h || echo arch-x86_32.h }

XENHEADERS=\
	$ARCH\
	xen.h\
	event_channel.h\
	grant_table.h\
	memory.h\
	physdev.h\
	$SCHED\
	io/ring.h\
	io/blkif.h\
	io/console.h\
	io/netif.h\
	io/xenbus.h\
	io/xs_wire.h\

OBJ=\
	l.$O\
	plan9l.$O\
	xen.$O\
	main.$O\
	fpu.$O\
	mmu.$O\
	random.$O\
	rdb.$O\
	irq.$O\
	trap.$O\
	$CONF.root.$O\
	$CONF.rootc.$O\
	$DEVS\
	$PORT\
	$XEN\

LIB=\
	/$objtype/lib/libmemlayer.a\
	/$objtype/lib/libmemdraw.a\
	/$objtype/lib/libdraw.a\
	/$objtype/lib/libip.a\
	/$objtype/lib/libsec.a\
	/$objtype/lib/libmp.a\
	/$objtype/lib/libc.a\

ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}

PAE=`{echo $PAE | sed 's/yes/yes[extended-cr3]/'}
XENELF='LOADER=generic,XEN_VER=xen-3.0,ELF_PADDR_OFFSET=0,VIRT_BASE='$KZERO',VIRT_ENTRY='$KTZERO',PAE='$PAE

$p$CONF:D:	$p$CONF.elf xenelf.$cputype
	./xenelf.$cputype $prereq(1) $target __xen_guest ''$XENELF''
	size $target

$p$CONF.elf:D:	$OBJ $CONF.$O $LIB
	$LD -o $target -H5 -T$KTZERO -P$KPZERO -l $prereq

$p$CONF.gz: $p$CONF
	#strip -o /fd/1 $p$CONF | gzip -9 > $p$CONF.gz
	gzip -9 $p$CONF > $p$CONF.gz

install:V: $p$CONF $p$CONF.gz
	cp $p$CONF $p$CONF.gz /$objtype/
	# import lookout / /n/lookout && cp $p$CONF $p$CONF.gz /n/lookout/$objtype/

# copies generated by the rule below
PCHEADERS=uncached.h ethermii.h mp.h io.h

REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
^($REPCH)\.h:R:	'../pc/\1.h'
	cp $prereq .

REPCC=`{../port/mkfilelist ../pc}
^($REPCC)\.$O:R:	'../pc/\1.c'
	$CC $CFLAGS -I. -. ../pc/$stem1.c

<../boot/bootmkfile
<../port/portmkfile
<|../port/mkbootrules $CONF

# we inherited these.. revisit.
$ETHER: 	../port/etherif.h ../port/netif.h
$SDEV:	../port/sd.h
main.$O:		rebootcode.i
main.$O trap.$O:	/sys/include/tos.h

%.$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

xendefs.h: xendat.h
	grep '^#define[ 	]+FLAT_' xendat.h >$target

xendat.h:
	{ echo '#define __i386__ __i386__'; \
	  echo '#define __XEN_INTERFACE_VERSION__ 0x00030201'; \
	  echo '#define XEN_GUEST_HANDLE_00030205(type) type *'; \
	  cat xen-public/^($XENHEADERS) } | \
	./cppx > $target

initcode.out:		init9.$O initcode.$O /$objtype/lib/libc.a
	$LD -l -R1 -s -o $target $prereq

rebootcode.$O:	../pc/rebootcode.s mem.h
	$AS ../pc/rebootcode.s

rebootcode.out:		rebootcode.$O
	$LD -l -R4 -s -o $target -T0x1000 -H3 $prereq

acid:V:
	$CC -a -w main.c>acid

dpart: dpart.$O
	$LD -o dpart dpart.$O

xenstore: xenstore.$O
	$LD -o xenstore xenstore.$O

xenbin.$cputype xenelf.$cputype:	utilmkfile
	mk -f utilmkfile $target

%.clean:V:
	rm -f $stem.c [9bz]$stem [9bz]$stem.gz 9$stem.elf boot$stem.* xendat.h xendefs.h $PCHEADERS dpart xenbin.$cputype xenelf.$cputype xenstore