-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
114 lines (87 loc) · 2.79 KB
/
Makefile
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
all: res
make -C mckrnl
make -C user
NETDEV = e1000
QEMU_FLAGS = -m 2G -cdrom cdrom.iso -boot d -hda res/foxos.img
QEMU_FLAGS += -netdev user,id=u1 -device $(NETDEV),netdev=u1 -object filter-dump,id=f1,netdev=u1,file=dump.dat
# QEMU_FLAGS += -soundhw pcspk
QEMU_FLAGS += -smp 1
ifdef REMOTE
QEMU_FLAGS += -serial tcp:127.0.0.1:1234,server
else
QEMU_FLAGS += -serial stdio
endif
ifdef AHCI
QEMU_FLAGS += -machine q35
endif
initrd.saf:
mkdir -p ./res/initrd/bin
cp -r ./user/bin/*.elf ./res/initrd/bin/ -v
cp -r ./initrd/* ./res/initrd/ -v
cp LICENSE ./res/initrd/LICENSE -v
mkdir -p ./res/initrd/docs
cp *.md ./res/initrd/docs/. -v
mkdir -p ./res/initrd/EFI/BOOT
cp mckrnl/mckrnl.* ./res/initrd/EFI/BOOT/. -v
cp ./cdrom/zap-light16.psf ./res/initrd/EFI/BOOT/. -v
./res/saf/saf-make ./res/initrd ./res/initrd.saf
iso: all initrd.saf
cp mckrnl/mckrnl.elf cdrom/.
cp mckrnl/mckrnl.syms cdrom/.
cp res/initrd.saf cdrom/.
cp LICENSE cdrom/.
grub-mkrescue -o cdrom.iso cdrom/
set_kvm:
ifneq ("$(wildcard ./kvm)","")
@echo "enabeling kvm"
$(eval QEMU_FLAGS += --enable-kvm)
endif
run: iso set_kvm
qemu-system-i386 $(QEMU_FLAGS) -s
test: iso
make -C test
res:
mkdir res
git clone https://github.com/chocabloc/saf.git --depth=1 ./res/saf
make -C res/saf
wget https://github.com/TheUltimateFoxOS/FoxOS/releases/download/latest/foxos.img -O res/foxos.img
format_disk:
dd if=/dev/zero of=res/foxos.img bs=512 count=93750 status=progress
mkfs.vfat -F 32 res/foxos.img
format_disk_gpt:
dd if=/dev/zero of=res/foxos.img bs=512 count=93750 status=progress
echo 'echo "o\ny\nn\n1\n\n\n0700\nw\ny\n" | gdisk res/foxos.img' | sh
sudo losetup /dev/loop100 res/foxos.img -P
sudo mkfs.vfat -F 32 /dev/loop100p1
sudo losetup -d /dev/loop100
run_dbg: iso
qemu-system-i386 $(QEMU_FLAGS) --no-reboot --no-shutdown -s -S
run_vnc: iso set_kvm
qemu-system-i386 $(QEMU_FLAGS) -s -vnc :1
EXECUTABLE = mckrnl/mckrnl.elf
debug:
gdb -ex "symbol-file $(EXECUTABLE)" -ex "target remote localhost:1234" -ex "b _main"
clean: iso
make -C mckrnl clean
make -C user clean
deepclean:
rm -rfv res
git clean -dxf
libs.zip: all
mkdir -p res/libs/include
cp user/lib/* res/libs/. -rf
cp user/libc/include/* res/libs/include/. -rf
cp user/libtinf/include/* res/libs/include/. -rf
zip -r libs.zip res/libs/
compile_flags.txt:
make -C mckrnl compile_flags.txt
make -C user compile_flags.txt
pre_commit:
deno run -A config/write_syscalls_md.ts
deno run -A config/config.ts --clean --auto config/libc.json
deno run -A config/config.ts --clean --auto config/kernel.json
cd pkgs; bash clean.sh
config_libc:
deno run -A config/config.ts config/libc.json
config_kernel:
deno run -A config/config.ts config/kernel.json