From a3f524004919e25d350812dbc2f5616725b1a2f5 Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Mon, 27 Nov 2023 11:51:09 +0900 Subject: [PATCH] Add a `Makefile` --- test/Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/Makefile diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..4d55d20 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,34 @@ +.PHONY: test clean + +test: build/os.img + qemu-system-x86_64 \ + -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \ + -drive if=pflash,format=raw,readonly=on,file=OVMF_VARS.fd \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ + -serial stdio \ + -display none \ + -drive format=raw,file=build/os.img; \ + if [ $$? -eq 33 ];\ + then\ + echo "Test passed";\ + else\ + echo "Test failed";\ + exit 1;\ + fi + +build/os.img: target/x86_64-unknown-uefi/debug/xhci-test.efi build + dd if=/dev/zero of=build/os.img bs=512 count=93750 + mformat -i build/os.img -h 200 -t 500 -s 144:: + mmd -i build/os.img ::/efi + mmd -i build/os.img ::/efi/boot + mcopy -i build/os.img target/x86_64-unknown-uefi/debug/xhci-test.efi ::/efi/boot/bootx64.efi + +target/x86_64-unknown-uefi/debug/xhci-test.efi: src/main.rs + cargo build + +build: + mkdir build + +clean: + rm -rf build + cargo clean