Tuesday, October 27, 2009

BitBake and reusing existing ipkg files

I've spent a few days helping a customer with BitBake, a python-based build tool for embedded systems. One of the distributions that uses BitBake is OpenEmbedded, a "build-every-single-thing-from-source" Linux distro.

The customer had a number of existing ipkg packages and wanted to add them to the BitBake'd image. That turns out to be an undocumented use case, so here's the information to save other people the time we spent.

For a target architecture of armv5te, the recipe file for a package with an ipkg file named mypackage-1.2.0.3-1_armv5te.ipk looks like the code below.


DESCRIPTION = "My Package"
DEPENDS = ""
LICENSE = "GPL"

PN = "mypackage"
PV = "1.2.0.3"
PR = "1"
PACKAGES = "${PN}"

# Just fetch and place the ipkg in the correct place to build the rootfs.

# As used in openembedded/classes/image.bbclass via rootfs_ipk.bbclass
PACKAGE_INSTALL_append = ${DEPLOY_DIR_IPK}/armv5te/${P}_armv5te.ipk

SRC_URI = "\
http://ipkg-repository.example.com/subdir/${P}_armv5te.ipk \
"

do_unpack() {
echo "Null unpack method"
}

do_patch() {
echo "Null patch method"
}

do_configure() {
echo "Null configure method"
}

do_compile() {
echo "Null compile method"
}

do_stage() {
echo "Null stage method"
}

do_install() {
oenote Creating directory ${WORKDIR}/install/${PN}
# A directory is needed for each member of PACKAGES
mkdir -p ${WORKDIR}/install/${PN}
}

do_package() {
echo "Null package method"
}

do_package_stage() {
echo "Null package_stage method"
}

do_distribute_sources() {
echo "Null distribute_sources method"
}

do_package_write() {
oenote Copying the downloaded ipkg package from ${DL_DIR} to\
${DEPLOY_DIR_IPK}/armv5te
install ${DL_DIR}/${P}_armv5te.ipk ${DEPLOY_DIR_IPK}/armv5te
}


Version: BitBake 1.8.3

It doesn't look like much by itself, but the work behind it was, er, significant. BitBake and OpenEmbedded have a good number of layers, moderate documentation and great power.


Other tips:

Don't execute BitBake in a subdirectory or it will rebuild the world in a new tmp directory there.

OpenEmbedded apparently doesn't check the return code from the ipkg install commands, so if your files aren't appearing in your image (rootfs) directory, then check their dependencies or run the explicit ipkg command that can be found in the relevant run* command file.

If ipkg asks for user input about overwriting a configuration file, then the OpenEmbedded do_rootfs() function will hang and you will need to kill both the ipkg and bitbake commands manually.

See http://bec-systems.com/web/content/view/79/9/ for more information about adding new packages to images.

Thursday, October 15, 2009

There's no such thing as a unique name

Reading an old post by James Clark about Thai personal names, I wondered how many different names I am addressed by. Surprisingly, I came up with eight.

John Matthew Simon Doar (birth certificate)
Matthew Doar (school name, birth family usage)
Matt Doar (work name)
Matthew Baginski Doar (family name after marriage)
Matthew B. Doar (shortened family name used for publications)
Matthew Baginski (used by systems that can't handle two words in a family name)
J. Matthew Doar (occasional form letters)

and strangest of all is the U.S. Immigration Service who refer to me as "John M. Doar" and once forced me to make up a signature for it on the spot! All I really want these days is to be unique enough for Google.

Friday, October 9, 2009

Handling large numbers of JIRA projects


Once you have a large number of projects in JIRA creating an issue can become a bit tedious, scrolling through the long list of projects to choose just the right one. JIRA (Enterprise edition) already provides Project Categories that you can group projects into, so without further ado, here's a JSP hack to reduce the size of that list of projects by letting you select a project category first.

Installation

The modified file for JIRA 3.13 is createissue-start.jsp and replaces the file of the same name in your JIRA instance. There should be no need to restart JIRA. The usual disclaimers apply, drink responsibly, don't drive and derive etc.

My first build tool question


gnu.misc.discuss


The post above from me in August 1994 asking for help with gnumake reminds me that I never did learn how to use a build tool in college. Fifteen years later, I still don't know the answer to the question that I asked, but I do know that make is still not my favourite build tool.

Still, at least the books about Make have improved with John Graham-Cumming's GNU Make Unleashed and Robert Mecklenburg's Managing Projects with GNU Make, Third Edition. That "Third Edition" part is important.

~Matt