下面是对1.00版本的实验。

1、文件准备

解压busybox-1.00.tar.gz得到busybox-1.00目录,进入,阅读相关的README和INSTALL,没什么特别的,都是提示busybox需要经过三个步骤的操作进行安装使用。

2、配置busybox

busybox的配置程序和linux内核菜单配置方式简直一模一样

#make menuconfig

下面是需要编译进busybox的功能选项,其他的可以根据需要自选,但是同样不要太贪心.

General Configuration应该选的选项

[*] Show verbose applet usage messages

[*] Support for SUID/SGID handling

[*]   Runtime SUID/SGID configuration via /etc/busybox.conf

Build Options

[*] Build BusyBox as a static binary (no shared libs)

这个选项是一定要选择的,这样才能把busybox编译成静态链接的可执行文件,运行时才独立于其他函数库.否则必需要其他库文件才能运行,在单一个linux内核不能使他正常工作.

Installation Options

[*] Don't use /usr

(./_install) BusyBox installation prefix

这个选项也一定要选,否则make install 后busybox将安装在原系统的/usr下,这将覆盖掉系统原有的命令.选择这个选项后,make install后会在busybox目录下生成一个叫_install的目录,里面有busybox和指向他的链接.

其他选项都是一些linux基本命令选项,自己需要哪些命令就编译进去,一般用默认的就可以了.

配置好后退出并保存.

3,编译并安装busybox

#make

#make install

顺利完成。

4、检查安装结果

根据参考资料2,检查到编译好后在解压目录busybox-1.00目录下生成子目录_install

# ll

总用量 8

drwxr-xr-x    2 root     root         4096 12月 11 15:49 bin

lrwxrwxrwx    1 root     root           11 12月 11 15:49 linuxrc -> bin/busybox

drwxr-xr-x    2 root     root         4096 12月 11 15:49 sbin

其中可执行文件busybox在bin目录下,其他的都是指向他的符号链接.

-rwxr-xr-x    1 root     root       801400 12月 11 15:49 busybox

可见busybox只要八百k多点。根据配置选择的不同,编译出来的busybox大小也会有差别。根据其他资料所述,典型的busybox文件大小在动态链接的情况下是300 KB左右,静态链接为800 KB左右,用它实现的文件系统完全可以控制在1 MB以下

在bin/下面有:

# ll

总用量 788

lrwxrwxrwx    1 root     root            7 12月 11 15:49 [ -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 ash -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 basename -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 bunzip2 -> busybox

-rwxr-xr-x    1 root     root       801400 12月 11 15:49 busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 bzcat -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 cat -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 chgrp -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 chmod -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 chown -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 chvt -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 clear -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 cmp -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 cp -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 cut -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 date -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 dd -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 deallocvt -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 df -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 dirname -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 dmesg -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 du -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 echo -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 egrep -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 env -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 expr -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 false -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 fgrep -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 find -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 free -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 grep -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 gunzip -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 gzip -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 head -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 hexdump -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 hostname -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 id -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 install -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 kill -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 killall -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 ln -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 logger -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 ls -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 mkdir -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 mknod -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 mktemp -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 more -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 mount -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 mv -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 openvt -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 pidof -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 ping -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 ps -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 pwd -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 readlink -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 reset -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 rm -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 rmdir -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 sed -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 sh -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 sleep -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 sort -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 strings -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 sync -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 tail -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 tar -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 tee -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 test -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 time -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 touch -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 tr -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 true -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 tty -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 umount -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 uname -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 uniq -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 unzip -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 uptime -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 usleep -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 vi -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 wc -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 wget -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 which -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 whoami -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 xargs -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 yes -> busybox

lrwxrwxrwx    1 root     root            7 12月 11 15:49 zcat -> busybox

根据资料,可以这样用busybox

#busybox ls

他的功能就相当运行ls命令

实验如下:

在bin/目录下

# busybox ls

[          chgrp      cut        du         find       hostname   ls         openvt     rm         sync       tr         uptime     xargs……

实际就是把原先的命令加一个busybox的前缀就是了~

最常用的用法是建立指向busybox的链接,不同的链接名完成不同的功能.

#ln -s busybox ls

#ln -s busybox rm

#ln -s busybox mkdir

然后分别运行这三个链接:

#./ls

#./rm

#./mkdir

就可以分别完成了ls rm 和mkdir命令的功能.虽然他们都指向同一个可执行程序busybox

但是只要链接名不同,完成的功能就不同。

实际上可以看到安装结果已经包含了这些基本命令但符号链接。实验如下:

# ./ls

Using fallback suid method

[          chgrp      cut        du         find       hostname   ls         openvt     rm         sync       tr         uptime     xargs……

# ./echo $PATH

Using fallback suid method

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

# ./mkdir

Using fallback suid method

BusyBox v1.00 (2006.12.11-07:42+0000) multi-call binary

Usage: mkdir [OPTION] DIRECTORY...

……

# busybox mkdir

BusyBox v0.60.5 (2003.01.24-22:43+0000) multi-call binary

Usage: mkdir [OPTION] DIRECTORY...

……

可以看到,使用busybox的ls命令会多输出一个左括符号,并会多出Using fallback suid method或BusyBox v1.00 (2006.12.11-07:42+0000) multi-call binary的提示

5、反思与总结

实际上最麻烦的工作是配置,其中动态/静态库,安装位置,是否使用交叉编译工具等几个问题在上面操作中并没有深入涉及。

参考资料3中提到配置时的选项:

下面三个目录是很多人都会感兴趣的:

Build Options --->

Installation Options --->

Login/Password Management Utilities --->

在Build Options里面有是否使用交叉编译的选项(Do you want to build BusyBox with a Cross Compiler)。如果要对其他平台进行编译就要选择它并设置相应的编译程序前缀。

在Installation Options里面可以设置安装的路径,即设置为新文件系统的根目录。当然也可以用缺省的 _install目录,安装之后再复制到新文件系统中去。

在设置Login/Password Management Utilities的时候,为了免去配置glibc的麻烦,最好设置使用busybox自己的password和shadow文件的功能(Use internal password and group functions rather than system functions)。

busybox 提供的命令无疑比较全面,但它的缺省配置还不能构成一个功能比较完备的文件系统。必须要添加的命令有Login/Password Management Utilities里面的getty、login和passwd,这些命令从前是由另外一个软件包tinylogin所提供的。当然,如果不需要一个交互的登录界面,这些命令也可以去掉。通过设定内核参数init=/bin/sh可以在系统启图1busybox的编译配置界面动后直接得到一个shell。

tlenetd命令是一个远程登录服务程序,把它编译进busybox中会为将来的调试提供很多的方便。当然也可以通过串口终端的方式管理嵌入式设备,但网络登录的方式却更为方便。

[遗留问题]

1、Show verbose applet usage messages

Runtime SUID/SGID configuration via /etc/busybox.conf是什么意思?

[参考资料]

1、《源码开放的嵌入式系统软件分析与实践——基于skyeye和arm开发平台》陈渝 李明 杨晔 等编著 北京航空航天大学出版社

2、编译busybox

实际上这个资料只不过是另一篇文章“”中的一个片段~

阅读(683) | 评论(0) | 转发(0) |

linux内核安装busybox,学习busybox基本配置安装(转载)相关推荐

  1. 驱动框架6——linux内核的gpiolib学习

    以下内容源于朱有鹏<物联网大讲堂>课程的学习整理,如有侵权,请告知删除. 八.linux内核的gpiolib学习1 1.gpiolib学习重点(主线) (1)主线一:gpiolib的建立过 ...

  2. 【嵌入式环境下linux内核及驱动学习笔记-(16)linux总线、设备、驱动模型之input框架】

    目录 1.Linux内核输入子系统概念导入 1.1 输入设备工作机制 1.2 运行框架 1.3 分层思想 2.驱动开发步骤 2.1 在init()或probe()函数中 2.2 在exit()或rem ...

  3. 【嵌入式环境下linux内核及驱动学习笔记-(15-1)例程】

    目录 1.在APP直接调用标准文件IO操作I2C(针对学习笔记-15的15.3节) 1.1 mail.c 1.2 mpu6050.h 1.3 mpu6050.c 1.4 Makefile 2.以外称i ...

  4. Linux内核0.11学习

    Linux内核0.11学习 文章目录 Linux内核0.11学习 一.计算机开机的过程 1.启动BIOS 2.BIOS 在内存中加载中断向量表和中断服务程序 Linux内核最新已经版本已经到5.18了 ...

  5. linux内核I2C子系统学习(三)

    写设备驱动: 四部曲: 构建i2c_driver 注册i2c_driver 构建i2c_client ( 第一种方法:注册字符设备驱动.第二种方法:通过板文件的i2c_board_info填充,然后注 ...

  6. 在Ubuntu上为Android系统编写Linux内核驱动程序(学习老罗的)

    首先提出2个问题 1. 驱动程序的作用是什么? 答:驱动程序的作用主要是向上层提供访问设备寄存器的一个接口,包括读和写. 2. 访问设备驱动程序的方法? 答:a. 通过proc文件系统来访问:b. 通 ...

  7. 八千字硬核长文梳理Linux内核概念及学习路线

    点击上方"大鱼机器人",选择"置顶/星标公众号" 福利干货,第一时间送达! 来源 :头条号@Linux学习教程,冰凌块儿 整理:公众号:嵌入式Linux,发哥 ...

  8. 在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序 (学习老罗的)

    不得不说,老罗写的太好了. 按照他的方法,我两次就成功了. 不过有点让人奇怪的地方就是 第一次我make snod是成功的 但是执行如下代码:       root@android:/ # cd sy ...

  9. 【嵌入式环境下linux内核及驱动学习笔记-(11-设备树)】

    目录 1.设备树体系 1.1 DTS /DTSI / DTC / DTB 2.基础语法 2.1 节点语法 2.1.1 通用名称建议 2.2 属性语法 2.2.1 属性值 2.3 关于label 2.4 ...

最新文章

  1. vivo统一告警平台建设与实践
  2. 束文圣和黄立南Nature综述极端环境中的微生物多样性
  3. 一幅图读懂量子力学(上)
  4. 用户运营平台产品设计指南
  5. java hasfocus_Java KeyEvent.hasNoModifiers方法代碼示例
  6. 计算机控制系统的稳态误差,计算机控制系统的稳态误差
  7. 小屏幕 ui设计_UI设计基础:屏幕
  8. Web控件TreeView展开无闪烁的两个解决方法
  9. 【转载】别了,摩托罗拉(十):“战争部落”和“独立王国”
  10. WPF--ContextMenu绑定命令的一个问题
  11. python自动化测试难不难_我从功能测试进阶到自动化测试工程师的经验总结~|Atstudy...
  12. java虚拟机之垃圾回收器
  13. JS倒计时特效--JavaScript基础
  14. 当后台返回的图片在前端加载不出来时,前端做默认图片展示
  15. win10易升计算机丢失,微软Windows 10易升
  16. php毕设周记_(完整版)毕设周记
  17. IP切换器是做什么用的?
  18. 微信公众号支付功能开发
  19. Publish Over SSH 本地安装
  20. python 计算置信区间,Python求解正态分布置信区间

热门文章

  1. 【自嗨笔记#5】2020 最新B站视频下载方法
  2. 敏捷开发与 DevOps 实战
  3. 电感线圈受什么因素音响
  4. 谷歌Guava工具类的使用(1):BloomFilter的使用
  5. 2017大学计算机操作题,2017年计算机二级MSOffice操作题及答案解析
  6. 秋招总结---求职攻略
  7. Python read()函数:按字节(字符)读取文件
  8. gpu显示off_解决方案:[硬件]亲测成功,让独立显卡支持UEFI开机,加快开机速度Repost...
  9. Qt提升部件后编译报错:ui_xxx.h:fatal error 无法打开包括文件:“xxx.h”
  10. 布隆的盾能挡机器人_怎样玩好蒸汽机器人?