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