Cboot, initrd file size limit increase


We would like to use an initrd as our rootfs, as we do with other systems, the cpio file is around 210MBytes and cboot fails to load it. Poking around the cboot source I can see that there is a limit:


#define RAMDISK_MAX_SIZE		0x04000000

I have tried increasing this to 0x10000000 but it results in a non booting xavier with a corrupt display.

Any ideas what else I need to change?



The way Linux loads into memory the kernel has some fixed start address, e.g., something like 0x80000000 (don’t remember if this is actually correct, but is representative of a physical address in the middle of the memory range). Modules and initrd occur just below this. The method of going between modules and initrd with the regular kernel code is by a direct branch assembler instruction.

The range available to a direct branch instruction depends on architecture, but on 64-bit ARM it is 128MB. On 32-bit ARM it is 32MB. If you go to an instruction within that range, and then execute initrd or module code which extends beyond that range, then there is no way to branch back into the kernel. You will have an undefined behavior when one part of the kernel can no longer reach another part. The size of the initrd and modules combined should not exceed 128MB on arm64. There is no way around this limit without changing architecture.