shithub: riscv

ref: 92e9b85b04214f5bf5664d0e01cdd6a30d951c22
dir: /sys/src/boot/efi/mkfile/

View raw version
TARG=bootia32.efi bootx64.efi efiboot.fat
HFILES=fns.h mem.h
IMAGEBASE=0x8000
CFLAGS=-FTVw
PEFLAGS=$CFLAGS '-DIMAGEBASE='$IMAGEBASE

all:V: $TARG

install:V: $TARG
	cp $prereq /386

bootia32.efi:	pe32.8 efi.8 fs.8 pxe.8 iso.8 sub.8
	8l -l -H3 -T$IMAGEBASE -o $target $prereq

pe32.8:	pe32.s
	8a $PEFLAGS pe32.s

efi.8:	efi.c efi.h
	8c $CFLAGS efi.c

fs.8:	fs.c efi.h
	8c $CFLAGS fs.c

pxe.8:	pxe.c efi.h
	8c $CFLAGS pxe.c

iso.8:	iso.c efi.h
	8c $CFLAGS iso.c

sub.8:	sub.c
	8c $CFLAGS sub.c

%.8:	$HFILES


bootx64.efi:	pe64.6 efi.6 fs.6 pxe.6 iso.6 sub.6
	6l -l -s -R1 -T$IMAGEBASE -o bootx64.out $prereq
	dd -if bootx64.out -bs 1 -iseek 40 >$target

pe64.6:	pe64.s
	6a $PEFLAGS pe64.s

efi.6:	efi.c efi.h
	6c $CFLAGS efi.c

fs.6:	fs.c efi.h
	6c $CFLAGS fs.c

pxe.6:	pxe.c efi.h
	6c $CFLAGS pxe.c

iso.6:	iso.c efi.h
	6c $CFLAGS iso.c

sub.6:	sub.c
	6c $CFLAGS sub.c

%.6:	$HFILES

efiboot.fat:D:	bootia32.efi bootx64.efi
	s = $target.$pid
	rm -f $target
	dd -if /dev/zero -of $target -bs 1024 -count 1024
	disk/format -xd -t hard $target
	dossrv -f $target $s
	mount -c /srv/$s /n/esp
	mkdir /n/esp/efi
	mkdir /n/esp/efi/boot
	cp bootia32.efi /n/esp/efi/boot
	cp bootx64.efi /n/esp/efi/boot
	unmount /n/esp
	rm /srv/$s


test.iso:D:	efiboot.fat
	rm -fr tmp
	mkdir tmp
	mkdir tmp/cfg
	mkdir tmp/386
	cp efiboot.fat tmp/386
	cp /386/9bootiso tmp/386
	cp /386/9pc tmp/386
	echo 'bootfile=/386/9pc' >tmp/cfg/plan9.ini
	disk/mk9660 -B 386/9bootiso -E 386/efiboot.fat -p <{echo +} -s tmp $target
	rm -r tmp

test.fat:D:	bootia32.efi bootx64.efi
	s = $target.$pid
	rm -f $target
	dd -if /dev/zero -of $target -bs 65536 -count 128
	disk/format -xd -t hard $target
	dossrv -f $target $s
	mount -c /srv/$s /n/esp
	mkdir /n/esp/efi
	mkdir /n/esp/efi/boot
	cp bootia32.efi /n/esp/efi/boot
	cp bootx64.efi /n/esp/efi/boot
	cp /386/9pc /n/esp
	echo 'bootfile=9pc' >/n/esp/plan9.ini
	unmount /n/esp
	rm /srv/$s


clean:V:
	rm -f *.[68] *.out $TARG test.*