项目作者: vfdev-5

项目描述 :
QEMU emulation ARMv7
高级语言: Shell
项目地址: git://github.com/vfdev-5/qemu-rpi2-vexpress.git
创建时间: 2016-09-25T23:44:10Z
项目社区:https://github.com/vfdev-5/qemu-rpi2-vexpress

开源协议:

下载


Start Raspberry Pi 2 image in QEMU

In this project you can find some scripts to launch QEMU on image from SD card of Raspberry Pi 2 (rpi2) as ARMv7 (vexpress-a9 or vexpress-a15).

For example, you can dump Ubuntu Mate 16.04 armhf to an SD card and start it in QEMU emulator

This project is similar to qemu-rpi-kernel where versatilepb machine used in QEMU (equivalent to ARMv6).

QEMU installation:

You need to use qemu-system-arm, to install qemu execute the following :

  1. sudo apt-get install qemu

Usage :

Important: Certain files on the SD card image are modified in order to start emulation in QEMU.

  • Insert micro SD and findout its device file. For example, device root file is /dev/sdb
  • in terminal start command :
  1. bash start.bash /dev/sdb [--no-verbose]

Image modifications for QEMU:

QEMU emulation requires modification in /etc/fstab and /etc/ld.so.preload files
For more details, see, for example, here or here or even here

Thus, start.bash script mounts the device to access its system files, copies original /etc/fstab and /etc/ld.so.preload and comments the lines:

  1. /dev/mmcblk0p2 / ext4 defaults,noatime 0 1
  2. /dev/mmcblk0p1 /boot/ vfat defaults 0 2

and

  1. /usr/lib/arm-linux-gnueabihf/libarmmem.so

Details :

The command to launch QEMU emulator on /dev/sdb is

  1. sudo qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel-qemu-4.4.1-vexpress -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd /dev/sdb -append "root=/dev/mmcblk0p2 rw rootfstype=ext4"

Linux kernel 4.4.1 and DTB

Linux kernel used with QEMU is a build of Linux 4.4.1 configured on vexpress :

  1. $ cd linux-4.4.1
  2. $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- vexpress_defconfig
  3. $ cat >> .config << EOF
  4. > CONFIG_FHANDLE=y
  5. > CONFIG_LBDAF=y
  6. > EOF
  7. $ make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- all
  8. ...
  9. $ cp arch/arm/boot/zImage ../kernel-qemu-4.4.1-vexpress
  10. $ cp arch/arm/boot/dts/vexpress-*.dtb ../

See download_and_compile_kernel.bash for more details.