MIPS QEMU Features

Jump to: navigation, search

This page indexes documentation designed to enable you to explore the usage of QEMU:


How to build QEMU for MIPS[edit]

1. Download QEMU from prpl QEMU repository
git clone https://github.com/prplfoundation/qemu.git

2. Configure (it is recommended to build QEMU in an empty directory)
<qemu source path>/configure --prefix=<install path> --target-list=<target list>

Available MIPS-specific targets:
System emulation mode: mips-softmmu, mipsel-softmmu, mips64-softmmu, mips64el-softmmu
Userland emulation mode: mips-linux-user, mipsel-linux-user, mips64-linux-user, mips64el-linux-user, mipsn32-linux-user, mipsn32el-linux-user

3. Build:
make install

How to prepare Linux user land programs for running on QEMU[edit]

There are numerous toolchains for the MIPS architecture. In this example Codesourcery CodeBench Lite Edition GNU/Linux is used. Imagination technologies provide a free toolchain with libraries for MIPS cores here Codescape MIPS SDK Essentials:

  • hello.c:
#include <stdio.h>
void main()
    printf("hello world!\n");
  • Build:

mips-linux-gnu-gcc -static -mips32r2 -o hello hello.c

  • Run:

qemu-mips -cpu mips32r5-generic hello

hello world!

Building Linux kernel code and running a Linux system emulation on QEMU[edit]

This example shows how to build Linux kernel and root filesystem using buildroot. The configuration used below is minimal, you might want to change it (including versions of buildroot / toolchain / Linux kernel) to meet your needs.

make qemu_mips_malta_defconfig
make menuconfig
Modify Toolchain and Kernel:

 Toolchain type: External toolchain
 Toolchain: Sourcery CodeBench MIPS 2013.11
 Kernel version: Custom Git repository
 URL of custom repository: git://www.linux-mips.org/pub/scm/linux-mti.git
 Custom repository version: linux-mti-3.10.42
  • Build


  • Run the system on QEMU

cd output/images
qemu-system-mips -cpu mips32r5-generic -M malta -nographic --no-reboot -kernel vmlinux -hda rootfs.ext2 -append "root=/dev/hda console=ttyS0"