Build an image and run it in the QEMU emulator on Yocto Project Release 1.8(fido)

Build an image and run it in the QEMU emulator on Yocto Project

1. Development Environment

host machine: Ubuntu14.04 running on virtual box
target machine: qemu for Xilinx zynq

1.1. Package Prepare

1.1.1. Basic Packages Installation

The following list shows the required packages by function
given a supported Ubuntu or Debian Linux distribution:

Essentials: Packages needed to build an image on a headless system:

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
gcc-multilib build-essential chrpath socat vim libncurses5-dev libncursesw5-dev

Graphical and Eclipse Plug-In Extras: Packages recommended if the host system has graphics support or if you are going to use the Eclipse IDE:

$ sudo apt-get install libsdl1.2-dev xterm

Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

$ sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto

ADT Installer Extras: Packages needed if you are going to be using the Application Development Toolkit (ADT) Installer:

$ sudo apt-get install autoconf automake libtool libglib2.0-dev

1.1.2. Required Git, tar, and Python Versions

In order to use the build system, your host development system must meet the following version requirements for Git, tar, and Python:
Git 1.7.8 or greater
tar 1.24 or greater
Python 2.7.3 or greater not including Python 3.x, which is not supported.

If your host development system does not meet all these requirements, you can resolve this by installing a buildtools tarball that contains these tools. You can get the tarball one of two ways: download a pre-built tarball or use BitBake to build the tarball. Please follow the steps in the link.
required-git-tar-and-python-versions

1.1.3. Downloading the Poky metadata

Create a new project folder at first.

$ pwd
/home/yongh/
$ mkdir yocto_prj
$ cd yocto_prj
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git checkout -b fido origin/fido

At this stage, we only have the base of the reference system (Poky). Basically, the BSP proposed by Poky only offers the following targets:

$ ls meta-yocto-bsp/conf/machine/*.conf
beaglebone.conf
edgerouter.conf
genericx86-64.conf
genericx86.conf
mpc8315e-rdb.conf

This is in addition to those provided by OE-Core:

$ ls meta/conf/machine/*.conf
qemuarm64.conf
qemuarm.conf
qemumips64.conf
qemumips.conf
qemuppc.conf
qemux86-64.conf
qemux86.conf

1.1.4. Downloading Xilinx BSP metadata

Execute the following commands under the poky folder.

$ git clone git://git.yoctoproject.org/meta-xilinx

You can find the other useful source repositories on the following link:
Source Repositories

$ cd meta-xilinx
$ git checkout -b fido origin/fido

Now we can verify whether we have the configuration metadata for our platform (qemuzynq.conf file):

$ ll meta-xilinx/conf/machine/*.conf
meta-xilinx/conf/machine/ep108-zynqmp.conf
meta-xilinx/conf/machine/kc705-trd-microblazeel.conf
meta-xilinx/conf/machine/microzed-zynq7.conf
meta-xilinx/conf/machine/picozed-zynq7.conf
meta-xilinx/conf/machine/qemumicroblaze.conf
meta-xilinx/conf/machine/qemuzynq.conf
meta-xilinx/conf/machine/zc702-zynq7.conf
meta-xilinx/conf/machine/zc706-zynq7.conf
meta-xilinx/conf/machine/zedboard-zynq7.conf
meta-xilinx/conf/machine/zybo-zynq7.conf

2. Building An Image

2.1. Setup Build Environment

$ source oe-init-build-env [build-directory]

Here, build-directory is an optional parameter for the name of the directory where the environment is set. In case it is not given, it defaults to build. The build-directory folder is the place where we perform the builds. But, in order to standardize the steps, we will use the following command throughout to initialize our environment:

$ source oe-init-build-env build_qemuzynq

When we initialize a build environment, it creates a directory (the conf directory) inside build_qemuzynq. This folder contain two important files:
local.conf: It contains parameters to configure BitBake behavior.
bblayers.conf: It lists the different layers that BitBake takes into account in its implementation. This list is assigned to the BBLAYERS variable.

2.2. Editing the local.conf file

The local.conf file under build_qemuzynq/conf/ is a file that can configure every aspect of the build process. It is through this file that we can choose the target machine (the MACHINE variable), the distribution (the DISTRO variable), the type of package (the PACKAGE_CLASSES variable), and the host configuration (PARALLEL_MAKE, for example). The minimal set of variables we have to change from the default is the following:

BB_NUMBER_THREADS ?= “${@oe.utils.cpu_count()}”
PARALLEL_MAKE ?= “-j ${@oe.utils.cpu_count()}”
MACHINE ??= “qemuzynq”

The BB_NUMBER_THREADS variable determines the number of tasks that BitBake will perform in parallel (tasks under Yocto; we’re not necessarily talking about compilation). By default, in build/conf/local.conf, this variable is initialized with ${@oe.utils.cpu_count()},corresponding to the number of cores detected on the host system (/proc/cpuinfo).
The PARALLEL_MAKE variable corresponds to the -j of the make option to specify the number of processes that GNU Make can run in parallel on a compilation task. Again, it is the number of cores present that defines the default value used.
The MACHINE variable is where we determine the target machine we wish to build for qemu on Xilinx-ZYNQ (define in the .conf file; in our case, it is qemuzynq.conf).

2.3. Editing the bblayers.conf file

Add the following line:

BBLAYERS ?= " \
/home/yongh/yocto_rsp/poky/meta \
/home/yongh/yocto_rsp/poky/meta-yocto \
/home/yongh/yocto_rsp/poky/meta-yocto-bsp \
/home/yongh/yocto_rsp/poky/meta-xilinx \
"

2.4. Build qemuzynq Image

$ bitbake -k core-image-minimal

The target is the name of the recipe you want to build Common targets are the images in meta/recipes-core/images, meta/recipes-sato/images, etc. For more details about the images the OpenEmbedded build system supports, please refer to the following link:
Ref-Images

2.5. Run Image

$ runqemu qemuzynq nographic qemuparams="-net none"

If you run “runqemu qemuzynq” directly without nographic parameter, you won’t see any boot log of kernel, and won’t see login prompt. Because core-image-minimal is compiled without graphical window support. Let’s see the differences of log when run the upper two kinds of commands.
在这里插入图片描述
在这里插入图片描述

3. Issue

When run bitbake to build qumezynq image, maybe you will encounter the following error:

ERROR: Function failed: do_compile (log file is located at
/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/temp/log.do_compile.21451)
ERROR: Logfile of failure stored in:
/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/temp/log.do_compile.21451
| x86_64-linux-libtool: error: ‘DestWind.lo’ is not a valid libtool
object | make[3]: *** [libX11.la] Error 1 | make[3]: Leaving directory
/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/build/src' | make[2]: *** [all-recursive] Error 1 | make[2]: Leaving directory/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/build/src’
| make[1]: *** [all] Error 2 | make[1]: Leaving directory
`/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/build/src’
| make: *** [all-recursive] Error 1 | ERROR: oe_runmake failed |
WARNING: exit code 1 from a shell command. | ERROR: Function failed:
do_compile (log file is located at
/home/yongh/yocto_rsp/poky/build_qemuzynq/tmp/work/x86_64-linux/libx11-native/1_1.6.2-r0/temp/log.do_compile.21451)
ERROR: Task 1972
(virtual:native:/home/yongh/yocto_rsp/poky/meta/recipes-graphics/xorg-lib/libx11_1.6.2.bb,
do_compile) failed with exit code ‘1’ NOTE: Tasks Summary: Attempted
2790 tasks of which 2754 didn’t need to be rerun and 1 failed.

You should follow section 1.1.1 - Graphical and Eclipse Plug-In Extras to install the necessary packages. And execute the following command to clean the generated libx11, then rebuild core-image-minimal.

$ bitbake -c clean libx11-native

4. Useful Link

yocto project release 1.8 ref-manual
yocto project release 1.8 quick start
yocto project release 1.8 kernel-dev
yocto project release 1.8 dev-manual
yocto project release 1.8 bsp-guide
yocto project release
bitbake user manual
Qemu for Arm
QEMU System Emulation User’s Guide
building-our-first-poky-image-raspberry-pi
Ubuntu下用QEMU搭建ARM Linux运行环境
Yocto中qemu模拟器的使用以zynq Cortex-A9为例
Xilinix-Wiki-QEMU-Yocto

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值