From 597e82e78f1f4600d3e6f14e0283531f2d95cca9 Mon Sep 17 00:00:00 2001 From: Tom-on64 Date: Mon, 9 Sep 2024 11:17:57 +0200 Subject: [PATCH] Updated config --- Makefile | 26 +++++++++++++------------- kern.iso | Bin 1470464 -> 1470464 bytes make.config | 11 +++++++++-- src/stage2.asm | 24 +++++++++++++++++++----- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 579742e..98823ff 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ # Variables -CC = i686-elf-gcc -LD = i686-elf-ld -AS = nasm +CC := i686-elf-gcc +LD := i686-elf-ld +AS := nasm -CFLAGS = -std=c17 -ffreestanding -fno-builtin -fno-stack-protector -fno-pie \ +CFLAGS := -g -std=c17 -ffreestanding -fno-builtin -fno-stack-protector -fno-pie \ -Os -nostdinc -mgeneral-regs-only -m32 -march=i386 -Wall -Iinclude/c -LDFLAGS = -z notext -melf_i386 -ASFLAGS = - -SRC = ./src -BIN = ./bin -C_FILES = calc edit -FONTS = testfont term16n +LDFLAGS := -z notext -melf_i386 -nostdlib +ASFLAGS := include make.config +SRC := ./src +BIN := ./bin +C_FILES := calc edit +FONTS := testfont term16n + .PHONY: os clean run # Main compilation target @@ -30,9 +30,9 @@ $(BIN): # Bootloader: This target is responsible for creating stage?.bin (1,2,3) bootloader: $(SRC)/stage1.asm $(SRC)/stage2.asm @echo "Assembling $(SRC)/stage1.asm..." - @$(AS) $(ASFLAGS) -fbin -o $(BIN)/stage1.bin $(SRC)/stage1.asm + @$(AS) -fbin -o $(BIN)/stage1.bin $(SRC)/stage1.asm $(ASFLAGS) @echo "Assembling $(SRC)/stage2.asm..." - @$(AS) $(ASFLAGS) -fbin -o $(BIN)/stage2.bin $(SRC)/stage2.asm + @$(AS) -fbin -o $(BIN)/stage2.bin $(SRC)/stage2.asm $(ASFLAGS) @echo "Compiling $(SRC)/stage3.c..." @$(CC) $(CFLAGS) -Iinclude -o $(BIN)/stage3.o -c $(SRC)/stage3.c @$(LD) $(LDFLAGS) -T$(SRC)/stage3.ld --oformat binary -o $(BIN)/stage3.bin $(BIN)/stage3.o diff --git a/kern.iso b/kern.iso index 47e0c8705daac4c2e60799b0b749318133a7aef3..094b8a70c329871bbee542a71051f6efd1e9784f 100644 GIT binary patch delta 89 zcmWN_yAgsw06;-b?;Z&LKq00KTDi>FDj0*;1Ua!YHbg17;m%v0xBOjVDvBwNzm`|{ jAVCgtlqgC5Q%WT#sil##T;wV@xl1dZJme|;%JAL+@7EM% delta 89 zcmWN_u@Qnm006;3oTltKbDt-vA33Fm*Y=}}|!_8aDTUvji%JnyV{*kem ikwQ*VN{~v9spTveY2+$5Y2_}R^b+MEPkG6(@Sb)Vh!pGq diff --git a/make.config b/make.config index 7a33ee7..a27d5f1 100644 --- a/make.config +++ b/make.config @@ -1,2 +1,9 @@ -# Use a default resolution of 1920x1080 32bpp -# ASFLAGS := $(ASFLAGS) -DDEF_RES +# Kern Config +# Uncomment a line to enable it +# You may also change values + +#ASFLAGS := $(ASFLAGS) -D DEF_RES # Use default resolution variables +ASFLAGS := $(ASFLAGS) -D DEF_W=1920 # Default width +ASFLAGS := $(ASFLAGS) -D DEF_H=1080 # Default height +ASFLAGS := $(ASFLAGS) -D DEF_BPP=32 # Default bpp + diff --git a/src/stage2.asm b/src/stage2.asm index 03706f4..b2c0e2d 100644 --- a/src/stage2.asm +++ b/src/stage2.asm @@ -368,12 +368,26 @@ CODE_SEG equ GDT.codeDescriptor - GDT.start DATA_SEG equ GDT.dataDescriptor - GDT.start ;; VBE Stuff -;; XXX IF YOU WANT TO SELECT ANY VALUE IN THE SETUP, SET THESE TO ZERO XXX -%ifdef DEF_RES -width: dw 1920 +; Default width +%ifndef DEF_W +%define DEF_W 0 %endif -height: dw 1080 -bpp: db 32 +; Default height +%ifndef DEF_H +%define DEF_H 0 +%endif +; Default bpp +%ifndef DEF_BPP +%define DEF_BPP 0 +%endif +; Use defaults +%ifdef DEF_RES +width: dw DEF_W +%else +width: dw 0 +%endif +height: dw DEF_H +bpp: db DEF_BPP offset: dw 0 _segment: dw 0 ; segment is a keyword