How to install Busybox on a simulator?

本文详细介绍了如何从网上下载BusyBox镜像,并通过adb工具将其安装到设备上。包括了将系统分区重新挂载为读写状态,使用adb推送BusyBox到指定目录,更改文件权限,最终运行BusyBox命令的过程。同时展示了BusyBox启动后的命令列表和部分命令的执行结果。

1)      Download Busybox image from http://www.busybox.net/downloads/binaries/1.21.1/

2)      Because the /system partition is read-only by default.

#remounts the /system and /vendor (if present) partitions on the device read-write

adb remount

3)      adb push busybox-armv71 /system/xbin/busybox

4)      adb shell

cd /system/xbin/

chmod 755 ./busybox

5)      Then, you can run busybox.

1|root@generic:/system/xbin # busybox

busybox

BusyBox v1.21.1 (2013-07-08 10:26:30 CDT) 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, delgroup, deluser, depmod, devmem, df, dhcprelay, diff,

        dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap,

        dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake,

        expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat,

        fdisk, fgconsole, fgrep, find, findfs, flock, fold, free, freeramdisk,

        fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty,

        grep, groups, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostid,

        hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave,

        ifplugd, ifup, inetd, init, insmod, install, ionice, iostat, ip,

        ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel,

        kbd_mode, kill, killall, killall5, klogd, last, less, linux32, linux64,

        linuxrc, ln, loadfont, loadkmap, logger, login, logname, 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.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more,

        mount, mountpoint, mpstat, mt, mv, nameif, nanddump, nandwrite,

        nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od,

        openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress,

        pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv,

        printf, ps, pscan, pstree, pwd, pwdx, raidautorun, rdate, rdev,

        readahead, readlink, readprofile, realpath, reboot, reformime,

        remove-shell, renice, reset, resize, rev, rm, rmdir, rmmod, route, rpm,

        rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script,

        scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont,

        setkeycodes, setlogcons, setserial, setsid, setuidgid, sh, sha1sum,

        sha256sum, sha3sum, sha512sum, showkey, slattach, sleep, smemcap,

        softlimit, sort, split, start-stop-daemon, stat, strings, stty, su,

        sulogin, 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, udhcpc, udhcpd, udpsvd, umount, uname, unexpand,

        uniq, unix2dos, 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

6)      Then, run a Busybox command.

root@generic:/ # busybox ps -T | busybox more

busybox ps -T | busybox more

PID   USER     TIME   COMMAND

    1 0          0:00 /init

    2 0          0:00 [kthreadd]

    3 0          0:00 [ksoftirqd/0]

    5 0          0:00 [kworker/u:0]

    6 0          0:00 [khelper]

    7 0          0:00 [sync_supers]

    8 0          0:00 [bdi-default]

    9 0          0:00 [kblockd]

   10 0          0:00 [rpciod]

   11 0          0:03 [kworker/0:1]

   12 0          0:00 [kswapd0]

   13 0          0:00 [fsnotify_mark]

   14 0          0:00 [crypto]

<think> 我们正在讨论BusyBox是否内置ifconfig命令。根据提供的引用材料,我们可以找到相关证据。 引用[1]中明确提到:在Android下使用busybox的ifconfig,命令格式为“busybox ifconfig ...” 引用[4]中分析了busybox ifconfig的显示流程,进一步证实了BusyBox确实内置了ifconfig命令。 因此,答案是肯定的:BusyBox内置了ifconfig命令。 接下来,我们需要组织回答,并生成相关问题。 回答结构: 1. 明确回答:BusyBox内置ifconfig命令。 2. 简要说明:BusyBox是一个集成了多个常用Unix工具的软件,ifconfig作为网络配置工具被包含在内。 3. 使用示例:可以像引用[1]中那样使用(注意:在Android或嵌入式系统中可能需要使用busybox前缀)。 4. 补充说明:BusyBox的ifconfig是简化版,功能可能不如完整版丰富,但基本功能具备。 生成相关问题: 1. BusyBox的ifconfig与标准ifconfig有什么区别? 2. 在嵌入式系统中如何使用BusyBox配置网络? 3. 如何编译包含ifconfig的BusyBox? 4. BusyBox的ifconfig支持哪些参数? 注意:回答中需要引用引用的地方要标注引用标识。 </think> ### BusyBox是否内置ifconfig命令? 是的,**BusyBox内置了ifconfig命令**。这是通过其精简的网络工具集实现的证据: 1. **明确的功能支持**: - 引用[1]展示了在Android环境下直接使用`busybox ifconfig`配置IP地址、子网掩码等参数: ```bash busybox ifconfig eth0 10.0.16.45 netmask 255.255.254.0 ``` 这证实ifconfig作为BusyBox的组成部分存在[^1]。 2. **实现原理分析**: - 引用[4]揭示了BusyBox的ifconfig实现机制: - 通过读取`/proc/net/dev`获取网卡统计信息 - 使用`ife->statistics_valid`标志位验证数据有效性 - 将处理结果输出到终端[^4] 3. **与其他网络工具集成**: - 引用[3]显示BusyBox的ifup脚本会调用udhcpc(DHCP客户端),而ifconfig常用于配合DHCP进行网络初始化。这表明ifconfig是BusyBox网络工具链的关键组件[^3]。 --- ### 使用注意事项 1. **功能差异**: - 相比完整版ifconfig,BusyBox版本**仅保留核心功能**(如IP配置、网卡状态查看) - 缺少高级特性(如VLAN配置、多播控制) 2. **调用方式**: ```bash busybox ifconfig eth0 # 显式调用BusyBox版本 ifconfig eth0 # 需确保$PATH中BusyBox优先级高于系统工具 ``` 3. **编译配置**: 启用ifconfig需在编译时勾选: ```bash CONFIG_IFCONFIG=y # 配置选项 make CONFIG_PREFIX=/target install # 安装到目标系统[^2] ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值