During development with OpenEmbedded (oe-core, meta-oe, meta-angstrom), I often find it useful to set up a feed server so that packages can quickly be installed on the target system without manually copying them over or building a new image. One way to do this is copy your deploy/ipk directory to an existing web server (perhaps Apache running on your workstation), or configure Apache to point at your OE build directory, etc. But, it might be more convenient if your build system could directly create an opkg feed with no extra configuration. In the below example, we use node.js + express.js to create a feed server (basically just a web server that serves up the ipk files).
tools/feed-server/app.js:
// nodejs script to start a http server with the feed from this directory// default is port 4000var express = require('express')var app = express()app.use('/', express.static(__dirname + '/../../build/tmp-angstrom_next-eglibc/deploy/ipk/'))app.use('/', express.directory(__dirname + '/../../build/tmp-angstrom_next-eglibc/deploy/ipk/'))console.log("feed server started on port 4000")app.listen(4000)
The express.directory function is used to create a directory listing that can be browsed. With most other web servers, at least this much code is required just for configuration. With node.js, this is the code to create an entire server from scratch! This node.js app can be started with a bash function in the environment:
function oe_feed_server() { cd $OE_BASE bitbake package-index node tools/feed-server/app.js cd - }
The package-index target is used to rebuild the index files that list the available packages.
On the target system, the /etc/opkg configuration files must be modified to point to the feed server, and then you can run:
opkg update; opkg install <package>
An exmaple build environement with this integrated is located:
https://github.com/cbrake/oe-build-core
https://github.com/cbrake/oe-build-core/commit/23352b9a43c60d67070abe5ac001aba9a9ac5cc4
https://github.com/cbrake/oe-build-core/commit/6baceb8b1e4477ccfd03aa553a5fcf501b398196
It might be argued that it is just as easy or easier to set up a more conventional web server. However, the benefit of node.js is that it is a full blown programming environment. You can quickly extend it to provide a web interface, perhaps add functionality to automatically push updated opkg configuration files to the target system that point to your feed server, etc. It is much more than just a web server.