Raspberry Pi/YOCTO

Raspberry Pi4 - YOCTO 개발 환경 구축(1)

engineer4ever 2025. 3. 19. 00:02

 

 
Target
Board
Raspberry Pi4
Host
PC - Ubuntu 22.04
목표
Raspberry Pi4 - YOCTO 개발 환경 구축(1)

 


Yocto image build

1. 사전 준비

2. Poky 시스템

3. 빌드 환경 준비

4. QEMU에서 이미지 실행

 

Cross Compile?

- 임베디드 시스템은 매우 제한된 리소스를 가지고 있어 S/W 개발은 호스트 시스템에서 이루어져야 한다.

- Host System의 프로세서와 Embedded System의 프로세서가 서로 다르기 때문에 Host System의 컴파일러로 Embedded의 S/W를 컴파일 할 수 없다.

- 따라서 호스트 시스템에서 작성된 프로그램을 임베디드 시스템에서 수행시키기 위해서는 cross compiler(교차 컴파일러)가 필요하다.

 

bitbake?

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

- yocto를 최초 설치할 때, bitbake를 입력하여 yocto 설치에 필요한 소스를 가져오고, bb의 SRC_URI에 정의된 패치 파일을 이용하여 빌드한다.

 


1. 사전 설치

PC $ sudo apt update
 
PC $ sudo apt install git git-lfs tar python3 python3-pip gcc 
 

 

1-1. 필수 패키지 설치

PC $ sudo apt invlstall gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool 
 

 

1-2. 작업 디렉토리 생성

PC $ mkdir yocto
PC $ cd yocto 
 

 

2. Poky 다운로드

PC $ git clone git://git.yoctoproject.org/poky
PC $ cd poky
PC $ git checkout -b dunfell origin/dunfell
 
 

 

3-1. 빌드 디렉토리 생성(및 환경 설정)

PC $ source oe-init-build-env
 

 

빌드 옵션

core-image-base
타깃 하드웨어를 완전히 지원하는 콘솔 전용 이미지.
core-image-minimal
작은 이미지를 사용하여 디바이스를 부팅
core-image-sato
Sato 지원 이미지, 모바일 환경 및 모바일 디바이스와 연동되는 비주얼 스타일
core-image-clutter
OpenGL 기반의 툴킷 Clutter를 지원하는 이미지
core-image-full-cmdline
보다 풀기능이 탑재된 Linux 시스템 기능이 탑재된 콘솔 전용 이미지

 

3-2. 빌드에 필요한 리소스 가져오기

PC $ bitbake core-image-sato --runall=fetch
 

 

4. 리소스를 가져오면 빌드 시작

PC $ bitbake core-image-sato
 

 

5-1. QEMU 에뮬레이터로 빌드 결과 검증

PC $ runqemu qemux86-64 nographic
 

 

5-2. image 생성 확인

 

 

'Raspberry Pi > YOCTO' 카테고리의 다른 글

Raspberry Pi4 - YOCTO 개발 환경 구축 및 확인(2)  (0) 2025.03.19