PC 上 QEMU模拟arm

1. 首先,编译 qemu代码:

 git clone git://git.qemu.org/qemu.git
 cd qemu/
 ./configure  --target-list=arm-softmmu,mipsel-softmmu --enable-debug --enable-sdl
 make
 sudo make install

如果在配置的时候报错:

ERROR: User requested feature sdl
       configure was not able to find it.
       Install SDL devel

执行:

sudo aptitude install libsdl-image1.2-dev

2. 编译 linux  kernel:

wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.tar.bz2
tar xjf linux-3.2.tar.bz2
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
cd linux-3.2
make vexpress_defconfig
make all
3. 创建  ramdisk

先创建一个目录 init, 在init下编写一个小程序init.c,打印 hello, world.

#include <stdio.h>

void main() {
  printf("Hello World!\n");
  while(1);
}
然后,生成 ramdisk:

cd init
arm-linux-gnueabi-gcc -static init.c -o init
echo init|cpio -o --format=newc > initramfs

5. 测试:

qemu-system-arm -M vexpress-a9 -kernel ./linux-3.2/arch/arm/boot/zImage -initrd ./init/initramfs -serial stdio -append “console=ttyAMA0″
PC 上 QEMU模拟arm_第1张图片

参考:

http://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/

你可能感兴趣的:(PC 上 QEMU模拟arm)