xref: /plan9-contrib/sys/src/9/pcboot/bootmkfile (revision 272efad760864ee41cfe633b56aea9b4f5cf3ae7)
1# make 9boot(pbs) and 9load(usb)
2# inherit KTZERO, START, CONF, BASE and SFX from mkfile
3x=`{bindpc $BASE $SFX}
4CONFLIST=$CONF
5EXTRACOPIES=piestand lookout bovril boundary
6
7objtype=386
8</$objtype/mkfile
9p=9
10
11DEVS=`{rc ../port/mkdevlist $CONF}
12
13PORT=\
14	alarm.$O\
15	alloc.$O\
16	allocb.$O\
17	auth.$O\
18	chan.$O\
19	dev.$O\
20	edf.$O\
21	latin1.$O\
22	logpow.$O\
23	page.$O\
24	parse.$O\
25	pgrp.$O\
26	portclock.$O\
27	print.$O\
28	proc.$O\
29	qio.$O\
30	qlock.$O\
31	rdb.$O\
32	rebootcmd.$O\
33	segment.$O\
34	taslock.$O\
35	tod.$O\
36	watermarks.$O\
37	xalloc.$O\
38
39OBJ=\
40	ktzero.$O\
41	$START\
42	l32p.$O\
43	l32v.$O\
44	l64p.$O\
45	realmode0.$O\
46	l.$O\
47	cga.$O\
48	fault.$O\
49	i8253.$O\
50	i8259.$O\
51	kbd.$O\
52	main.$O\
53	memory.$O\
54	mmu.$O\
55	multiboot.$O\
56	trap.$O\
57	warp64.$O\
58	$CONF.root.$O\
59	$CONF.rootc.$O\
60	$DEVS\
61	$PORT\
62
63LIB=\
64	/$objtype/lib/libflate.a\
65	/$objtype/lib/libip.a\
66	/$objtype/lib/libc.a\
67
68ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
69
70$p$CONF:Q:	$CONF.c $OBJ $LIB
71	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
72	echo linking $p$CONF^'*'
73	$LD -o $target -H3 -T$KTZERO -l $OBJ $CONF.$O $LIB	# dos .com
74	$LD -o $target^debug -T$KTZERO -l $OBJ $CONF.$O $LIB
75#	$LD -o $target.elf -H5 -R4096 -T$KTZERO -l $OBJ $CONF.$O $LIB
76	size $target^debug
77
78# don't strip the gzipped kernels -- too frustrating when that's all you have!
79$p%.gz:D:	$p%
80	gzip -9 <$p$stem >$p$stem.gz
81
82install:V:	$p$CONF $p${CONF}debug		# $p$CONF.elf
83	cp $p$CONF $p$CONF^debug /$objtype/ &
84	for(i in $EXTRACOPIES)
85		{ 9fs $i && cp $p$CONF $p$CONF^debug /n/$i/$objtype &&
86			echo -n $i... & }
87	wait
88	echo
89
90<../port/portmkfile
91<|../port/mkbootrules $CONF
92
93%.$O:		/$objtype/include/ureg.h /sys/include/pool.h ../port/netif.h
94%.$O:		../port/sd.h ../ip/ip.h dosfs.h pxe.h
95$ETHER: 	etherif.h ethermii.h
96ether2000.$O ether8003.$O ether8390.$O etherec2t.$O: ether8390.h
97l.$O l16r.$O l32p.$O l32v.$O l64p.$O: /sys/src/boot/pc/x16.h
98sd%.$O:		/sys/include/disk.h
99auth.$O:	/sys/include/authsrv.h
100bootld.$O:	/sys/include/a.out.h /sys/src/libmach/elf.h
101devcons.$O:	/sys/include/authsrv.h
102devfloppy.$O:	floppy.h
103inflate.$O:	/sys/include/flate.h
104main.$O:	reboot.h
105sd53c8xx.$O:	sd53c8xx.i
106sdiahci.$O:	ahci.h
107trap.$O:	/sys/include/tos.h
108
109init.h:
110	>$target
111
112reboot.h:D:	rebootcode.s
113	$AS rebootcode.s
114	$LD -l -s -T0x11000 -R4 -o reboot.out rebootcode.$O
115	{echo 'uchar rebootcode[]={'
116	 xd -1x reboot.out |
117		sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
118	 echo '};'} > reboot.h
119
120acid:V:
121	8c -a -w -I. i8253.c>acid
122
123<callsmkfile
124
125%.checkether:VQ:
126	for (i in ether*.c){
127		x=`{echo $i | sed 's/\.c//'}
128		if(! ~ $x ether8390 && ! grep -s '^	'^$x^'([ 	]|$)' $stem)
129			echo $x not included in $stem
130	}
131	exit 0
132
133%.clean:V:
134	@ {
135		rfork n
136		unmount .
137		rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* reboot.h apbootstrap.h 9boot* 9load*
138	}
139