Archive for the ‘Android’ Category

I am delighted to announce the immediate availability of BotBrew on Google Play. This first release brings cross-compiled command line software to Android, along with a package manager based on opkg and a service manager based on runit. Some highlights include:

  • an almost-complete busybox with 327 applets
    have more of your favorite commands without the bloat
  • python and ruby
    script on-the-go, or run django- and rails-powered servers
  • subversion and git
    access source code using two popular version control systems
  • tcpdump and nmap
    analyze network traffic and query remote hosts
  • lynx and w3m
    go retro with lightweight text-based Web browsers

BotBrew could be used with any terminal app that provides a local shell, but Hacker’s Keyboard and Script Manager might be helpful, too. Spread the word if you like BotBrew! If you have trouble with BotBrew or have bugs to report, feel free to email us at or chat with us at #botbrew on And we’d love to hear from you if you want to distribute your own software using BotBrew.

I return to school at noon, but before then, I’d like to share my evening project: agcc.bash, a rewrite of agcc and that works with revisions 6 and 7 of the Android NDK.

The NDK is a GCC-based cross-compiler that lets you embed object code in a traditional Android app. It also works as a standalone cross-compiler, though it is not advertised as such. It is quite rough when used by itself, and agcc wraps the complexity in a little script. While agcc and are written in Perl, agcc.bash is a Bash script. It also supports the latest revisions of the NDK, though r7 is slightly buggy.

With agcc.bash, building native Android software feels almost like working with GCC. As a quick example, let’s try the classic hello world:

AGCC_NDK=~/android-ndk-r6 ./agcc.bash hello.c -o hello

That wasn’t too exciting… but what happened there? I have the NDK installed at ~/android-ndk-r6 and I told agcc.bash where to look for it, using the AGCC_NDK environment variable. I then invoked agcc.bash as if it were GCC. Let’s see what agcc.bash did behind the scenes:

AGCC_NDK=~/android-ndk-r6 AGCC_ECHO=yes ./agcc.bash hello.c -o hello

=> ./agcc.bash hello.c -o hello
<= /home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -o hello -I/home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/include -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fmessage-length=0 -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fmessage-length=0 hello.c -Bdynamic -Wl,-T,/home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-dynamic-linker,/system/bin/linker -Wl,–gc-sections -Wl,-z,nocopyreloc -Wl,–no-undefined -Wl,-rpath-link=/home/jyio/android-ndk-r6/platforms/android-8/arch-arm -L/home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib -nostdlib /home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib/crtend_android.o /home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o -lc /home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a -lm -ldl

See how it transformed our innocent little command into a monster! This might be overkill for a hello world program, but it provides pretty good support for more complex software such as OpenSSL, cURL, and Python. It would be a good idea to add the NDK toolchain and agcc.bash to $PATH before trying to build a big program. In my case, the toolchain resides in ~/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin. If you want to build some software that come with configure scripts, you might start with:

CC=agcc.bash ./configure

Do try this at home! Relevant links:

Some of you might remember this lowly device. Once upon a time, it was the talk of the town. When the mobile carriers stopped issuing updates, CyanogenMod became one of the predominant variant distributions. But now, with official support dropped from the Android Open Source Project, even Cyanogen and his team are having trouble keeping up. I am, of course, talking about the HTC Dream; this review will cover a number of ways to keep this device up to date, and may apply to the HTC Sapphire/Magic as well.

Read on »

Opkg is not limited to using packages from files; it is also capable of using apt-get style repositories, vastly simplifying the job of fetching dependencies and updating packages. I already have a repository set up, and it could be added as such

echo "src/gz inportb-android-froyo" > /cache/etc/opkg/inportb.conf

After doing that, we could refresh the package list

opkg update

Installing a package then becomes as easy as

opkg install name-of-package

And we could keep all our packages up-to-date using

opkg update; opkg upgrade

It’s also quite simple to set up a repository for distributing packages.

Read on »

Now that we have Opkg for Android, we could use it to install packages from local files or off Web servers. Installing a package is as simple as

opkg install path/to/package.opk

or, if it’s on the Web

opkg install http://host/path/to/package.opk

And to remove the package, we would go

opkg remove name-of-package

But what if we wanted to share our own software with others? In this case, we would create our own packages. An Opkg package is essentially a Debian package with fewer control fields. If you know how to make a Debian package, you should be well on your way. In general, a package is an ar archive containing a control tarball, a data tarball, and a debian-binary file. For example let’s have a look at the opkg-hello package:

Read on »

Well, almost. While one could theoretically install Debian packages on Android phones, it is generally a bad idea to install software designed for one system onto a different system. However, the Debian package manager is excellent for keeping track of software, and it would be nice if it could be used on Android as well. iPhone users already have access to this mechanism in the form of Cydia, so why not put it on Android too?

Read on »

Recently, I rewrote from scratch a two-year-old project of mine. Imagine, a browser-based image editor, had been sitting around collecting dust, so I figured I’d delete all the legacy code (almost all of it) and create something better. I’ve also been evaluating the possibility of integrating Imagine into Google Wave.

Read on »

A recent trick floating around the xda-developers forums involves using UnionFS to layer the microSD storage on top of the existing data partition, effectively allowing the microSD storage to be used for data. This technique originated from MarcusMaximus04 and has made its way into the firmware builds of TheDudeOfLife and JesusFreke.

While most users were playing around with the easy “apps2SD” feature, I decided to explore a different aspect of UnionFS — stackable snapshots. The goal was to be able to make snapshots of the filesystem that could be rolled back at any time, undoing any changes. While this may sound like server-oriented technology, it could be useful on a mobile platform that is collecting a sizable hacker community.

Read on »

Really, there is no need for this post… because Cupcake (an updated version of Android found on the HTC Magic and ported over to the G1) is quite friendly to users without data service. The ability to skip activation allows the user to delay activation until the WiFi connection can be initialized. And since rooting is required, the modified recovery image and engineering SPL makes backup-and-restore trivial.

Read on »

Haykuro has recently released a series of Android builds. This is the software for the HTC Magic, ported to the G1. Since I have not had time to fully explore this new operating system, I’ll just list some of the most obvious changes:

  • activation not required! (can set up account later)
  • new theme
  • new camera options, such as video recording
  • lock-screen background
  • 3G notification icon says H
  • smooth transitions by default
  • automatic screen orientation flipping
  • no more voice search in search widget
  • on-screen keyboard
  • … among other things …

Now, it is actually pretty simple to get this software. There’s even a nice guide for this, which was pretty straightforward for me to follow. Nevertheless, since I had not rooted my phone and I have no data plan, I had a couple of extra steps.

Read on »