forked from pimnik98/SayoriOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
240 lines (191 loc) · 8.28 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# MakeFile
# SayoriOS Soul
# (c) SayoriOS Team 2022-2023
include common.mk
# Правило сборки
############################################################
# Cтандартное действие при вызове Make
all:
@-mkdir -p $(OBJ_DIRECTORY) $(DIRECTORIES)
@echo $(OBJ_DIRECTORY) $(BUILD_PREFIX)
$(MAKE) -C $(CURDIR) -f $(BUILD_PREFIX)Makefile $(KERNEL)
$(OBJ_DIRECTORY)/%.o : %.s | $(OBJ_DIRECTORY)
@echo -e '\x1b[32mASM \x1b[0m' $@
@$(AS) $< $(ASFLAGS) -o $@
$(OBJ_DIRECTORY)/%.o : %.c | $(OBJ_DIRECTORY)
@echo -e '\x1b[32mC \x1b[0m' $@
@$(CC) $(CFLAGS) -c -o $@ $<
#$(OBJ_DIRECTORY)/%.o: %.s
# @echo $< $@
$(KERNEL): $(KERNEL_NEED)
@echo -e '\x1b[32mLINK \x1b[0m' $(KERNEL)
@rm -f $(KERNEL)
@$(LD) $(LDFLAGS) -o $(KERNEL) $(KERNEL_NEED)
@bash $(BUILD_PREFIX)tools/genmap.sh
@bash $(BUILD_PREFIX)tools/insertmap.sh
@ls -lh $(KERNEL) kernel.map
@-rm kernel.map
# Сборка ядра
build: $(SOURCES)
# Запуск
run:
$(QEMU) -serial file:Qemu.log $(QEMU_FLAGS)
lite:
$(QEMU) -serial file:Qemu.log -serial telnet:sayorios.piminoff.ru:10000 $(QEMU_FLAGS)
run_milla:
$(QEMU) -serial file:Qemu.log -serial telnet:sayorios.piminoff.ru:10000 $(QEMU_FLAGS)
# Запуск Live COM2
runLocalMode:
$(QEMU) -serial file:Qemu.log -serial telnet:localhost:10000 $(QEMU_FLAGS)
run_remote_mon:
$(QEMU) $(QEMU_FLAGS) -serial mon:stdio -monitor tcp:127.0.0.1:1234,server
run_ahci_sata:
$(QEMU) $(QEMU_FLAGS) -serial mon:stdio \
-device ahci,id=ahci,debug=3 \
-trace "ahci*" \
-drive id=thatdisk,file=disk.img,if=none \
-device ide-hd,drive=thatdisk,bus=ahci.0 \
-drive id=thatcdrom,file=/dev/cdrom,if=none \
-device ide-cd,drive=thatcdrom,bus=ahci.1 \
# -drive id=thatcdrom,file=TEST.iso,if=none \
# -device ide-cd,drive=thatcdrom,bus=ahci.1 \
run_disks:
$(QEMU) $(QEMU_FLAGS) -serial mon:stdio -hda disk1.img -hdb disk2.img -hdd disk3.img
bra:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . run_ahci_sata
disks:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . run_disks
# Запуск Milla
milla:
$(QEMU) -cdrom kernel.iso -serial file:Qemu.log -serial telnet:sayorios.piminoff.ru:10000 -accel kvm -m 128M -name "SayoriOS Soul" -d guest_errors -rtc base=localtime -soundhw pcspk
floppy:
$(QEMU) -cdrom kernel.iso -serial mon:stdio -m 64M -name "SayoriOS v0.3.x (Dev)" -d guest_errors -rtc base=localtime -fda floppy.img -boot order=dc -accel kvm
# Запуск с логами в консоль
runlive:
$(QEMU) -serial mon:stdio $(QEMU_FLAGS)
# Запуск в режиме UEFI с логами в файл
uefi:
qemu-system-x86_64 -bios /usr/share/qemu/OVMF.fd -cdrom SayoriOS_UEFI.iso -serial file:Qemu.log -accel kvm \
-m 128M -name "SayoriOS Soul" -d guest_errors -rtc base=localtime -device ahci,id=ahci \
-drive id=thatdisk,file=disk.img,if=none \
-device ide-hd,drive=thatdisk,bus=ahci.0 \
-drive id=thatcdrom,file=/dev/cdrom,if=none \
-device ide-cd,drive=thatcdrom,bus=ahci.1 \
# Запуск в режиме UEFI с логами в консоль
uefilive:
qemu-system-x86_64 -bios /usr/share/qemu/OVMF.fd -cdrom SayoriOS_UEFI.iso -serial mon:stdio -accel kvm \
-m 128M -name "SayoriOS Soul" -d guest_errors -rtc base=localtime
# Генерация ISO-файла
geniso: $(KERNEL)
$(shell bash $(BUILD_PREFIX)tools/grub.sh) -o "kernel.iso" iso/ -V kernel
# Генерация ISO-файла с поддержкой UEFI
genuefi:
$(shell bash $(BUILD_PREFIX)tools/grub.sh) -d /usr/lib/grub/x86_64-efi -o SayoriOS_UEFI.iso iso/ --locale-directory=/usr/share/locale/ -V "SayoriOS Soul"
# Удаление оригинального файла и *.о файлов
clean:
-rm -f $(KERNEL)
-rm -f $(KERNEL_NEED)
-rm -f $(DEPS)
-rm -f iso/boot/ramdisk
# Быстрая линковка, генерация ISO, запуск
bir:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . run
# Быстрая линковка, генерация ISO, запуск
birl:
$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . runlive
bf:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . clean
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . floppy
cppcheck:
cppcheck --enable=warning,performance,portability .
debug: geniso
$(QEMU) $(QEMU_FLAGS) -s -S &
gdb -ex "target remote localhost:1234" -ex "break kernel" -ex "continue"
ensure_tools:
@echo "C:" $(CC)
@echo "LD:" $(LD)
release:
ADDCFLAGS="-DRELEASE" $(MAKE)
@$(MAKE) RAM
# ВНИМАНИЕ: Данное правило установит SayoriOS на ваш компьютер!
deploy: $(KERNEL)
sudo cp iso/boot/kernel.elf /boot/sayorios_kernel.elf
sudo cp iso/boot/ramdisk /boot/sayori_ramdisk
sudo cp other/41_sayori /etc/grub.d/
sudo update-grub
RAM:
@-rm ./iso/boot/ramdisk
@tar -cvf ./iso/boot/ramdisk ./ramdisk/
VBOX_create_vm:
@echo "TODO"
@VBoxManage createvm --name=SayoriOS --register
@VBoxManage storagectl SayoriOS --name=ide --add=ide --bootable=on
@VBoxManage storageattach SayoriOS --type=dvddrive --medium kernel.iso --storagectl=ide --port=0 --device=0
VBOX:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@VBoxManage startvm "SayoriOS"
WSL_RUN:
"/mnt/c/Program Files/qemu/qemu-system-i386.exe" -cdrom "C:\\SayoriDev\\SayoriOS_DEV_WSL.iso" -serial mon:stdio -m 128M -name "SayoriOS DEV WSL MODE" -d guest_errors -rtc base=localtime $(QEMU_FLAGS_WSL)
WSL:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@-mkdir /mnt/c/SayoriDev/
mv kernel.iso /mnt/c/SayoriDev/SayoriOS_DEV_WSL.iso
"/mnt/c/Program Files/qemu/qemu-system-i386.exe" -cdrom "C:\\SayoriDev\\SayoriOS_DEV_WSL.iso" -serial mon:stdio -m 128M -name "SayoriOS DEV WSL MODE" -d guest_errors -rtc base=localtime -netdev user,id=net1,net=192.168.222.0,dhcpstart=192.168.222.128 -device virtio-net-pci,netdev=net1,id=mydev1,mac=52:54:00:6a:40:f8
WSL_NAT:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@-mkdir /mnt/c/SayoriDev/
mv kernel.iso /mnt/c/SayoriDev/SayoriOS_DEV_WSL.iso
"/mnt/c/Program Files/qemu/qemu-system-i386.exe" -cdrom "C:\\SayoriDev\\SayoriOS_DEV_WSL.iso" -serial mon:stdio -serial telnet:sayorios.piminoff.ru:10000 -m 128M -name "SayoriOS DEV WSL MODE" -d guest_errors -rtc base=localtime $(QEMU_FLAGS_WSL)
WSL_DISKS:
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C .
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . RAM
@$(MAKE) -f $(BUILD_PREFIX)/Makefile -C . geniso
@-mkdir /mnt/c/SayoriDev/
mv kernel.iso /mnt/c/SayoriDev/SayoriOS_DEV_WSL.iso
@-mv disk1.img /mnt/c/SayoriDev/disk1.img
@-mv disk2.img /mnt/c/SayoriDev/disk2.img
@-mv disk3.img /mnt/c/SayoriDev/disk3.img
"/mnt/c/Program Files/qemu/qemu-system-i386.exe" -cdrom "C:\\SayoriDev\\SayoriOS_DEV_WSL.iso" -serial mon:stdio -m 128M -name "SayoriOS DEV WSL MODE" -d guest_errors -rtc base=localtime $(QEMU_FLAGS_WSL) -hda "C:\\SayoriDev\\disk1.img" -hdb "C:\\SayoriDev\\disk2.img" -hdd "C:\\SayoriDev\\disk3.img"
create_fat_disk:
fallocate -l 64M disk1.img
sudo mkfs.fat -F 32 disk1.img
net_tap_dev: geniso
sudo $(QEMU) -cdrom kernel.iso -m $(MEMORY_SIZE) \
-name "SayoriOS Soul v0.3.5 (Dev) [NETWORK ON TAP]" \
-rtc base=localtime \
-d guest_errors,cpu_reset,int \
-smp 1 \
-netdev tap,id=net0 \
-device rtl8139,netdev=net0,id=mydev0 \
-boot d \
-cpu core2duo-v1 \
-serial mon:stdio \
$(KVM_QEMU_FLAGS)
files:
@echo $(KERNEL_NEED)
@echo ------------------
@echo $(ASM_SRC) $(SOURCES)
@echo ------------------
@echo $(DEPS)
# Extract directories from file paths
@echo $(DIRECTORIES)
-include $(DEPS)