본문 바로가기

Hop the wag during working

Busybox를 이용한 Filesystem만들기

1. busybox 다운로드 및 패치

2. 압축 해제 및 패치 적용

  • 압축 해제
    root # tar -xvf busybox-1.12.1.tar.tar
  • 패치 적용
    root # patch < busybox-1.12.1-grep.patch
    can't find file to patch at input line 3
    Perhaps you should have used the -p or --strip option?
    The text leading up to this was:
    --------------------------
    |--- busybox-1.12.1/findutils/grep.c    Sun Sep 28 20:04:28 2008
    |+++ busybox-1.12.1-grep/findutils/grep.c       Wed Oct  1 00:45:49 2008
    --------------------------
    File to patch: busybox-1.12.1/findutils/grep.c
    patching file busybox-1.12.1/findutils/grep.c
    root # patch < busybox-1.12.1-modprobe.patch
    can't find file to patch at input line 4
    Perhaps you should have used the -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff -urN busybox-1.12.1/modutils/modprobe.c busybox-1.12.1-modprobe/modutils/modprobe.c
    |--- busybox-1.12.1/modutils/modprobe.c 2008-09-28 20:04:15.000000000 +0200
    |+++ busybox-1.12.1-modprobe/modutils/modprobe.c        2008-10-10 14:36:58.000000000 +0200
    --------------------------
    File to patch: busybox-1.12.1/modutils/modprobe.c
    patching file busybox-1.12.1/modutils/modprobe.c
    root #

3. Busybox configuration

  • busybox디렉토리에서 make menuconfig를 실행하여 busybox의 configuration을 설정한다.
    : busybox의 환경요소(라이브러리 세팅 등)와 필요한 command등을 체크한뒤 빠져나오면 .config파일이 생성된다. configuration의 내용은 help를 참고하기 바란다.
     

4. Compile

  • croos_compile 설정 : Makefile을 열어 아래와 같이 원하는 크로스 컴파일러를 설정한다.


  • comepile : 크로스 컴파일러를 설정한 후 make를 통해 busybox를 컴파일한다.
root # make
   CC        applets/applets.o
   ................................    ................................
   LINK     busybox_unstripped
Trying libraries: crypt m
  Library crypt is not needed
  Library m is needed
Final link with: m
root #

  • install
    컴파일 완료 후 make install을 실행하면 _install 디렉토리에 compile된 파일들이 생성되어 하나의 파일 시스템으로 나타난다.(해당 디렉토리는 configuration의 BusyBox installation prefix의 설정에 따라 달라진다. default는_install이다.)
    여기에 /dev, /proc등의 파일 시스템에 필요한 장치 파일이나 디렉토리 등을 만들어 파일 시스템을 완성시킨다.