MIPS QEMU MIPS64R6

From PRPL
Jump to: navigation, search

Information about MIPS64R6 feature branch[edit]

MIPS64 Release 6 features are available on i6400-mips64r6-PRIP4 branch on prpl. They are being upstreamed and should appear in v2.4 QEMU.

Example: Running MIPS64R6 Linux kernel on QEMU[edit]

This example shows how to build MIPS64R6 Linux kernel and minimal root filesystem (BusyBox) and run on emulated MIPS Malta board in QEMU.

In this example I used the following:

Preparation[edit]

These steps assume that directory containing qemu-system-mips64el is in $PATH and $IMAGES is a path to a directory where built images will be copied to.

Build MIPS64R6 64-bit kernel[edit]

Configure[edit]

Go to the Linux kernel top directory and use predefined configuration for malta:
$ make ARCH=mips malta_defconfig
Make additional changes in order to prepare MIPS64R6 64-bit kernel with ram filesystem support:
$ make ARCH=mips menuconfig

  • Select MIPS64R6 CPU type
   CPU selection  --->
   CPU type (MIPS64 Release 6 (EXPERIMENTAL))
  • Select 64-bit kernel
   Kernel type  --->
   Kernel code model (64-bit kernel)  ---> 
  • Add support for initial ram filesystem
   General setup  --->
   [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

Build[edit]

$ make ARCH=mips CROSS_COMPILE=mips-img-linux-gnu-

vmlinux should appear, copy it to $IMAGES
$ cp vmlinux $IMAGES

Build rootfs with BusyBox[edit]

Configure[edit]

Go to busybox directory and use default configuration
$ make defconfig
Make additional changes (i.e. build static binary and disable RPC services)
$ make menuconfig

  • Select a static build
   Busybox Settings  --->
   [*] Build BusyBox as a static binary (no shared libs)
  • Unset RPC services (as it failed to build for me)
   Networking Utilities  --->
   [ ]   Support RPC services

Build[edit]

$ make CROSS_COMPILE=mips-img-linux-gnu- CFLAGS="-EL -mabi=64" LDFLAGS="-EL -mabi=64" install

The root filesystem tree will appear in _install directory. In order to create an image use cpio tool:
$ cd _install/
$ find . | cpio -o -H newc > $IMAGES/rfs_mip64r6el.cpio

Running on mips64r6-generic CPU[edit]

Run just built Linux kernel and root filesystem on mips64r6-generic CPU in QEMU:
$ cd $IMAGES
$ qemu-system-mips64el -cpu mips64r6-generic -M malta -kernel vmlinux -nographic -no-reboot -append "rdinit=/bin/sh" -initrd rfs_mip64r6el.cpio
Linux kernel will start booting and eventually will execute /bin/sh.

Once command prompt appeared, we can for example mount /proc filesystem and read system information:

# mkdir /proc && mount -t proc none /proc
# cat /proc/cpuinfo | grep -i mips
   system type             : MIPS Malta
   cpu model               : MIPS GENERIC QEMU V0.0  FPU V0.0
   BogoMIPS                : 978.94
   isa                     : mips32r6 mips64r6