mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-18 17:15:09 -04:00
Prepare the infrastructure for C++ kernel
This commit is contained in:
parent
a35ee7f71d
commit
50ffb9c67a
11
Makefile
11
Makefile
@ -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
BIN
kernel.bin.o
Normal file
Binary file not shown.
9
src/kernel.cpp
Normal file
9
src/kernel.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
void kernel_main(){
|
||||
unsigned char *vidmem = (unsigned char*) 0xB80000;
|
||||
|
||||
*vidmem = 'a';
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user