busybox的代码采用静态编译,所以动态编译的wireless tool无法使用,故添加到busybox中来,前面blog中已经介绍了tree的添加,所以此处只添加代码。
把所有的命令都添加到busybox/networking/
arp.c httpd_indexcgi.c ip.c iwlib.o nc_bloaty.c slattach.o vconfig.o
arping.c httpd.o ipcalc.c iwlist.8 nc.c tc.c wget.c
arping.o httpd_post_upload.txt ipcalc.o iwlist.c nc.o tcpudp.c wget.o
arp.o httpd_ssi.c ip.o iwlist.o netstat.c tcpudp.o wireless.10.h
brctl.c ifconfig.c isrv.c iwmulticall.c netstat.o tcpudp_perhost.c wireless.11.h
brctl.o ifconfig.o isrv.h iwpriv.8 nslookup.c tcpudp_perhost.h wireless.12.h
built-in.o ifenslave.c isrv_identd.c iwpriv.c nslookup.o tcpudp_perhost.o wireless.13.h
Config.in ifenslave.o isrv_identd.o iwpriv.o ntpd.c telnet.c wireless.14.h
Config.src ifplugd.c isrv.o iwspy.8 ntpd.o telnetd.c wireless.15.h
dnsd.c ifplugd.o iwconfig.8 iwspy.c ntpd_simple.c telnetd.ctrlSQ.patch wireless.16.h
dnsd.o ifrename.8 iwconfig.c iwspy.o ping.c telnetd.o wireless.17.h
ether-wake.c ifrename.c iwconfig.o Kbuild ping.o telnet.o wireless.18.h
ether-wake.o ifrename.o iwevent.8 Kbuild.src pscan.c tftp.c wireless.19.h
ftpd.c iftab.5 iwevent.c lib.a pscan.o tftp.o wireless.20.h
ftpd.o ifupdown.c iwevent.o libiproute route.c traceroute.c wireless.21.h
ftpgetput.c ifupdown.o iwgetid.8 libiw.so.29 route.o traceroute.o wireless.22.h
ftpgetput.o inetd.c iwgetid.c macaddr.c sample_enc.c tunctl.c wireless.7
hostname.c inetd.o iwgetid.o MakefileMake sample_pm.c tunctl.o wireless.h
hostname.o interface.c iwlib.c nameif.c sample_priv_addr.c udhcp zcip.c
httpd.c interface.o iwlib.h nameif.o slattach.c vconfig.c zcip.o
1,在miscutils目录下添加.c文件,函数名要与其它.c文件里面的函数名的格式保持一致,即命令名tree_main(),刚下载下来的时候是main,修改为tree_main即可。
2,修改编译文件,因为仅添加.c源文件,busybox编译系统不知道有新的代码添加进来,make的时候也不会编译tree.c文件,所以要修改Config.src文件(添加命令的整个过程跟添加内核驱动类似--内核是Kconfig):
config IWCONFIG
bool "iwconfig"
default y
help
iwconfig the wireless
config IFRENAME
bool "ifrename"
default y
help
iwconfig the wireless
config IWEVENT
bool "iwevent"
default y
help
iwconfig the wireless
config IWGETID
bool "iwgetid"
default y
help
iwconfig the wireless
config IWLIST
bool "iwlist"
default y
help
iwconfig the wireless
config IWPRIV
bool "iwpriv"
default y
help
iwconfig the wireless
config IWSPY
bool "iwspy"
default y
help
iwconfig the wireless
3,修改编译文件Kbuild.src,编译tree命令需要这个几个文件。
lib-$(CONFIG_IWCONFIG) += iwlib.o iwconfig.o
lib-$(CONFIG_IFRENAME) += iwlib.o ifrename.o
lib-$(CONFIG_IWEVENT) += iwlib.o iwevent.o
lib-$(CONFIG_IWGETID) += iwlib.o iwgetid.o
lib-$(CONFIG_IWLIST) += iwlib.o iwlist.o
lib-$(CONFIG_IWPRIV) += iwlib.o iwpriv.o
lib-$(CONFIG_IWSPY) += iwlib.o iwspy.o
4,修改/include/applets.src.h文件
IF_IWCONFIG(APPLET(iwconfig, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IFRENAME(APPLET(ifrename, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IWEVENT(APPLET(iwevent, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IWGETID(APPLET(iwgetid, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IWLIST(APPLET(iwlist, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IWPRIV(APPLET(iwpriv, _BB_DIR_BIN, _BB_SUID_DROP))
IF_IWSPY(APPLET(iwspy, _BB_DIR_BIN, _BB_SUID_DROP))
5,为命令添加帮助信息,以便使用--help的时候查阅,此处None可以随便修改
vim usage.src.h
#define iwconfig_trivial_usage "None"
#define iwconfig_full_usage "None"
#define ifrename_trivial_usage "None"
#define ifrename_full_usage "None"
#define iwevent_trivial_usage "None"
#define iwevent_full_usage "None"
#define iwgetid_trivial_usage "None"
#define iwgetid_full_usage "None"
#define iwlist_trivial_usage "None"
#define iwlist_full_usage "None"
#define iwpriv_trivial_usage "None"
#define iwpriv_full_usage "None"
#define iwspy_trivial_usage "None"
#define iwspy_full_usage "None"
6,make
7,make install
我把可以使用的roots文件系统,压缩上传到资源里面。