Using Qemu-system-arm to simulate an arm environment under Ubuntu

Source: Internet
Author: User

Reprint please indicate the source of the original, http://www.cnblogs.com/flyingcloude/p/6992396.html

Recently, due to learning needs, began to build an embedded development environment, but the hardware platform has not been ready, so first in the Ubuntu environment simulation.

The following method installs a ARM11 operating system on the ubuntu10.10 host, using Qemu-system-arm. The system uses NFS to mount the file system, which can be used to simulate the operating environment of ARM11.

Installing Qemu-system-arm

(The use of QEMU was introduced in http://www.cnblogs.com/flyingcloude/archive/2012/10/18/2730052.html.)

sudo add-apt-repository ppa:linaro-maintainers/tools sudo apt-get update sudo apt-get install Qemu-system

Once installed, you can execute the following command to view the version.

    Qemu-system-arm--version

Compiling the ARM11 kernel

1. Create folder ~/arm/kernel and switch working directory

        mkdir ~/arm        mkdir ~/arm/kernel        cd ~/arm/kernel

2. Download Eabi tar Package

wget https://sourcery.mentor.com/sgpp/lite/arm/portal/package8734/public/arm-none-eabi/ Arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2tar XJVF arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

3, download, unzip, for the kernel to hit the ARMV6 support patch

wget HTTP://WWW.KERNEL.ORG/PUB/LINUX/KERNEL/V3.0/LINUX-3.0.4.TAR.BZ2TAR-XVF Linux-3.0.4.tar.bz2wget/http Thoronir.net/raspi-dev/linux-arm.patchpatch-p1-d linux-3.0.4/< Linux-arm.patch

4. Set Kernel compilation options

Install ncurses First

sudo apt-get install Libncurses5-dev
CD linux-3.0.4make arch=arm versatile_defconfigmake arch=arm menuconfig

General Setup->cross-compiler Tool prefix (We need-enter the path of the toolchain followed by '/bin/arm-none-eabi-' )

It's/usr/local/arm-2011.03/bin/arm-none-eabi-on my computer.

System type-> [*] Support arm V6 processor[*] arm errata:invalidation of the instruction Cache operation can fail
Kernel features-> [*] Use ARM EABI to compile the kernel[*] allow old ABI binaries to run with this Kernel
Bus support-> [*] PCI support
Device DRIVERS->SCSI Device support-> [*] SCSI device support[*] SCSI Disk support[*] SCSI CDROM support[*] SCSI L  Ow-lever drivers->[*] sym53c8xx  Version 2 SCSI supportdevice drivers->generic Driver options-> [*] Maintain A DEVTMPFS filesystem to Mount At/dev[*] AutoMount Devtmpfs At/dev, after the kernel mounted the Rootdevice DRIVERS-&G T;input device support-> [*] Event interfacedevice drivers-> [*] Real time Clock
File Systems->pseudo filesystems-> [*] Virtual Memory file system support (former SHM FS)

5. Compile the kernel

Make Arch=arm

Making a file system

1. Create a new file system target and download the file

CD ~/armmkdir debian_armel_squeezesudo debootstrap--foreign--arch Armel Squeeze Debian_armel_squeeze/http/ Ftp.tw.debian.org/debian

If the debootstrap is not installed, install it first

sudo apt-get install Debootstrap

2. Installing kernel modules

CD Linux-3.0.4sudo make Arch=arm install_mod_path=. /debian_armel_squeeze Modules_install

3. Copy Zimage

CD ~/ARMCP Kernel/linux-3.0.4/arch/arm/boot/zimage.

Configuring NFS Services

1. If NFS is not installed, install the NFS package first

sudo apt-get install nfs-kernel-server Nfs-common

2. Adding a service path, adding a row to the configuration file

/home/ubuntu/arm/debian_armel_squeeze  * (Rw,sync,no_root_squash)

3. Save and restart the NFS service

sudo service nfs-kernel-server restart

Network configuration

After configuring the network, the host Ubuntu and the virtual ARM11 system are on the same network segment, connected in bridge mode. If your computer is under a router, the virtual machine ARM11 system and Ubuntu can access the extranet after the configuration network is complete.

1. Open Tun/tap option

1. See if the option is already open

grep config_tun=/boot/config-2.6.35-32-generic

2. See if/dev/net/tun exists, and if it does not exist, you can create it

Mknod/dev/net/tun C 10 200

2. Installation Bridge Tool

sudo apt-get install bridge-utils

3. Initialize the ARM11 system

1. Initialize the network

sudo brctl addbr br0sudo ifconfig eth0 0.0.0.0 promisc upsudo brctl addif br0 eth0sudo dhclient br0sudo iptables-f Forwar D

2. Start ARM11 System

CD ~/ARMDD If=/dev/zero of=rootfs.ext2 count=6mmkfs.ext2 rootfs.ext2mkdir mntsudo mount-o Loop rootfs.ext2 mntsudo CP Deb ian_armel_squeeze/* Mnt-asudo Umount mnt

sudo qemu-system-arm-m versatilepb-cpu arm1176-m 256-hda rootfs.ext2-kernel zimage-append "Root=/dev/sda RW init=/bi N/bash "-serial stdio

After the system starts successfully, the shell interface appears, run the following command

Mount/proc/proc-t/proc  

Set host name and password

printf "Auto eth0\niface eth0 inet dhcp\n" >> etc/network/interfaces   echo "Arm-debian" >/etc/hostname   

By this, the system has been completed to stop QEMU from rebooting the system

sudo qemu-system-arm-m versatilepb-cpu arm1176-m 256-hda rootfs.ext2-kernel zimage-append "ROOT=/DEV/SDA"-serial St Dio

Reference: http://www.cnx-software.com/2011/10/18/raspberry-pi-emulator-in-ubuntu-with-qemu/

Reprint please indicate the source of the original, http://www.cnblogs.com/flyingcloude/p/6992396.html

Using Qemu-system-arm to simulate an arm environment under Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.