File tree Expand file tree Collapse file tree 1 file changed +13
-21
lines changed Expand file tree Collapse file tree 1 file changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -3,44 +3,36 @@ BUILD=build/$(TARGET)
3
3
4
4
SRC_DIR =.
5
5
6
- MKFS =mkfs.vfat
7
-
6
+ # sudo pkg install qemu edk2-qemu-x64
8
7
QEMU? =qemu-system-x86_64
8
+ OVMF_FD? =/usr/local/share/edk2-qemu/QEMU_UEFI-x86_64.fd
9
9
QEMU_FLAGS =\
10
10
-M q35 \
11
11
-m 1024 \
12
12
-net none \
13
13
-vga std \
14
- -bios /usr/share/OVMF/OVMF_CODE .fd
14
+ -bios /usr/local/ share/edk2-qemu/QEMU_UEFI-x86_64 .fd
15
15
16
16
.PHONY : qemu clean
17
17
18
18
all : $(BUILD ) /boot.img
19
19
20
+ $(BUILD ) /boot.img : $(BUILD ) /boot.efi
21
+ mkdir -p temp/EFI/BOOT
22
+ cp $(BUILD ) /boot.efi temp/EFI/BOOT/bootx64.efi
23
+ makefs -t msdos \
24
+ -o fat_type=16 \
25
+ -o sectors_per_cluster=1 \
26
+ -s 10000k \
27
+ $(BUILD ) /boot.img temp
28
+ rm -rf temp
29
+
20
30
clean :
21
31
rm -r $(BUILD )
22
32
23
33
qemu : $(BUILD ) /boot.img
24
34
$(QEMU ) $(QEMU_FLAGS ) $<
25
35
26
- # Create ESP partition and filesystem
27
- $(BUILD ) /boot.img : $(BUILD ) /efi.img
28
- dd if=/dev/zero of=$@ .tmp bs=512 count=100352
29
- parted $@ .tmp -s -a minimal mklabel gpt
30
- parted $@ .tmp -s -a minimal mkpart EFI FAT16 2048s 93716s
31
- parted $@ .tmp -s -a minimal toggle 1 boot
32
- dd if=$< of=$@ .tmp bs=512 count=98304 seek=2048 conv=notrunc
33
- mv $@ .tmp $@
34
-
35
- # Create filesystem with updater (bootx64.efi)
36
- $(BUILD ) /efi.img : $(BUILD ) /boot.efi
37
- dd if=/dev/zero of=$@ .tmp bs=512 count=98304
38
- $(MKFS ) $@ .tmp
39
- mmd -i $@ .tmp efi
40
- mmd -i $@ .tmp efi/boot
41
- mcopy -i $@ .tmp $< ::efi/boot/bootx64.efi
42
- mv $@ .tmp $@
43
-
44
36
$(BUILD ) /boot.efi : ../Cargo.lock $(SRC_DIR ) /Cargo.toml $(SRC_DIR ) /src/*
45
37
mkdir -p $(BUILD )
46
38
cargo rustc \
You can’t perform that action at this time.
0 commit comments