xref: /plan9/sys/src/9/teg2/mkfile (revision d11907f1310fb3aff37a1c3d604436d4028fd86f)
1CONF=ts
2CONFLIST=ts
3EXTRACOPIES=
4
5# allegedly u-boot uses the bottom 4MB (up to 0x400000) so avoid that,
6# and leave 64K for plan9.ini.  loadaddr must match KTZERO in mem.h
7# and CONFADDR must be 0x10000 lower.
8loadaddr=0xc0410000
9
10objtype=arm
11</$objtype/mkfile
12p=9
13
14DEVS=`{rc ../port/mkdevlist $CONF}
15
16PORT=\
17	alarm.$O\
18	alloc.$O\
19	allocb.$O\
20	auth.$O\
21	cache.$O\
22	chan.$O\
23	dev.$O\
24	edf.$O\
25	fault.$O\
26	latin1.$O\
27	mul64fract.$O\
28	rebootcmd.$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	segment.$O\
38	swap.$O\
39	sysfile.$O\
40	sysproc.$O\
41	taslock.$O\
42	tod.$O\
43	xalloc.$O\
44
45OBJ=\
46	l.$O\
47	lexception.$O\
48	lproc.$O\
49	arch.$O\
50	clock.$O\
51	clock-tegra.$O\
52	kbd.$O\
53	main.$O\
54	mmu.$O\
55	random.$O\
56	trap.$O\
57	$CONF.root.$O\
58	$CONF.rootc.$O\
59	$DEVS\
60	$PORT\
61
62HFILES=\
63	arm.h\
64	dat.h\
65	../port/error.h\
66	errstr.h\
67	fns.h\
68	io.h\
69	../port/lib.h\
70	mem.h\
71	../port/portdat.h\
72	../port/portfns.h\
73	/$objtype/include/u.h\
74
75LIB=\
76	/$objtype/lib/libmemlayer.a\
77	/$objtype/lib/libmemdraw.a\
78	/$objtype/lib/libdraw.a\
79	/$objtype/lib/libip.a\
80	/$objtype/lib/libsec.a\
81	/$objtype/lib/libmp.a\
82	/$objtype/lib/libc.a\
83
849:V: $p$CONF s$p$CONF
85
86$p$CONF:DQ:	$CONF.c $OBJ $LIB mkfile
87	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
88	echo '# linking raw kernel'	# H6: no headers, data segment aligned
89	$LD -o $target -H6 -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
90
91s$p$CONF:DQ:	$CONF.$O $OBJ $LIB
92	echo '# linking 9 kernel with symbols'
93	$LD -o $target -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
94	size $target
95
96$p$CONF.gz:D:	$p$CONF
97	gzip -9 <$p$CONF >$target
98
99$OBJ: $HFILES
100
101install:V: /$objtype/$p$CONF
102
103/$objtype/$p$CONF:D: $p$CONF s$p$CONF
104	cp -x $p$CONF s$p$CONF /$objtype/ &
105	for(i in $EXTRACOPIES)
106		{ 9fs $i && cp $p$CONF s$p$CONF /n/$i/$objtype && echo -n $i... & }
107	wait
108	echo
109	touch $target
110
111<../boot/bootmkfile
112<../port/portmkfile
113<|../port/mkbootrules $CONF
114
115CFLAGS= -I. -I../port $CFLAGS	# hack to compile private sysproc.c (e.g.)
116
117arch.$O clock.$O fpiarm.$O main.$O mmu.$O screen.$O sdscsi.$O syscall.$O \
118	trap.$O: /$objtype/include/ureg.h
119
120archtegra.$O devether.$0 ether9221.$O: etherif.h ../port/netif.h
121archtegra.$O devflash.$O flashtegra.$O flashigep.$O: ../port/flashif.h
122ecc.$O flashtegra.$O flashigep.$O: ../port/nandecc.h io.h
123fpi.$O fpiarm.$O fpimem.$O: ../port/fpi.h
124l.$O lexception.$O lproc.$O mmu.$O: arm.s mem.h
125l.$O rebootcode.$O: cache.v7.s
126main.$O: errstr.h init.h reboot.h
127devdss.$O devmouse.$O mouse.$O screen.$O: screen.h
128devusb.$O: ../port/usb.h
129usbehci.$O usbohci.$O usbuhci.$O: ../port/usb.h usbehci.h uncached.h
130
131init.h:D:	../port/initcode.c init9.s
132	$CC ../port/initcode.c
133	$AS init9.s
134	$LD -l -R1 -s -o init.out init9.$O initcode.$O /$objtype/lib/libc.a
135	{echo 'uchar initcode[]={'
136	 xd -1x <init.out |
137		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
138	 echo '};'} > init.h
139
140reboot.h:D:	rebootcode.s cache.v7.s arm.s arm.h mem.h
141	$AS rebootcode.s
142	# -lc is only for memmove.  -T arg is PADDR(REBOOTADDR)
143#	$LD -l -a -s -T0x100 -R4 -o reboot.out rebootcode.$O -lc >reboot.list
144	$LD -l -s -T0x100 -R4 -o reboot.out rebootcode.$O -lc
145	{echo 'uchar rebootcode[]={'
146	 xd -1x reboot.out |
147		sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
148	 echo '};'} > reboot.h
149errstr.h:D:	../port/mkerrstr ../port/error.h
150	rc ../port/mkerrstr > errstr.h
151