Kernel Larger than 14 MB linker script

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
RyanPoint
Posts: 2
Joined: Sun Aug 11, 2019 5:36 pm
Libera.chat IRC: RyanPoint

Kernel Larger than 14 MB linker script

Post by RyanPoint »

Hi,

There is a hold between the guaranteed 14MB if exist and rest of the free memory.
How would one write a linker script so say a kernel larger than 14 MB can be loaded at 1M location as it will be necessary to let linker aware of the hole.

I am no master of linker script. Only way I can think of is to do trail and error and find out where is the approximate cutoff of 14 MB in code. Then setup a section at the cutoff and advance the location counter to accommodate the hole. But this method is tedious. May I ask is there any other way or we should just not load at 1M if kernel is larger than 14 MB?
nullplan
Member
Member
Posts: 1798
Joined: Wed Aug 30, 2017 8:24 am

Re: Kernel Larger than 14 MB linker script

Post by nullplan »

Not even my Linux kernel is that large. If my kernel was so large that it caused problems with the available physical memory, I think I would go with a loader kernel. That is, create a second kernel that sets up paging and then jumps to the original kernel. The original kernel is then a normal ELF executable, only with a really high .text address. If the original kernel is loaded as module or initrd, GRUB (or whatever) will be able to put it wherever it fits. And using virtual memory means even the kernel itself does not really need to care where it was loaded.

Anyway, I don't think that a linker script is the right way to address this.
Carpe diem!
Post Reply