728x90
반응형





리눅스 기반 Buildroot 를 이용하여 시스템 이미지 생성하기




Buildroot 메뉴얼 : https://buildroot.org/downloads/manual/manual.html





1. 패키지 설치 




1.1 필수 패키지 


Build tools:


  • which
  • sed
  • make (version 3.81 or any later)
  • binutils
  • build-essential (only for Debian based systems)
  • gcc (version 4.4 or any later)
  • g++ (version 4.4 or any later)
  • bash
  • patch
  • gzip
  • bzip2
  • perl (version 5.8.7 or any later)
  • tar
  • cpio
  • python (version 2.6 or any later)
  • unzip
  • rsync
  • file (must be in /usr/bin/file)
  • bc


Source fetching tools:


  • wget




1.2 옵션 패키지 



Configuration interface dependencies:


For these libraries, you need to install both runtime and development data, which in many distributions are packaged separately. The development packages typically have a -dev or -devel suffix.


  • ncurses5 to use the menuconfig interface
  • qt4 to use the xconfig interface
  • glib2, gtk2 and glade2 to use the gconfig interface


Source fetching tools:


In the official tree, most of the package sources are retrieved using wget from ftp, http or https locations. A few packages are only available through a version control system. Moreover, Buildroot is capable of downloading sources via other tools, like rsync or scp (refer to Chapter 19, Download infrastructure for more details). If you enable packages using any of these methods, you will need to install the corresponding tool on the host system:


  • bazaar
  • cvs
  • git
  • mercurial
  • rsync
  • scp
  • subversion

Java-related packages, if the Java Classpath needs to be built for the target system:


  • The javac compiler
  • The jar tool


Documentation generation tools:


  • asciidoc, version 8.6.3 or higher
  • w3m
  • python with the argparse module (automatically present in 2.7+ and 3.2+)
  • dblatex (required for the pdf manual only)


Graph generation tools:


  • graphviz to use graph-depends and <pkg>-graph-depends
  • python-matplotlib to use graph-build






2. Buildroot 시작 





buildroot 다운로드 : https://buildroot.org/download


buildroot 원하는 버전 다운로드 : https://buildroot.org/downloads/







다운로드 링크 주소 복사해서 터미널에서 다음과 같은 명령어 실행




2.1 해당 경로에 다운로드 받기 


curl -O https://buildroot.org/downloads/buildroot-2018.02.5.tar.gz 




2.2 해당 경로에 압축 해제


tar -xvzf buildroot-2018.02.5.tar.gz 




2.3 압축 해제되면 해제된 폴더 진입


cd buildroot-2018.02.5/









3. menuconfig





필요한 기능을 설정하기 위한 명령어이다. 


make menuconfig 


위와 같은 명령어를 입력하면 아래와 같은 화면이 나타난다. 


원하는 기능에 맞게 커스텀 해주면 된다. 



입력은 평소대로 하면 되고, 


메뉴 선택은 Enter, 작성한 글 삭제는 Ctrl+Backspace 를 누르면 된다. 










Target options








Kernel 






모든 설정이 끝났다면 Exit 하여 저장 








4. make



설정을 완료했으니 make 명령어를 실행한다. 


buildroot의 source를 build 하는 것으로, hostPC 성능 및 인터넷 속도에 따라 30분 ~ 1시간 정도 소요 될 수 있다. 



* make clean : 


build 디렉토리, host, staging, target trees, images, toolchain 을 포함한 모든 build products 를 지울 때 사용하는 명령어



* make distclean : 


make clean + 모든 configuration 제거 시 사용 (초기 상태로 되돌리고자 할 때)








5. output 폴더 확인





make를 마치고 나면 output 폴더에 다음과 같은 파일들이 생성되며,


images 폴더에 들어가보면 




  • rootfs.tar
  • rootfs.tar.gz
  • rootfs.tgz
  • uImage
  • uzImage.bin





파일이 생성된 것을 볼 수 있다. 









참고자료 1 : http://slowbootkernelhacks.blogspot.com/2016/12/buildroot.html


참고자료 2 : https://buildroot.org/downloads/manual/manual.pdf


참고자료 3 : https://www.youtube.com/watch?v=2MclfKWqveg


참고자료 4 : http://www.staroceans.org/e-book/buildroot-slides.pdf








728x90
반응형