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...
kernel size
Re: kernel size
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.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: kernel size
here is the linker:
that is nothing more then the Bran's tutorial..
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 = .;
}
Re: kernel size
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
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.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??
JAL
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: kernel size
What does the first line of his linker script say?jal wrote: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.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??
JAL
Re: kernel size
Sorry, hit that reply button too fast. Won't do again, promise.Craze Frog wrote:What does the first line of his linker script say?
JAL
Re: kernel size
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.Craze Frog wrote:What does the first line of his linker script say?jal wrote: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.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??
JAL
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: kernel size
Is the file really 104kb? Or is it just your calculations?