Advertisement

Problem when compiling kernel in NASM

Started by January 25, 2006 06:17 AM
2 comments, last by bakery2k1 19 years ago
Er.. ok so I'm making a small kernel in NASM. Everything went ok till I got till the compilation stage. I'm using an extremely simple bootloader (much simpler than GRUB) that just sets up protected mode and loads the kernel, so I didn't expect any problems. NASM keeps saying "error: binary output format does not support external references." But that's bull because I've not specified binary output format! kernel.asm:
[bits 32] ; hey, we're in Protected Mode

[global start]
[extern _kernel_main] ; always add a "_" in front of a C function to call it

start:
  call _kernel_main
  jmp $ ; halt
kernel.c:
void kernel_main()
{
}
Can someone please help??
_______________________Afr0Games
What command line do you use to build your kernel.asm?
Advertisement
nasm -o kernel.o c:\dev\OS\kernel.asm
_______________________Afr0Games
There you go - NASM defaults to binary format. I guess by the ".o" that you want ELF format, so you need to use "nasm -f elf ...".

This topic is closed to new replies.

Advertisement