Buildroot and QEMU – the quickest receipe 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: http://buildroot.uclibc.org/downloads/manual/manual.html.

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

Comments (2)

  1. Did everything like in the guide. QEMU shows black screen and nothing happens. Can you please adivse?

    • Hi, I recompiled current version of buildroot (commit 4d1c2c8) and edited article. Basically, method of running qemu has slightly changed. I have qemu 2.8.1. Please note that above example doesn’t turn on network card but I don’t believe it was ever done here. I highly recommend reading qemu-system-arm –help for more options.

Leave a Reply

Required fields are marked *