-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (52 loc) · 2 KB
/
Makefile
File metadata and controls
63 lines (52 loc) · 2 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
52
53
54
55
56
57
58
59
60
61
62
63
.PHONY: run clean
TARGET:=debug
SOURCES=Cargo.toml $(wildcard src/*.rs) $(wildcard resources/*)
debug: target/x86_64-unknown-uefi/debug/inputmodules.efi
@ls -lh $<
clean:
rm -f target/x86_64-unknown-uefi/debug/inputmodules.efi
rm -f target/x86_64-unknown-uefi/release/inputmodules.efi
azalea: $(SOURCES)
cargo build --target x86_64-unknown-uefi --features azalea
qemu: $(SOURCES)
cargo build --target x86_64-unknown-uefi --features qemu
qemu-release: $(SOURCES)
cargo build --release --target x86_64-unknown-uefi --features qemu
target/x86_64-unknown-uefi/debug/inputmodules.efi: $(SOURCES)
cargo build --target x86_64-unknown-uefi
release: target/x86_64-unknown-uefi/release/inputmodules.efi
@ls -lh $<
target/x86_64-unknown-uefi/release/inputmodules.efi: $(SOURCES)
cargo build --target x86_64-unknown-uefi --release
clippy:
cargo clippy --target x86_64-unknown-uefi
# Automatically get OVMF from system path
ovmf/OVMF_CODE.fd:
mkdir -p ovmf
cp `nix-build '<nixpkgs>' -A OVMF.fd`/FV/OVMF_CODE.fd ovmf/ || \
cp /usr/share/OVMF/OVMF_CODE.fd ovmf/
chmod 755 ovmf/*
ovmf/OVMF_VARS.fd:
mkdir -p ovmf
cp `nix-build '<nixpkgs>' -A OVMF.fd`/FV/OVMF_VARS.fd ovmf/ || \
cp /usr/share/OVMF/OVMF_VARS.fd ovmf/ || \
sudo dnf install edk
chmod 755 ovmf/*
# Enable 2560x1600 resolution, same as Framework Laptop 16
sudo dnf install python3-virt-firmware || \
sudo apt install python3-virt-firmware || true
virt-fw-vars --in-place ovmf/OVMF_VARS.fd --set-json ovmf_vars.json || true
run: ovmf/OVMF_CODE.fd ovmf/OVMF_VARS.fd target/x86_64-unknown-uefi/$(TARGET)/inputmodules.efi
mkdir -p esp/efi/boot
cp target/x86_64-unknown-uefi/$(TARGET)/inputmodules.efi esp/efi/boot/bootx64.efi
qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 1024 \
-net none \
-serial stdio \
-debugcon file:debug.log -global isa-debugcon.iobase=0x402 \
-usb \
-drive if=pflash,format=raw,readonly=on,file=ovmf/OVMF_CODE.fd \
-drive if=pflash,format=raw,readonly=off,file=ovmf/OVMF_VARS.fd \
-drive format=raw,file=fat:rw:esp