Bitbake on Ubuntu

From Gumstix User Wiki
Jump to: navigation, search

Bitbake on Ubuntu

Getting Started

  1. Download Ubuntu from: here
  2. Burn ISO Image to a disk
  3. Put Disk into machine of your choice (These examples are run on an Acer Aspire Model: KAW60)
  4. Install Ubuntu from Disk

Once Ubuntu is up and running Type:

  • $ sudo passwd
  • $ yourpassword

Configure internet access using:

  • $ ifconfig eth0 OR
  • $ net-setup

Note: On the Acer, Ubuntu automatically connected Note: Every command run with sudo will require your password in order to run Note: Most likely /bin/sh is linked to /bin/dash. If so, then change /bin/sh to link to /bin/bash. If you don't this could cause file corruption and the build image wont work! Run "sudo dpkg-reconfigure dash" and select "no" on the screen when given the option to install dash as /bin/sh.


There are a couple of dependencies which must be installed first:

  • Monotone (or bitkeeper, but I used monotone) <UL="circle">
  • This requires that Boost is installed
  • Pyscho JIT Compiler
  • Python compiler (should come with OS) Download These from Monotone Sourceforge Boost </UL> Create a directory under your home directory called slug
    • $cd /home/yourname
    • $mkdir slug

    Place all of the downloaded files into this directory and extract them. Either by right clicking and choosing extract OR

    • $ gunzip –d name followed by $ tar –xfv name


    Monotone will not install without other dependencies. Run the following:

    • $ sudo apt-get install autoconf
    • $ sudo apt-get install automake
    • $ sudo apt-get install gettext
    • $ sudo apt-get install libboost-dev
    • $ sudo apt-get install libz-dev
    • $ sudo apt-get install g++

    Run the commands:

    • $ cd boost_1_38_0
    • $ ./configure
    • $ make install
    • $ sudo apt-get install python
    • $ sudo apt-get install make
    • $ sudo apt-get install subversion
    • $ sudo apt-get install psycho OR
    • $ sudo python install
    • Ungunzip monotone-0.42
    • $ cd monotone-0.42
    • $ sudo ./configure
    • $sudo apt-get install monotone

    To Configure Monotone:

    Create a configure script in /home/yourname/slug if one is not created. Include the following lines in the script:

    $aclocal-1.9&&autoreconf –install $AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf install

    Download automake1.9 (if not installed) from filewatcher Extract and run

    • $sudo apt-get install automake1.9

    Then run

    • $sudo ./configure

    To fetch the monotone sources run:

    • mtn db init
    • mtn pull “net.venge.monotone*”
    • mtn --branch=net.venge.mnotone checkout monotone-sources

    Getting Bitbake

    You can either download bitbake from: here

    OR go into /home/yourname/slug and run:

    Additional help can be found: here.

    If you downloaded bitbake, then save and extract the files in /home/yourname/slug cd into the bitbake directory You can either run:

  • $sudo apt-get install bitbake OR
  • $ sudo ./ install --prefix=/usr/local </UL> Run the following:
    • $sudo mkdir openembedded
    • $cd openembedded
    • $sudo mkdir packages
    • $cd packages
    • $sudo mkdir file
    • $cd file

    Create the following files


    OEROOT="/home/yourname/slug" OESYS=$OEROOT/bitbake-1.8.12 PKGDIR=$OEROOT/openembedded OEBUILD=$OEROOT/build BBPATH=$OEBUILD:$PKGDIR:$OESYS PATH=$OESYS/bin:$PATH cd $OEBUILD LD_LIBRARY_PATH= export PATH LD_LIBRARY_PATH BBPATH export LANG=C unset LC_CTYPE unset CC unset CXX alias bb=bitbake echo "Environment set up for OpenEmbedded development."


    OEROOT = "/home/yourname/slug" DL_DIR = "${OEROOT}/sources" BBFILES = ${OEROOT}/bitbake-1.8.12/openembedded/packages/*/*.bb BBPATH = ${OEROOT}/bitbake-1.8.12 OEMASK = "" PREFERRED_PROVIDERS = " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial" PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross" PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross" MACHINE = "nslu2" DISTRO = "unslung" OEINCLUDELOGS = "yes"

    DESCRIPTION = "hello world sample program"PR = "r0"DEPENDS = ""SRC_URI = "file://hello.c"S = "${WORKDIR}"do_compile () { ${CC} ${CFLAGS} ${LDFLAGS} -o hello hello.c}do_install () { install -d ${D}${bindir}/ install -m 0755 ${S}/hello ${D}${bindir}/}FILES_${PN} = "${bindir}/hello"


    #include "stdio.h“ main(){ printf("Hello World\n");}

    Where to put the files:

    • /home/yourname/slug/set-env
    • /home/yourname/slug/bitbake-1.8.12/openembedded/packages/
    • /home/yourname/slug/bitbake-1.8.12/openembedded/packages/file/hello.c
    • /home/yourname/slug/bitbake-1.8.12/conf/local.conf

    In the bitbake.conf file – located in the conf folder, ensure that OEDIR is set to: /home/yourname/slug Also ensure that you change the path in the files you just created to match your directory structure

    In /home/yourname/slug run:

    • $sudo ./set-env

    This sets up the openembedded environment which is needed to finish running everything from bitbake

    Building Hello World

    Once all files are in the correct place and the dependencies are installed, run the following:

    • $cd /home/yourname/slug/bitbake-1.8.12/openembedded/packages
    • $bitbake world OR
    • $bitbake –b hello

    World will build everything in the folder -b hello will only build the hello package

    • $sudo apt-get install hello
    • $hello

    This will print out “hello world!”

    Running on Verdex Pro

    The previous instructions will cause problems using Ubuntu8.10 when getting the basic image built. There is a workaround by installing the old version of gcc, but as this caused other problems, I regressed to Ubuntu 8.4. Here is how I got the image built to install on the Verdex Pro. Ensure you follow the note at the top of the page and switch the bash pointer. I am also assuming you have your gumstix hardware put together and you have the ability to plug it into your laptop and that you have a keyboard plugged into your verdex pro. (There are some great tutorials on this site on how to build the hardware. Thanks guys!)


    • Follow the Previous instruction on installing Ubuntu, but install version 8.4
    • You can setup your own password during installation
    • Then follow the instructions to download and install the dependencies, but don't download bitbake yet


    This can take a little bit to download. Once its done then do the following:

    • $cat gumstix-oe/extras/profile >> ~/.bashrc
    • $ sudo groupadd oe
    • $ sudo usermod -a -G oe your_username
    • $ sudo mkdir /usr/share/sources
    • $ sudo chgrp oe /usr/share/sources
    • $ sudo chmod 0775 /usr/share/sources
    • $ sudo chmod ug+s /usr/share/sources

    I found that I had to change some permissions on folders in order to get everything to run. Make sure that you have full permission to the gumstix folder without having to sudo. Then do the following

    • $bitbake gumstix-basic-image

    On my Acer this build took almost 8 hours, so don't panic if it seems to hang at some points. There were some points in which my machine would try to connect to the repositories to download info and it would have to try several times, which obviously added time to the build.

    When the build is done and you are back at your prompt:

    • ls ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/

    This will show you several files. You want to ensure that you have the following files:

    • gumstix-basic-image-gumstix-custom-verdex.jffs2
    • uImage-2.6.22-r1-gumstix-custom-verdex.bin

    These are the files you will be shooting over to the verdex pro. Now you have to setup Kermit:

    • $ sudo apt-get install ckermit

    Then create a script in your home directory (it doesn't really matter where, just somewhere you can get to it easily) I am using a USB adapter to talk to the serial port, so you may need to change the second line and make sure to change the take line to match your path:

    #!/usr/bin/kermit +
    kermit -l /dev/ttyUSB0
    set speed 115200
    set reliable
    set carrier-watch off
    set flow-control none
    set prefixing all
    set file type bin
    set rec pack 4096
    set send pack 4096
    set window 5
    take /home/yourname/gumstix/gumstix-oe/extras/kermit-setup

    Save and run:

    • $ ./script

    This will bring up the kermit screen. Make sure at this point you have the gumstix plugged into your laptop and connected to keyboard. Now that the kermit setup is running you can plug your gumstix into the power. You have to hit the space bar on your laptop immediately in order to get to the U-boot command line (you will see GUM> ). The verdex pro comes with the correct version of U-boot so you don't have to risk bricking your gumstix (yea!). Once you are at the GUM> command line, type (on your laptop):

    • GUM> loadb a2000000

    loadb is the U-boot command to get info from Kermit. (If you choose to use something else like minicom, type help at GUM> to get the correct command to use.) then hit CTRL+\ + c to go back to kermit then:

    • C-Kermit> cd ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/
    • C-Kermit> send gumstix-basic-image-gumstix-custom-verdex.jffs2
    • C-Kermit> connect

    This will bring back up the GUM screen. Do NOT replace ${filesize} with a number!:

    • GUM> protect on 1:0-1
    • GUM> erase all
    • GUM> cp.b a2000000 40000 ${filesize}
    • GUM> loadb a2000000

    Then hit CTRL+\ + c to go back to kermit then:

    • C-Kermit> send uImage-2.6.21-r1-gumstix-custom-verdex.bin
    • C-Kermit> connect

    This will go back to GUM>

    • GUM> katinstall 100000
    • GUM> katload 100000
    • GUM> bootm

    This will boot you up to the command line. username: root, password: gumstix Thankfully in the newest version of the image build, tslib is included, so you don't have to go and get it separately. (yea!) Also on my build, I found that the ts.conf file in /etc had the correct modules called. If you want to double check, you need to:

    • # cat /etc/ts.conf

    If it has the following, then you are all set:

    module_raw input module pthres pmin=1 module variance delta=30 module dejitter delta=100 module linear

    Then # vi /etc/profile and add:

    export TSLIB_TSDEVICE = /dev/input/event0 export TSLIB_TSEVENTTYPE=INPUT export TSLIB_CONFFILE=/etc/ts.conf export TSLIB_CALIBFILE=/etc/pointercal

    then :wq

    • # cd /usr/bin/
    • # ./ts_calibrate

    This will bring up a screen for you to calibrate the touchscreen. The verdex pro does not come with a stylus. I went and got some cheap ones meant for Nintendo DS ($7 for three of them). I found that I had to run the calibration tool a few times in order to get it properly calibrated. Then if you want to test out if it calibrated correctly try the following:

    • ./ts_test

    Other Factors

    These instructions will change depending on the OS being used.

    Tutorial was based on information from: this Hello World tutorial. For More information please see the above mentioned site