Building Embedded Linux System with Qemu

In my Embedded Linux courses, I’m using Qemu to simulate a Linux system. Qemu simulates many boards including hardware, interrupts, networking and more.

In this tutorial, I’ll cover the steps to build a complete system including kernel, filesystem, and application

Qemu – Building from source

You can install binary version but it is better to download and build Qemu from source because we can use the source to simulate a new hardware.

The last step checks if your system meets all qemu requirements. If you get error messages you need to install missing packages. I’m using Ubuntu and it’s very easy to install the missing parts, for example, I got the following message:

after searching Google install the required packages

more packages needed:

Now run configure again and check that SDL support is reported yes

run make

To check if qemu is installed correctly run


ARM Toolchain

The first thing we need to install is a cross toolchain for ARM. Go to and download the Linux version, extract it in ~/armsystem/toolchain directory

Add the location to the PATH environment variable:


Linux Kernel

Go to and download the latest kernel. It is recommended to use long-term supported version. Extract the files in an empty directory ~/armsystem/kernel

Edit the kernel Makefile (line 253)

Set the config file

Run make

Now we can check the kernel in QEMU using the command:

The system will boot but crashed because we didn’t build the file system yet


Building The Filesystem

We can use many tools to build an embedded Linux file system. Some examples are buildroot, OpenWRT, yocto

In this tutorial, we will use buildroot because it is the easiest tool

Download the latest Buildroot package from here and extract it in ~/armsystem/fs

Open the configuration menu:

On the target options select target architecture – ARM

You can use buildroot to download and install an external toolchain from Sourcery (recommended) or use the existing toolchain we already downloaded

We will use the Sourcery toolchain because it has some plugins to IDEs

To download Sourcery toolchain – from the toolchain menu select:

  • Toolchain type (External toolchain)
  • Toolchain (Sourcery CodeBench ARM 2014.05)
  • Toolchain origin (Toolchain to be downloaded and installed)
  • Copy gdb server to the Target

Save the configuration and build it

After the build is finished without errors you can find the new toolchain in

Add it to the PATH variable, change the kernel Makefile and build it again

The generated file system is located in buildroot/output/target but we can’t use it yet


Using Root Filesystem via NFS

The best way to work with embedded board, is to mount the target filesystem via NFS (on the host) to do that, we need to do some setup:

Install NFS server

Edit /etc/exports to add the NFS folder

Restart the NFS server


Configure QEMU tap networking

Qemu can use a private networking with ubuntu using tap/tunnel mode. To setup it, create the file /etc/qemu-ifup:

Add execute permission to the file (chmod a+x /etc/qemu-ifup)

Creating the Root Filesystem folder

Copy the generated files ~/armsystem/outfs

Now add the following device files using root user:

If you want the device files to generated automatically, configure udev. With buildroot it is very easy:

From the system configuration menu select /dev management (Dynamic using devtmpfs + eudev)

And from Target packages > Hardware handling menu, select eudev

Build buildroot and you will see the udev running on init:

Create the running script

Create a script in ~/armsystem – run_qemu

Add execute permission and test it using sudo (It starts a new network device)


That’s it!!!

We can now write a testing application, compile and run in qemu:


Now we can also build complex applications, kernel modules and more (Next posts …)





3 thoughts on “Building Embedded Linux System with Qemu

  1. Wow , you are so impressive! I was a student with Linux certs with hand on experience as a student but nit much work experience with Linux but microsoft. I will want to istall and do this. Thank you for sharing and posting this. Very appreciated!

  2. Thanks to sharing tour Know-how.

  3. […] Let go over the process. You can do it yourself , just build an Embedded Linux system with QEMU […]

Leave a Reply

Your email address will not be published. Required fields are marked *