0.0.2d: Added BGA support, graphics!

This commit is contained in:
2026-06-05 16:14:14 -05:00
parent 5971218b56
commit f3b2f95af5
40 changed files with 1007 additions and 1197 deletions

View File

@ -12,9 +12,11 @@ NASMFLAGS := -f elf32
WNOFLAGS := -Wno-discarded-qualifiers
CFLAGS := -std=gnu99 -ffreestanding -O2 -Wall -Wextra -msse $(WNOFLAGS) -nostdlib -nostartfiles -include include/kincl.h
LDFLAGS := -T linker.ld -ffreestanding -O2 -nostdlib -nostartfiles
QEMUFLAGS := -no-shutdown -boot d -cdrom $(ISO) -drive file=$(FAT16_DISK),format=raw,if=ide,readonly=off,rerror=report,werror=report -cpu qemu32,sse4.1
QEMUFLGS_EXT := -vga std -d int,cpu_reset -D qemu.log # -audiodev pa,id=speaker -machine pcspk-audiodev=speaker
QEMUFLAGS := -no-shutdown -drive file=$(FAT16_DISK),format=raw,if=ide,readonly=off,rerror=report,werror=report -cpu qemu32,sse4.1
QEMUFLGS_EXT := -vga std
MOR_QEMUFLGS := -net none -netdev user,id=n0 -device rtl8139,netdev=n0 -serial file:serial.log
QEMU_BOOT_FLG := -boot d -cdrom $(ISO)
QEMU_BOOT_RPI := -kernel $(TARGET)
SRC_DIRS := kernel drivers lib
INCLUDE_DIRS := include
ARCH_DIR := arch
@ -26,6 +28,9 @@ BOOT_DIR := $(ISO_DIR)/boot
GRUB_DIR := $(BOOT_DIR)/grub
GRUB_CFG := grub.cfg
# === Host checks ===
IS_RPI := $(shell [ -f /proc/device-tree/model ] && grep -qi "Raspberry Pi" /proc/device-tree/model && echo 1 || echo 0)
# === File collection ===
C_SRCS := $(foreach dir, $(SRC_DIRS), $(shell find $(dir) -name '*.c'))
S_SRCS := $(foreach dir, $(ARCH_DIR), $(shell find $(dir) -name '*.s'))
@ -73,9 +78,11 @@ $(TARGET): ./arch/x86/boot/boot.o $(filter-out boot.o, $(OBJ_LINK_LIST))
iso: $(TARGET)
@grub-file --is-x86-multiboot $(TARGET) && echo "multiboot confirmed" || (echo "not multiboot" && exit 1)
mkdir -p $(GRUB_DIR)
cp $(TARGET) $(BOOT_DIR)/
cp $(GRUB_CFG) $(GRUB_DIR)/
cp $(TARGET) $(BOOT_DIR)
ifneq ($(IS_RPI),1)
cp $(GRUB_CFG) $(GRUB_DIR)
grub-mkrescue -o $(ISO) $(ISO_DIR)
endif
# === Run in QEMU ===
run: iso
@ -83,8 +90,12 @@ run: iso
$(QEMU_MKE_IMG); \
sudo mkfs.fat $(MKFS_FLAGS) espresso.img; \
fi
@echo
qemu-system-i386 $(QEMUFLAGS) $(QEMUFLGS_EXT) $(MOR_QEMUFLGS)
@echo $(IS_RPI)
ifeq ($(IS_RPI),1)
qemu-system-i386 $(QEMU_BOOT_RPI) $(QEMUFLAGS) $(QEMUFLGS_EXT) $(MOR_QEMUFLGS)
else
qemu-system-i386 $(QEMU_BOOT_FLG) $(QEMUFLAGS) $(QEMUFLGS_EXT) $(MOR_QEMUFLGS)
endif
# === Clean all build artifacts ===
@ -99,9 +110,15 @@ clean_disk:
commit:
ifndef MSG
$(error MSG required)
endif
ifndef RELEASENUM
$(error RELEASENUM required)
endif
git add .
git commit -m "$(MSG)"
git push
git push origin main
git tag -a "$(RELEASENUM)" -m "Espresso $(RELEASENUM)"
git push origin "$(RELEASENUM)"
.PHONY: all clean clean_disk iso run debug build buildc