2009-04-08

busybox的所有命令如何快速安装到/bin目录下或者自定义目录下

直接执行./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
};
http://blog.chinaunix.net/u1/38994/showart_1782372.html

No comments: