Buildroot custom kernel under 1MB

3.2k views Asked by At

I am trying to build minimal kernel under 1 Mb with Buildroot. It is intended for small board with qspi memory and basic functionality, ethernet, usb, spi, and some GPIO's. Basic terminal access via ssh and UART. My first thoughts are if it is even possible to modify kernel .config via linux-menuconfig to reach this size.

Also if it is possible to identify the redundant parts without deep knowledge about kernel architecture and exclude them from compilation.

If someone can direct me to good direction how to solve this problem or even specify some tools and ways how to do it would be very helpful.

Thank you!

2

There are 2 answers

0
alexander On BEST ANSWER

If you have working build root for your board, than, it's better to continue to work with it. Technic for disabling kernel options should be the same. In the article he reached ~0,7MB uImage with lost a lot of functionality (p40). He started with minimal (bare) config (p27) and add blocks of configs. So instead of identify the redundant parts you can build smallest possible uImage you can boot. Than add to it more options: ext2, serial and so on. Actually this work require a lot of testing. And you probably brake dependencies.

Kernel configs (working and new one) could be compared using diff -Naur, so you can see what changed.

Offtopic:

Looks like yocto officially supported by altera. here are instructions how to build altera-image-minimal. If you fine with it size, than use it and don't spend time on minimizing uImage. If you need extra packages installed into it, than you can ease extend it.

And here are instructions about building Angstrom (yocto based distribution). You can create you custom image based on console-image-minimal.

I use Angstrom in production. Must say, it was really hard to use it first time.

1
Arnout On

Whether or not you build the kernel with buildroot is not really relevant. The important thing is to configure it so it fits in 1MB. When you build the kernel from buildroot, you can do that with make linux-menuconfig, as you mention.

That said, getting a kernel under 1MB will be quite hard. Biff once did this for an x86-based platform, bifferboard. But that was without networking or USB.

You can refer to the kernel size tuning guide, which has links to some patches to reduce the size. But it's not been updated in a couple of years.