Building a Base Yocto Image for Raspberry Pi Zero 2W
A step-by-step guide to building and booting a clean base Yocto image for the Raspberry Pi Zero 2W
December 11, 2025

Building a Base Yocto Image for Raspberry Pi Zero 2W

개인적으로 Raspberry Pi Zero 2W 기반으로 작은 프로젝트를 진행해 보려 합니다.
프로젝트 특성상 부트로더, 커널 포함 많은 부분의 수정이 필요할수도 있어서, 기존 ubuntu 나 raspbian 이미지를 사용하지 않고 yocto 환경으로 직접 이미지를 빌드하여 진행하려고 합니다.

1. Setting up the Yocto Environment

가장 먼저 Yocto 프로젝트(Poky)와 Raspberry Pi 전용 레이어인 meta-raspberrypi를 다운로드하여 빌드 환경을 구성해야 합니다.

Installing Prerequisites

Ubuntu 기반 호스트(22.04 또는 24.04 LTS)를 기준으로, Yocto 빌드에 필요한 필수 패키지들을 설치합니다.

Installing Prerequisites for Yocto
shell

Cloning Sources

Yocto 빌드에 필요한 poky와 필요한 meta-* 레시피들을 clone 합니다. 현재 기준 Yocto외 최신 LTS branch인 scarthgap 사용합니다.

Cloning Sources
shell

2. Initializing Build Environment

oe-init-build-env 스크립트를 실행하여 빌드 디렉토리를 생성합니다.

shell

RaspberryPi 빌드를 위한 meta layer를 추가해줘야 합니다.

shell

conf 파일에서 Machine 설정을 합니다.
linux-firmware-rpidistro를 사용하기 위해선 License 설정도 해야 합니다.

vi conf/local.conf
diff

3. Building the Image

이제 이미지 빌드를 합니다. core-image-base로 빌드를 수행하면 됩니다.

shell

4. Flashing and Testing

빌드가 성공되면 wic 이미지가 나옵니다.
wic 파일은 Partition Table과 Bootloader, Root filesystem이 모두 포함된 완성된 디스크 이미지로, 별도의 파티셔닝 과정 없이 굽기만 하면 바로 부팅이 가능합니다.

Flashing to SD Card
shell

5. Verifying Boot

SD 카드를 Raspberry Pi Zero 2W 에 넣은 후 Mini-HDMI에 연결하면 시리얼 콘솔 로그를 확인할 수 있습니다.

PreviousGetting Started with the SmartThings API - Environment Setup
Jooojub
System S/W engineer
Explore Tags
Series
    Recent Post
    © 2026. jooojub. All right reserved.