I am currently dabbling in OS Development, and one of the main tasks is to build an i386-elf-tools toolchain. I am following the playlist https://www.youtube.com/playlist?list=PLm3B56ql_akNcvH8vvJRYOc7TbYhRs19M and all the code so far has worked, until the last video when we start to write C++ code. I got my i386 binaries from https://github.com/nativeos/i386-elf-toolchain/releases/tag/preview.
Here is my kernel file:
extern "C" int main() {
*(char*)0xb8000 = 'A';
return 0;
}
Here is my kernel entry file:
[bits 32]
extern main
call main
jmp $
Here is my build script:
nasm "boot.asm" -f bin -o "boot.bin"
nasm "kernel_entry.asm" -f elf -o "kernel_entry.o"
i386-elf-gcc -ffreestanding -m32 -c "kernel.cpp" -o "kernel.o"
nasm "zeroes.asm" -f bin -o "zeroes.bin"
i386-elf-ld -o "full_kernel.bin" -Ttext 0x1000 "kernel_entry.o" "kernel.o" --oformat binary
cat "boot.bin" "full_kernel.bin" "zeroes.bin" > "OS.bin"
This is the error it returns
If needed, I’ll edit this question with the bootloader code as well, however I doubt it’s relevant to the problem.