Amir Abedin
Amir Abedin

Reputation: 9

Loading a bootloader function into kernel

I am trying to build a minimal kernel. But I am not sure how to load a function from my custom bootloader into the kernel. Can anybody solve this problem?

Upvotes: 0

Views: 136

Answers (1)

Brendan
Brendan

Reputation: 37262

I am trying to build a minimal kernel. But I am not sure how to load a function from my custom bootloader into the kernel. Can anybody solve this problem?

Typically the each boot loader's code is intended for a different environment, so it doesn't make sense to use the code from any boot loader in the kernel.

For rare cases where that doesn't apply; you might pass a function pointer from boot loader to kernel (possibly as a parameter to the kernel's entry point, but possibly in some kind of table or other data structure that's passed to kernel).

However, even when it is possible, it's likely to be easier to "cut & paste" the function into kernel's code (or use #include or..) instead of calling code in the boot loader. This is especially true if kernel frees/re-uses the memory that the boot loader consumed after the boot loader has done its job.

Upvotes: 1

Related Questions