Page 1 of 1
kernel size
Posted: Mon Mar 30, 2009 4:03 pm
by Srowen
my kernel compiled is 12kb and i define a stack of 8 kb. so the kernel should be about 20kb.. but if i try to calculate it with the end of the kernel (i use a symbol at the end of the linker) and the kernel start, i can see that is 104kb! there's something wrong on my operations or it is possible that the kernel is so big??
sorry for my bad english...
Re: kernel size
Posted: Mon Mar 30, 2009 5:22 pm
by neon
It might have to do with padding and/or alignment of the sections in your kernel binary. Hard to tell without looking at a linker map.
Re: kernel size
Posted: Tue Mar 31, 2009 1:16 am
by Srowen
here is the linker:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
that is nothing more then the Bran's tutorial..
Re: kernel size
Posted: Tue Mar 31, 2009 1:28 am
by skyking
What you need to do is to run objdump and then you see what's in your kernel. What section is occupying too much space. And when you've seen this you can use objdump to see what symbols are present in that section.
Re: kernel size
Posted: Tue Mar 31, 2009 4:51 am
by jal
Srowen wrote:i can see that is 104kb! there's something wrong on my operations or it is possible that the kernel is so big??
Have you stripped the kenel? If not, all symbols may be present making it big. If it's an ELF file, using elfdump or the like to check.
JAL
Re: kernel size
Posted: Tue Mar 31, 2009 8:31 am
by Craze Frog
jal wrote:Srowen wrote:i can see that is 104kb! there's something wrong on my operations or it is possible that the kernel is so big??
Have you stripped the kenel? If not, all symbols may be present making it big. If it's an ELF file, using elfdump or the like to check.
JAL
What does the first line of his linker script say?
Re: kernel size
Posted: Tue Mar 31, 2009 1:11 pm
by jal
Craze Frog wrote:What does the first line of his linker script say?
Sorry, hit that reply button too fast. Won't do again, promise.
JAL
Re: kernel size
Posted: Wed Apr 01, 2009 10:41 am
by skyking
Craze Frog wrote:jal wrote:Srowen wrote:i can see that is 104kb! there's something wrong on my operations or it is possible that the kernel is so big??
Have you stripped the kenel? If not, all symbols may be present making it big. If it's an ELF file, using elfdump or the like to check.
JAL
What does the first line of his linker script say?
Well it wouldn't hurt to output an ELF variant of the kernel as well (or a mapfile). It's not fun to read through a 104kb binary file to see what's occupying all space.
Re: kernel size
Posted: Wed Apr 01, 2009 1:05 pm
by Craze Frog
Is the file really 104kb? Or is it just your calculations?