Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15530362
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2009-01-08 11:32:04

如果是从源码编译获得的busybox,可以使用make install CONFIG_PREFIX="/home/luther/gliethttp_busybox"
luther@gliethttp:~$ tree gliethttp_busybox/
gliethttp_busybox/
|-- bin
|   |-- ash -> busybox
|   |-- busybox
|   |-- cat -> busybox
|   |-- catv -> busybox
|   |-- chmod -> busybox
|   |-- cp -> busybox
|   |-- date -> busybox
|   |-- dd -> busybox
|   |-- df -> busybox
|   |-- dmesg -> busybox
|   |-- echo -> busybox
|   |-- egrep -> busybox
|   |-- false -> busybox
|   |-- fgrep -> busybox
|   |-- getopt -> busybox
|   |-- grep -> busybox
|   |-- hostname -> busybox
|   |-- kill -> busybox
|   |-- ln -> busybox
|   |-- login -> busybox
|   |-- ls -> busybox
|   |-- mkdir -> busybox
|   |-- mknod -> busybox
|   |-- mktemp -> busybox
|   |-- more -> busybox
|   |-- mount -> busybox
|   |-- mountpoint -> busybox
|   |-- mv -> busybox
|   |-- netstat -> busybox
|   |-- nice -> busybox
|   |-- pidof -> busybox
|   |-- ping -> busybox
|   |-- ping6 -> busybox
|   |-- pipe_progress -> busybox
|   |-- printenv -> busybox
|   |-- ps -> busybox
|   |-- pwd -> busybox
|   |-- rm -> busybox
|   |-- rmdir -> busybox
|   |-- run-parts -> busybox
|   |-- sed -> busybox
|   |-- sleep -> busybox
|   |-- stat -> busybox
|   |-- stty -> busybox
|   |-- sync -> busybox
|   |-- touch -> busybox
|   |-- true -> busybox
|   |-- umount -> busybox
|   |-- uname -> busybox
|   |-- usleep -> busybox
|   |-- vi -> busybox
|   `-- watch -> busybox
|-- linuxrc -> bin/busybox
|-- sbin
|   |-- fdisk -> ../bin/busybox
|   |-- freeramdisk -> ../bin/busybox
|   |-- getty -> ../bin/busybox
|   |-- halt -> ../bin/busybox
|   |-- hdparm -> ../bin/busybox
|   |-- hwclock -> ../bin/busybox
|   |-- ifconfig -> ../bin/busybox
|   |-- ifdown -> ../bin/busybox
|   |-- ifup -> ../bin/busybox
|   |-- init -> ../bin/busybox
|   |-- insmod -> ../bin/busybox
|   |-- klogd -> ../bin/busybox
|   |-- logread -> ../bin/busybox
|   |-- losetup -> ../bin/busybox
|   |-- lsmod -> ../bin/busybox
|   |-- makedevs -> ../bin/busybox
|   |-- mdev -> ../bin/busybox
|   |-- modprobe -> ../bin/busybox
|   |-- pivot_root -> ../bin/busybox
|   |-- poweroff -> ../bin/busybox
|   |-- reboot -> ../bin/busybox
|   |-- rmmod -> ../bin/busybox
|   |-- route -> ../bin/busybox
|   |-- runlevel -> ../bin/busybox
|   |-- setconsole -> ../bin/busybox
|   |-- start-stop-daemon -> ../bin/busybox
|   |-- switch_root -> ../bin/busybox
|   |-- sysctl -> ../bin/busybox
|   |-- syslogd -> ../bin/busybox
|   |-- udhcpc -> ../bin/busybox
|   |-- vconfig -> ../bin/busybox
|   |-- watchdog -> ../bin/busybox
|   `-- zcip -> ../bin/busybox
`-- usr
    |-- bin
    |   |-- [ -> ../../bin/busybox
    |   |-- [[ -> ../../bin/busybox
    |   |-- basename -> ../../bin/busybox
    |   |-- chrt -> ../../bin/busybox
    |   |-- chvt -> ../../bin/busybox
    |   |-- cksum -> ../../bin/busybox
    |   |-- clear -> ../../bin/busybox
    |   |-- cmp -> ../../bin/busybox
    |   |-- crontab -> ../../bin/busybox
    |   |-- cut -> ../../bin/busybox
    |   |-- deallocvt -> ../../bin/busybox
    |   |-- diff -> ../../bin/busybox
    |   |-- dirname -> ../../bin/busybox
    |   |-- du -> ../../bin/busybox
    |   |-- eject -> ../../bin/busybox
    |   |-- env -> ../../bin/busybox
    |   |-- expr -> ../../bin/busybox
    |   |-- find -> ../../bin/busybox
    |   |-- fold -> ../../bin/busybox
    |   |-- free -> ../../bin/busybox
    |   |-- fuser -> ../../bin/busybox
    |   |-- head -> ../../bin/busybox
    |   |-- hexdump -> ../../bin/busybox
    |   |-- hostid -> ../../bin/busybox
    |   |-- id -> ../../bin/busybox
    |   |-- install -> ../../bin/busybox
    |   |-- ipcrm -> ../../bin/busybox
    |   |-- ipcs -> ../../bin/busybox
    |   |-- killall -> ../../bin/busybox
    |   |-- killall5 -> ../../bin/busybox
    |   |-- last -> ../../bin/busybox
    |   |-- length -> ../../bin/busybox
    |   |-- less -> ../../bin/busybox
    |   |-- logger -> ../../bin/busybox
    |   |-- logname -> ../../bin/busybox
    |   |-- md5sum -> ../../bin/busybox
    |   |-- mesg -> ../../bin/busybox
    |   |-- mkfifo -> ../../bin/busybox
    |   |-- nohup -> ../../bin/busybox
    |   |-- nslookup -> ../../bin/busybox
    |   |-- od -> ../../bin/busybox
    |   |-- openvt -> ../../bin/busybox
    |   |-- passwd -> ../../bin/busybox
    |   |-- printf -> ../../bin/busybox
    |   |-- readlink -> ../../bin/busybox
    |   |-- realpath -> ../../bin/busybox
    |   |-- renice -> ../../bin/busybox
    |   |-- reset -> ../../bin/busybox
    |   |-- rx -> ../../bin/busybox
    |   |-- seq -> ../../bin/busybox
    |   |-- sha1sum -> ../../bin/busybox
    |   |-- sort -> ../../bin/busybox
    |   |-- strings -> ../../bin/busybox
    |   |-- sum -> ../../bin/busybox
    |   |-- tail -> ../../bin/busybox
    |   |-- tee -> ../../bin/busybox
    |   |-- telnet -> ../../bin/busybox
    |   |-- test -> ../../bin/busybox
    |   |-- tftp -> ../../bin/busybox
    |   |-- time -> ../../bin/busybox
    |   |-- top -> ../../bin/busybox
    |   |-- tr -> ../../bin/busybox
    |   |-- traceroute -> ../../bin/busybox
    |   |-- tty -> ../../bin/busybox
    |   |-- uniq -> ../../bin/busybox
    |   |-- uptime -> ../../bin/busybox
    |   |-- vlock -> ../../bin/busybox
    |   |-- wc -> ../../bin/busybox
    |   |-- wget -> ../../bin/busybox
    |   |-- which -> ../../bin/busybox
    |   |-- who -> ../../bin/busybox
    |   |-- whoami -> ../../bin/busybox
    |   |-- xargs -> ../../bin/busybox
    |   `-- yes -> ../../bin/busybox
    `-- sbin
        |-- chroot -> ../../bin/busybox
        |-- crond -> ../../bin/busybox
        |-- fbset -> ../../bin/busybox
        |-- inetd -> ../../bin/busybox
        |-- rdate -> ../../bin/busybox
        |-- setlogcons -> ../../bin/busybox
        `-- telnetd -> ../../bin/busybox

5 directories, 167 files
=====================================================
如果不是从源码编译的,那么可以直接执行./busybox --install即可

/data/luther # ./busybox --install -s 将创建符号连接
/data/luther # ./busybox --install 将直接生成文件
然后在手机的测试脚本.sh的第一行写上:
#!/data/bin/sh
这样kernel在加载我们的测试脚本.sh时,就会使用/data/bin/sh程序来运行我们的.sh文件


static void install_links(const char *busybox, int use_symbolic_links)
{
    /* directory table
     * this should be consistent w/ the enum,
     * busybox.h::bb_install_loc_t, or else... */
    static const char usr_bin [] ALIGN1 = "/usr/bin";//如果想修改其他路径可以在这里修改
    static const char usr_sbin[] ALIGN1 = "/usr/sbin";
    static const char *const install_dir[] = {
        &usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
        &usr_bin [4], /* "/bin" */
        &usr_sbin[4], /* "/sbin" */
        usr_bin,
        usr_sbin
    };

static int busybox_main(char **argv)

比如这样修改,当执行./busybox --insatll之后,将会把所有程序安装到/data/bin和/data/sbin目录下
static void install_links(const char *busybox, int use_symbolic_links)
{
    /* directory table
     * this should be consistent w/ the enum,
     * busybox.h::bb_install_loc_t, or else... */
    static const char usr_bin [] ALIGN1 = "/data/bin";
    static const char usr_sbin[] ALIGN1 = "/data/sbin";
    static const char *const install_dir[] = {
        &usr_bin [9], /* "", equivalent to "/" for concat_path_file() */
        &usr_bin [0], /* "/bin" */
        &usr_sbin[0], /* "/sbin" */
        usr_bin,
        usr_sbin
    };


阅读(6037) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~