commit 5623211d35ff4d663e6b36305fdc6f0ba59f4b64
parent 2f4e7e3d071406f34bc10985555cd2abc6079acf
Author: Matsuda Kenji <info@mtkn.jp>
Date: Mon, 1 Apr 2024 12:08:05 +0900
update root Makefile
Diffstat:
2 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,31 +0,0 @@
-all: disk.img
-
-disk.img: sys/src/boot/boot.efi sys/src/kernel/main.elf
- qemu-img create -f raw disk.img 200M
- mkfs.fat -n 'SETOS' -s 2 -f 2 -R 32 -F 32 disk.img
- mkdir -p image
- doas mount disk.img image
- doas mkdir -p image/EFI/BOOT
- doas cp sys/src/boot/boot.efi image/EFI/BOOT/BOOTX64.EFI
- doas cp sys/src/kernel/main.elf image/setos.elf
- doas umount image
-
-run: disk.img OVMF.fd
- qemu-system-x86_64 \
- -bios OVMF.fd \
- -drive format=raw,file=disk.img \
-
-gdb: disk.img OVMF.fd
- qemu-system-x86_64 \
- -bios OVMF.fd \
- -drive format=raw,file=disk.img \
- -gdb tcp::1234 -S
-
-#OVMF.fd:
-# curl -OL https://downloads.sourceforge.net/project/edk2/OVMF/OVMF-X64-r15214.zip
-# unzip OVMF-X64-r15214.zip OVMF.fd
-
-clean:
- rm -rf *.o *.efi *.elf *.dll disk.img image
- rm -f uefi/*.efi uefi/*.dll
- rm -f kernel/*.o kernel/*.elf
-\ No newline at end of file
diff --git a/sys/src/Makefile b/sys/src/Makefile
@@ -0,0 +1,37 @@
+TARGETS = boot kernel
+
+disk.img: targets
+ qemu-img create -f raw disk.img 200M
+ mkfs.fat -n 'SETOS' -s 2 -f 2 -R 32 -F 32 disk.img
+ mkdir -p image
+ doas mount disk.img image
+ doas mkdir -p image/EFI/BOOT
+ doas cp boot/boot.efi image/EFI/BOOT/BOOTX64.EFI
+ doas cp kernel/main.elf image/setos.elf
+ doas umount image
+
+targets:
+ for t in $(TARGETS); do \
+ (cd $$t && make); \
+ done
+
+run: disk.img OVMF.fd
+ qemu-system-x86_64 \
+ -bios OVMF.fd \
+ -drive format=raw,file=disk.img \
+
+gdb: disk.img OVMF.fd
+ qemu-system-x86_64 \
+ -bios OVMF.fd \
+ -drive format=raw,file=disk.img \
+ -gdb tcp::1234 -S
+
+#OVMF.fd:
+# curl -OL https://downloads.sourceforge.net/project/edk2/OVMF/OVMF-X64-r15214.zip
+# unzip OVMF-X64-r15214.zip OVMF.fd
+
+clean:
+ rm -rf disk.img image
+ for t in $(TARGETS); do \
+ (cd $$t && make clean); \
+ done