Buildroot custom kernel under 1MB
Asked Answered
P

2

5

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!

Patriotism answered 9/6, 2015 at 12:58 Comment(4)
The article: Tuning Embedded Linux may help you.Asel
@Asel thank's. I checked this already and it is more related to Yocto. Still very informative! But I was not quite sure how to apply his approach to buildroot. Maybe I am just not familiar enough with buildroot to see the links. Also he list sizes of kernel modules and remove them and I guess it's quite tricky not to break the dependencies.Patriotism
I've posted incomplete answer. What SOC do you use? So I could look into yocto sources and may be recommend anything else.Asel
@Asel I use altera cyclone 5. I also dig into yocto but it looks too overkill for me so I switched to buildroot. Maybe it was wrong assumption :DPatriotism
A
4

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.

Asel answered 9/6, 2015 at 16:37 Comment(0)
W
4

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.

Warhorse answered 10/6, 2015 at 20:56 Comment(1)
This bifferboard config has network and USB: github.com/bifferos/bb/blob/master/tiny/linux-2.6.37.6/.conf‌​igInconvincible

© 2022 - 2024 — McMap. All rights reserved.