I decided to write a simple asm loader and C ++ kernel. I read a lot of tutorials, but I can not compile the assembly file as shown below:
[BITS 32]
[global start]
[extern _k_main]
start:
call _k_main
cli
hlt
(I would like to call the k_main function from the c file)
Compile / compile / link errors:
nasm -f bin -o kernelstart.asm -o kernelstart.bin:
error: bin file cannot contain external references
okay, then I tried to create a .o file:
nasm -f aout -o kernelstart.asm -o kernelstart.o (That right)
ld -i -e _main -Ttext 0x1000 kernel.o kernelstart.o main.o
error: File format not recognized
Someone give me a plz working example or say how to compile.: / (I look through the tutorials and helps 2 days ago, but can not find the correct answer)
Sebee source
share