[HTC Sensation] merwin:
Yes, it is possible to use Debian (or any other ARM based distribution) binaries instead of busybox. These devices have plenty of horsepower, and a fair amount of space on them. There should be enough room to get proper versions of command line apps baked in :)

NOTE: This is a PROOF OF CONCEPT. Do not attempt unless you are familiar with linux, chroot, and are fine with potentially screwing up your phone!

Frankly, I got tired of the limited feature set and compatibility issues that come with busybox. So, I decided to see if I could come up with something better... all it took was a free app from the market, 4 GB carved out of my SD card, and a little bit of time.

I've played a bit with chroot (mostly using the "Linux Installer" app):

https://market.android.com/details?id=com.galoula.LinuxInstall&hl=en

My SD card has a 4GB SD-EXT partition on it, formatted as EXT4, and then a FAT32 partition. I have my phone set up to never unmount the SD-EXT partition. And, since I'm using ICS, it's not using that partition for anything yet anyways.

In any case, to save a whole lot of trouble and deal with potential corruption issues, I set up the linux chroot to use a folder instead of an image. This turned out to be handy, because I can access files and play around with bind mounts much more easily than I can with an image file.

Right now I've got Debian Stable installed using chroot to my SD-EXT partition. After getting to a Debian prompt, I updated apt:

apt-get update

apt-get install build-essential

Now we have a fully working GCC environment to use. However, the environment that Linux Installer provides comes with most tools already at your disposal.

Now what? I don't want to have to chroot to use these utilities. That's a waste of my time :)

Here, we have two options... one is somewhat easy, and one is really easy.

These are not statically compiled applications, so we do need a few libraries. To replicate the functionality of busybox (and so much more), you really only need about 15 of them.

---------------------- THE REALLY EASY WAY ----------------------

The really easy way to do this is to bind mount the following folders from the "chroot" (in my case it's /sd-ext/linux) to the root of the android device:

/bin

/lib

/usr

/sbin

I'm writing this from memory, but I believe (off the top of my head) the proper command is:

busybox mount -o bind,rw /sd-ext/linux/bin /bin

busybox mount -o bind,rw /sd-ext/linux/lib /lib

busybox mount -o bind,rw /sd-ext/linux/usr /usr

busybox mount -o bind,rw /sd-ext/linux/sbin /sbin

Please correct me if I'm wrong (and this is assuming that your chroot environment is in /sd-ext/linux

On some devices, /bin and /sbin already exist. Deal with that however you want.

Now, all you have to do is:

EXPORT PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin

If you've done it properly, you can shut down your chroot environment, go to /bin, and run ./ping 8.8.8.8

If it doesn't work, you screwed up somewhere (or I did!).

---------------------- THE SOMEWHAT EASY WAY ----------------------

On the android side, make the following folder structure:

/bin

/lib

/sbin

/usr

/usr/bin

/usr/lib

/usr/local/bin

Also, set your path so you can actually use the programs:

EXPORT PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin

Now, let's say we want to have Debian's version of 'ping' without having to chroot. Do the following:

Pop into your chroot environment, head into the /bin folder, and run the following command:

ldd /bin/ping

This will tell you what shared libraries ping uses. In my case, it uses:

/lib/libgcc_s.so.1

/lib/libc.so.6

/lib/ld-linux.so.3

Pop back over to the android side, and run the following commands (assuming that /sd-ext/linux is your chroot environment, and adjusting as necessary for the libraries that are actually used by the program you are attempting to make work)

cp /sd-ext/linux/bin/ping /bin

cp /sd-ext/linux/lib/libgcc_s.so.1 /lib

cp /sd-ext/linux/lib/libc.so.6 /lib

cp /sd-ext/linux/lib/ld-linux.so.3 /lib

Now type:

/bin/ping

You will get either get an error message about a shared library, command not found, or (if you're lucky) the Debian version of ping.

If you're not so lucky, i'd suggest copying over /usr/bin/ldd from the debian side and using it to figure out (on the android side) which libraries you're missing.

***HUGE NOTE***: Remember that folder structure we're using? It will disappear when you reboot your phone, so back it up! I would actually recommend using bind mounts and a shell script to have a more "persistent" folder structure, but that's just me...

Like I said, there's really only about 15 shared libraries or so that are needed to give us a plethora of applications at our disposal. I'll give up a bit of my phone's system space to be able to drop to a proper bash command line and pull up nano, use the full and complete version of tar, gzip, or whatever utility I want.

As I'm still playing with this, I don't have a test package or anything to put up. This is more of a proof of concept idea (that I've already partially implemented on my phone).

Also, GCC can get you a long way :) Since we're compiling on-device, there is no cross-compiler necessary. Inside of the chroot, I compiled patchELF

http://nixos.org/patchelf.html

I thought that utility might come in handy. Compiles slowly (this is a phone we're compiling on), but it works great.

The next step is to see if I can bake it in...