Page 1 of 1

Kernel doesn't fit into memory (?)

Posted: Mon Sep 09, 2002 5:17 am
by Whatever5k
When I try to build my kernel with elf, there's the error message:
"ld: kernel.bin: Not enough space for program headers, try linking with -N"
Ok, I did so and it worked. Now I tried to load my kernel with GRUB, but the following error message is printed:
"Kernel does not fit into memory"

What's wrong? My kernel is only 10878 bytes big...
Can somebody help me please?

Re:Kernel doesn't fit into memory (?)

Posted: Mon Sep 09, 2002 9:41 am
by Whatever5k
Ok now I do not have the message
"Not enough room for program headers..."
anymore - I fixed s.th. in the linker script.
But still, GRUB sais that the kernel doesn't fit into memory...
Please help me...
This here is my linker script:

Code: Select all

OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS
{
    .text 0x100000 :   /* 1 meg */
    {
/* kernel code */
   code = .; _code = .; __code = .;
   *(.text)
    }
    .data :
    {
/* kernel data */
   data = .; _data = .; __data = .;
   *(.data)
    }
    .bss :
    {
/* kernel BSS */
   bss = .; _bss = .; __bss = .;
   *(.bss)
   *(COMMON) /* GNU C "common" variables */
    }
    end = .; _end = .; __end = .;
}
Help, please

Re:Kernel doesn't fit into memory (?)

Posted: Tue Sep 10, 2002 6:44 am
by Whatever5k
Hey, really nobody ever had this problem before me?
Come on... ;)

Re:Kernel doesn't fit into memory (?)

Posted: Tue Sep 10, 2002 10:38 am
by Whatever5k
Hm, perhaps GRUB cannot load my kernel because I move the GDT to 0x500. Might this be the problem?

Re:Kernel doesn't fit into memory (?)

Posted: Tue Sep 10, 2002 2:55 pm
by Dave_Hunt
No. GRUB doesn't know where your GDT is.

Did you perhaps declare an exceptionally large array somewhere in your C code? If so, it would get stuck in the .bss section and wouldn't show up in your file size.

What does objdump -h show you?

Re:Kernel doesn't fit into memory (?)

Posted: Wed Sep 11, 2002 4:51 am
by Whatever5k
Hm, I have created a bss section (zero'd it) and reserved 4096 bytes (4Kb) for it. This should be enough, shouldn't it?
Of course I reserve some char-arrays (char buffer[MAXLEN], MAXLEN is 500), but this should be sufficient...

I really am in big trouble, I do not know what to do..:(

Re:Kernel doesn't fit into memory (?)

Posted: Wed Sep 11, 2002 10:17 pm
by Dave_Hunt
What does objdump -h show you?