Busybox

From embeddedTS Manuals

Overview

Busybox is a minimalistic shell containing similar tools to the GNU Core utilities. This is used as the default ramdisk and is only 2Mbyte. There is space for approximately 800 Kbyte of additional user applications. The binaries on the initrd are dynamically linked against embedded Linux's "uclibc" library instead of the more common Linux C library "glibc". "uclibc" is a smaller version of the standard C library optimized for embedded systems and requires a different set of GCC compiler tools which are available in the VFAT partition of the default 2GB SD card/USB flash dongle optionally shipped with the boards.

This ramdisk is modified to mount the debian filesystem as readonly. This allows you access to all of debian's binaries and libraries while still having the very fast boot time.

Available Commands

# /bin/busybox --help
BusyBox v1.14.2 (2009-08-07 14:43:48 MST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
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:
        [, [[, ash, basename, cat, chgrp, chmod, chown, chroot, cmp, cp,
        cpio, cttyhack, cut, date, dd, depmod, devmem, df, dirname, dmesg,
        du, echo, egrep, env, expr, false, fdisk, fgrep, find, grep, gunzip,
        gzip, halt, head, hostname, hush, ifconfig, insmod, kill, killall,
        ln, login, ls, lsmod, md5sum, mdev, mkdir, mknod, modprobe, more,
        mount, msh, mv, netstat, ping, pivot_root, poweroff, printf, ps,
        pwd, reboot, rm, rmdir, rmmod, route, rx, sed, setconsole, setsid,
        sh, sleep, stty, sync, tail, tar, telnetd, test, tftp, top, tr,
        true, udhcpc, umount, unzip, usleep, uudecode, uuencode, vi, wget,
        xargs, yes, zcat

linuxrc

The '/linuxrc' file is a shell script that is the very first thing run by the kernel on startup. Several sample startup scripts are included and can either be used directly ("ln -sf /linuxrc-XXX /linuxrc" command) or modified to include custom bootup logic. These shell scripts were designed to be as fast and simple as possible for easy customer modifications. It is anticipated that this shell script be modified from the default to implement things in the customer's product such as backup configurations, software field updates, conditional booting/verification of SD cards, etc. Technologic Systems professional services is available should you need help in implementing a specific feature.

Skip Busybox

By default this file is linked to linuxrc-fastboot which will boot to a shell. To make it boot to SD by default, you would type:

   rm linuxrc; ln -sf /linuxrc-sdroot /linuxrc; save

FAQ

Can I use Busybox to run my application?

In most cases yes. However if you need to save data, busybox is loaded entirely into memory so it is temporary unless you run 'save'. You can also remount the debian filesystem as read/write, but you must remember to sync and remount readonly before you shutdown the system.

Can I start debian services from Busybox?

Technically yes, but it is not recommended as it would require modifying each service init script and its dependencies to start up correctly. Instead, you should consider booting to the debian filesystem and trimming down services to save boot time.