makescript complete modularity
This commit is contained in:
parent
6dc29e41ee
commit
93721bca84
14
Makescript
14
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"
|
||||
|
12
README.md
12
README.md
@ -1,3 +1,13 @@
|
||||
# omos-tcnj2024
|
||||
|
||||
goofy os for x86
|
||||
goofy x86 os
|
||||
|
||||
## Working
|
||||
|
||||
* VGA
|
||||
|
||||
## TBD
|
||||
|
||||
* MMU
|
||||
* Filesystem
|
||||
* Process Management
|
||||
|
@ -1,5 +0,0 @@
|
||||
AS=nasm
|
||||
FLAGS=-felf32
|
||||
|
||||
boot.o:
|
||||
$(AS) $(FLAGS) boot.s -o boot.o
|
3
boot/Makescript
Normal file
3
boot/Makescript
Normal file
@ -0,0 +1,3 @@
|
||||
echo "Bootloader Build"
|
||||
|
||||
nasm $ASFLAGS boot/boot.s -o $OBJ/boot.o
|
10
sys/Makefile
10
sys/Makefile
@ -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
3
sys/Makescript
Normal file
@ -0,0 +1,3 @@
|
||||
echo "Kernel Build"
|
||||
|
||||
cc $CFLAGS -c sys/sysinit.c -o $OBJ/sysinit.o
|
3
sys/drv/Makescript
Normal file
3
sys/drv/Makescript
Normal file
@ -0,0 +1,3 @@
|
||||
echo "Driver Build"
|
||||
|
||||
. sys/drv/vga/Makescript
|
@ -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
3
sys/drv/vga/Makescript
Normal 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
25
sys/include/file.h
Normal 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];
|
||||
}
|
Loading…
Reference in New Issue
Block a user