MIPS QEMU Features

From PRPL
Jump to: navigation, search

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

General[edit]

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
Output:

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
 Toolchain type: External toolchain
 Toolchain: Sourcery CodeBench MIPS 2013.11
Kernel
 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

make

  • 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"

Features[edit]

MIPS64R6[edit]