diff --git a/Makescript b/Makescript index a2c1a8f..1b43ed9 100755 --- a/Makescript +++ b/Makescript @@ -1,13 +1,17 @@ #!/usr/bin/env sh -mkdir -p obj/ - +OBJ="obj" INCLUDE="-Isys/drv/vga/include -Isys/include" CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE" ASFLAGS="-felf32" LDFLAGS="-m elf_i386" -cc $CFLAGS -c sys/drv/vga/video.c -o obj/vga.o -cc $CFLAGS -c sys/sysinit.c -o obj/sysinit.o -nasm $ASFLAGS boot/boot.s -o obj/boot.o +mkdir -p $OBJ + +. boot/Makescript +. sys/Makescript +. sys/drv/Makescript + ld $LDFLAGS -T boot/link.ld -o omos obj/boot.o obj/vga.o obj/sysinit.o + +echo "Build Success" diff --git a/README.md b/README.md index 99f831b..76abda9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # omos-tcnj2024 -goofy os for x86 \ No newline at end of file +goofy x86 os + +## Working + +* VGA + +## TBD + +* MMU +* Filesystem +* Process Management diff --git a/boot/Makefile b/boot/Makefile deleted file mode 100644 index 2e284ff..0000000 --- a/boot/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -AS=nasm -FLAGS=-felf32 - -boot.o: - $(AS) $(FLAGS) boot.s -o boot.o diff --git a/boot/Makescript b/boot/Makescript new file mode 100644 index 0000000..17f3727 --- /dev/null +++ b/boot/Makescript @@ -0,0 +1,3 @@ +echo "Bootloader Build" + +nasm $ASFLAGS boot/boot.s -o $OBJ/boot.o diff --git a/sys/Makefile b/sys/Makefile deleted file mode 100644 index b974734..0000000 --- a/sys/Makefile +++ /dev/null @@ -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) diff --git a/sys/Makescript b/sys/Makescript new file mode 100644 index 0000000..5e47274 --- /dev/null +++ b/sys/Makescript @@ -0,0 +1,3 @@ +echo "Kernel Build" + +cc $CFLAGS -c sys/sysinit.c -o $OBJ/sysinit.o diff --git a/sys/drv/Makescript b/sys/drv/Makescript new file mode 100644 index 0000000..de0577f --- /dev/null +++ b/sys/drv/Makescript @@ -0,0 +1,3 @@ +echo "Driver Build" + +. sys/drv/vga/Makescript diff --git a/sys/drv/vga/Makefile b/sys/drv/vga/Makefile deleted file mode 100644 index 7fc9c59..0000000 --- a/sys/drv/vga/Makefile +++ /dev/null @@ -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) - diff --git a/sys/drv/vga/Makescript b/sys/drv/vga/Makescript new file mode 100644 index 0000000..b4d31f3 --- /dev/null +++ b/sys/drv/vga/Makescript @@ -0,0 +1,3 @@ +echo "VGA Driver Build" + +cc $CFLAGS -c sys/drv/vga/video.c -o $OBJ/vga.o diff --git a/sys/include/file.h b/sys/include/file.h new file mode 100644 index 0000000..a364414 --- /dev/null +++ b/sys/include/file.h @@ -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]; +}