change build system and cosmetic changes to main.s

This commit is contained in:
notsomeidiot123 2024-10-29 14:05:54 -04:00
parent 6887afafa9
commit 52303cb629
2 changed files with 25 additions and 4 deletions

25
c_build_helper.sh Normal file
View File

@ -0,0 +1,25 @@
CFLAGS="-g -c -m32 -fno-pie -mno-sse -O3 -D __bits__=32 -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -Wno-incompatible-pointer-types -Wno-address-of-packed-member -fno-stack-protector -mno-red-zone -mno-sse -mno-sse2 -ffreestanding -nostdlib -mno-mmx"
LDFLAGS_i386="-Ttext 0xc0000000 --oformat binary -melf_i386"
cd src/kernel/
gcc kmain.c $CFLAGS -o ../../bin/kernel/kmain.o
for d in ./*/; do
if [ "$d" != "./obj/" ]; then
echo -e "\033[1;32mCompiling files in $d\033[0m"
for f in $d*.c; do
echo -e "\033[1;36mfile: $f\033[0m"
SUF=".c"
SUF_REM=${f%"$SUF"}
END=${SUF_REM#"$d"}
# doing this, '#' removes prefix, and '%' removes suffix
gcc $f $CFLAGS -o ../../bin/kernel/$END.o
done
fi
done
cd ../../
# find -name bin/ *.o | xargs echo
# echo ../obj/*.o
# ld ../obj/kentry.o obj/*.o -T linker.ld -melf_i386 -o ../obj/kernel.bin

View File

@ -779,7 +779,6 @@ k_info:
.yres: dw 25
.framebuffer_ptr: dd 0xb8000
.loaded_modules: dd 0
;NOTE: remember to search for a free pg directory for the paddr map
;loaded_modules points to a struct array containing a ptr to the entry point of each pre-loaded module to be executed during startup
;module_struct:
;.entry_point: dd 0
@ -792,9 +791,6 @@ sacrifice1: dd 0
sacrifice0: dd 1
kernel_physical_size: dd 0
kload_paddr: dd 0x20000
; elf_magic EQU 0x7f454c46
elf_magic EQU 0x464c457f
file_buffer EQU 0xa000
root_dir EQU 0x1000