Prepare the infrastructure for C++ kernel

This commit is contained in:
Baptiste Wicht 2013-10-26 13:15:29 +02:00
parent a35ee7f71d
commit 50ffb9c67a
4 changed files with 19 additions and 1 deletions

View File

@ -9,9 +9,18 @@ bootloader.bin: src/bootloader/bootloader.asm
micro_kernel.bin: $(KERNEL_SRC) $(KERNEL_UTILS_SRC)
nasm -w+all -f bin -o micro_kernel.bin src/micro_kernel.asm
thor.flp: bootloader.bin micro_kernel.bin
kernel.o: src/kernel.cpp
g++ -Wall -Wextra -O2 -fno-exceptions -fno-rtti -ffreestanding -c src/kernel.cpp -o kernel.o
kernel.bin: kernel.o
ld -e kernel_main -Ttext 0x10000 -o kernel.bin.o kernel.o
ld -i -e kernel_main -Ttext 0x1000 -o kernel.bin.o kernel.o
objcopy -R .note -R .comment -S -O binary kernel.bin.o kernel.bin
thor.flp: bootloader.bin micro_kernel.bin kernel.bin
cat bootloader.bin > thor.bin
cat micro_kernel.bin >> thor.bin
cat kernel.bin >> thor.bin
dd status=noxfer conv=notrunc if=thor.bin of=thor.flp
qemu: thor.flp

BIN
kernel.bin.o Normal file

Binary file not shown.

BIN
kernel.o Normal file

Binary file not shown.

9
src/kernel.cpp Normal file
View File

@ -0,0 +1,9 @@
extern "C"
void kernel_main(){
unsigned char *vidmem = (unsigned char*) 0xB80000;
*vidmem = 'a';
}