BusyBox 將許多 UNIX 系统常用工具合併為單一 busybox 執行檔, 减少系统資源使用量使 busybox 適合在系统資源有限的嵌入式系统中運行.

<< 從 BusyBox GIT 下載原始碼 >>
~$ git clone git://busybox.net/busybox.git

<< 编譯配置 - 静態連结 >>
~$ cd busybox
~/busybox$ make config
~/busybox$ make menuconfig
選取 Busybox Settings -> Build Options -> Build BusyBox as a static binary (no shared lib)

* You may need "libncurses5-dev" for menuconfig

<< 编譯與安裝 >>
~/busybox$ make
~/busybox$ make install

busybox 執行檔位於 ~/busybox/_install/bin 目錄.

<< 使用說明與支援功能列表 >>
~/busybox$ cd _install/bin
~/busybox/_install/bin$ ./busybox
BusyBox v1.24.0.git (2015-01-15 10:22:19 CST) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
    or: busybox --list[-full]
    or: busybox --install [-s] [DIR]
    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:
        [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev,
        bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot,
        chrt, chvt, cksum, clear, cmp, comm, conspy, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt,
         ...
        ttysize, tunctl, ubiattach, ubidetach, ubimkvol, ubirmvol, ubirsvol, ubiupdatevol, udhcpc, udhcpd, udpsvd, umount,
        uname, unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unxz, unzip, uptime, users, usleep, uudecode, uuencode,
        vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, whois, xargs, xz, xzcat, yes, zcat,
        zcip

<< 使用 mpstat 監視 CPU 使用率 >>
~/busybox/_install/bin$ ./busybox mpstat -P ALL
Linux 3.13.0-44-generic ( ) 01/15/15 _x86_64_ (12 CPU)

11:42:51 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
11:42:51 all 1.29 0.06 0.28 2.20 0.00 0.00 0.00 0.00 96.15
11:42:51 0 1.57 0.07 0.71 3.22 0.00 0.03 0.00 0.00 94.39
...
11:42:51 10 0.70 0.00 0.11 0.10 0.00 0.00 0.00 0.00 99.08
11:42:51 11 0.61 0.01 0.12 0.03 0.00 0.00 0.00 0.00 99.24

<< 新增或移除功能 >>
~/busybox$ make menuconfig

 busybox_menuconfig.jpg    

* 本文工作環境為 Ubuntu 14.04 LTS, 64-位元, x86.

   

文章標籤
創作者介紹
創作者 版大 的頭像
版大

嵌入式系統

版大 發表在 痞客邦 留言(0) 人氣()