Running/building an 32 bits kernel on A53 CPU?

Robin Murphy robin.murphy at arm.com
Fri Oct 29 06:00:34 PDT 2021


On 2021-10-29 11:32, Joakim Tjernlund wrote:
> On Fri, 2021-10-29 at 11:09 +0100, Catalin Marinas wrote:
>> On Fri, Oct 29, 2021 at 08:27:35AM +0000, Joakim Tjernlund wrote:
>>> In order to reduce RAM usage we are wondering if running an 32 bits
>>> kernel on ARM A53 CPU is a good idea?
>>
>> No. Really.
>>
>> What's the RAM size on your SoC?
> 
> 32MB + 4MB SRAM
> 
>>
>>> Is it possible to build such a kernel? If so, how to go about it?
>>> Should one use ARCH=arm and a 32 bits toolchain or
>>> ARCH=arm64 and 64 bits toolchain and adding 32 bits compile options?
>>
>> If you want a 32-bit kernel, you'd have to use ARCH=arm and a 32-bit
>> toolchain. This would give you an ARMv7 kernel that can run on ARMv8
>> hardware. But you'd miss errata workarounds for example and any other
>> features that come with ARMv8.
>>
>> I don't recommend this at all. If you have some specific embedded
>> system, you can disable kernel features you don't need to make it
>> smaller. Also note that you can still run 32-bit applications with a
>> 64-bit kernel.
>>
> I have built the smallest kernel I can(so I think ATM), disabling all the features we
> don't need. We do need IPv4/IPv6 though so that builds size.
> 
> ATM the my memory consumption is(without starting any user space):
>    Memory: 23924K/32768K available (3584K kernel code, 688K rwdata, 568K rodata, 320K init, 244K bss, 8844K reserved, 0K cma-reserved)
> 
> The reserved size is about twice the size of static kernel use, any way to lower the dynamic part?

FWIW, if you haven't already I'd certainly reduce CONFIG_NR_CPUS to the 
minimum you need, as oversized percpu structures can add up. I'd also 
try hacking ARCH_DMA_MINALIGN down to 64 - provided your SoC doesn't 
have a system cache with larger lines - as that should save a bit of 
wastage on smaller allocations.

Robin.



More information about the linux-arm-kernel mailing list