Busybox on the 770

This post has already been read 8381 times!

Busybox is your gateway to exploring the 770. It’s called “The Swiss Army Knife of Embedded Linux” for good reason. When you login to the 770 and use the CLI (or shell) what you are using is Busybox. Traditional Unix machines uses many small programs (most often the GNU toolset) for most common tasks. Almost all small handheld devices with limited resources (RAM) use this one application which emulates all those small programs. Using Busybox is much smaller in terms of a memory footprint that all those other apps. Busybox on the 770 is only 272k.

To learn more about Busybox, visit its home page. They have a wonderful page with every command that is possible with a full build of Busybox. The Busybox in the 770 doesn’t implement all of these commands however. The full list of what you have available to you on the 770 is available by executing Busybox by itself:

Nokia770-51:~# busybox
BusyBox v1.00 (Debian 2:20041102-11) multi-call binary

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:
        [, ash, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt,
        clear, cmp, cp, cut, date, dd, df, dirname, dmesg, du, echo, egrep,
        env, expr, false, fgrep, find, free, getty, grep, gunzip, gzip, head,
        hostname, id, ifconfig, ifdown, ifup, insmod, kill, killall, ln, logger,
        login, ls, lsmod, mkdir, mkfifo, mknod, mkswap, mktemp, modprobe,
        more, mount, mv, netstat, nslookup, pivot_root, printf, ps, pwd, realpath,
        renice, reset, rm, rmdir, rmmod, route, run-parts, sed, seq, sh, sleep,
        sort, stty, su, swapoff, swapon, sync, tail, tar, tee, test, time,
        top, touch, tr, true, tty, umount, uname, uniq, uptime, wc, which,
        who, whoami, xargs, yes, zcat

To see how much Busybox does take a look at /bin and /usr/bin. Almost all the programs in /bin are just links to the Busybox binary.

Pesky Swap

One thing I’m doing is investigating using swap with the .51 firmware. I still get out of memory errors when I swapon my little 32M swap partition on the MMC card. Once I’ve activated swap I can’t load any applications– and if I have something running (say the browser) the device will reboot.

I’m tracking what is happening by running this small script:

# while true; do
> cat /proc/meminfo
> echo '----------------'
> sleep 2
> done

Which spits out stats similar to these:

MemTotal:        61828 kB
MemFree:          5916 kB
Buffers:           112 kB
Cached:          27556 kB
SwapCached:          0 kB
Active:          24296 kB
Inactive:        16624 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        61828 kB
LowFree:          5916 kB
SwapTotal:       32728 kB
SwapFree:        32728 kB
Dirty:               0 kB
Writeback:           0 kB
Mapped:          25936 kB
Slab:             6692 kB
CommitLimit:     63640 kB
Committed_AS:    36728 kB
PageTables:       1140 kB
VmallocTotal:   188416 kB
VmallocUsed:       640 kB
VmallocChunk:   187776 kB

And by watching the output I see that my swap is never used by the 770! So while I’m not sure what is going on with this, I’m continuing to poke around the 770.

3 thoughts on “Busybox on the 770

  1. dillera

    Ok- thanks again Flegg- you got it. I was still trying to use 32Megs. I re-partitioned it down to 24 megs and it’s finally working.

    SwapTotal: 24792 kB
    SwapFree: 16764 kB

    Thanks, I’m happy to say that I opened some games, sketch, 3 browserwindows and the RSS reader and the 770 is staying peppy.

  2. There were issues with a single 32MB swap in earlier revisions, which were “fixed” if you swapped-on a 1MB file first.

    However, 24MB caused no problems in the earlier revisions. Have you tried a smaller swap file to see if that works?

  3. tsuraan

    You should check if paging is even enabled in the kernel (not sure if it can be disabled in linux, but I think it can be). Generally, paging to a flash device is not considered a good idea, so if I were configuring a kernel for a device that only support flash storage, I’d probably just disable that functionality. Just a thought…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.