Added missing scripts and C kernel
This commit is contained in:
parent
c06dbb7280
commit
1e7f6dd22e
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
i386-elf-gcc -ffreestanding -c src/kernel/main.c -o main.o
|
||||
nasm -f elf src/entrypoint.s -o entrypoint.o
|
||||
i386-elf-ld -o kernel.bin -Ttext 0x1000 entrypoint.o main.o --oformat binary
|
||||
cat mbr.bin kernel.bin > os.bin
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
export CC=/usr/bin/gcc
|
||||
export LD=/usr/bin/gcc
|
||||
export PREFIX="/usr/local/i386elfgcc"
|
||||
export TARGET=i386-elf
|
||||
export PATH="$PREFIX/bin:$PATH"
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
qemu-system-x86_64 -drive format=raw,file=os.bin,index=0,media=disk
|
|
@ -0,0 +1,16 @@
|
|||
// C entry point of our kernel
|
||||
#define VMEM_ADDR 0xb8000
|
||||
|
||||
void dummy_test_entrypoint(void) {
|
||||
}
|
||||
|
||||
|
||||
void kmain(void) {
|
||||
char* vbuf = (char*)VMEM_ADDR;
|
||||
vbuf += 480; // We skip the log messages before us
|
||||
char *s = "Hello from the TSOS kernel!";
|
||||
for (int i = 0; s[i] != '\0'; i++) {
|
||||
*vbuf = s[i];
|
||||
vbuf += 2;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue