xref: /plan9-contrib/sys/src/9/omap/mkfile (revision 22402af72e824b13a03306b380e882c0b67c2e73)
1CONF=beagle
2CONFLIST=beagle
3
4# allegedly u-boot uses the bottom 3MB (up to 0x300000) so avoid that,
5# and leave 64K for plan9.ini.  loadaddr must match KTZERO in mem.h.
6# 0xc0310000 has worked, 0x80310000 should work but doesn't yet.
7loadaddr=0xc0310000
8
9objtype=arm
10</$objtype/mkfile
11p=9
12
13DEVS=`{rc ../port/mkdevlist $CONF}
14
15PORT=\
16	alarm.$O\
17	alloc.$O\
18	allocb.$O\
19	auth.$O\
20	cache.$O\
21	chan.$O\
22	dev.$O\
23	edf.$O\
24	fault.$O\
25	latin1.$O\
26	mul64fract.$O\
27	rebootcmd.$O\
28	logpow.$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	fpi.$O\
52	fpiarm.$O\
53	fpimem.$O\
54	kbd.$O\
55	main.$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/libip.a\
69	/$objtype/lib/libsec.a\
70	/$objtype/lib/libmp.a\
71	/$objtype/lib/libc.a\
72
739:V: $p$CONF s$p$CONF
74
75$p$CONF:DQ:	$CONF.c $OBJ $LIB mkfile
76	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
77	echo '# linking raw kernel'
78	$LD -o $target -H0 -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
79
80s$p$CONF:DQ:	$CONF.$O $OBJ $LIB
81	echo '# linking kernel with symbols'
82#	$LD -o $target -R4096 -T$loadaddr -l -a $OBJ $CONF.$O $LIB >$target.list
83	$LD -o $target -R4096 -T$loadaddr -l $OBJ $CONF.$O $LIB
84	size $target
85
86$p$CONF.gz:D:	$p$CONF
87	gzip -9 <$p$CONF >$target
88
89$OBJ: $HFILES
90
91install:V: /$objtype/$p$CONF
92
93/$objtype/$p$CONF:D: $p$CONF s$p$CONF
94	{ cp -x $p$CONF s$p$CONF /$objtype } &
95	wait
96	touch $target
97
98<../boot/bootmkfile
99<../port/portmkfile
100<|../port/mkbootrules $CONF
101
102CFLAGS= -I. -I../port $CFLAGS	# hack to compile private sysproc.c (e.g.)
103
104arch.$O clock.$O fpiarm.$O main.$O mmu.$O screen.$O sdscsi.$O syscall.$O \
105	trap.$O: /$objtype/include/ureg.h
106
107archomap.$O devether.$0 ether9221.$O: etherif.h ../port/netif.h
108archomap.$O devflash.$O flashbeagle.$O flashigep.$O: ../port/flashif.h
109ecc.$O flashbeagle.$O flashigep.$O: ../port/nandecc.h io.h
110fpi.$O fpiarm.$O fpimem.$O: ../port/fpi.h
111l.$O lexception.$O lproc.$O mmu.$O: arm.s arm.h mem.h
112l.$O rebootcode.$O: cache.v7.s
113main.$O: errstr.h init.h reboot.h
114devdss.$O devmouse.$O mouse.$O screen.$O: screen.h
115devusb.$O: ../port/usb.h
116usbehci.$O usbohci.$O usbuhci.$O: ../port/usb.h usbehci.h uncached.h
117
118init.h:D:	../port/initcode.c init9.s
119	$CC ../port/initcode.c
120	$AS init9.s
121	$LD -l -R1 -s -o init.out init9.$O initcode.$O /$objtype/lib/libc.a
122	{echo 'uchar initcode[]={'
123	 xd -1x <init.out |
124		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
125	 echo '};'} > init.h
126
127reboot.h:D:	rebootcode.s cache.v7.s arm.s arm.h mem.h
128	$AS rebootcode.s
129	# -lc is only for memmove.  -T arg is PADDR(REBOOTADDR)
130#	$LD -l -a -s -T0x100 -R4 -o reboot.out rebootcode.$O -lc >reboot.list
131	$LD -l -s -T0x100 -R4 -o reboot.out rebootcode.$O -lc
132	{echo 'uchar rebootcode[]={'
133	 xd -1x reboot.out |
134		sed -e '1,2d' -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
135	 echo '};'} > reboot.h
136errstr.h:D:	../port/mkerrstr ../port/error.h
137	rc ../port/mkerrstr > errstr.h
138