Espresso 0.0.1e

This commit is contained in:
2025-07-04 14:23:29 -05:00
parent dd11e15c3b
commit dbaee2c881
17 changed files with 215 additions and 20 deletions

View File

@ -9,12 +9,15 @@ MKFS_VFAT := sudo mkfs.vfat
MKFS_FLAGS := -F 32 -S 512
NASMFLAGS := -f elf32
WNOFLAGS := -Wno-discarded-qualifiers
CFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -msse $(WNOFLAGS)
CFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -msse4 $(WNOFLAGS)
LDFLAGS := -T linker.ld -ffreestanding -O2 -nostdlib
QEMUFLAGS := -boot d -cdrom $(ISO) -drive file=espresso.img,format=raw,if=ide,readonly=off,rerror=report,werror=report -cpu qemu32,sse4.1
QEMUFLGS_EXT := -net none -netdev user,id=n0 -device rtl8139,netdev=n0 #-singlestep
QEMUFLGS_EXT := -net none -netdev user,id=n0 -device rtl8139,netdev=n0 -vga std #-singlestep
SRC_DIRS := kernel drivers lib
INCLUDE_DIRS := include
ARCH_DIR := arch
X86_ARCH_DIR := $(ARCH_DIR)/x86
X86_BOOT_DIR := $(X86_ARCH_DIR)/boot
INCLUDES := $(addprefix -I, $(INCLUDE_DIRS))
ISO_DIR := isodir
BOOT_DIR := $(ISO_DIR)/boot
@ -23,8 +26,8 @@ GRUB_CFG := grub.cfg
# === File collection ===
C_SRCS := $(foreach dir, $(SRC_DIRS), $(shell find $(dir) -name '*.c'))
S_SRCS := boot.s crti.s crtn.s misc_asm.s
NASM_SRCS := gdt.asm pit.asm isr.asm
S_SRCS := $(foreach dir, $(ARCH_DIR), $(shell find $(dir) -name '*.s'))
NASM_SRCS := $(foreach dir, $(ARCH_DIR), $(shell find $(dir) -name '*.asm'))
CRTI_OBJ := crti.o
CRTBEGIN_OBJ := $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o)
CRTEND_OBJ := $(shell $(CC) $(CFLAGS) -print-file-name=crtend.o)
@ -37,11 +40,17 @@ INTERNAL_OBJS := $(CRTI_OBJ) $(OBJS) $(CRTN_OBJ)
# === Build all targets ===
build: all iso run
# === Build all targets and clean ===
buildc: test all iso run clean
# === Default target ===
all: $(TARGET)
test:
printf $(CRTI_OBJ)
# === Linking ===
$(TARGET): boot.o $(filter-out boot.o, $(OBJ_LINK_LIST))
$(TARGET): ./arch/x86/boot/boot.o $(filter-out boot.o, $(OBJ_LINK_LIST))
@mkdir -p $(dir $@)
$(CC) $(LDFLAGS) -o $@ $^ -lgcc