Building the Yocto GENIVI Baseline

Yocto GENIVI Baseline inside QEMU

Yocto GENIVI Baseline inside QEMU

About the Yocto GENIVI Baseline

Yocto Project: http://www.yoctoproject.org/about

The Yocto Project is a Linux Foundation workgroup whose goal is to produce tools and processes that will enable the creation of Linux distributions for embedded software.

—Source: https://en.wikipedia.org/wiki/Yocto_Project

GENIVI Alliance: http://www.genivi.org/

The GENIVI Alliance is a non-profit automotive industry alliance committed to driving the broad adoption of an In-Vehicle Infotainment (IVI) open-source development platform. The GENIVI Alliance was founded on March 2, 2009 by BMW Group, Delphi, GM, Intel, Magneti-Marelli, PSA Peugeot Citroen, Visteon, and Wind River Systems.

—Source: https://en.wikipedia.org/wiki/GENIVI_Alliance

The Yocto GENIVI Baseline is a GENIVI compliant reference system based on the Yocto Project.

Build a QEMU image that contains GENIVI components

Note: This will need around 27 GB of free hard disk space.

Check out the baseline for building

See here: http://wiki.projects.genivi.org/index.php/Meta-ivi/7.0.2

[chris@thinkpad GENIVI]$ mkdir genivi-baseline
[chris@thinkpad GENIVI]$ cd genivi-baseline/
[chris@thinkpad genivi-baseline]$ git clone git://git.yoctoproject.org/poky
Cloning into 'poky'...
remote: Counting objects: 252963, done.
remote: Compressing objects: 100% (62970/62970), done.
remote: Total 252963 (delta 185265), reused 252401 (delta 184704)
Receiving objects: 100% (252963/252963), 106.89 MiB | 502.00 KiB/s, done.
Resolving deltas: 100% (185265/185265), done.
Checking connectivity... done.
[chris@thinkpad genivi-baseline]$ cd poky; git checkout df87cb27efeaea1455f20692f9f1397c6fcab254; cd -
Note: checking out 'df87cb27efeaea1455f20692f9f1397c6fcab254'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at df87cb2... readline: Patch for readline multikey dispatch issue
/home/chris/data/Projects/GENIVI/genivi-baseline
[chris@thinkpad genivi-baseline]$ git clone git://git.openembedded.org/meta-openembedded
Cloning into 'meta-openembedded'...
remote: Counting objects: 43817, done.
remote: Compressing objects: 100% (17593/17593), done.
remote: Total 43817 (delta 26194), reused 40778 (delta 24180)
Receiving objects: 100% (43817/43817), 20.52 MiB | 669.00 KiB/s, done.
Resolving deltas: 100% (26194/26194), done.
Checking connectivity... done.
[chris@thinkpad genivi-baseline]$ cd meta-openembedded; git checkout 9efaed99125b1c4324663d9a1b2d3319c74e7278; cd -
Note: checking out '9efaed99125b1c4324663d9a1b2d3319c74e7278'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 9efaed9... openvpn: bypass check for /sbin/ip on the host
/home/chris/data/Projects/GENIVI/genivi-baseline
[chris@thinkpad genivi-baseline]$ git clone git://git.yoctoproject.org/meta-ivi
Cloning into 'meta-ivi'...
remote: Counting objects: 5987, done.
remote: Compressing objects: 100% (2433/2433), done.
remote: Total 5987 (delta 3301), reused 5918 (delta 3232)
Receiving objects: 100% (5987/5987), 12.09 MiB | 436.00 KiB/s, done.
Resolving deltas: 100% (3301/3301), done.
Checking connectivity... done.
[chris@thinkpad genivi-baseline]$ cd meta-ivi; git checkout 7.0.2; cd -
Note: checking out '7.0.2'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 54000a2... linux-yocto: enable kernel feature to support NFC
/home/chris/data/Projects/GENIVI/genivi-baseline
[chris@thinkpad genivi-baseline]$

Build the QEMU image

See here: http://git.yoctoproject.org/cgit/cgit.cgi/meta-ivi/tree/README.md?h=7.0.2

[chris@thinkpad genivi-baseline]$ export TEMPLATECONF="$PWD/meta-ivi/meta-ivi/conf"
[chris@thinkpad genivi-baseline]$ echo $TEMPLATECONF
/mnt/data/data/Projects/GENIVI/genivi-baseline/meta-ivi/meta-ivi/conf
[chris@thinkpad genivi-baseline]$ ls /mnt/data/data/Projects/GENIVI/genivi-baseline/meta-ivi/meta-ivi/
conf         recipes-connectivity  recipes-devtools  recipes-graphics    recipes-qt           recipes-yocto-ivi
COPYING.MIT  recipes-core-ivi      recipes-extended  recipes-multimedia  recipes-support-ivi
[chris@thinkpad genivi-baseline]$ ls
meta-ivi  meta-openembedded  poky
[chris@thinkpad genivi-baseline]$ source poky/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 use a
different MACHINE (target hardware) or enable parallel build options to take
advantage of multiple cores for example. See the file for more information as
common configuration options are commented.

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/

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

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:
    intrepid-image
    ivi-image

[chris@thinkpad build]$ pwd
/mnt/data/data/Projects/GENIVI/genivi-baseline/build
[chris@thinkpad build]$ bitbake intrepid-image
Parsing recipes: 100% |#######################################| Time: 00:01:57
Parsing of 1436 .bb files complete (0 cached, 1436 parsed). 1883 targets, 238 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.24.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Fedora-20"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "vexpressa9"
DISTRO            = "poky-ivi-systemd"
DISTRO_VERSION    = "7.0.2"
TUNE_FEATURES     = "arm armv7a vfp neon"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp    = "(detachedfromdf87cb2):df87cb27efeaea1455f20692f9f1397c6fcab254"
meta-oe           = "(detachedfrom9efaed9):9efaed99125b1c4324663d9a1b2d3319c74e7278"
meta-ivi
meta-ivi-bsp      = "(detachedfrom7.0.2):54000a206e4df4d5a94db253d3cb8a9f79e4a0ae"

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL http://download.savannah.gnu.org/releases/quilt/quilt-0.63.tar.gz, attempting MIRRORS if available
Currently 4 running tasks (196 of 3230):
0: glibc-initial-2.20-r0 do_fetch (pid 28668)
1: glibc-2.20-r0 do_fetch (pid 19905)
2: gcc-cross-initial-arm-4.9.1-r0 do_compile (pid 21072)
3: file-native-5.18-r0 do_fetch (pid 15826)
WARNING: Failed to fetch URL http://download.savannah.gnu.org/releases/quilt/quilt-0.63.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/b/base-passwd/base-passwd_3.5.29.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL http://downloads.sourceforge.net/project/libpng/libpng16/1.6.13/libpng-1.6.13.tar.xz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.info-zip.org/pub/infozip/src/unzip60.tgz, attempting MIRRORS if available
NOTE: validating kernel config, see log.do_kernel_configcheck for details
WARNING: Failed to fetch URL http://www.apache.org/dist/apr/apr-util-1.5.3.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL git://git.gitorious.org/bluez/vudentzs-clone.git;protocol=http;branch=for-upstream, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find revision f76472e7983e52580afbf3a47f2f2e29e26514b9 in branch for-upstream even from upstream
ERROR: Function failed: Fetcher failure for URL: 'git://git.gitorious.org/bluez/vudentzs-clone.git;protocol=http;branch=for-upstream'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/bluez5/5.15-horizon_r1/temp/log.do_fetch.11573
ERROR: Task 1245 (/mnt/data/data/Projects/GENIVI/genivi-baseline/poky/meta/recipes-connectivity/bluez5/bluez5_5.22.bb, do_fetch) failed with exit code '1'
WARNING: Failed to fetch URL http://www.apache.org/dist/subversion/subversion-1.8.9.tar.bz2, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1236 tasks of which 12 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:

Summary: 1 task failed:
  /mnt/data/data/Projects/GENIVI/genivi-baseline/poky/meta/recipes-connectivity/bluez5/bluez5_5.22.bb, do_fetch
Summary: There were 7 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
[chris@thinkpad build]$ bitbake intrepid-image
Loading cache: 100% |#########################################| ETA:  00:00:00
Loaded 1883 entries from dependency cache.
Parsing recipes: 100% |#######################################| Time: 00:00:02
Parsing of 1436 .bb files complete (1435 cached, 1 parsed). 1883 targets, 238 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.24.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Fedora-20"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "vexpressa9"
DISTRO            = "poky-ivi-systemd"
DISTRO_VERSION    = "7.0.2"
TUNE_FEATURES     = "arm armv7a vfp neon"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp    = "(detachedfromdf87cb2):df87cb27efeaea1455f20692f9f1397c6fcab254"
meta-oe           = "(detachedfrom9efaed9):9efaed99125b1c4324663d9a1b2d3319c74e7278"
meta-ivi
meta-ivi-bsp      = "(detachedfrom7.0.2):54000a206e4df4d5a94db253d3cb8a9f79e4a0ae"

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL git://git.gitorious.org/bluez/vudentzs-clone.git;protocol=http;branch=for-upstream, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find revision f76472e7983e52580afbf3a47f2f2e29e26514b9 in branch for-upstream even from upstream
ERROR: Function failed: Fetcher failure for URL: 'git://git.gitorious.org/bluez/vudentzs-clone.git;protocol=http;branch=for-upstream'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/bluez5/5.15-horizon_r1/temp/log.do_fetch.9280
ERROR: Task 1245 (/mnt/data/data/Projects/GENIVI/genivi-baseline/poky/meta/recipes-connectivity/bluez5/bluez5_5.22.bb, do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1264 tasks of which 1235 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:

Summary: 1 task failed:
  /mnt/data/data/Projects/GENIVI/genivi-baseline/poky/meta/recipes-connectivity/bluez5/bluez5_5.22.bb, do_fetch
Summary: There was 1 WARNING message shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
[chris@thinkpad build]$

OK, after grepping through the code, it seems the problem comes from genivi-baseline/meta-ivi/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend.

The .bbappend file overrides the default settings from genivi-baseline/poky/meta/recipes-connectivity/bluez5/bluez5_5.22.bb.

Let’s remove this file and build it again.

[chris@thinkpad build]$ rm /mnt/data/data/Projects/GENIVI/genivi-baseline/meta-ivi/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend
[chris@thinkpad build]$ bitbake intrepid-image
Loading cache: 100% |#########################################| ETA:  00:00:00
Loaded 1884 entries from dependency cache.
Parsing recipes: 100% |#######################################| Time: 00:00:01
Parsing of 1436 .bb files complete (1434 cached, 2 parsed). 1883 targets, 238 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.24.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Fedora-20"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "vexpressa9"
DISTRO            = "poky-ivi-systemd"
DISTRO_VERSION    = "7.0.2"
TUNE_FEATURES     = "arm armv7a vfp neon"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp    = "(detachedfromdf87cb2):df87cb27efeaea1455f20692f9f1397c6fcab254"
meta-oe           = "(detachedfrom9efaed9):9efaed99125b1c4324663d9a1b2d3319c74e7278"
meta-ivi
meta-ivi-bsp      = "(detachedfrom7.0.2):54000a206e4df4d5a94db253d3cb8a9f79e4a0ae"

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: QA Issue: bluez5: configure was passed unrecognised options: --with-systemdunitdir [unknown-configure-option]
WARNING: QA Issue: coreutils: configure was passed unrecognised options: --disable-acl [unknown-configure-option]
WARNING: QA Issue: mesa: configure was passed unrecognised options: --with-llvm-shared-libs [unknown-configure-option]
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/n/netbase/netbase_5.2.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.17.4.tar.xz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools/dosfstools-2.11.src.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL http://ftp.de.debian.org/debian/pool/main/m/mklibs/mklibs_0.1.39.tar.xz, attempting MIRRORS if available
WARNING: QA Issue: coreutils rdepends on libacl, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: pulseaudio-module-console-kit rdepends on consolekit, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: ELF binary '/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/wayland-ivi-extension/1.2.0-r0/packages-split/wayland-ivi-extension/usr/lib/weston/ivi-controller.so' has relocations in .text [textrel]
WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: sed: warning: failed to get security context of /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/work/vexpressa9-poky-linux-gnueabi/intrepid-image/7.0.2-r0/rootfs/etc/pango/pango.modules: No data available

WARNING: log_check: There is a warn message in the logfile
WARNING: log_check: Matched keyword: [warn]
WARNING: log_check: warning: group pulse does not exist - using root

NOTE: Tasks Summary: Attempted 3230 tasks of which 1313 didn't need to be rerun and all succeeded.

Summary: There were 16 WARNING messages shown.
[chris@thinkpad build]$

Run the emulator

Even though the runqemu script asks for root permissions through sudo it is not possible to run the emulator as unprivileged user in Fedora:

[chris@thinkpad build]$ ../meta-ivi/scripts/runqemu intrepid-image vexpressa9
Assuming intrepid-image really means /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/intrepid-image-vexpressa9.tar.bz2

Continuing with the following parameters:
KERNEL: [/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/zImage-vexpressa9.bin]
ROOTFS: [/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/intrepid-image-vexpressa9.tar.bz2]
FSTYPE: [tar.bz2]
Acquiring lockfile for tap0:...
Using preconfigured tap device 'tap0:'
../meta-ivi/scripts/runqemu-internal: line 223: (0: * 2) + 1 : missing `)' (error token is ": * 2) + 1 ")
../meta-ivi/scripts/runqemu-internal: line 224: (0: * 2) + 2 : missing `)' (error token is ": * 2) + 2 ")
No need to create image.
WARNING: distccd not present, no distcc support loaded.
Running qemu-system-arm...
/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-arm -kernel /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/zImage-vexpressa9.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0:,script=no,downscript=no -M vexpress-a9 -cpu cortex-a9 -sd /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/intrepid-image-vexpressa9.ext3 -no-reboot -m 1024 --append "root=/dev/mmcblk0 rw mem=1024M raid=noautodetect console=tty0 console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0 "
qemu-system-arm: -net tap,vlan=0,ifname=tap0:,script=no,downscript=no: could not configure /dev/net/tun (tap0:): Operation not permitted
qemu-system-arm: -net tap,vlan=0,ifname=tap0:,script=no,downscript=no: Device 'tap' could not be initialized
Set 'tap0:' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0:'
[chris@thinkpad build]$ sudo tunctl -t tap0 -u $USER
Set 'tap0' persistent and owned by uid 1000
[chris@thinkpad build]$

I’ve tried to change the permissions of the tap device, for example by running sudo tunctl -t tap0 -u $USER but so far without success.

But you can easily start the emulator as root:

[chris@thinkpad build]$ su -c "../meta-ivi/scripts/runqemu intrepid-image vexpressa9"
Password:
Assuming intrepid-image really means /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/intrepid-image-vexpressa9.tar.bz2

Continuing with the following parameters:
KERNEL: [/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/zImage-vexpressa9.bin]
ROOTFS: [/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/intrepid-image-vexpressa9.tar.bz2]
FSTYPE: [tar.bz2]
Acquiring lockfile for tap0:...
Using preconfigured tap device 'tap0:'
../meta-ivi/scripts/runqemu-internal: line 223: (0: * 2) + 1 : missing `)' (error token is ": * 2) + 1 ")
../meta-ivi/scripts/runqemu-internal: line 224: (0: * 2) + 2 : missing `)' (error token is ": * 2) + 2 ")
No need to create image.
WARNING: distccd not present, no distcc support loaded.
Running qemu-system-arm...
/mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-arm -kernel /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/zImage-vexpressa9.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0:,script=no,downscript=no -M vexpress-a9 -cpu cortex-a9 -sd /mnt/data/data/Projects/GENIVI/genivi-baseline/build/tmp/deploy/images/vexpressa9/intrepid-image-vexpressa9.ext3 -no-reboot -m 1024 --append "root=/dev/mmcblk0 rw mem=1024M raid=noautodetect console=tty0 console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0 "

[shutdown -h now]

Set 'tap0:' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0:'
[chris@thinkpad build]$
QEMU: Yocto GENIVI Baseline first boot

QEMU: Yocto GENIVI Baseline first boot