原来使用的是BusyBox v1.14.2由于缺少lsusb命令故起了升级BusyBox的心思。
如果你还不知道如何查看自己正在使用的BusyBox的版本信息,这里提供给如下两种方案:
1、故意敲错某简单命令的选项,提示信息中可能就包含BusyBox的版本信息。如:#ls -j(事实上ls没有-j的选项)
2、使用命令#/bin/busybox --help直接查看版本信息。
一、关于更新BusyBox版本的选择
通过BusyBox的官方网站:www.busubox.net查询下载其他新版的BusyBox。一番浏览后笔者发现v1.14.2是2009年6月22日发布,最新版是2012年7月2日的v1.20.2(stable)
而后经笔者测试在v1.20.2(stable)这一版本的BusyBox中没有lsusb这个命令。当然官网上并没有明确提示说在最新的这个版本中没有lsusb,只是在之前的v1.16.0(unstable)明确提示添加了新的aplet即lsusb。为安全起见笔者选了v1.16.1(stable)这个稳定版来继续我的升级。
果不其然,在这一版本(v1.16.1 stable)中含有lsusb。
二、配置安装BusyBox
[wsl@localhost ~]$ tar -xjvf busybox-1.16.1.tar.bz2 [wsl@localhost ~]$ cd busybox-1.16.1 [wsl@localhost busybox-1.16.1]$ ls applets Config.in docs include LICENSE Makefile.flags printutils selinux TODO_unicode applets_sh configs e2fsprogs init loginutils Makefile.help procps shell util-linux arch console-tools editors INSTALL mailutils miscutils README sysklogd archival coreutils examples libbb Makefile modutils runit testsuite AUTHORS debianutils findutils libpwdgrp Makefile.custom networking scripts TODO [wsl@localhost busybox-1.16.1]$ make help Cleaning: clean - delete temporary files created by build distclean - delete all non-source files (including .config) doc-clean - delete all generated documentation Build: all - Executable and documentation busybox - the swiss-army executable doc - docs/BusyBox.{txt,html,1} html - create html-based cross-reference Configuration: allnoconfig - disable all symbols in .config allyesconfig - enable all symbols in .config (see defconfig) config - text based configurator (of last resort) defconfig - set .config to largest generic configuration menuconfig - interactive curses-based configurator oldconfig - resolve any unresolved symbols in .config hosttools - build sed for the host. You can use these commands if the commands on the host is unusable. Afterwards use it like: make SED="/home/wsl/busybox-1.20.2/sed" android2_defconfig - Build for android2 android_defconfig - Build for android android_ndk_defconfig - Build for android_ndk cygwin_defconfig - Build for cygwin freebsd_defconfig - Build for freebsd TEST_nommu_defconfig - Build for TEST_nommu TEST_noprintf_defconfig - Build for TEST_noprintf TEST_rh9_defconfig - Build for TEST_rh9 Installation: install - install busybox into CONFIG_PREFIX uninstall Development: baseline - create busybox_old for bloatcheck. bloatcheck - show size difference between old and new versions check - run the test suite for all applets checkhelp - check for missing help-entries in Config.in randconfig - generate a random configuration release - create a distribution tarball sizes - show size of all enabled busybox symbols objsizes - show size of each .o object built bigdata - show data objects, biggest first stksizes - show stack users, biggest first [wsl@localhost busybox-1.16.1] make defconfig
做到这里,完成默认的配置后。你需要修改makefile的内容。
CROSS_COMPILE ?=
修改为
ARCH ?= mips
CROSS_COMPILE ?= mips-linux-gnu-
接下来config busybox:
[[email protected]]$ make menuconfig
修改如下的Item
BusyboxSettings --->
BuildOptions --->
[*] BuildBusyBox as a static binary (nosharedlibs)
MiscellaneousUtilities --->
[ ] taskset
最后你只需要make一下,然后make install一下就OK了。
如果提示错误,mtd/mtd-user.h没有那个文件或目录
miscutils/flash_lock_unlock.c:7:26:error:mtd/mtd-user.h: No such file or directory
解决:
$cp/usr/include/mtd/ ./include/mtd/ -a
接着make,又出现缺少mtd/ubi-user.h ,我从内核里拷贝一个过来(你只需locateubi-user.h就能找到自己这个文件)
$ cp/home/wsl/RedLion_571854_120514_K2/2.6.28.9/include/mtd/ubi-user.h./include/mtd
$ Make install
安装后的文件默认存放在busybox下的_install中。
在运行的时候指定你新的busybox下命令的路径就可以正常使用了,如
#/_install/sbin/lsusb
Bus 001 Device001: ID 1d6b:0002
Bus 002 Device001: ID 1d6b:0002
Bus 003 Device001: ID 1d6b:0002
Bus 004 Device001: ID 1d6b:0002
#/_install/sbin/lspci
lspci:/sys/bus/pci/devices: No such file or directory