Linux utilities can be used on Android using a very interesting tool busybox. This tools supports most of the Linux tools (functions as listed in below section). More details on busybox can be found here.
Download the ‘busybox‘, install and use it as below. Hope its useful for somebody.
Note:
- Familiarity with Android ‘adb’ utility is assumed here.
- ‘adb’ path is set for $PATH environment variable.
- Following instructions were tried on Android G1 phone.
On a terminal execute following instructions to create ‘busybox’
directory under /data on G1 phone.
$adb shell #mkdir /data/busybox #exit
Go to the location where busybox binary is downloaded and execute following instructions.
$adb push busybox /data/busybox/busybox 1194 KB/s (1745016 bytes in 1.427s) $adb shell #cd /data/busybox #ls -l -rw-rw-rw- root root 1745016 2010-12-16 17:17 busybox #chmod 777 busybox #ls -l -rwxrwxrwx root root 1745016 2010-12-16 17:17 busybox
Time to verify ‘busybox’ is installed correctly, its version and various functions supported.
#./busybox BusyBox v1.8.1 (2007-11-14 10:11:37 EST) multi-call binary Copyright (C) 1998-2006 Erik Andersen, Rob Landley, and others. Licensed under GPLv2. See source distribution for full notice. Usage: busybox [function] [arguments]... or: [function] [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as! Currently defined functions: [, [[, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk, basename, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cut, date, dc, dd, deallocvt, delgroup, deluser, df, dhcprelay, diff, dirname, dmesg, dnsd, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold, free, freeramdisk, fsck, fsck.minix, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname, httpd, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod, install, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, ls, lsattr, lsmod, lzmacat, makedevs, md5sum, mdev, mesg, microcom, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, mountpoint, mt, mv, nameif, nc, netstat, nice, nmeter, nohup, nslookup, od, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, poweroff, printenv, printf, ps, pscan, pwd, raidautorun, rdate, readlink, readprofile, realpath, reboot, renice, reset, resize, rm, rmdir, rmmod, route, rpm, rpm2cpio, run-parts, runlevel, runsv, runsvdir, rx, sed, seq, setarch, setconsole, setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, slattach, sleep, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tail, tar, taskset, tcpsvd, tee, telnet, telnetd, test, tftp, time, top, touch, tr, traceroute, true, tty, ttysize, udhcpc, udhcpd, udpsvd, umount, uname, uncompress, unexpand, uniq, unix2dos, unlzma, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat, zcip
‘busybox’ is installed correctly! Now go ahead and try Linux utilities/functions as per your need.
Since I needed ‘stty’ utility, I used following instruction.
#./busybox stty -F /dev/ttySDIO0 raw #cat /dev/ttySDIO0 12345 ^C
ripple
July 22, 2011 at 9:45 pm
This one is kewl… found to the point.. Nice job
maynature
July 23, 2011 at 4:58 am
Nice to know the information was useful!
Thank you for adding the post link on your blog.
sam
September 27, 2011 at 6:05 am
very good, thanks