Buildroot and QEMU – the quickest recipe for your own Linux

I will show the quickest way of running your own-built Linux system in QEMU emulator. Did I say quickest? Let’s start then:

Where qemu_arm_versatile_defconfig is file & defconfig name from buildroot/configs directory. Next:

And menu similar to Linux kernel menuconfig shows up. Since we preconfigured it with the defconfig file, there is almost nothing to change here. Be sure to have all tools from Build options —> Commands menu installed in your host system.

In Build options check Enable compiler cache which will save compiler output files and make consequent compilations faster. It is not necessary though.

Now type this and get some coffee:

We have now the time to chat a bit. So, what we have just done is we run a massive process of downloading core packages and compiling them into toolchain, kernel and root filesystem that will became our own, small Linux OS. Ever heard that making Linux for embedded devices is hard? Well, it is. But we have taken three huge shortcuts.

First, by using Buildroot which is a big set of Makefiles that configures and compiles GCC, C library and whole OS ecosystem (BusyBox). What it produces in the end are the Linux kernel and the image of root filesystem.

Second shortcut is configuring Buildroot with qemu_arm_versatile_defconfig. There is nothing to change within the kernel thanks to this. This configuration file along with buildroot/board/qemu/arm-versatile/linux-4.9.config tells Buildroot to set kernel configuration to suit ARM Versatile boards template. This is one of the development platforms supported both by Linux and QEMU out of the box.

The last one is the use of QEMU. Because of that, we do not have to configure any bootloader (like U-Boot for instance). All we need to do is to run one command right after the compilation ends:

This was inspired by buildroot/board/qemu/arm-versatile/readme.txt.

And there it is!

As in every shortcut there is not much to understand here. Please go further:

13. September 2013 by resset
Categories: Software | Tags: , , , , , , , , , | 6 comments

Comments (6)

  1. Pingback: arm64(aarch64)のLinuxカーネルをQEMU上でgdbデバッグする | IT技術情報局

  2. Pingback: Fundamentals of Linux : II | Technofusion

Leave a Reply

Required fields are marked *