shithub: riscv

ref: 9efcce402b4c7b16b86bfd612fa35ea0d536da2b
dir: /sys/src/9/xen/mkfile/

View raw version
CONF=xenpcf
CONFLIST=xenpcf

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

KTZERO=0x80010000
KZERO=0x80000000
KPZERO=0x10000
PAE=yes

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

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

XEN=\
	xengrant.$O\
	xentimer.$O\
	xensystem.$O\

SCHED=`{ls -p xen-public/sched*.h >[2]/dev/null}
ARCH=`{test -d xen-public/arch-x86 && echo arch-x86/xen-x86_32.h arch-x86/xen.h || echo arch-x86_32.h }

XENHEADERS=\
	$ARCH\
	xen.h\
	event_channel.h\
	grant_table.h\
	memory.h\
	physdev.h\
	$SCHED\
	io/ring.h\
	io/blkif.h\
	io/console.h\
	io/netif.h\
	io/xenbus.h\
	io/xs_wire.h\

OBJ=\
	l.$O\
	plan9l.$O\
	xen.$O\
	main.$O\
	fpu.$O\
	mmu.$O\
	random.$O\
	rdb.$O\
	irq.$O\
	trap.$O\
	$CONF.root.$O\
	$CONF.rootc.$O\
	$DEVS\
	$PORT\
	$XEN\

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

ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}

PAE=`{echo $PAE | sed 's/yes/yes[extended-cr3]/'}
XENELF='LOADER=generic,XEN_VER=xen-3.0,ELF_PADDR_OFFSET=0,VIRT_BASE='$KZERO',VIRT_ENTRY='$KTZERO',PAE='$PAE

$p$CONF:D:	$p$CONF.elf xenelf.$cputype
	./xenelf.$cputype $prereq(1) $target __xen_guest ''$XENELF''
	size $target

$p$CONF.elf:D:	$OBJ $CONF.$O $LIB
	$LD -o $target -H5 -T$KTZERO -P$KPZERO -l $prereq

$p$CONF.gz: $p$CONF
	#strip -o /fd/1 $p$CONF | gzip -9 > $p$CONF.gz
	gzip -9 $p$CONF > $p$CONF.gz

install:V: $p$CONF $p$CONF.gz
	cp $p$CONF $p$CONF.gz /$objtype/
	# import lookout / /n/lookout && cp $p$CONF $p$CONF.gz /n/lookout/$objtype/

# copies generated by the rule below
PCHEADERS=uncached.h ethermii.h mp.h io.h

REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
^($REPCH)\.h:R:	'../pc/\1.h'
	cp $prereq .

REPCC=`{../port/mkfilelist ../pc}
^($REPCC)\.$O:R:	'../pc/\1.c'
	$CC $CFLAGS -I. -. ../pc/$stem1.c

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

# we inherited these.. revisit.
$ETHER: 	../port/etherif.h ../port/netif.h
$SDEV:	../port/sd.h
main.$O:		rebootcode.i
main.$O trap.$O:	/sys/include/tos.h

%.$O:	/$objtype/include/u.h ../port/lib.h mem.h dat.h fns.h io.h ../port/error.h ../port/portdat.h ../port/portfns.h xendat.h xendefs.h

xendefs.h: xendat.h
	grep '^#define[ 	]+FLAT_' xendat.h >$target

xendat.h:
	{ echo '#define __i386__ __i386__'; \
	  echo '#define __XEN_INTERFACE_VERSION__ 0x00030201'; \
	  echo '#define XEN_GUEST_HANDLE_00030205(type) type *'; \
	  cat xen-public/^($XENHEADERS) } | \
	./cppx > $target

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

rebootcode.$O:	../pc/rebootcode.s mem.h
	$AS ../pc/rebootcode.s

rebootcode.out:		rebootcode.$O
	$LD -l -R4 -s -o $target -T0x1000 -H3 $prereq

acid:V:
	$CC -a -w main.c>acid

dpart: dpart.$O
	$LD -o dpart dpart.$O

xenstore: xenstore.$O
	$LD -o xenstore xenstore.$O

xenbin.$cputype xenelf.$cputype:	utilmkfile
	mk -f utilmkfile $target

%.clean:V:
	rm -f $stem.c [9bz]$stem [9bz]$stem.gz 9$stem.elf boot$stem.* xendat.h xendefs.h $PCHEADERS dpart xenbin.$cputype xenelf.$cputype xenstore