shithub: riscv

ref: 88181e1c5c8d19e61c76b93620abcbc7c2e57481
dir: /sys/src/9/kw/mkfile/

View raw version
CONF=plug
CONFLIST=plug

# allegedly u-boot uses the bottom 8MB (up to 0x800000)
# so avoid that
loadaddr=0x60800000

objtype=arm
</$objtype/mkfile
p=9

DEVS=`{rc ../port/mkdevlist $CONF}

PORT=\
	alarm.$O\
	alloc.$O\
	allocb.$O\
	auth.$O\
	cache.$O\
	chan.$O\
	dev.$O\
	edf.$O\
	fault.$O\
	mul64fract.$O\
	rebootcmd.$O\
	page.$O\
	parse.$O\
	pgrp.$O\
	portclock.$O\
	print.$O\
	proc.$O\
	qio.$O\
	qlock.$O\
	segment.$O\
	syscallfmt.$O\
	sysfile.$O\
	sysproc.$O\
	taslock.$O\
	tod.$O\
	xalloc.$O\
	random.$O\
	userinit.$O\

OBJ=\
	l.$O\
	lexception.$O\
	lproc.$O\
	arch.$O\
	cga.$O\
	clock.$O\
	fpi.$O\
	fpiarm.$O\
	fpimem.$O\
	main.$O\
	mmu.$O\
	trap.$O\
	syscall.$O\
	$CONF.root.$O\
	$CONF.rootc.$O\
	$DEVS\
	$PORT\

# HFILES=

LIB=\
	/$objtype/lib/libmemlayer.a\
	/$objtype/lib/libmemdraw.a\
	/$objtype/lib/libdraw.a\
	/$objtype/lib/libip.a\
	/$objtype/lib/libsec.a\
	/$objtype/lib/libc.a\
	/$objtype/lib/libmp.a\
	/$objtype/lib/libfis.a\

9:V: $p$CONF s$p$CONF

$p$CONF:DQ:	$OBJ $CONF.$O $LIB
	echo '# linking raw kernel'
	$LD -o $target -H0 -R4096 -T$loadaddr -l $prereq

s$p$CONF:DQ:	$OBJ $CONF.$O $LIB
	echo '# linking kernel with symbols'
	$LD -o $target -R4096 -T$loadaddr -l $prereq
	size $target

$p$CONF.gz:D:	$p$CONF
	gzip -9 <$p$CONF >$target

$OBJ: $HFILES

install:V: /$objtype/$p$CONF

install-in-flash:V: /$objtype/$p$CONF paqdisk
	plug.flash.cfg
	echo erase all >/dev/flash/kernelctl
	cp /$objtype/$p$CONF /dev/flash/kernel
	echo erase all >/dev/flash/plan9ctl
	cp paqdisk /dev/flash/plan9

/$objtype/$p$CONF:D: $p$CONF s$p$CONF
	cp -x $p$CONF s$p$CONF /$objtype &
	{ 9fs lookout &&  cp -x $p$CONF s$p$CONF /n/lookout/$objtype } &
#	{ 9fs piestand && cp -x $p$CONF s$p$CONF /n/piestand/$objtype } &
	wait
	touch $target

paqdisk:
	rm -fr armpaq
	mkdir armpaq
	cd armpaq
	disk/mkfs -d . /sys/lib/sysconfig/proto/armpaqproto
	mkpaqfs -o ../paqdisk
	cd ..

<../boot/bootmkfile
<../port/portmkfile
<|../port/mkbootrules $CONF

# CFLAGS= -I. -I../port $CFLAGS	# hack to compile private sysproc.c (e.g.)

arch.$O clock.$O fpiarm.$O main.$O mmu.$O screen.$O sdscsi.$O syscall.$O \
	trap.$O: /$objtype/include/ureg.h
arch.$O syscall.$O main.$O: /sys/include/tos.h
archkw.$O devether.$O ether1116.$O ethermii.$O: \
	../port/ethermii.h ../port/etherif.h ../port/netif.h
archkw.$O devflash.$O flashkw.$O: ../port/flashif.h
fpi.$O fpiarm.$O fpimem.$O: fpi.h
l.$O lexception.$O lproc.$O mmu.$O rebootcode.$O: arm.s arm.h mem.h
main.$O:	errstr.h rebootcode.i
mouse.$O:	screen.h
devusb.$O:	../port/usb.h
usbehci.$O usbohci.$O usbuhci.$O: ../port/usb.h usbehci.h

init9.$O:	../omap/init9.s
	$AS ../omap/init9.s

initcode.out:		init9.$O initcode.$O /$objtype/lib/libc.a
	$LD -l -R1 -s -o $target $prereq

rebootcode.out:		rebootcode.$O
	$LD -l -R4 -T0x100 -s -o $target $prereq -lc

plug.clean:
	rm -rf $p$CONF s$p$CONF armpaq paqdisk $CONF.c boot$CONF.c ../boot/libboot.a5