본문 바로가기

카테고리 없음

Yocto - Quick Start

Yocto Project는 OpenEmbedded(OE)프로젝트 기반의 호스트를 빌드한다.

Yocto는 BitBake tool을 사용한다.


BitBake란 ?

 BitBake는 임베디드 리눅스의 크로스 컴파일 과정을 위한 패키지와 관련파일들을 빌드하는 데 사용되는 툴이다.


BitBake recipes는 특정패키지에 대한 빌드방법을 구체화하고, 패키지들의 의존성, 위치, 설정법, 컴파일, 빌드, 설치 및 제거정보를 포함한다. 그리고 패키지의 메타데이터 정보를 표준화된 변수들로 가지고 있다.

BitBake recipes는 패키지의 소스 URL (httphttpsftpcvssvngit, 로컬 파일 시스템), 패키지간의 의존성, 컴파일, 설치옵션들로 구성 되어있다. 빌드 진행중에 BitBake recipes는 패키지의 의존성을 추적하고, 네이티브 혹은 크로스 컴파일을 로컬 혹은 타겟 장치에 맞게 수행한다. 루트 파일 시스템과 완전한 이미지를 생성할 수 있다. 또한 타겟 플랫폼에 맞는 크로스 컴파일 툴체인을 생성한다.


출처 : https://ko.wikipedia.org/wiki/BitBake


  • Yocto Environment

(http://www.yoctoproject.org/docs/2.3.1/yocto-project-qs/yocto-project-qs.html)



Yocto Project의 몇개의 중요한 점들.


  • Embedded environment에 적합한 시스템 명령어와 라이브러리 세트를 최근 리눅스 커널과 함께 제공.
  • SDL , Clutter, Qt, GTK+, X11 같은 사용가능한 시스템 컴포넌트들을 만듬. 따라서 디스플레이가 있는 장치(Device) 에서 풍부한 사용자 환경을 만들 수 있습니다. 디스플레이가 없는 디바이스 또는 다른 UI framework를 사용하길 원하면, 이 컴포넌트들은 설치되지 않을 것이다.
  • 광범위한 하드웨어와 장치(device) 에뮬레이터는 Quick EMUlator(QEMU)를 통해 완벽히 제공된다.
  • 쉬운 시스템 확장, 커스터마이징, 체계적으로 유지할 수 있는 계층 메카니즘(layer mechanism)을 제공한다.

Yocto Project를 다양한 장치에 이미지를 생성할 수 있을 것이다(설치할 수 있다는 말). 앞에서도 말했다시피, Yocto Project는 QEMU를 사용해서 부팅해야된다. 32비트 QEMU full-system emulation 과 64-bit환경의 다양한 X86, ARM, MIPS, 그리고 PowerPC 아키텍처를 타켓으로한 표준예제가 있다.



Setting Up to Use the Yocto Project

리눅스 기반의 호스트에 Yocto Project를 빌드하기 위한 이미지를 사용해서 설치해볼 예정이다.

  • Build Host 리눅스 배포판에서 실행할려면 최소 50Gbytes의 여유공간이 있어야 한다.
  • Build Host Packages 빌드 호스트에 설치된 적절한 패키지들
  • The Yocto Project Yocto Project의 릴리즈들  


The Linux Distribution

Yocto Project는 아래의 리눅스 배포판에 안정적인 버전을 지원한다.

  • Ubuntu
  • Fedora
  • openSUSE
  • CentOS
  • Debian

Yocto Project를 서포트하는 더 많은 배포판 리스트를 알고싶다면, "Supported Linux Distributions" 섹션을 봐라.


OE(Open Embedded) 빌드 시스템은 최신 배포판을 Git,tar,Python 을 통해 사용할 수 있다.

  • Git 1.8.3.1 or greater
  • tar 1.24 or greater
  • Python 3.4.0 or greater

The Build Host Packages


  • Ubuntu and Debian

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
     xz-utils debianutils iputils-ping libsdl1.2-dev xterm
  • Fedora

$ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch \

     diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \

     ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat \

     python3-pexpect findutils which file cpio python python3-pip xz SDL-devel xterm


  • OpenSUSE

 $ sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml \

     diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip \

     python3-pexpect xz which libSDL-devel xterm


  • CentOS

$ sudo yum install -y epel-release

     $ sudo yum makecache

     $ sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \

     diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat \

     perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip xz \

     which SDL-devel xterm


  • CentOs 6.x 유저는 Git, tar그리고 Python의 위에서 언급한 버전이 맞아야 한다.
  • Enterperis Linux용 추가 패키지는 enterprise Linux에 기본적으로 포함되어있지 않은 패키지들을 쉽게 설치할 수 있게 RHEL / CentOS에 빌드 된 Fedora의 패키지 모음입니다. 이러한 패키지들을 부분적으로 설치해야 한다.
  • makecache 커맨드는 epel-release로부터 추가적인 metadata를 소비한다.


Yocto Project Release


Yocto Project의 현재버전을 다운받는 법입니다.

위의 과정을 잘 따라오셨으면 문제없이 설치가 될 것입니다.


$ git clone git://git.yoctoproject.org/poky 

$ git checkout pyro


Building an Image for Emulation


1. Check Out Your Branch : 소스 폴더(e.g. poky)로 이동하고 최근에 배포된 Yocto Project의 Branch를 check out 해라.


$ cd ~/poky

$ git checkout -b pyro origin/pyro 


git의 checkout 커맨드는 현재 Yocto Project 릴리즈를 local branch에서 이름이 같은 릴리즈된 버전을 가져오는것을 뜻한다(i.e. pyro). local branch는 같은이름을 상위 branch로 이동한다. 최근 파일에 기반한 자신만의 branch를 만들 수 있다.


2. Initialize the Build Environment : poky 폴더 안에 있는 환경설정 스크립트 oe-init-build-env를 실행하여 빌드호스트에 OpenEmbedded 빌드 환경을 정의해라.


$source oe-init-build-env 


3. Examine Your Local Configuration File : When you set up the build environment, a local configuration file named local.conf becomes available in a conf subdirectory of the Build Directory. Before using BitBake to start the build, you can look at this file and be sure your general configurations are how you want them:


To help conserve disk space during builds, you can add the following statement to your project's configuration file, which for this example is poky/build/conf/local.conf. Adding this statement deletes the work directory used for building a recipe once the recipe is built.


     INHERIT += "rm_work"

                                

By default, the target machine for the build is qemux86, which produces an image that can be used in the QEMU emulator and is targeted at an Intel® 32-bit based architecture. Further on in this example, this default is easily changed through the MACHINE variable so that you can quickly build an image for a different machine.


Another consideration before you build is the package manager used when creating the image. The default local.conf file selects the RPM package manager. You can control this configuration by using the PACKAGE_CLASSES variable.


Selection of the package manager is separate from whether package management is used at runtime in the target image.


For additional package manager selection information, see the "package.bbclass" section in the Yocto Project Reference Manual.(추후에 정리하여 올릴 예정)


4. Start the Build : core-image-sato 인 대상에 대한 OS 이미지를 빌드하려면 다음 명령을 입력해라(이 과정에서 시간이 제일 많이 걸린다.)


$ bitbake core-image-sato 


5. Simulate Your Image Using QEMU : 위의 OS 이미지가 설치됬으면, 너는 QEMU를 실행할 수 있을 것이다


$ runqemu qemux86 


만약 QEMU실행에 관해 더 알고싶으면, "Using the Quick EMUlator (QEMU)"의 Yocto Project Development Manual 부분을 참조해라


6. Exit QEMU : QEMU에서 나가고싶으면 셧다운 버튼을 누르거나 Ctrl-c를 누르면 QEMU 윈도우에서 나갈 수 있다.


Building an Image for Hardware