-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 2.06 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 2.06 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
LIMINE=build/limine-9.3.3
LIMINE_BIN=build/limine-9.3.3/bin/limine
LIMINE_FILES = $(patsubst %, $(LIMINE)/bin/%, limine-bios.sys limine-bios-cd.bin limine-uefi-cd.bin)
RELEASE=1
KERNEL=build/kernel/x86_64-unknown-none/$(if $(RELEASE),release,debug)/soos
KERNEL_SOURCES := $(shell find kernel -type f)
USERSPACE_APPLICATIONS=$(patsubst %, build/userspace/bin/%, sosh sogui)
USERSPACE_SOURCES := $(shell find userspace -type f -name '*.zig')
clean:
rm SoOS.iso || true
rm -rf build/* || true
$(LIMINE): limine-9.3.3.tar.gz
mkdir -p $(LIMINE)
tar -xzf limine-9.3.3.tar.gz -C build
$(LIMINE_FILES) $(LIMINE_BIN): $(LIMINE)
cd $(LIMINE) && ./configure --enable-bios --enable-bios-cd --enable-uefi-x86-64 --enable-uefi-cd && make -j$(nproc)
build/userspace/bin:
mkdir -p build/userspace/bin
build/userspace/bin/%: userspace/% build/userspace/bin $(USERSPACE_SOURCES)
cd $< && zig build -p ../../build/userspace
$(KERNEL): $(USERSPACE_APPLICATIONS) $(KERNEL_SOURCES) $(USERSPACE_SOURCES)
cd kernel && cargo build $(if $(RELEASE),--release)
build/iso-root: $(KERNEL) $(LIMINE_FILES)
mkdir -p build/iso-root
cp -v $(KERNEL) build/iso-root/kernel.elf
cp -v limine.conf $(LIMINE_FILES) build/iso-root/
mkdir -p build/iso-root/EFI/BOOT
cp -v $(LIMINE)/bin/BOOT*.EFI build/iso-root/EFI/BOOT/
build/SoOS.iso: build/iso-root $(LIMINE_FILES) $(LIMINE_BIN) $(KERNEL)
xorriso -as mkisofs -b limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
build/iso-root -o build/SoOS.iso
$(LIMINE_BIN) bios-install build/SoOS.iso
run: build/SoOS.iso
qemu-system-x86_64 \
-cpu max -cdrom build/SoOS.iso -d guest_errors,cpu_reset -m 8G -s \
-no-shutdown -no-reboot
run-serial: build/SoOS.iso
qemu-system-x86_64 \
-cpu max -cdrom build/SoOS.iso -d guest_errors,cpu_reset -m 8G -s \
-no-shutdown -no-reboot -nographic -serial mon:stdio
run-gdb: build/SoOS.iso
qemu-system-x86_64 \
-cpu max -cdrom build/SoOS.iso -d guest_errors,cpu_reset -m 8G -s \
-no-shutdown -no-reboot -S