Skip to content

Commit

Permalink
Introduce variables to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
toku-sa-n committed Nov 27, 2023
1 parent 073688c commit d5978b2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
IMG = build/os.img
EFI = target/x86_64-unknown-uefi/debug/xhci-test.efi

.PHONY: test clean

test: build/os.img
test: $(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 \
-no-reboot \
-display none \
-drive format=raw,file=build/os.img; \
-drive format=raw,file=$(IMG); \
if [ $$? -eq 33 ];\
then\
echo "Test passed";\
Expand All @@ -17,14 +20,14 @@ test: build/os.img
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
$(IMG): $(EFI) build
dd if=/dev/zero of=$@ bs=512 count=93750
mformat -i $@ -h 200 -t 500 -s 144::
mmd -i $@ ::/efi
mmd -i $@ ::/efi/boot
mcopy -i $@ $(EFI) ::/efi/boot/bootx64.efi

target/x86_64-unknown-uefi/debug/xhci-test.efi: src/main.rs
$(EFI):
cargo build

build:
Expand Down

0 comments on commit d5978b2

Please sign in to comment.