顯示具有 Busybox 標籤的文章。 顯示所有文章
顯示具有 Busybox 標籤的文章。 顯示所有文章

2013年3月13日 星期三

[Busybox] How to add a new executable file in busybox-0.60.3 in Ubuntu 10.04


[Busybox] How to add a new executable file in busybox-0.60.3 in Ubuntu 10.04

1. Add the following definition into applets.h

#ifdef BB_HAPPY

APPLET(happy, happy_main, _BB_DIR_BIN)

#endif

2. Add the following definition into Config.h

must follow the order.

#define BB_HAPPY

3. Add the following definition into usage.h

#define happy_full_usage \

"[HAPPY]..."

#define happy_trivial_usage \

"[HAPPY]..."

4. make

5. make install

6. cd _install/bin

7. ./busybox happy



happy.c



 



#include <stdlib.h>


#include <string.h>


#include "busybox.h"


 


extern int happy_main(int argc, char **argv)


{


    fprintf(stderr,"I am successful to add new function \n");


    return 1;


}

2013年3月12日 星期二

[Busybox] How to install busybox-0.60.3.tar.bz2 into Ubuntu 10.04


[Busybox] How to install busybox-0.60.3.tar.bz2 into Ubuntu 10.04



1. Download busybox-0.60.3.tar.bz2 from internet



2. tar xvf busybox-0.60.3.tar.bz2 && cd busybox-0.60.3/



3. make



Error :



libbb/syscalls.c:43: error: expected declaration specifiers or ‘...’ before ‘sysfs’



solve :



geany libbb/syscalls.c +43 &



_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);



to



_syscall3(int sysfs, int option, unsigned int fs_index, char * buf);



geany libbb/syscalls.c +68 &



_syscall2(int,pivot_root,const char *,new_root,const char *,put_old);



to



_syscall2(int pivot_root,const char *new_root,const char *put_old);



Error



ip.c:2176: error: conflicting types for ‘build_bl_tree’

gzip.c:1651: note: previous declaration of ‘build_bl_tree’ was here



solve



geany gzip.c +2176 &



copy at 2176 static const int build_bl_tree()



to at static int build_bl_tree (void); <-- replace to static const int build_bl_tree (void);



Error



gzip.c: In function ‘gzip_main’:

gzip.c:1278: warning: format not a string literal and no format arguments

gzip.c:1279: warning: format not a string literal and no format arguments

gzip.c:1280: warning: format not a string literal and no format arguments

gzip.c:1281: warning: format not a string literal and no format arguments

gzip.c:1282: warning: format not a string literal and no format arguments

In file included from /usr/include/fcntl.h:205,

                 from gzip.c:50:

In function ‘open’,

    inlined from ‘gzip_main’ at gzip.c:1330:



Solve



geany gzip.c +1330 &



#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)

                outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW);

#else

                outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL);

#endif



to



#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)

                outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0666);

#else

                outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL, 0666);

#endif



Error



mkswap.c:45:59: error: asm/page.h: No such file or directory



Solve



ln -sf /usr/src/linux-headers-2.6.32-33/arch/x86/include/asm/ asm



4. make install



5. Exec bin file



home/freeman/Desktop/busybox-0.60.3/_install/bin



ls