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.
No comments:
Post a Comment