General discussion about anything related to Ultibo.
2 posts • Page 1 of 1
Is there an ultibo function that returns the kernel size (reflective of the size of kernel7.img?) I'd like to report it in a web status page. Thanks, Mark.
Ultibo - The Internet of Things that Just Work
mark wrote:Is there an ultibo function that returns the kernel size (reflective of the size of kernel7.img?)
There is no specific function available but it is very easy to calculate based on information already known to the kernel.
Near the top of the GlobalConfig unit you will find variables that reference the "Kernel Image sections" and describe the start and end of code, initialized data and uninitialized data, you can also see in the WebStatus unit how to use these variables to get the start and end addresses of each section.
If you just want to know the size of the kernel7.img file (without looking at the file itself) then subtracting _text_start from _edata will give a very close match (the difference is just the size of the kernel trailer which does not get loaded info memory).
Remember of course that the kernel image does not include the BSS (unitialized data) section because it is all zeroes so there is no point including it in the file, if you want to know the total size of the kernel including the BSS then subtracting _text_start from _bss_end will tell you that.
Note that this only tells you the raw loaded size, there are other structures created during boot like the page tables, initial stack, initial heap etc that consume memory but are not part of the image size as such, most of those are also available as GlobalConfig values as well.
Ultibo.org | Make something amazing
Who is online
Users browsing this forum: No registered users and 0 guests