makescript complete modularity

This commit is contained in:
Agnosto Dvonik 2024-02-17 22:55:37 -05:00
parent 6dc29e41ee
commit 93721bca84
10 changed files with 57 additions and 31 deletions

View File

@ -1,13 +1,17 @@
#!/usr/bin/env sh #!/usr/bin/env sh
mkdir -p obj/ OBJ="obj"
INCLUDE="-Isys/drv/vga/include -Isys/include" INCLUDE="-Isys/drv/vga/include -Isys/include"
CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE" CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE"
ASFLAGS="-felf32" ASFLAGS="-felf32"
LDFLAGS="-m elf_i386" LDFLAGS="-m elf_i386"
cc $CFLAGS -c sys/drv/vga/video.c -o obj/vga.o mkdir -p $OBJ
cc $CFLAGS -c sys/sysinit.c -o obj/sysinit.o
nasm $ASFLAGS boot/boot.s -o obj/boot.o . boot/Makescript
. sys/Makescript
. sys/drv/Makescript
ld $LDFLAGS -T boot/link.ld -o omos obj/boot.o obj/vga.o obj/sysinit.o ld $LDFLAGS -T boot/link.ld -o omos obj/boot.o obj/vga.o obj/sysinit.o
echo "Build Success"

View File

@ -1,3 +1,13 @@
# omos-tcnj2024 # omos-tcnj2024
goofy os for x86 goofy x86 os
## Working
* VGA
## TBD
* MMU
* Filesystem
* Process Management

View File

@ -1,5 +0,0 @@
AS=nasm
FLAGS=-felf32
boot.o:
$(AS) $(FLAGS) boot.s -o boot.o

3
boot/Makescript Normal file
View File

@ -0,0 +1,3 @@
echo "Bootloader Build"
nasm $ASFLAGS boot/boot.s -o $OBJ/boot.o

View File

@ -1,10 +0,0 @@
include sys/drv/vga/Makefile
CC=cc
FLAGS=-Wall -c -g -Wextra -ffreestanding -m32 -nostdlib
SRCS=$(wildcard sys/*.c)
INC=sys/include/
INC_PARAMS=$(INC:%=-I%)
sysinit.o:
$(CC) $(FLAGS) $(INC_PARAMS) $(SRCS)

3
sys/Makescript Normal file
View File

@ -0,0 +1,3 @@
echo "Kernel Build"
cc $CFLAGS -c sys/sysinit.c -o $OBJ/sysinit.o

3
sys/drv/Makescript Normal file
View File

@ -0,0 +1,3 @@
echo "Driver Build"
. sys/drv/vga/Makescript

View File

@ -1,10 +0,0 @@
CC=cc
FLAGS=-Wall -c -g -Wextra -ffreestanding -m32 -nostdlib
SRCS=$(wildcard sys/drv/vga/*.c)
INC=sys/drv/vga/include/ sys/include/
INC_PARAMS=$(INC:%=-I%)
BIN=obj/vga.o
vga.o:
$(CC) $(FLAGS) $(INC_PARAMS) $(SRCS) -o $(BIN)

3
sys/drv/vga/Makescript Normal file
View File

@ -0,0 +1,3 @@
echo "VGA Driver Build"
cc $CFLAGS -c sys/drv/vga/video.c -o $OBJ/vga.o

25
sys/include/file.h Normal file
View File

@ -0,0 +1,25 @@
#define FS_ROOT_INODE 1
#define FS_BSIZE 512
#define FS_NDIRECT 12
#define FS_NINDIRECT (BASE / sizeof(u32))
#define FS_MAXFILE (FS_NINDIRECT + FS_NDIRECT)
#define FS_IPB (FS_BSIZE / sizeof(struct dinode)
#define FS_IBLOCK(i, sb) ((i) / IPB + sb.inodestart)
#define FS_BPB (FS_BSIZE * 8)
#define FS_BBLOCK(b, sb) (b/FS_BPB + b.bmapstart)
#define FS_DIRSIZ 14
struct superblock {
u32 size;
u32 nblock;
u32 ninode;
u32 nlog;
u32 firstlog;
u32 firstinode;
u32 firstfreemapblock;
}
struct dirent {
u16 inum;
s8 name[FS_DIRSIZ];
}