something

This commit is contained in:
2025-05-10 15:48:10 +03:00
parent b836a37264
commit d4a14633ce
4 changed files with 89 additions and 90 deletions
+12 -11
View File
@@ -1,19 +1,22 @@
# Define the object files
OBJS = bin/boot.o bin/kernel.o bin/idt.o bin/isr.o bin/screen.o \
bin/utils.o bin/string.o bin/stdio.o bin/disk.o bin/pic.o bin/pit.o \
bin/keyboard.o bin/paging.o bin/heap.o bin/page_alloc.o bin/page_tables.o \
bin/fat.o bin/task.o bin/switch.o bin/sys_exit.o bin/gdt.o
bin/utils.o bin/string.o bin/stdio.o bin/disk.o bin/pic.o bin/pit.o \
bin/keyboard.o bin/paging.o bin/heap.o bin/page_alloc.o bin/page_tables.o \
bin/fat.o bin/task.o bin/switch.o bin/sys_exit.o bin/gdt.o
# Define the compiler and assembler
#CC = i686-elf-gcc -D__is_katauos
CC = gcc -D__is_katauos
AS = nasm
#LD = i686-elf-ld
LD = ld
# Define the compiler flags
CFLAGS = -I./include/ -std=gnu99 -ffreestanding -O0 -Wall -Wextra -m32 -g
CFLAGS = -I./include/ -std=gnu99 -ffreestanding -O0 -Wall -Wextra -m32 -fno-pie -fno-common -g
ASFLAGS = -f elf32
# Define the linker flags
LDFLAGS = -ffreestanding -O0 -nostdlib -m32 -g -lgcc
LDFLAGS = -m elf_i386 -L$(shell $(CC) -print-libgcc-file-name | xargs dirname)
LDSCRIPT = link.ld
# Define the output file
@@ -28,10 +31,9 @@ create-image:
parted boot.iso --script mkpart primary fat32 1MiB 100%
sudo losetup /dev/loop0 boot.iso
sudo losetup /dev/loop1 boot.iso -o 1048576
#sudo mkdosfs -F32 -f 2 /dev/loop1
sudo mkfs.vfat -F32 -f 2 /dev/loop1
sudo mount /dev/loop1 /mnt
sudo grub-install --root-directory=/mnt --no-floppy --modules="normal part_msdos ext2 multiboot biosdisk" /dev/loop0 #there was biosdev also
sudo grub-install --root-directory=/mnt --no-floppy --modules="normal part_msdos ext2 multiboot biosdisk" /dev/loop0
sudo cp -r grubshit/* /mnt/
sync
sudo umount /mnt
@@ -49,16 +51,15 @@ image:
test:
qemu-system-i386 -drive file=boot.iso,media=disk,format=raw -m 4096M -d int
#qemu-system-i386 -s -S -kernel myos.bin
debug:
qemu-system-i386 -s -S -kernel myos.bin
qemu-system-i386 -s -S -kernel myos.bin -monitor stdio
test-bochs:
bochs -f bochsrc
$(OUTPUT): $(OBJS)
$(CC) -T $(LDSCRIPT) -o $@ $(OBJS) $(LDFLAGS)
$(LD) -N -T $(LDSCRIPT) -nostdlib -o $@ $(OBJS) $(LDFLAGS)
bin/boot.o: src/boot.asm
$(AS) $(ASFLAGS) $< -o $@
@@ -126,6 +127,6 @@ bin/gdt.o: src/kernel/gdt.c
clean:
rm -rf bin/
rm -f $(OUTPUT)
rm boot.iso
rm -f boot.iso
.PHONY: all clean