Tweaking Your Build
From BUG Wiki
Contents |
Overview
This page describes techniques to modify the software used to create the BUG Linux operating system. As such, it is probably only useful to folks that already have at least a basic understanding of OpenEmbedded or Poky Linux.
Modifying Existing Recipes
This example shows how to tweak the phoneME Advanced Personal build for the BUG such that JIT is disabled and the virtual machine will run in debug mode. You will then deploy the new build as an ipk onto a live BUG. This tutorial assumes that you have already started building with the instructions in Kernel and Rootfs Build System.
Find the Recipe, Be Careful
Hopefully you already know which recipe you want to modify to get the desired result. In the case that you're not sure, the command below is your friend:
find $OE_ROOT -name \*.bb | xargs grep ...
Just like apt, there are dependencies among recipes that must be taken into consideration. If you want to see the dependencies for a given recipe, because you're a cautious person, you can use
bitbake -g name-of-package
Modifying one recipe may effect others, so before tweaking, be sure you know what you're doing.
Out With The Old
Before we started editing and remaking package, it's a good idea to blast it from your $OE_ROOT directory. Do this by:
- Remove the source tarball from $OE_ROOT/sources
- Remove the ipk from $OE_ROOT/build/tmp/deploy/ipk/<arch>/...
- bitbake -cclean recipe-name
- ...
In this case, while in $OE_ROOT:
rm -fr sources/sources/tools_phoneme.dev.java.net_.svn.phoneme.builds.phoneme_advanced-mr2-dev-b73_11560_.tar.gz.md5 sources/legal_phoneme.dev.java.net_.svn.phoneme_11560_.tar.gz.md5 sources/cdc_phoneme.dev.java.net_.svn.phoneme.builds.phoneme_advanced-mr2-dev-b73_11560_.tar.gz sources/tools_phoneme.dev.java.net_.svn.phoneme.builds.phoneme_advanced-mr2-dev-b73_11560_.tar.gz sources/legal_phoneme.dev.java.net_.svn.phoneme_11560_.tar.gz rm -fr build/tmp/deploy/ipk/armv5te/phoneme-advanced-personal* rm -fr build/tmp/staging/arm-poky-linux-gnueabi/phoneme-advanced-personal bitbake -cclean phoneme-advanced-personal
Be forewarned that some recipes create directories in the staging tree and try to create them again upon rebuild, and fail. It can be messy.
Edit the Recipe
So, we're talking about phoneME Advanced Personal, and its recipe lives in
$OE_ROOT/meta-bug/packages/phoneme-advanced/
We want to change some of the build flags, and they're set in numerous places. So, as before, find + grep are your friends:
find $OE_ROOT/meta-bug/packages/phoneme-advanced | xargs grep JIT meta-bug/packages/phoneme-advanced/phoneme-advanced.inc: echo "CVM_JIT = true" >> GNUmakefile meta-bug/packages/phoneme-advanced/phoneme-advanced.inc: echo "CVM_JIT_REGISTER_LOCALS = false" >> GNUmakefile
find $OE_ROOT/meta-bug/packages/phoneme-advanced | xargs grep DEBUG meta-bug/packages/phoneme-advanced/phoneme-advanced.inc: echo "CVM_DEBUG = false" >> GNUmakefile
Edit those flags in phoneme-advanced.inc, setting CVM_JIT = false and CVM_DEBUG = true
vi meta-bug/packages/phoneme-advanced/phoneme-advanced.inc
We're ready to build it.
Building the Modified Component
Now that the build flags are tweaked in the recipe, we're ready to build it again. Be sure that you've already cleaned and obliterated traces of the component from your $OE_ROOT directory!
bitbake phoneme-advanced-personal
Deploy the ipk
After the build is complete, there should be a file in build/tmp/deploy/ipk/armv5te/
ls build/tmp/deploy/ipk/armv5te/ Display all 3190 possibilities? (y or n)
SCP it up to your BUG:
scp build/tmp/deploy/ipk/armv5te/phoneme-advanced-personal_mr2-r0_armv5te.ipk root@10.10.10.10:/tmp/
SSH into your BUG and deploy it:
$ ssh root@bug root@bug's password: Poky Linux 3.1 on BUG root@bug:~# cd /tmp/ root@bug:/var/tmp# ls eventpipe phoneme-advanced-personal_mr2-r0_armv5te.ipk root@bug:/var/tmp# ipkg install phoneme-advanced-personal_mr2-r0_armv5te.ipk Installing phoneme-advanced-personal (mr2-r0) to root... Configuring phoneme-advanced-personal update-alternatives: Linking //usr/bin/java-cdc to /usr/lib/jvm/phoneme-advanced-personal/bin/cvm
Adding OE Components to Build
Poky and BUG-Linux are derivatives of OpenEmbedded. The packages contained in your Rootfs build are a subset of the thousands available from OpenEmbedded. If you find that you'd like a component on your rootfs that isn't available from our recipes, it's fairly easy to incorporate it into a custom rootfs build.
Setting up your OE Repo
Full documentation for this is available here: [1]. This is a summary.
The idea for the OE repository is minimal contact. You'll download a database containing all of the recipes, classes, etc from the OE repo, then build against your local DB. You'll need Monotone (or, soon, git, which will be replacing monotone for OE).
sudo apt-get install monotone git
It's generally a good idea to set up your OE repo next to your com.buglabs.build.oe directory. In my case, in ~/buglabs/build/
$ cd ~/buglabs/build/ $ git clone git://git.openembedded.net/openembedded ... ... ... $ cd openembedded $ ls packages 0xFFFF fdclock iperf matchbox-wm opie-rdesktop slutils ... ... ... ... ... ... fbreader ion matchbox-panel-manager opie-pyquicklaunchapplet slrn zziplib fbset iozone3 matchbox-sato opie-qasteroids slsnif fbui ipaq-boot-params matchbox-stroke opie-qcop slugimage fbvncserver ipaq-sleep matchbox-themes-extra opie-qss slugos-init fceu ipatience matchbox-themes-gtk opie-quicklauncher slugtool
There's a lot in there. You have choices about how to get the binaries on to your BUG. Below shows how to modify your BUG image recipe so that it ends up in your rootfs tarball. The other way is to do as above with phoneME, using the ipkg system to deploy the binary.
Adding A Package to your Rootfs
Let's say we want python in our rootfs build.
$ cd ~/buglabs/build/openembedded $ cp -vr packages/python ../com.buglabs.build.oe/packages/meta-bug/ ...
It's overkill to copy so many recipes into the buld directory, but for the purposes of this example, and with an eye for dependency resolution, we'll just copy it wholesale.
You'll want to edit the $OE_ROOT/meta-bug/images/
vi meta-bug/packages/images/bug-image-production.bb
And add the python version of choice (from meta-bug/packages/python/) into the IMAGE_INSTALL string:
# Copyright (C) 2008 Bug Labs, Inc
# Based on poky-image-sato.bb from Open Hand, Ltd.
#
# Image that defines production rootfs image.
#
IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES}"
inherit bug-image
# These are the base system recipes
IMAGE_INSTALL += "kernel-modules \
hwclock \
phoneme-advanced-personal \
concierge \
diffutils \
matchbox-theme-bug \
mb-bug-icon-theme \
bug-udev \
fbprogress \
bug-kflash \
startup-scripts \
'''python"'''
In this case, it will install python 2.5. If you want 2.4, change "python" to "python24"
Build it
Just build bug-image-production again and you should see pythong begin to build.
$ bitbake bug-image-production
If you see dependency problems, you may need to repeat the above steps for required packages. This process can be incredibly laborious, so it may be worthwhile just to bitbake -g package-name and take a look at the dependencies, moving them into your BUGrootfs tree beforehand.
That's it!
