Support calling EFI functions directly from Forth
[rrq/jonasforth.git] / Makefile
1 .PHONY: qemu
2 qemu: out/main out/startup.nsh OVMF_CODE.fd OVMF_VARS.fd
3         # Based on https://wiki.osdev.org/UEFI#Emulation_with_QEMU_and_OVMF
4         qemu-system-x86_64 -cpu qemu64 \
5                 -drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \
6                 -drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd \
7                 -net none \
8                 -drive format=raw,file=fat:rw:out \
9                 -display type=gtk,zoom-to-fit=on
10
11 # Assuming 'ovmf' package on Arch Linux is installed.
12 OVMF_CODE.fd: /usr/share/ovmf/x64/OVMF_CODE.fd
13         cp $< $@
14 OVMF_VARS.fd: /usr/share/ovmf/x64/OVMF_VARS.fd
15         cp $< $@
16
17 out/main: main.asm impl.asm bootstrap.asm sys.f os/uefi.asm
18         mkdir -p out
19         OS_INCLUDE=os/uefi.asm fasm $< $@
20
21 out/startup.nsh:
22         mkdir -p out
23         echo 'fs0:main' >out/startup.nsh
24
25 main: main.asm impl.asm bootstrap.asm sys.f os/linux.asm
26         OS_INCLUDE=os/linux.asm fasm $< $@
27
28 .PHONY: clean
29 clean:
30         rm -rf out OVMF_CODE.fd OVMF_VARS.fd