2016年10月8日 星期六

Using openembedded to build QEMU


這篇文章主要來說明如何使用Openembedded/Krogoth來build出QEMU for ARM。
步驟大概就是:
先下載yp-krogoth之後,source目錄下的oe-init-build-env,接著再編輯conf/local.conf,最後就是執行bitbake core-image-minimal。
我的Krogoth最後一個commit ID是e93596f。
brook@vista:~/projects$ git clone -b krogoth git://git.yoctoproject.org/poky.git yp-krogoth
Cloning into 'yp-krogoth'...
remote: Counting objects: 339411, done.
remote: Compressing objects: 100% (82247/82247), done.
remote: Total 339411 (delta 251486), reused 338934 (delta 251035)
Receiving objects: 100% (339411/339411), 127.65 MiB | 4.49 MiB/s, done.
Resolving deltas: 100% (251486/251486), done.
Checking connectivity... done.
brook@vista:~/projects$ cd yp-krogoth/
brook@vista:~/projects/yp-krogoth$ git log --oneline -1
e93596f binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
brook@vista:~/projects/yp-krogoth$ . oe-init-build-env
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
brook@vista:~/projects/yp-krogoth/build$ vim conf/local.conf
...內容請看一段
brook@vista:~/projects/yp-krogoth/build$ bitbake core-image-minimal
WARNING: Host distribution "Ubuntu-16.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes...done.
Parsing of 871 .bb files complete (0 cached, 871 parsed). 1301 targets, 66 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.30.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-16.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "qemuarm"
DISTRO            = "poky"
DISTRO_VERSION    = "2.1.1"
TUNE_FEATURES     = "arm armv5 thumb dsp"
TARGET_FPU        = "soft"
meta
meta-poky
meta-yocto-bsp    = "krogoth:e93596fe74927e2e2f4dd7f671994ccb9744cff8"

NOTE: Fetching uninative binary shim from http://downloads.yoctoproject.org/releases/uninative/1.0.1/x86_64-nativesdk-libc.tar.bz2;sha256sum=acf1e44a0ac2e855e81da6426197d36358bf7b4e88e552ef933128498c8910f8
NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
...略
brook@vista:~/projects/yp-krogoth/build$ ./tmp/sysroots/x86_64-linux/usr/bin/qemu-system-arm -kernel ./tmp/deploy/images/qemuarm/zImage-qemuarm.bin -M versatilepb -drive file=/home/jpr/projects/yp-krogoth/build/tmp/deploy/images/qemuarm/core-image-minimal-qemuarm.ext4,if=virtio,format=raw -no-reboot -show-cursor -usb -usbdevice tablet -m 128 -nographic -append 'root=/dev/vda rw console=ttyAMA0,115200 console=tty ip=192.168.7.2::192.168.7.1:255.255.255.0 mem=128M highres=off rootfstype=ext4 ' 
audio: Could not init `oss' audio driver
ALSA lib ../../alsa-lib-1.1.0/src/confmisc.c:768:(parse_card) cannot find card '0'
...略
qemuarm login: root
root@qemuarm:~# uname -a
Linux qemuarm 4.4.11-yocto-standard #1 PREEMPT Sun Oct 9 11:36:44 CST 2016 armv5tejl GNU/Linux


conf/local.conf相關修改
change MACHINE for "qemux86" to "qemuarm"
MACHINE ?= "qemuarm"
#MACHINE ?= "qemuarm64"
#MACHINE ?= "qemumips"
#MACHINE ?= "qemumips64"
#MACHINE ?= "qemuppc"
#MACHINE ?= "qemux86"
#MACHINE ?= "qemux86-64"
#
# There are also the following hardware board target machines included for
# demonstration purposes:
#
#MACHINE ?= "beaglebone"
#MACHINE ?= "genericx86"
#MACHINE ?= "genericx86-64"
#MACHINE ?= "mpc8315e-rdb"
#MACHINE ?= "edgerouter"
#
# This sets the default machine to be qemux86 if no other machine is selected:
#MACHINE ??= "qemux86"
...
commout out these 2 lines
#PACKAGECONFIG_append_pn-qemu-native = " sdl"
#PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"



    參考資料:
  1. Yocto Project Quick Start
  2. Yocto Project Build System/Download




2 則留言:

  1. https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html
    the option '-s' is used for Show current and preferred versions of all recipes.
    for example,
    brook@vista:~/oe$ bitbake -s|grep gcc
    Recipe Name Latest Version Preferred Version
    =========== ============== =================
    gcc :5.2.0-r0 :4.8.4-r0
    gcc-cross-arm :5.2.0-r0 :4.9.3-r0
    gcc-cross-canadian-arm :5.2.0-r0 :4.8.4-r0
    gcc-cross-initial-arm :5.2.0-r0 :4.9.3-r0
    gcc-crosssdk-initial-x86_64 :5.2.0-r0 :4.8.4-r0
    gcc-crosssdk-x86_64 :5.2.0-r0 :4.8.4-r0
    gcc-runtime :5.2.0-r0 :4.8.4-r0
    gcc-sanitizers :5.2.0-r0 :4.8.4-r0
    gcc-source-4.8.4 :4.8.4-r0
    gcc-source-4.9.3 :4.9.3-r0
    gcc-source-5.2.0 :5.2.0-r0
    gccmakedep 1:1.0.3-r3
    libgcc :5.2.0-r0 :4.8.4-r0
    libgcc-initial :5.2.0-r0 :4.8.4-r0
    nativesdk-gcc :5.2.0-r0 :4.8.4-r0
    nativesdk-gcc-runtime :5.2.0-r0 :4.8.4-r0
    nativesdk-gcc-sanitizers :5.2.0-r0 :4.8.4-r0
    nativesdk-libgcc :5.2.0-r0 :4.8.4-r0
    nativesdk-libgcc-initial :5.2.0-r0 :4.8.4-r0

    回覆刪除
  2. git-upload-pack: command not found

    ERROR: gnu-config-native-20180713+gitAUTOINC+30d53fc428-r0 do_unpack: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export https_proxy="http://172.16.100.51:3128/"; export http_proxy="http://172.16.100.51:3128/"; export PATH="/home/rene/apps_proc/poky/scripts/native-intercept:/home/rene/apps_proc/poky/scripts:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/usr/bin/x86_64-linux:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/usr/bin:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/usr/sbin:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/usr/bin:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/sbin:/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/recipe-sysroot-native/bin:/home/rene/apps_proc/poky/bitbake/bin:/home/rene/apps_proc/poky/build/tmp-glibc/hosttools"; export HOME="/home/rene"; git -c core.fsyncobjectfiles=0 clone -s -n /home/rene/download/git2/git.savannah.gnu.org.config.git/ /home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/git/ failed with exit code 128, output:
    Cloning into '/home/rene/apps_proc/poky/build/tmp-glibc/work/x86_64-linux/gnu-config-native/20180713+gitAUTOINC+30d53fc428-r0/git'...
    warning: templates not found in /home/rene/share/git-core/templates
    git-upload-pack '/home/rene/download/git2/git.savannah.gnu.org.config.git/': git-upload-pack: command not found
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.


    rene@vista:/home/rene/apps_proc/poky/build$ cp /usr/bin/git-upload-pack /home/rene/apps_proc/poky/scripts/native-intercept

    回覆刪除

熱門文章