xref: /plan9/sys/src/9/pc/mkfile (revision 225077b0bf393489f69f6689df234a9b945497b7)
1CONF=pc
2CONFLIST=pc pccpu pcf pccpuf pcdisk pcauth
3CRAPLIST=pccd pcflop
4EXTRACOPIES=
5#EXTRACOPIES=lookout boundary	# copy to these servers on install
6
7objtype=386
8</$objtype/mkfile
9p=9
10
11# must match mem.h
12
13APBOOTSTRAP=0xF0003000
14KTZERO=0xF0100020
15
16DEVS=`{rc ../port/mkdevlist $CONF}
17
18PORT=\
19	alarm.$O\
20	alloc.$O\
21	allocb.$O\
22	auth.$O\
23	cache.$O\
24	chan.$O\
25	dev.$O\
26	edf.$O\
27	fault.$O\
28	latin1.$O\
29	page.$O\
30	parse.$O\
31	pgrp.$O\
32	portclock.$O\
33	print.$O\
34	proc.$O\
35	qio.$O\
36	qlock.$O\
37	rdb.$O\
38	rebootcmd.$O\
39	segment.$O\
40	swap.$O\
41	sysfile.$O\
42	sysproc.$O\
43	taslock.$O\
44	tod.$O\
45	xalloc.$O\
46
47OBJ=\
48	l.$O\
49	plan9l.$O\
50	cga.$O\
51	i8253.$O\
52	i8259.$O\
53	kbd.$O\
54	main.$O\
55	memory.$O\
56	mmu.$O\
57	random.$O\
58	trap.$O\
59	$CONF.root.$O\
60	$CONF.rootc.$O\
61	$DEVS\
62	$PORT\
63
64LIB=\
65	/$objtype/lib/libmemlayer.a\
66	/$objtype/lib/libmemdraw.a\
67	/$objtype/lib/libdraw.a\
68	/$objtype/lib/libc.a\
69	/$objtype/lib/libsec.a\
70
71ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
72VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
73SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}
74
75$p$CONF:	$CONF.c $OBJ $LIB
76	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
77	$LD -o $target -T$KTZERO -l $OBJ $CONF.$O $LIB
78	size $target
79
80# don't strip the gzipped kernels -- too frustrating when that's all you have!
81$p%.gz:	$p%
82	gzip -9 <$p$stem >$p$stem.gz
83
84
85# pcflop and pccd need all the space they can get
869pcflop.gz: 9pcflop
87	strip -o /fd/1 9pcflop | gzip -9 >9pcflop.gz
88
899pccd.gz: 9pccd
90	strip -o /fd/1 9pccd | gzip -9 >9pccd.gz
91
92
93install:V:	$p$CONF $p$CONF.gz
94	cp $p$CONF $p$CONF.gz /$objtype/
95	for(i in $EXTRACOPIES)
96		import $i / /n/$i && cp $p$CONF $p$CONF.gz /n/$i/$objtype/
97
98<../boot/bootmkfile
99<../port/portmkfile
100<|../port/mkbootrules $CONF
101
102$ETHER: 			etherif.h ../port/netif.h
103ether8003.$O ether8390.$O:	ether8390.h
104$VGA mouse.$O:			screen.h
105devfloppy.$O: 			floppy.h
106archmp.$O mp.$O:		apbootstrap.h
107apic.$O archmp.$O mp.$O:	mp.h
108$SDEV:				../port/sd.h
109sd53c8xx.$O:			sd53c8xx.i
110sdiahci.$O:			ahci.h
111main.$O:			init.h reboot.h
112wavelan.$O:			wavelan.c ../pc/wavelan.c ../pc/wavelan.h
113etherwavelan.$O:		etherwavelan.c ../pc/wavelan.h
114devusb.$O usbuhci.$O usbohci.$O: usb.h
115trap.$O:			/sys/include/tos.h
116uartaxp.$O:			uartaxp.i
117
118init.h:		../port/initcode.c init9.c
119	$CC ../port/initcode.c
120	$CC init9.c
121	$LD -l -R1 -o init.out init9.$O initcode.$O /386/lib/libc.a
122	strip init.out
123	{echo 'uchar initcode[]={'
124	 cat init.out | xd -1x |
125		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
126	 echo '};'} > init.h
127
128reboot.h:	rebootcode.s
129	$AS rebootcode.s
130	$LD -l -s -T0x11000 -R4 -o reboot.out rebootcode.$O
131	{echo 'uchar rebootcode[]={'
132	 xd -1x reboot.out |
133		sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
134	 echo '};'} > reboot.h
135
136apbootstrap.h:	apbootstrap.s mem.h
137	$AS $prereq
138	$LD -o apbootstrap.out -T$APBOOTSTRAP -R4 -l -s apbootstrap.$O
139	{echo 'uchar apbootstrap[]={'
140	 xd -1x apbootstrap.out |
141		sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
142	 echo '};'} > $target
143
144sd53c8xx.i:	sd53c8xx.n
145	aux/na $prereq > $target
146
147uartaxp.i:	a100p.cp
148	{echo 'static uchar uartaxpcp[] = {'
149	 xd -1x $prereq |
150		sed -e 's/^[0-9a-f]+ //' -e '/^$/d' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
151	 echo '};'
152	} > $target
153
154acid:V:
155	8c -a -w -I. i8253.c>acid
156
157%.checkether:VQ:
158	for (i in ether*.c){
159		x=`{echo $i | sed 's/\.c//'}
160		if(! ~ $x ether8390 && ! grep -s '^	'^$x^'([ 	]|$)' $stem)
161			echo $x not included in $stem
162	}
163	exit 0
164
165%.checkvga:VQ:
166	for (i in vga*.c){
167		x=`{echo $i | sed 's/\.c//'}
168		if(! ~ $x vga vgax vgasavage && ! grep -s '^	'^$x^'([ 	]|$)' $stem)
169			echo $x not included in $stem
170	}
171	exit 0
172
173checkdist:VQ:
174	for(i in pcdisk pcflop)
175	for(j in checkvga checkether)
176		mk $i.$j
177
178%.clean:V:
179	rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* reboot.h apbootstrap.h init.h
180
181# testing
1829load:D: /usr/rsc/boot/$O.load 9pcload
183	cat $prereq >$target
184
1859load.flp: 9load
186	disk/format -b /386/pbs -df $target $prereq
187
188$p$CONF.flp: /386/9load plan9.ini $p$CONF.gz
189	disk/format -b /386/pbs -df $target $prereq
190
191
192