i found a tutorial to write a bootloader in asm that loads a kernel written in c.
Code: Select all
nasm –f bin –o boot.bin boot.asm
Code: Select all
gcc -ffreestanding -c -o kernel.o kernel.c
Code: Select all
OUTPUT_FORMAT("binary")
INPUT(kernel.o)
ENTRY(_main)
SECTIONS
{
.text 0x40000 :
{
*(.text)
}
.data :
{
*(.data)
}
.bss :
{
*(.bss)
}
}
Code: Select all
ld -T link.ld -o kernel.bin
when i try to link it without the linker script i get the following error:ld: PE operations on non PE file.
ld kernel.o -o kernel.bin
what do i have to do to get this running ? i know i need a binary file of the c-code and then copy boot.bin and kernel.bin together.kernel.o:kernel.c:(.text+0x12): undefined reference to '__main'
the code is in the addition.
system information:
gcc 4.3
nasm-2.05.01
windows vista x64 (yeah i know )