Maximum bootable kernel size in current ARM linux

Russell King - ARM Linux linux at arm.linux.org.uk
Mon Sep 13 08:38:13 EDT 2010


On Mon, Sep 13, 2010 at 01:58:14PM +0200, Matthieu CASTET wrote:
> Russell King - ARM Linux a écrit :
>> On Mon, Sep 13, 2010 at 10:10:39AM +0000, Simon Guinot wrote:
>>> On Mon, Sep 13, 2010 at 05:56:30PM +0800, Haojian Zhuang wrote:
>>>> On Mon, Sep 13, 2010 at 4:43 PM, Marek Vasut <marek.vasut at gmail.com> wrote:
>>>>> Cheers
>>>> If initramfs is built in, we'll get a huge kernel. Even using LZMA, my
>>>> kernel size is near 5MB.
>>> The initramfs is located at the end of the init section and before the
>>> text section. Because the kernel must be able to 'branch' between the
>>> init and text sections, the initramfs size can't be greater than the
>>> 'branch' maximum offset. 32MB ?
>>>
>>> I guess that relocate the initramfs just after the text section should
>>> break this limitation.
>>
>> But then means that it won't be freed after init time.
> And why not putting it before init section ?

You still need code at the start of the kernel for the boot loader to
run, and some of that code needs to be reachable from the __init code.

You could move it away from the start of the kernel, replacing it with
a couple of instructions to branch to it, but then you're into problems
with setting up a 1:1 MMU mapping to cover the necessary code - and
making sure that the instructions don't overlap a mapping boundary.

Moreover, putting an initramfs at the very start risks making kernel
modules useless, as they're placed below the kernel in virtual space.
Adding an initramfs at the start of the kernel image pushes the kernel
text further away from the modules, possibly meaning that the modules
can't be linked.

So, all in all, having a large initramfs built into the kernel is a
stupid idea.  It's not going to work on ARM.



More information about the linux-arm-kernel mailing list