
GDT control is how I would like it to be but there are some issues, namely: 1. far jumping to flush the code segment crashes the whole os(not good) 2. Segment selectors seem fine apart from the code segment thing 3. some administrative issues regarding the structure of the project which is slowly making things painful
45 lines
1.0 KiB
Makefile
45 lines
1.0 KiB
Makefile
CC=gcc
|
|
ASM=nasm
|
|
LINK=ld
|
|
ISO=genisoimage
|
|
|
|
OBJECTS=gdt_seg.o gdt.o loader.o serial.o framebuffer.o ports.o stlio.o tests.o
|
|
AFLAGS=-f elf32
|
|
CFLAGS=-m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
|
-nodefaultlibs -Wall -Wextra -Werror -c
|
|
|
|
all: kernel.elf
|
|
|
|
# Link objects together to produce the kernel object
|
|
kernel.elf: $(OBJECTS)
|
|
$(LINK) -T link.ld -melf_i386 $(OBJECTS) -o kernel.elf
|
|
|
|
# Builds image of our os
|
|
os.iso: kernel.elf
|
|
cp kernel.elf iso/boot/kernel.elf
|
|
$(ISO) -R \
|
|
-b boot/grub/stage2_eltorito \
|
|
-no-emul-boot \
|
|
-boot-load-size 4 \
|
|
-A os \
|
|
-input-charset utf8 \
|
|
-quiet \
|
|
-boot-info-table \
|
|
-o os.iso \
|
|
iso
|
|
|
|
# Builind asm objects
|
|
%.o: %.s
|
|
$(ASM) $(AFLAGS) $< -o $@
|
|
|
|
# Building C objecets
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
# Running (no recipes called)
|
|
run: os.iso
|
|
bochs -f bochsrc.conf -q
|
|
|
|
clean:
|
|
rm -rf *.o kernel.elf os.iso bochslog.txt
|