1: 下载Qemu源码编译,由于只需要arm的其他的就不编了
./configure --target-list=arm-softmmu --prefix=xxx
make
make install
添加xxx/bin 到环境变量
运行 qemu-system-arm -M ?可以查看qemu支持的开发板,默认支持integratorcp.
2:配置内核,选用integrator_defconfig作为参考配置,另外修改几处地方:
a:system Type->Integrator Options 选择Support Integrator/CP platform
Support ARM926T processor
b:清空boot option中的command line
c:网卡选择SMC 91C9x/91C1xxx support
d:串口选择 ARM AMBA PL011 serial port support
e:input device 中选上Keyboards
f:Graphics support中不要选上VGA text console
3:通过NFS启动Qemu
a:创建qemu-ifup:
#!/bin/sh
echo "Executing /etc/qemu-ifup"
sudo ifconfig tap0 192.168.7.1
b:sudo qemu-system-arm -kernel linux-2.6.32.12/arch/arm/boot/zImage -nographic -append "console=ttyAMA0 root=/dev/nfs rw nfsroot=192.168.7.1:/home/lcq/emulator/root_fs ip=192.168.7.2:192.168.7.1:255.255.255.0" -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=./qemu-ifup
(注意:需要sudo权限,root=/dev/nfs rw中如果不加上rw则为只读,通过上述方法可以在host和qemu间通信,但是qemu是不可以上外网的)
4:如果需要图形界面的话,去掉-nographic和console=ttyAMA0
sudo /home/lcq/tools/qemu-0.12.3/_install/bin/qemu-system-arm -kernel linux-2.6.32.12/arch/arm/boot/zImage -append "console=ttyAMA0 root=/dev/nfs rw nfsroot=192.168.7.1:/home/lcq/emulator/root_fs ip=192.168.7.2:192.168.7.1:255.255.255.0" -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=./qemu-ifup