Skip to content
Matthieu Crapet edited this page Apr 2, 2015 · 1 revision

Use Plowshare in an OpenEmbedded environment

Initializing a build environment (manual method)

$ mkdir ~/plowoe
$ cd ~/plowoe
$ git clone --depth 3 git://git.openembedded.org/bitbake
$ git clone --depth 3 git://git.openembedded.org/openembedded-core
$ git clone --depth 3 git://git.openembedded.org/meta-openembedded
$ git clone https://github.com/mcrapet/meta-plowshare.git

Note1: To speed up clone time and save disk space, we make a shallow clone (truncates history to requested number of revisions) by adding --depth 3 command-line switch.

Note2: As you can see, I'm using only OpenEmbedded repositories and not any Yocto related metadata layers.

Openembedded engine will rebuild all native dependencies (tools, compilers, ...) to be independent from your local Linux distribution. However (exception!), you'll need Python 2.7.3+, chrpath and gawk installed. That's all.

Now setup minimal configuration for Openembedded.

$ mkdir build
$ mkdir build/conf

Here is build/conf/bblayers.conf file to add:

LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BASEDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
  ${BASEDIR}/meta-plowshare \
  ${BASEDIR}/meta-openembedded/meta-oe \
  ${BASEDIR}/openembedded-core/meta \
"

Here is build/conf/local.conf file to add:

# Parallelism Options (change according to your CPU)
BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()}"
PARALLEL_MAKE ?= "-j 4"

# Machine and Distribution
MACHINE ?= "qemux86-64"
DISTRO ?= "tiny"

# Package Management configuration
PACKAGE_CLASSES ?= "package_ipk"

# By default disable interactive patch resolution (tasks will just fail instead):
PATCHRESOLVE = "noop"

# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
# track the version of this file when it was generated. This can safely be ignored if
# this doesn't mean anything to you.
CONF_VERSION = "1"

Note: There are template configurations files in openembedded/meta/conf directory. See local.conf.sample and local.conf.sample.extended.

Switch to openembedded mode

You'll have to call (source) this command line each time you want to cook something (using bitbake).

$ BITBAKEDIR=bitbake source ./openembedded-core/oe-init-build-env
...
# You are now in build directory

Note1: The oe-init-build-env script can take an optional argument, which is the directory build name (default is build).

Note2: When command is invoked for the first time, conf/local.conf and conf/bblayers.conf are created for you if it is missing.

Note3: source is a bash builtin command (aka bashism), you can alternatively use . (dot) instead.

Note4: To reduce command line length. You can strip BITBAKEDIR=bitbake and create a symbolic link (cd openembedded-core && ln -s ../bitbake bitbake).

We are now ready to build!

I like to see that my environmment is altered. So I change my prompt to indicated that I'm in this openembedded mode:

export PS1="\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]OE|\[$(tput sgr0)\]$PS1"

I also like aliases (because I'm a bit lazy, like all programmers):

alias bb=bitbake

Initializing a build environment (Android method)

Install Google's repo utility (it's a python script):

$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Be sure to have ~/bin in your path. You should be something like this in your .profile

PATH="$HOME/bin:$PATH"
export PATH

Clones required repositories

FIXME..

Build a qemu target

OE|$ bitbake plowshare-image

Or optionally, you can override MACHINE value from conf/local.conf by doing this:

OE|$ MACHINE=qemux86 bitbake plowshare-image

Wait some hours...

$ ls -1  tmp-glibc/deploy/images/qemux86-64/
bzImage
bzImage--3.19.2+git0+9e70b482d3_31b35da6a5-r0-qemux86-64-20150331105200.bin
bzImage-qemux86-64.bin
modules--3.19.2+git0+9e70b482d3_31b35da6a5-r0-qemux86-64-20150331105200.tgz
modules-qemux86-64.tgz
plowshare-image-qemux86-64-20150331114635.hdddirect
plowshare-image-qemux86-64-20150331114635.rootfs.ext3
plowshare-image-qemux86-64-20150331114635.rootfs.ext4
plowshare-image-qemux86-64-20150331114635.rootfs.manifest
plowshare-image-qemux86-64-20150331114635.rootfs.tar.bz2
plowshare-image-qemux86-64-20150331114635.vmdk
plowshare-image-qemux86-64.ext3
plowshare-image-qemux86-64.ext4
plowshare-image-qemux86-64.hdddirect
plowshare-image-qemux86-64.manifest
plowshare-image-qemux86-64.tar.bz2
plowshare-image-qemux86-64.vmdk
README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt

Launch qemu

$ runqemu qemux86-64 plowshare-image
Assuming plowshare-image really means /home/plowoe/build/tmp-eglibc/deploy/images/qemux86-64/plowshare-image-qemux86-64.ext3

Continuing with the following parameters:
KERNEL: [/home/plowoe/build/tmp-eglibc/deploy/images/qemux86-64/bzImage-qemux86-64.bin]
ROOTFS: [/home/plowoe/build/tmp-eglibc/deploy/images/qemux86-64/plowshare-image-qemux86-64.ext3]
FSTYPE: [ext3]
Setting up tap interface under sudo
Acquiring lockfile for tap0...
Running qemu-system-x86_64...

You can now login as root (there's no password).

runqemu is just a script located in openembedded-core. You could invoke qemu manually (I have stripped paths for readability):

qemu-system-x86_64 -kernel bzImage-qemux86-64.bin \
-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no \
-hda plowshare-image-qemux86-64.ext3 \
-show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 256 \
--append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 "

sudo issue for creating tap interface

If you are not under an Ubuntu like distro. You may need to edit your system /etc/sudoers file and add (replace with you own path):

myusername ALL=NOPASSWD: /home/plowoe/openembedded-core/scripts/runqemu-ifup
myusername ALL=NOPASSWD: /home/plowoe/openembedded-core/scripts/runqemu-ifdown

Build a VirtualBox target

You can either edit build/conf/local.conf to change machine name or you can override value via command-line:

OE|$ MACHINE=generic-core2 bitbake virtual/kernel
OE|$ MACHINE=generic-core2 bitbake plowshare-image

The resulting .vmdk file can be used with VirtualBox.

Basic tuning

Console is framebuffer (use uvesafb kernel module). Default resolution is VGA, but you can change it:

# fbset -xres 1024 -yres 768

Changing keyboard country (layout):

# loadkeys fr-latin9