- http://www.bravegnu.org/gnu-eprog/arm-lab.html
- http://www.linuxforu.com/2011/06/qemu-for-embedded-systems-development-part-1/
1. Setting up the ARM Lab
This section shows how to setup a simple ARM development and testing environment in your PC, using Qemu and the GNU toolchain. Qemu is a machine emulator capable of emulating various machines including ARM based machines. You can write ARM assembly programs, compile them using the GNU toolchain and execute and test them in Qemu.Qemu ARM
Qemu will be used to emulate a PXA255 based connex board from Gumstix. You should have at least version 0.9.1 of Qemu to work with this tutorial. The PXA255 has an ARM core with a ARMv5TE compliant instruction set. The PXA255 also has several on-chip peripherals. Some peripherals will be introduced in the course of the tutorial.Installing Qemu in Ubuntu
Download source from http://download.savannah.gnu.org/releases/qemu/. I use the lastest version now is qemu-0.14.1.tar.gz. Untar and compile for ARM:# tar -xzvf qemu-0.14.1.tar.gz
# ./configure --target-list=arm-softmmu
# make # sudo make install
Note: Remember to install SDL lib before make the qemu. If not it will show message "VNC server started at 127.0.0.1:5869" and nothing to show.
sudo apt-get install libsdl1.2-devInstalling GNU Toolchain for ARM
Download the GNU toolchain for ARM, available from from http://www.codesourcery.com/gnu_toolchains/arm
Extract the source and set the environment:
# export CROSS_COMPILE=arm-none-linux-gnueabi-
# export ARCH=arm
# export PATH:=$PATH:~/arm/lite/2010q1-202/bin
2. Build Linux kernel for ARM and run on Qemu
Download the linux source from http://www.kernel.org/pub/linux/kernel/v2.6/. Example linux-2.6.37.tar.bz2
Extract the source and compile
# tar xjf linux-2.6.37.tar.bz2# make versatile_defconfig# make uImageImage Name: Linux-2.6.37
Created: Tue Sep 25 22:25:29 2012
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1577924 Bytes = 1540.94 kB = 1.50 MB
Load Address: 00008000
Entry Point: 00008000
Image arch/arm/boot/uImage is ready
Then check the file:
Run on qemu:
#file arch/arm/boot/uImagearch/arm/boot/uImage: u-boot legacy uImage, Linux-2.6.37, Linux/ARM, OS Kernel Image (Not compressed), 1577924 bytes, Tue Sep 25 22:25:29 2012, Load Address: 0x00008000, Entry Point: 0x00008000, Header CRC: 0x9EE022C0, Data CRC: 0x9CD7BA5A
# qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.37/arch/arm/boot/uImage
A dummy filesystem for your testing:
Write a simple hello.cCompile:
#include
int main(){
while(1){
printf("Hello Open World\n");
getchar();
}
}
# arm-none-linux-gnueabi-gcc hello.c -static -o hello
# echo hello | cpio -o --format=newc > rootfs
1269 blocks
# file rootfs
rootfs: ASCII cpio archive (SVR4 with no CRC)
You now have a dummy filesystem ready for testing with this command:
# qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.37/arch/arm/boot/zImage -initrd rootfs -append "root=/dev/ram rdinit=/hello" -serial stdio