Page 1 of 1

How do I tell how large the kernel is in the code?

Posted: Fri Aug 22, 2003 11:00 pm
by bowchow79
I need to reserve the kernel's memory and not allocate it so to do this I would have to have where the kernel starts and how large it is.  I know the first, and I would imagine the second is some time of compiler directive.  Anyone know how to do this?  I'm using the gcc compiler.

Or, alternatively, does anyone know any place with good documentation of the gcc compiler and it's features/directives?  I tried their site but couldn't find anything, hence me asking questions like this.

RE:How do I tell how large the kernel is in the code?

Posted: Sat Aug 23, 2003 11:00 pm
by mikeleany
For info about gcc, type "info gcc" at the command prompt. To find out where the kernel ends, I stick an identifier called __end_kernel at the end of my linker script. You have one of those, don't you? If not, I suggest you make one. You can learn about how to make and use one by typing "info ld" at the command prompt.

RE:How do I tell how large the kernel is in the code?

Posted: Sat Aug 23, 2003 11:00 pm
by bowchow79
I'm using a DOS shell in XP; info gcc or info ld don't work, and ld --help isn't much help at all.  When I try to put something like __end or __end_kernel at the end of my linker script, it gives me a parse error.  Assuming it worked well, would I be able to find the size in C with something like "(unsigned long)(&__end- &__start)"?  I'm sorry for all the questions, but I do really appreciate your help!

RE:How do I tell how large the kernel is in the code?

Posted: Sat Aug 23, 2003 11:00 pm
by mikeleany
They should still provide the documentation with gcc in some format you can read (such as html), but I don't know. I don't use Dos. The line "__end_kernel = .;" in your linker script should work (it works for me). Yes, that C code should give you the size.