Hi,
I have created a simple kernel in C, it just prints an 'A' to the screen and then hangs. The problem is that LD will not link it. I have tried
ld -Ttext 0x20000 -oformat binary -o kernel.bin kernel.o
and
ld kernel.o -o kernel.bin -oformat binary -Ttext 0x20000
both of these were given to me and none of them will work, I get an error saying 'cannot open binary: No such file or directory'
Any ideas?
Thanks.
Linking with LD
Re:Linking with LD
You've got -oformat binary (one hyphen). It should by --oformat binary (two hyphens).
Re:Linking with LD
When I use two hyphens I get the error saying something about operating on PE files?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Linking with LD
isn't this that well-known problem about LD that isn't able to output flat binary from a COFF/PE output ?
Re:Linking with LD
Any ideas on how I should compile and link my C Source to get it to work?
Re:Linking with LD
Compile to PE as normal (i.e. don't use --oformat binary). Use objcopy to convert from PE to binary:
[tt]objcopy -O binary kernel.exe kernel.bin[/tt]
[tt]objcopy -O binary kernel.exe kernel.bin[/tt]