Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

QEMU

2,906 bytes added, 10:06, 31 August 2012
Board Emulation
= '''QEMU on IGEP Boards''' =
[http://wiki.qemu.org/Main_Page '''QEMU''']   is a [http://en.wikipedia.org/wiki/Central_processing_unit processor] [http://en.wikipedia.org/wiki/Emulator generic and open source machine emulator] that relies on dynamic [http://en.wikipedia.org/wiki/Binary_translation binary translation] to achieve a reasonable speed while being easy to port on new host CPU architecturesand virtualizer.
In conjunction with CPU emulation, it also provides When used as a set of device modelsmachine emulator, allowing it to QEMU can run a variety of unmodified guest [http://enOSes and programs made for one machine (e.wikipediag.org/wiki/Operating_system operating systems]; it can thus be viewed as an ARM board) on a [http://endifferent machine (e.g.wikipediayour own PC).org/wiki/Virtual_machine_monitor#Classification hosted virtual machine monitor]By using dynamic translation, it achieves very good performance. It also provides an accelerated mode for supporting  When used as a mixture of binary translation (for kernel code) and virtualizer, QEMU achieves near native execution (for user performances by executing the guest code), in directly on the same fashion as [http://enhost CPU.wikipediaQEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux.org/wiki/VMware_Workstation VMware Workstation] When using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests.  QEMU documentation can be found [http://enwiki.wikipediaqemu.org/wiki/VirtualBox VirtualBoxManual here]. QEMU can also be used purely for CPU emulation for user level processes, allowing applications compiled for one architecture to be run on another.<br>
== Build QEMU with IGEP support ==
$ [http://git.linaro.org/gitweb?p=qemu/qemu-linaro.git;a=summary git clone git://git.linaro.org/qemu/qemu-linaro.git]
Download IGEP support patch for QEMU from this [http://downloadswww.igepisee.esbiz/QEMUcomponent/zoo/item/0001qemu-IGEP_QEMU_support.path emulator link ]and after that apply the patch as: <pre>$ cd qemu-linaro $ patch -p1 &lt; 0001-IGEP_QEMU_support.path</pre> Configure the sources for build with this command: <pre>$ ./configure --target-list=arm-softmmu --prefix=/opt/qemu-linaro</pre> Build the sources: <pre>$ make </pre> Install QEMU: <pre>$ make install</pre> Optionally you can download from [http://www.isee.biz/component/zoo/item/qemu-emulator here] the QEMU binaries, we suggest install it under /opt directory with the right user execution permissions.<br>  == Board Emulation == Go to your qemu install directory.<br> <pre>$ cd /opt/qemu-linaro/bin</pre> We provide a QEMU ready image based on Ubuntu/Linaro Nano (Oneric 11.11) image, it can be download from [http://www.isee.biz/component/zoo/item/qemu-emulator here] (first uncompress it).<br>  The image has 2 partitions (you can see the partitions using fdisk -ul command as: fdisk -ul igep-nano.img)<br>  Device&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Boot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Blocks&nbsp;&nbsp; Id&nbsp; System<br>  igep-nano.img1&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 63&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 106494&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 53232&nbsp;&nbsp;&nbsp; c&nbsp; FAT32 LBA (Boot)<br>  igep-nano.img2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 106496&nbsp;&nbsp;&nbsp;&nbsp; 1048575&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 470016&nbsp;&nbsp; 83&nbsp; Linux (Root filesystem)<br>  Optionally you can mount the partitions in you host PC and modify the content as:<br> <pre>First Partition: $ mount -o loop,offset=$[63*512] igep-nano.img /mnt/tmp</pre><pre>Second Partition: $ mount -o loop,offset=$[106496*512] igep-nano.img /mnt/tmp</pre> Now you're ready for execute the emulator in a console with this command:<br> <pre>qemu-system-arm -M igep -m 512 -clock unix -serial stdio -drive file=igep-nano.img,if=sd,cache=writeback -usb -monitor telnet:localhost:7100,server,nowait,nodelay -device usb-kbd -device usb-mouse</pre> Parameters:<br>  -m&nbsp;: Memory assigned to the Virtualized board in Mega Bytes.  [[Image:QEMU boot.png|thumb|center]] == Tips == === Resize Rootfs Partition === We will resize our rootfs partition adding 1 GB at end.
First we create a new raw file using qemu-img as: <pre>$ cd qemu-linaro img create -f raw addon.raw 1G </pre> With addon.raw we concatenate it at end of our image file as: <pre>$ cat addon.raw &gt;&gt; igep-nano.img </pre> Next step it's modify the partition table information. We will use cfdisk utility for modify the information. <pre>$ sudo cfdisk igep-nano.img </pre> Next step it's select your rootfs partition as this picture shows
$ patch -p1 [[Image:Cfdisk change size partition.png|thumb|center]]Select the menu '''RESIZE''' and select '''CHANGE&ltnbsp;SIZE'''&nbsp;0001-IGEP_QEMU_supportoption.path
Configure [[Image:Cfdisk change size partition option.png|thumb|center]]Select resize at '''END'''.  [[Image:Cfdisk resize end.png|thumb|center]]Enter the sources for build with this command: MAX new size and press enter key.
$&nbsp;./configure --target-list=arm-softmmu --prefix=<span style="color: rgbWe will write the changes to the disk using the '''commit''' menu option and select '''YES''' (255, 0, 0confirm the changes);">/opt/qemu-linaro</span> .
Build The next step it's update the sources: file-system structure. <pre>$ sudo losetup /dev/loop0 igep-nano.img -o $[106496*512]
$ make sudo e2fsck -f /dev/loop0
Install QEMUe2fsck 1.41.14 (22-Dec-2010)rootfs: recovering journalPass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information
$ make install rootfs: ***** FILE SYSTEM WAS MODIFIED *****rootfs: 11969/5579872 files (0.6% non-contiguous), 1126338/22491136 blocks
Optionally you can download from [http:$ sudo resize2fs /dev/downloads.igep.es/QEMU/qemu-linaro.tar.gz here] the QEMU binaries.<br> loop0
== Board Emulation ==$ sudo losetup -d /dev/loop0 </pre> Now you should see your new partition with your wished new size.
./qemu-system-arm -M igep -m 512 -clock unix -serial stdio -drive file=/home/mcaro/Projects/myigep/workspace/igep-dsp-gst-framework/igep-ubuntu-desktop.img,if=sd,cache=writeback -usb -usbdevice host[[Category:usb.1:80ee:cafe -monitor telnet:localhost:7100,server,nowait,nodelayDevelopment_tools|QEMU]]