使用busybox

1,busybox简介:busybox是一个集成了一百多个最常用linux命令和工具的软件,他甚至还集成了一个http服务器和一个telnet服务器,而所有这一切功能却只有区区1M左右的大小。我们平时用的那些linux命令就好比是分立式的电子元件,而busybox就好比是一个集成电路,把常用的工具和命令集成压缩在一个可执行文件里,功能基本不变,而大小却小很多倍。在MID平台上,我的很多linux命令都无法使用,比如cp,但是通过安装busybox后就可以使用了。

2,配置busybox:下载后解压,我用的是busybox-1.15.3版本。首先执行make clean;然后在执行make defconfig;然后开始busybox的配置程序,和linux内核菜单配置方式简直一模一样,熟悉用make menuconfig方式配置linux内核的朋友很容易上手。在执行make编译之前,首先要修改Makefile的编译器选项,因为默认是编译X86机器上的,需要修改交叉编译器配置后编译的busybox才能在ARM linux上运行,我此处修改的就是:

CROSS_COMPILE ?= /usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-。执行make 即可。

      如果不用make defconfig,手动配置也可,如下:

(1),Busybox Settings->General Configuration:

       Show verbose applet usage messages
       Runtime SUID/SGID configuration via /etc/busybox.conf
上两个要选上。
(2),Busybox Settings->Build Options:
       Build BusyBox as a static binary (no shared libs)这个选项是一定要选择的,这样才能把busybox编译成静态链接的可执行文件(较大),运行时才独立于其他函数库。否则必需要其他库文件才能运行,在单一个linux内核不能使他正常工作。
(3),Busybox Settings->Installation Options
       Don't use /usr
这个选项也一定要选,否则make install后busybox将安装在原系统的/usr下,这将覆盖掉系统原有的命令。选择这个选项后,make install后会在busybox目录下生成一个叫_install的目录,里面有busybox和指向他的链接。
     其他选项都是一些linux基本命令选项,自己需要哪些命令就编译进去,一般用默认的就可以了。
4,编译并安装或使用busybox:
#make
#make install
编译好后在busybox目录下生成子目录_install,里面的内容:
drwxr-xr-x 2 root root 4096 11月 24 15:28 bin
lrwxrwxrwx 1 root root 11 11月 24 15:28 linuxrc -> bin/busybox
drwxr-xr-x 2 root root 4096 11月 24 15:28 sbin
其中可执行文件busybox在bin目录下,其他的都是指向他的符号链接。

      如果不安装,也可以直接拷贝busybox到MID上的/systme/bin目录下;或者通过复制busybox到out/target/product/smdk6410/system/bin目录,一起编译进系统。系统会默认在这个路径下查找命令。可以命令行直接执行busybox vi等就可以使用VI编辑器了。亦或者使用buysbox cp就可以使用拷贝命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Busybox for Android v1.20.2 Stable built by Linus Yang [Aug 12, 2012 Update] - Update to 1.20.2 stable [Features] - Tested on Android 2.1, 2.3, 4.0 and 4.1. Should be capable with all Android devices (Use at your own risk) - ELF armv5te binary (statically linked) - More suitable for Android than the prebuilt ARM binaries from busybox.net - IPv6 support, using own DNS resolver, correct user name display and more improvements for Android [Install] wget http://yangapp.googlecode.com/files/busybox-1.20.2 mv busybox-1.20.2 busybox chmod 755 busybox ./busybox --install [INSTALL_DIR] You can build by yourself from my github's project: (forked from tias/android-busybox-ndk) https://github.com/linusyang/android-busybox-ndk [Information] BusyBox v1.20.2-linusyang (2012-08-12 21:41:27 CST) multi-call binary. Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko and others. Licensed under GPLv2. See source distribution for full notice. 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, adjtimex, ar, arp, arping, ash, awk, base64, basename, bbconfig, beep, blkid, blockdev, bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cttyhack, cut, date, dc, dd, deallocvt, depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, dpkg, dpkg-deb, du, dumpkmap, dumpleases, echo, ed, egrep, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs, flash_lock, flash_unlock, flashcp, flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, grep, groups, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, inotifyd, insmod, install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, less, linuxrc, ln, loadkmap, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.reiser, mkfs.vfat, mknod, mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mv, nameif, nanddump, nandwrite, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, od, openvt, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pstree, pwd, pwdx, raidautorun, rdate, rdev, readlink, readprofile, realpath, reboot, reformime, renice, reset, resize, rev, rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-parts, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setconsole, setkeycodes, setlogcons, setserial, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach, sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true, tty, ttysize, tunctl, tune2fs, ubiattach, ubidetach, ubimkvol, ubirmvol, ubirsvol, ubiupdatevol, udhcpc, udhcpd, udpsvd, umount, uname, uncompress, unexpand, uniq, unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, volname, watch, watchdog, wc, wget, which, whoami, whois, xargs, xz, xzcat, yes, zcat, zcip
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值