-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (41 loc) · 1.08 KB
/
Makefile
File metadata and controls
51 lines (41 loc) · 1.08 KB
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
44
45
46
47
48
49
50
51
TARGET?=x86_64-unknown-uefi
BUILD=build/$(TARGET)
SRC_DIR=.
MKFS=mkfs.vfat
QEMU?=qemu-system-x86_64
QEMU_FLAGS=\
-M q35 \
-m 1024 \
-net none \
-vga std \
-bios /usr/share/OVMF/OVMF_CODE.fd
.PHONY: qemu clean
all: $(BUILD)/boot.img
clean:
rm -r $(BUILD)
qemu: $(BUILD)/boot.img
$(QEMU) $(QEMU_FLAGS) $<
# Create ESP partition and filesystem
$(BUILD)/boot.img: $(BUILD)/efi.img
dd if=/dev/zero of=$@.tmp bs=512 count=100352
parted $@.tmp -s -a minimal mklabel gpt
parted $@.tmp -s -a minimal mkpart EFI FAT16 2048s 93716s
parted $@.tmp -s -a minimal toggle 1 boot
dd if=$< of=$@.tmp bs=512 count=98304 seek=2048 conv=notrunc
mv $@.tmp $@
# Create filesystem with updater (bootx64.efi)
$(BUILD)/efi.img: $(BUILD)/boot.efi
dd if=/dev/zero of=$@.tmp bs=512 count=98304
$(MKFS) $@.tmp
mmd -i $@.tmp efi
mmd -i $@.tmp efi/boot
mcopy -i $@.tmp $< ::efi/boot/bootx64.efi
mv $@.tmp $@
$(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/$@