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?
Whats the problem with ld linker???
Re:Whats the problem with ld linker???
I don't use grub or know anything about it, but...
is the file format that you selected to boot flat binary?
is the file format that you selected to boot flat binary?
Re:Whats the problem with ld linker???
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
Check here for a good tutorial on using GRUB:
http://osdev.neopages.net/docs.php
Re:Whats the problem with ld linker???
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.
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???
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???
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...
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???
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?