-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (35 loc) · 846 Bytes
/
Makefile
File metadata and controls
43 lines (35 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
TARGET?=x86_64-unknown-uefi
BUILD=build/$(TARGET)
SRC_DIR=.
# sudo pkg install qemu edk2-qemu-x64
QEMU?=qemu-system-x86_64
OVMF_FD?=/usr/local/share/edk2-qemu/QEMU_UEFI-x86_64.fd
QEMU_FLAGS=\
-M q35 \
-m 1024 \
-net none \
-vga std \
-bios /usr/local/share/edk2-qemu/QEMU_UEFI-x86_64.fd
.PHONY: qemu clean
all: $(BUILD)/boot.img
$(BUILD)/boot.img: $(BUILD)/boot.efi
mkdir -p temp/EFI/BOOT
cp $(BUILD)/boot.efi temp/EFI/BOOT/bootx64.efi
makefs -t msdos \
-o fat_type=16 \
-o sectors_per_cluster=1 \
-s 10000k \
$(BUILD)/boot.img temp
rm -rf temp
clean:
rm -r $(BUILD)
qemu: $(BUILD)/boot.img
$(QEMU) $(QEMU_FLAGS) $<
$(BUILD)/boot.efi: ../Cargo.lock $(SRC_DIR)/Cargo.toml $(SRC_DIR)/src/*
mkdir -p $(BUILD)
cargo rustc \
--target $(TARGET) \
--release \
-- \
-C soft-float \
--emit link=framework_uefi/$@