Other OS

Build minimal image with Yocto under ubuntu 12.04

1 5368
Post Last Edited by John at 2014-7-30 08:56

I'm glad to say that we will have 1 more choice to build the Bananapi image from now on. I have added the meta layer for bananapi board with the support from bananapi team.
You could get the meta layers from https://github.com/xleng/meta-bananapi and https://github.com/xleng/meta-sunxi.

If you are a yocto expert, I think you could add your own package with bananapi layers, if you are a beginner, you can follow these steps to make this achievement.

1. First of all, install the essential packages for ubuntu with this command:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
  build-essential chrpath libsdl1.2-dev xterm

You can read the "Yocto Project Quick Start"  if you want to known more about it.

2. Get poky, here we use daisy release version.

$wget http://downloads.yoctoproject.or ... aisy-11.0.1.tar.bz2

$tar xvjf poky-daisy-11.0.0.tar.bz2

3. Step into the poky folder and get bananapi meta layers.
$cd poky-daisy-11.0.0
$git clone https://github.com/xleng/meta-sunxi.git
$git clone https://github.com/xleng/meta-bananapi.git

4. Get meta-openembedded layers, be sure you use the right branch with poky, here we use daisy branch.

$git clone -b daisy https://github.com/openembedded/meta-openembedded.git

5. Now we come to the last. Source this script, it will create and step into a "build" directory.

$source ./oe-init-build-env

In the build directory, you will find 2 files under conf folder: bblayers.conf and local.conf, these two configuration files are used to control the yocto what and how to build the image.

First we need add bananapi's meta layers to the bblayers.conf file,this file will be something like this at the beginning:

$cat ./conf/bblayers.conf
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly LCONF_VERSION = "6"


BBLAYERS ?= " /home/john/opensource/yocto/poky-daisy-11.0.0/meta \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-yocto \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-yocto-bsp \
BBLAYERS_NON_REMOVABLE ?= "/home/john/opensource/yocto/poky-daisy-11.0.0/meta \
/home/john/opensource/yocto/poky-daisy-11.0.0/meta-yocto \ "

The path maybe different depending on your username and folder name.Change the BBLAYERS's value to this with your favorite editor:

BBLAYERS ?= " /home/john/opensource/yocto/poky-daisy-11.0.0/meta \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-yocto \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-yocto-bsp \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-sunxi \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-bananapi \
    /home/john/opensource/yocto/poky-daisy-11.0.0/meta-openembedded/meta-oe \
Save and exit.

In the last, we need to change the machine type. Find the "MACHINE ??= " line in ./conf/local.conf file, change this line to:
MACHINE ??= "bananapi"
Save and exit.

Finally, make sure you still under build directory and run the command to build the minimal image:
$bitbake core-image-minimal

The build will cost a lot of time,it will download the kernel,uboot,toolchain and other essential packages and build them, so be patient with it.

You will get a image file under './tmp/deploy/images/bananapi/core-image-minimal-bananapi.sunxi-sdimg' if no error occur.

Flash this image file with your tools to sd card to boot the system, the login username is root, and no password.

This minimal image don't have a X system, so you can't login to a desktop screen, this is our first step to bring Yocto to Bananapi, we will add more packages later.

Please feel free to let me know if you got any trouble during the build, you can also create tickets on github.
Thanks John.

You have to log in before you can reply Login | Sign Up

Points Rules