kernel/Makefile

32 lines
791 B
Makefile
Raw Normal View History

2023-06-12 11:46:47 +03:00
all: kernel-i386.elf
clean:
2023-06-14 20:06:27 +03:00
-@rm *.o *.elf 2> /dev/null || true
2023-06-12 11:46:47 +03:00
start32.o: start32.asm
fasm start32.asm
kernel.o: kernel.c
2023-06-13 09:45:04 +03:00
tcc -m32 -c kernel.c
vga.o: vga.c
tcc -m32 -c vga.c
2023-06-15 03:06:27 +03:00
serial.o: serial.c
tcc -m32 -c serial.c
2023-06-13 09:45:04 +03:00
2023-06-15 03:06:27 +03:00
kernel-i386.elf: kernel.o start32.o vga.o serial.o
tcc -m32 -nostdlib -Wl,-Ttext,0x100000 start32.o kernel.o vga.o serial.o -o kernel-i386.elf
2023-06-12 11:46:47 +03:00
2023-06-14 20:06:27 +03:00
qemu-multiboot: kernel-i386.elf
2023-06-14 20:39:30 +03:00
qemu-system-i386 -kernel kernel-i386.elf -serial stdio
2023-06-14 20:06:27 +03:00
qemu-image: kernel-i386.elf mount
cp kernel-i386.elf mnt/
sync
2023-06-15 03:06:27 +03:00
qemu-system-i386 koalemos.img -serial stdio
2023-06-14 19:28:16 +03:00
mount: koalemos.img mnt/
2023-06-14 20:06:27 +03:00
@if ! mountpoint -q "mnt/"; then \
sudo mount -o loop,offset=1048576,umask=177,dmask=222,uid=$(shell id -u),gid=$(shell id -g) koalemos.img mnt/; \
fi;
2023-06-14 19:28:16 +03:00
umount:
2023-06-14 20:06:27 +03:00
@sudo umount mnt
2023-06-14 19:28:16 +03:00
mnt/:
2023-06-14 20:06:27 +03:00
@mkdir mnt