Major refactoring, added Makefile
This commit is contained in:
parent
0193c26413
commit
4f16d46f3f
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${workspaceFolder}/include/"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
mkdir /tmp/src
|
||||
cd /tmp/src
|
||||
curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.gz
|
||||
tar xf binutils-2.39.tar.gz
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
../binutils-2.39/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log
|
||||
sudo make all install 2>&1 | tee make.log
|
||||
cd /tmp/src
|
||||
curl -O https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
|
||||
tar xf gcc-12.2.0.tar.gz
|
||||
mkdir gcc-build
|
||||
cd gcc-build
|
||||
../gcc-12.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-languages=c --without-headers
|
||||
sudo make all-gcc
|
||||
sudo make all-target-libgcc
|
||||
sudo make install-gcc
|
||||
sudo make install-target-libgcc
|
12
build.sh
12
build.sh
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Compile the kernel and its drivers
|
||||
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/main.c -o obj/kernel.o
|
||||
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/vga/screen.c -o obj/screen.o
|
||||
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/ports/ports.c -o obj/ports.o
|
||||
# Compile the assembly entry point and the MBR
|
||||
nasm -f elf src/entrypoint.s -o obj/entry.o
|
||||
nasm -f bin src/boot/mbr.s -o build/mbr.bin
|
||||
# Link everything together
|
||||
i386-elf-ld -o build/kernel.bin -Ttext 0x1000 entry.o kernel.o ports.o screen.o --oformat binary
|
||||
# Produce a bootable image
|
||||
cat build/mbr.bin build/kernel.bin > build/os.img
|
6
env.sh
6
env.sh
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
export CC=/usr/bin/gcc
|
||||
export LD=/usr/bin/gcc
|
||||
export PREFIX="/usr/local/i386elfgcc"
|
||||
export TARGET=i386-elf
|
||||
export PATH=$PATH:$PREFIX/bin
|
|
@ -4,6 +4,7 @@
|
|||
#include "kernel/ktypes.h"
|
||||
#include "kernel/drivers/ports/ports.h"
|
||||
|
||||
|
||||
#define VMEM_ADDRESS 0xb8000
|
||||
#define VMEM_BUF ((byte*)VMEM_ADDRESS)
|
||||
#define MAX_ROWS 25
|
||||
|
@ -21,8 +22,8 @@
|
|||
|
||||
// Public API
|
||||
void clearScreen(void);
|
||||
void kprintAt(byte* message, i32 col, i32 row);
|
||||
void kprint(byte* message);
|
||||
void kprintAt(char* message, i32 col, i32 row);
|
||||
void kprint(char* message);
|
||||
|
||||
|
||||
#endif
|
2
run.sh
2
run.sh
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
qemu-system-x86_64 -drive format=raw,file=build/os.bin,index=0,media=disk
|
|
@ -1,6 +1,6 @@
|
|||
// Utilities for writing to and reading from I/O ports
|
||||
|
||||
#include "ports.h"
|
||||
#include "kernel/drivers/ports/ports.h"
|
||||
|
||||
|
||||
// Note: We use the volatile modifier everywhere because
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Implementation of a simple text-only VGA driver
|
||||
#include "screen.h"
|
||||
#include "kernel/drivers/vga/screen.h"
|
||||
#include "kernel/ktypes.h"
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ i32 getColumn(i32 offset);
|
|||
|
||||
// Public API below
|
||||
|
||||
void kprintAt(byte* message, i32 col, i32 row) {
|
||||
void kprintAt(char* message, i32 col, i32 row) {
|
||||
/*
|
||||
Prints a null-terminated string to the VGA
|
||||
text buffer at the specified row and column.
|
||||
|
@ -42,7 +42,7 @@ void kprintAt(byte* message, i32 col, i32 row) {
|
|||
}
|
||||
|
||||
|
||||
void kprint(byte* message) {
|
||||
void kprint(char* message) {
|
||||
/*
|
||||
Prints a null-terminated string to the
|
||||
VGA text buffer
|
||||
|
|
Loading…
Reference in New Issue