Page 1 of 1
Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 11:03 am
by Unexpected
I don't understand, what the problem
In what file format is kernel?
In flat binary yea?
I have a grub loader in fat12 floppy...
Grub loading kernel.bin file....
I compiled all correct... I do all what was wrote in this forum...
But my kernel doesn't load!
I try with grub... but grub wrote "Bad executable format" or smth...
What can I do?
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 11:27 am
by Tom
I don't use grub or know anything about it, but...
is the file format that you selected to boot flat binary?
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 11:44 am
by Dave_Hunt
Try using ELF format and make sure your multiboot header is correct and at or near the beginning of your kernel image.
Check here for a good tutorial on using GRUB:
http://osdev.neopages.net/docs.php
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 12:51 pm
by Unexpected
I compiling like this:
gcc -c kernel.c -o kernel.o
ld -T kernel.ld kernel.o
kernel.ld file is like this:
OUTPUT_FORMAT("binary")
ENTRY(_start)
SECTIONS
{
.text 0x100000 : {
*(.text)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
Is there smth wrong?
Thnx.
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 1:25 pm
by Dave_Hunt
The problem isn't just with the way you linked. The problem is that you have to use a format that GRUB recognizes. This includes setting up a valid multiboot header in your executable image that tells GRUB what format you used and how to deal with it. Take a look at the tutorial I mentioned. It's all explained there.
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 1:57 pm
by Unexpected
How about when I use not a grub, I use simple boot code, witch loads the kernel, sets pmode and jumps to 0x1000:0x0000
Kernel is placed in sector 1.
In what format I need to compile the kernel?
Boot sector works fine, but with kernel something wrong... Is nothing happens or rebooting PC...
My kernel is verys simple just printf and freeze funtions.
Wath the problem?
Please help...
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 2:30 pm
by Tom
Try some of my code...I don't know what's wrong with your C Kernel untill I see your code too...Where did you get your printf and freeze function?
Re:Whats the problem with ld linker???
Posted: Thu Oct 24, 2002 5:02 pm
by PlayOS
[attachment deleted by admin]
Re:Whats the problem with ld linker???
Posted: Fri Oct 25, 2002 7:11 am
by Unexpected
Very thank you!
My kernel works fine
THANX!!!