Yocto tips: Using the QEMU simulator in Yocto, take Zynq cortex-a9 as an example

Source: Internet
Author: User
Tags unsupported yocto

in the previous article, " Learning arm Linux IIC drivers using BuildRoot and Qemu , wrote about using QEMU to emulate the use of ARM Linux, which was buildroot, and this time we used Yocto to do the same thing.

Advantages

The advantage of using QEMU is that when we are developing userspace programs, we can complete the tests without the hardware.

And unlike before we need to compile qemu ourselves, this time we use Yocto compiled by native Qemu to simulate. Eliminates the problems that may arise when we manually compile.


Select

The selection here means that we specify the value of the machine variable in local.conf. I divide it into two types:

1. The default Qemuarm

I used to use this, but this simulation is a ARM9 processor with a wide range of peripherals, and we want to emulate a higher-arm architecture Soc.

2. Xilinx's zynq-9:xilinx-zynq-a9

In Qemu's simulations, ZYNQ has better support in QEMU, according to the individual's limited experience of the simulation of different boards. Xilinx also has a lot of documentation for this, while Xilinx's support for some boards belongs to QEMU's default test and support machine, so choosing Xilinx's board to simulate is more appropriate.

At the same time, we are concerned about arm, so the use of cortex-a9 is better, for this, we choose XILINX-ZYNQ-A9.

If Qemu-system-arm is installed in our host PC, we can see that the board is in the supported board:

Qemu-system-arm-m? Supported Machines Are:versatileab arm Versatile/ab (arm926ej-s) VERSATILEPB arm VERSATILE/PB (ARM926EJ-S ) Lm3s811evb Stellaris lm3s811evbz2 zipit Z2 (pxa27x) Connex Gumstix Connex (PXA25 5) sx1 Siemens SX1 (OMAP310) v2realview-eb ARM RealView Emulation baseboard (arm926ej-s) Cubieboar D Cubietech cubieboardvexpress-a9 ARM versatile Express for Cortex-a9lm3s6965evb Stellaris LM3 S6965evbrealview-pbx-a9 ARM RealView Platform baseboard Explore for Cortex-a9musicpal Marvell 88w8618/m                 Usicpal (arm926ej-s) mainstone Mainstone II (pxa27x) Terrier terrier PDA (PXA270) n810 Nokia N810 tablet aka. RX-44 (OMAP2420) <span style= "color: #ff6666;" &GT;XILINX-ZYNQ-A9 Xilinx zynq Platform baseboard for Cortex-a9</span>nuri Samsung Nuri Board (Exynos4210) Realview-eb-mpcore ARM RealView emulation baseboard (arm11mpcore) verdex Gumstix verdex (PXA270) Spitz Spitz PDA (PXA270) canon-a1100 Canon PowerShot A1100 Isakita Akita PDA (PXA270) smdkc210 Samsung SMDKC210 Board (EXYNOS4 INTEGRATORCP ARM INTEGRATOR/CP (arm926ej-s) sx1-v1 Siemens SX1 (OMAP310) V1kzm A  RM KZM Emulation baseboard (ARM1136) Highbank Calxeda Highbank (ECX-1000) n800 Nokia N800 tablet aka. RX-34 (OMAP2420) Collie Collie PDA (SA-1110) realview-pb-a8 ARM realview Platform baseboard for Cortex-a 8VEXPRESS-A15 ARM Versatile Express for Cortex-a15none empty Machinecheetah Palm Tung sten| E aka.                 Cheetah PDA (OMAP310) Tosa Tosa PDA (PXA255) Midway Calxeda Midway (ECX-2000) Virt ARM Virtual Machineborzoi Borzoi PDA (PXA270)


For this board in the Yocto simulation, the official also has a page: Yocto for znyqmp, we can refer to this page, but according to this page does not actually work. Below I mainly explain the need to change and note the place.
build and use steps

First compile the required image according to the official Step1 to STEP6. It is important to note that we use a single-core A9 here, so machine should be qemuzynq, that is, in local.conf:

# This sets the "Default machine" to be qemux86 if no other machine is Selected:machine?? = "Qemuzynq"

This machine is defined in the config in its layer:

$ ls.. /meta-xilinx/conf/machine/-ltotal 52drwxrwxr-x Hexiongjun hexiongjun 4096 may 10:38 boards-rw-rw-r--1 Hexiongjun 593 Hexiongjun 10:38 ep108-zynqmp.confdrwxrwxr-x 3 Hexiongjun hexiongjun 4096 may 10:38 include-rw-rw-r--1 h Exiongjun Hexiongjun 1049 May 10:38 kc705-trd-microblazeel.conf-rw-rw-r--1 Hexiongjun hexiongjun 623 may 10:38 mi crozed-zynq7.conf-rw-rw-r--1 Hexiongjun Hexiongjun 804 May-10:38 picozed-zynq7.conf-rw-rw-r--1 Hexiongjun hexiongj Un 564 may 10:16 qemumicroblaze.conf-rw-rw-r--1 Hexiongjun hexiongjun (May) 10:16 qemumicroblaze-s3adsp1800.co  1 Hexiongjun hexiongjun 496 nf-rw-rw-r--10:38 qemuzynq.conf-rw-rw-r--1 Hexiongjun hexiongjun 1059 May 16 10:38   zc702-zynq7.conf-rw-rw-r--1 Hexiongjun Hexiongjun 1008 May-10:38 zc706-zynq7.conf-rw-rw-r--1 Hexiongjun Hexiongjun 847 10:38 zedboard-zynq7.conf-rw-rw-r--1 Hexiongjun hexiongjun 627 may be 10:38 zybo-zynq7.conf

You also need to configure output for the INITRD type cpio:

Image_fstypes = "JFFS2 tar.bz2 cpio"

Otherwise, we cannot specify INITRD when we specify it in the later QEMU.


So far, we have prepared all the materials.

running the emulator

You can use Runqemu directly:

$ Runqemu qemuzynqcontinuing with the following parameters:kernel: [/home/hexiongjun/embproj/am335x_yocto/qemuzynq/ TMP/DEPLOY/IMAGES/QEMUZYNQ/UIMAGE]ROOTFS: [/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/ Qemuzynq/core-image-minimal-qemuzynq-20160516035635.rootfs.cpio]fstype: [cpio]setting up Tap interface under Sudoacquiring Lockfile for Tap0 ... Running qemu-system-arm.../home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/sysroots/x86_64-linux/usr/bin/ Qemu-system-arm-kernel/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/uimage-net NIC, Model=virtio-net tap,vlan=0,ifname=tap0,script=no,downscript=no-m xilinx-zynq-a9-serial null-serial MON:STDIO-DTB/ home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/uimage-qemuzynq.dtb-initrd/home/ hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/ Core-image-minimal-qemuzynq-20160516035635.rootfs.cpio-no-reboot-m 1024x768--append "EARLYPRINTK root=/dev/ram rw ip=192.168.7.2::192.168.7.1:255.255.255.0 mem=1024m "qemu-system-arm:unsupported NIC model:virtioset ' tap0 ' Nonpersistentreleasing Lockfile of preconfigured tap device ' tap0 '


Then you encounter a problem: qemu-system-arm:unsupported NIC model:virtio

For this, there are a number of processing methods, the simplest is that we directly use the QEMU NIC model can be, so first query:

$/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-arm-m Xilinx-zynq-a9-net nic,model=?qemu:supported Nic Models:cadence_gem

You can see that the support is cadence_gem, so we need to change this.


changes to Runqemu

The Runqemu script is located at:

In the poky/scripts/runqemu-internal, we can see that it specifies the NIC model, so we'll change it to Cadence_gem:

        Kernel_network_cmd= "ip=192.168.7. $n 2::192.168.7. $n 1:255.255.255.0"        qemu_tap_cmd= "-net tap,vlan=0,ifname=$ Tap,script=no,downscript=no "        if [" $VHOST _active "=" yes "]; then            qemu_network_cmd="-net Nic,model=<span style= "COLOR: #ff6666;" >virtio</span> $QEMU _tap_cmd,vhost=on "        else            qemu_network_cmd="-net nic,model=<span style= " Color: #ff6666; " >virtio</span> $QEMU _tap_cmd "        fi

Then run again and you can work, and you can see some of its log as follows:

$ Runqemu qemuzynqcontinuing with the following parameters:kernel: [/home/hexiongjun/embproj/am335x_yocto/qemuzynq/ TMP/DEPLOY/IMAGES/QEMUZYNQ/UIMAGE]ROOTFS: [/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/ Qemuzynq/core-image-minimal-qemuzynq-20160516035635.rootfs.cpio]fstype: [cpio]setting up Tap interface under Sudoacquiring Lockfile for Tap0 ... Running qemu-system-arm.../home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/sysroots/x86_64-linux/usr/bin/ Qemu-system-arm-kernel/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/uimage-net NIC, Model=cadence_gem-net tap,vlan=0,ifname=tap0,script=no,downscript=no-m xilinx-zynq-a9-serial null-serial Mon:stdio -dtb/home/hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/uimage-qemuzynq.dtb-initrd/home/ hexiongjun/embproj/am335x_yocto/qemuzynq/tmp/deploy/images/qemuzynq/ Core-image-minimal-qemuzynq-20160516035635.rootfs.cpio-no-reboot-m 1024x768--append "EARLYPRINTK root=/dev/ram RWip=192.168.7.2::192.168.7.1:255.255.255.0 mem=1024m "Warning:nic cadence_gem.1 have no peer[0.000000] Booting Linux on Physical CPU 0x0[0.000000] Linux version 3.19.0-xilinx ([email protected]) (GCC version 5.2.0 (gcc)) #1 SMP PRE Empt Mon may 11:54:40 CST 2016[0.000000] cpu:armv7 Processor [413fc090] revision 0 (ARMV7), cr=10c5387d[0.0000 XX] Cpu:pipt/vipt nonaliasing data cache, vipt nonaliasing instruction cache[0.000000] Machine model:xilinx-zynq-a 9[0.000000] Memory policy:data cache writeback[0.000000] Cpu:all CPU (s) started in SVC mode. [0.000000] percpu:embedded 9 pages/cpu @eefd8000 s8128 r8192 d20544 u36864[0.000000] Built 1 zonelists in Zone or  Der, mobility grouping on. Total pages:260624[0.000000] Kernel command LINE:EARLYPRINTK root=/dev/ram RW ip=192.168.7.2::192.168.7.1:255.255.25 5.0 mem=1024m [0.000000] PID hash table entries:4096 (order:2, 16384 bytes) [0.000000] Dentry cache hash table en tries:131072 (oRder:7, 524288 bytes) [0.000000] inode-cache hash table entries:65536 (order:6, 262144 bytes) [0.000000] Memory: 1028324k/1048576k available (4457K kernel code, 234K rwdata, 1408K rodata, 220K init, 198K BSS, 20252K reserved, 0K cma-re   Served, 270336K highmem) [0.000000] Virtual kernel memory layout:[0.000000] vector:0xffff0000-0xffff1000 (4 KB) [0.000000] fixmap:0xffc00000-0xfff00000 (3072 kB) [0.000000] vmalloc:0xf0000000-0xff000000 (2    (+ MB) [0.000000] lowmem:0xc0000000-0xef800000 (760 MB) [0.000000] pkmap:0xbfe00000-0xc0000000 (2 MB) [0.000000] modules:0xbf000000-0xbfe00000 (MB) [0.000000]. TEXT:0XC0008000-0XC05C28F4 (58    KB) [0.000000]. init:0xc05c3000-0xc05fa000 (KB) [0.000000]. data:0xc05fa000-0xc06349e0 (235 KB) [0.000000]. bss:0xc06349e0-0xc0666470 (199 KB) [0.000000] preemptible hierarchical RCU ImplEmentation. [0.000000] RCU restricting CPUs from nr_cpus=4 to nr_cpu_ids=2.


Exit Qemu

Input CTRL + A C, and enter the Q carriage, CTRL + C is unable to exit.



other tools for Runqemu

All the tools are:

$ runqemurunqemu                  runqemu-addptable2image  runqemu-export-rootfs    runqemu-extract-sdk
Runqemu-gen-tapdevs      runqemu-ifdown           runqemu-ifup             runqemu-internal


You can see up-down and create, which are primarily related to tap functionality, with two tools associated with Nfsroot.


Reference

Http://www.wiki.xilinx.com/QEMU

http://zedboard.org/content/qemu-deep-dive-0

Https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg00755.html


Yocto tips: Using the QEMU simulator in Yocto, take Zynq cortex-a9 as an example

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.