This is bleeding-edge stuff, so please don't try it if you're new to Android system development. Android already has an excellent package manager for user apps (apk's). What I propose here is a package manager for the operating system itself.
Why? Read on, or read my blog post
Some of you who have used Debian (or Debian-like Linux distributions such as Ubuntu) might know about dpkg/apt, a framework for installing packages and keeping them up to date. dpkg maintains information about everything you have installed on the system, and apt takes care of fetching packages from the Internet and other sources. It's one of the most awesome (imho) package managers ever.
opkg is similar to dpkg -- in fact, opkg is compatible with some dpkg packages (otherwise known as deb's). The difference is that it's tiny. I have built a statically-linked version of opkg for my phone that is just 746KB. It could potentially be used to keep Android systems up to date without periodically reflashing the whole ROM.
I have cooked up an installer an example package for the adventurous fellows here who have root and would like to try. It works well on my G1, but YMMV, so be sure to backup
before you start. When you have done that, head over to http://dl.dropbox.com/u/1213413/android-opkg/index.htm
for files and instructions. Unless you want to build opkg yourself, there's no need to read further.
If you want to do it yourself, just grab the latest code off SVN
and cross-compile. I already had a full Debian-based development environment on my phone, so I didn't bother with cross-compiling. The last line generates a static build, so we end up with a self-contained binary that does not depend on any shared libraries. You might also want to edit libopkg/opkg_conf.h
and change OPKG_CONF_DEFAULT_TMP_DIR_BASE to "/cache/tmp" instead of "/tmp".
LDFLAGS=-static ./autogen.sh --enable-sha256=no --enable-openssl=no --enable-ssl-curl=no --enable-gpg=no --enable-curl=no --with-opkglibdir=/cache/usr/lib --with-opkgetcdir=/cache/etc
gcc -Ilibopkg -g -O2 -static -o opkg-cl src/opkg-cl.o libopkg/.libs/libopkg.a libbb/.libs/libbb.a