1. 본 글은 아래의 공식 페이지를 이용해 작성하는 글입니다!

2. 저의 나름대로의 요약이니, 틀린 부분 지적 부탁드립니다!

3. 총 2개의 섹션으로 분리해서 나눠서 작성할 예정입니다.

THE GENERAL "WORKFLOW" - HOW IT ALL WORKS

  • 욕토를 시작하기 위해서는 개발자들은 architecture, policies, patches and configuration details 등을 명시해줘야 합니다.
  • 빌드 시스템은 그러면 소스코드를 fetch하고 다운로드 합니다. 이 프로젝트는 우선 tarball 또는 code repository 같은 git과 같은 방식을 지원합니다.
  • 다운로드가 되면, 소스코드는 로컬 영역에 extract 됩니다. 그리고 소프트웨어를 configuring과 compiling하기 step이 진행됩니다.
  • 소프트웨어는 그럼 인스톨되어질것인데, 개발자들이 선택한 바이너리 패키지 포맷이 사용되어지는 경로입니다.
  • 다양한 QA와 sanity check가 실행되어 집니다.

DEVELOPMENT ENVIRONMENT - HOST SETUP

  1. 위 빌드 과정을 수행하기 위한 host는 보통 리눅스를 이용하는것같네요.

REFERENCE EMBEDDED DISTRIBUTION (POKY)

  • poky는 위에도 언급했듯이 레퍼런스 배포판입니다! poky는 빌드시스템(bitbake and OpenEmbedded Core) 뿐만 아니라 다양한 metadata를 가지고 있습니다.

총 2부로 간략하게 마무리 하겠습니다.

사실 쓰다보니 2부정도로 마무리가 될 수 있겠다 판단이 들었습니다 ㅎㅎ;

'LINUX > yocto' 카테고리의 다른 글

yocto project 컨셉 이해(1)  (0) 2022.11.02
local.conf 주요 환경 변수  (0) 2022.02.22
욕토 프로젝트 시작하기  (0) 2022.02.22
욕토 프로젝트 용어  (0) 2021.07.08

1. 본 글은 아래의 공식 페이지를 이용해 작성하는 글입니다!

2. 저의 나름대로의 요약이니, 틀린 부분 지적 부탁드립니다!

3. 총 3개의 섹션으로 분리해서 나눠서 작성할 예정입니다.

Software – Yocto Project

GETTING STARTED: THE YOCTO PROJECT® OVERVIEW

yocto project(이하 YP)를 이해하기 위해서는 크게 2가지의 컴포넌트를 이해하셔야 합니다.

  1. OpenEmbedded 프로젝트(이하 OE)
  2. Poky
  3. YP

OE는 커스텀 리눅스 배포판을 빌드하기 위한 "빌드 시스템 프레임워크"입니다.

Openembedded.org

YP는 customized linux distribution을 제작하기 위한 프로젝트입니다. 그리고 주 프로덕트 타겟은 임베디드 프로덕트입니다. 일반적인 범용 PC가 주 타겟은 아닌듯합니다.

그리고 YP는 customized linux distribution을 빌드하기 위한 빌드 시스템으로, OE를 채택했습니다.

YP가 제공하는 여러 툴과 OE를 이용하여 빌드한 YP의 레퍼런스 distribution인 Poky가 탄생합니다.

Poky는 사실 BUILD EXAMPLE입니다. 이 example을 이용해 small embedded os를 제작할 수 있습니다. 즉, 리눅스 배포판을 제작할 수 있다는 것입니다. 그럼 example에는 뭐가 있다느 것일까요? 예시로 Bitbake라는 빌드 엔진, 그리고 core build system metadata가 있습니다.

특히 위에 2개는 recipeslayers라고 불립니다. 개발자는 이러한 것을 수정, 복사할 수 있습니다.

THE LAYER MODEL - THE KEY TO CUSTOMIZATION

YP는 임베디드 리눅스 제작을 위해 Layer Model 이라는 개발 모델을 가지고 있습니다.

레이어는 일종의 레포지토리입니다. 빌드 시스템에게 이것저것, 무엇을 해야하는지 알려주는 명령어 집합을 가지고 있습니다. 빌드 시스템은 이 명령어 집합들을 종합해서 리눅스 배포판을 제작하는 것입니다.

개발자는 이 레이어를 그대로 이용하는것에서 멈추지 않고, 수정과 삭제 또한 할 수 있습니다.

개발자는 레이어들을 논리적으로 분리해서 이용할 수도 있습니다. 예시로, 특정 벤더들이 내놓은 개발보드가 있다고 가정하겠습니다. 이러한 보드들의 BSP, GUI, Config, Middleware, application의 레이어를 분리할 수 있다는 것입니다. 이러한 것들은 특정 칩 벤더들에게 가능하면 제공받는것이 좋습니다. (ex STMicroelectronics)

이러한 YP layer들은 아래의 두 링크에서 확인할 수 있습니다.

  1. https://www.yoctoproject.org/software-overview/layers/
  2. http://layers.openembedded.org/

유의 사항으로 2번의 OE 링크 경우, 덜 검증된 부분이 있다고 합니다.

COMPONENTS AND TOOLS MAINTAINED BY THE YOCTO PROJECT

위 사진을 보면 meta-poky, meta-yocto-bsp, document 등의 것이 있는것을 확인할 수 있습니다. 이러한 것들은 유저의 커스텀 리눅스 개발을 위해 사용됩니다. 또한 YP 그 자체를 위해 이용되기도 합니다.

위 내용들을 종합하면 아래와 같습니다.

TERMS FOR REFERENCE

  • Configuration Files: Files which hold global definitions of variables, user defined variables and hardware configuration information. They tell the build system what to build and put into the image to support a particular platform.
  • Recipe: The most common form of metadata. A recipe will contain a list of settings and tasks (instructions) for building packages which are then used to build the binary image. A recipe describes where you get source code and which patches to apply. Recipes describe dependencies for libraries or for other recipes, as well as configuration and compilation options. They are stored in layers.
  • Layer: A collection of related recipes. Layers allow you to consolidate related metadata to customize your build, and isolate information for multiple architecture builds. Layers are hierarchical in their ability to override previous specifications. You can include any number of available layers from the Yocto Project and customize the build by adding your layers after them. The Layer Index is searchable for layers within Yocto Project.
  • Metadata: A key element of the Yocto Project is the meta-data which is used to construct a Linux distribution, contained in the files that the build system parses when building an image. In general, Metadata includes recipes, configuration files and other information refering to the build instructions themselves, as well as the data used to control what things get built and to affect how they are built. The meta-data also includes commands and data used to indicate what versions of software are used, and where they are obtained from, as well as changes or additions to the software itself (patches or auxiliary files) which are used to fix bugs or customize the software for use in a particular situation. OpenEmbedded Core is an important set of validated metadata.
  • OpenEmbedded-Core: oe-core is meta-data comprised of foundation recipes, classes and associated files that are meant to be common among many different OpenEmbedded-derived systems, including the Yocto Project. It is a curated subset of an original repository developed by the OpenEmbedded community which has been pared down into a smaller, core set of continuously validated recipes resulting in a tightly controlled and an quality-assured core set of recipes.
  • Poky: A reference embedded distribution and a reference test configuration created to 1) provide a base level functional distro which can be used to illustrate how to customize a distribution, 2) to test the Yocto Project components, Poky is used to validate Yocto Project, and 3) as a vehicle for users to download Yocto Project. Poky is not a product level distro, but a good starting point for customization. Poky is an integration layer on top of oe-core.
  • Build System - "Bitbake": a scheduler and execution engine which parses instructions (recipes) and configuration data. It then creates a dependency tree to order the compilation, schedules the compilation of the included code, and finally, executes the building of the specified, custom Linux image (distribution). BitBake is a make-like build tool. BitBake recipes specify how a particular package is built. They include all the package dependencies, source code locations, configuration, compilation, build, install and remove instructions. Recipes also store the metadata for the package in standard variables. Related recipes are consolidated into a layer. During the build process dependencies are tracked and native or cross-compilation of the package is performed. As a first step in a cross-build setup, the framework will attempt to create a cross-compiler toolchain (Extensible SDK) suited for the target platform.
  • Packages: The output of the build system used to create your final image.
  • Extensible Software Development Kit (ESDK): A custom SDK for application developers that allows them to incorporate their library and programming changes back into the image to make their code available to other apps developers.
  • Image: A binary form of a Linux distribution (operating system) intended to be loaded onto a device.

2편에서 추가로 작성하겠습니다!

'LINUX > yocto' 카테고리의 다른 글

yocto project 컨셉 이해(2)  (0) 2022.11.02
local.conf 주요 환경 변수  (0) 2022.02.22
욕토 프로젝트 시작하기  (0) 2022.02.22
욕토 프로젝트 용어  (0) 2021.07.08

 source ./oe-init-build-env 를 실행했을때 생기는 local.conf의 내용 중 주요 환경 변수는 아래와 같습니다(조금 상이할 수 있습니다).

  • BB_NUMBER_THREADS ?= "${@bb.utils.cpu_count())"
  • PARALLEL_MAKE ?= "-j ${@bb.tuils.cpu_count())"
  • MACHINE ??= "qemux86"
  • DL_DIR ?= "${TOPDIR}/downloads"
  • SSTATE_DIR ?= "${TOPDIR}/sstate_cache"
  • TMP_DIR = "${TOPDIR}/tmp"

**${TOPDIR} = build 디렉토리

# The default is a downloads directory under TOPDIR which is the build directory.

변수 기본값 설명
BB_NUMBER_THREADS ${@bb.utils.cpu_count()) 동시 실행 비트베이크 작업 갯수
PARALLEL_MAKE -j ${@bb.tuils.cpu_count()) 동시 실행 메이크 프로세스 갯수
MACHINE qemux86 타깃 머신
DL_DIR ${TOPDIR}/downloads 소스가 다운로드된 디렉토리
SSTATE_DIR ${TOPDIR}/sstate_cache 공유 상태 캐시 파일 디렉토리
TMP_DIR ${TOPDIR}/tmp 빌드 출력 디렉토리

 

다음 게시글로는 오픈소스 소프트웨어 패키지를 빌드하는 워크플로우에 대해 알아보겠습니다.

'LINUX > yocto' 카테고리의 다른 글

yocto project 컨셉 이해(2)  (0) 2022.11.02
yocto project 컨셉 이해(1)  (0) 2022.11.02
욕토 프로젝트 시작하기  (0) 2022.02.22
욕토 프로젝트 용어  (0) 2021.07.08

 시작하기에 앞서 욕토 프로젝트를 왜 활용해야하는지에 대해 질문할것 같습니다. 그리고 이에 대한 대답은 아주 간단합니다. 리눅스를 제공하되, 그 중 필요로 하지않는 부분은 모두 덜어내기 위함입니다. 결과적으로 욕토 프로젝트를 이용해 커스터마이징된 리눅스를 생성할 것입니다. 그리고 이는 리소스가 제한된 임베디드 환경에서 효과적입니다. 만일 리눅스보드에서 우분투가 돌아간다 생각해보면... 흠... 너무 많은 리소스가 낭비되죠... 쓸데없는 부분이 너무 많이 포함돼있습니다. 각종 소프트웨어, 문서 소프트웨어 ,gui 툴 등등... 하지만 욕토 프로젝트를 이용하면 최대한 많이 덜어낼 수 있습니다. 이런 부분을.

 

 욕토 프로젝트 사이트에서부터 시작합니다. 

https://www.yoctoproject.org/ 

 

Yocto Project – It's not an embedded Linux distribution – it creates a custom one for you

A Linux Foundation Collaborative Project. All Rights Reserved. Linux Foundation® and Yocto Project® are registered trademarks of the Linux Foundation. Linux® is a registered trademark of Linus Torvalds. Please see our privacy policy.

www.yoctoproject.org

이 링크에서 git clone 합니다.

SOFTWARE -> DOWNLOADS 로 들어가면 git clone할 수 있는 주소가 있습니다.

clone 결과는 다음과 같습니다.

이제 이미지를 빌드하기 위해 다음의 스크립트를 실행합니다. 위에 보이는 oe-init-build-env입니다.

해당 스크립트를 실행하면 bitbake가 활성화됩니다. 그리고 자동적으로 build라는 디렉토리를 생성시키고 그 디렉토리로 이동합니다. 결과를 보면 build 디렉토리로 이동한것을 확인할 수 있습니다.

 

그리고 빌드를 시작합니다.

해당 명령어의 의미는 다음과 같습니다.

"core-image-sato 라는 이름의 이미지를 빌드한다." 

core-image-sato란 무엇이냐 질문이 생길수 있습니다. 이는 욕토 프로젝트에서 기본적으로 지원하는 이미지입니다. core-image를 레퍼런스삼아 core-image-** 이런식으로 확장할 수 있습니다. core-image-sato는 그런 형식인것입니다.

 

 본 게시글을 통해 아주 간단하게 빌드하는 과정만 수행해봤습니다. 물론 이미지를 생성하기 위한 여러 파라미터들이 존재합니다. 이것들은 다음 게시글을 통해 소개하도록 하겠습니다.

'LINUX > yocto' 카테고리의 다른 글

yocto project 컨셉 이해(2)  (0) 2022.11.02
yocto project 컨셉 이해(1)  (0) 2022.11.02
local.conf 주요 환경 변수  (0) 2022.02.22
욕토 프로젝트 용어  (0) 2021.07.08
#!/bin/bash

echo 0 > /sys/kernel/debug/tracing/tracing_on
sleep 1
echo "tracing_off"

echo 0 > /sys/kernel/debug/tracing/events/enable
sleep 1
echo "events disabled"

echo secondary_start_kernel > /sys/kernel/debug/tracing/set_ftrace_filter
sleep 1
echo "set_ftrace_filter init"

echo function > /sys/kernel/debug/tracing/current_tracer
sleep 1
echo "function tracer enabled"

echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable

echo 1 > /sys/kernel/debug/tracing/events/irq/irq_handler_entry/enable
echo 1 > /sys/kernel/debug/tracing/events/irq/irq_handler_exit/enable

echo 1 > /sys/kernel/debug/tracing/events/raw_syscalls/enable
sleep 1
echo "event enabled"

echo    schedule ttwu_do_wakeup > /sys/kernel/debug/tracing/set_ftrace_filter
sleep 1
echo "set_ftrace_filter enabled"

echo 1 > /sys/kernel/debug/tracing/options/func_stack_trace
echo 1 > /sys/kernel/debug/tracing/options/sym-offset
echo "function stack trace enabled"

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo "tracing_on"

wsl에서 테스트 해보려는데 11번 라인에서 오류가 나는군요. 내일 회사에 있는 라즈베리파이를 이용해서 테스트 계속 해봐야겠습니다.

회사에서 욕토 관련한 프로젝트를 진행하고 있지만, 용어와 개념을 모두 파악하지 못해 아직 수동적으로 진행하고 있습니다(도움없이는 하지 못하는 ㅜ).

 

입사 초 구매했던 책을 열심히 정독하던 중 용어부터 파악해야 한다는 생각이 들었고 그에 대한 결과를 아래에 작성합니다 :)

 

1) 비트베이크(Bitbake) : 오픈임베디드 빌드 시스템에 포함된 빌드 엔진이다. 비트베이크는 작업의 실행 및 스케줄을 맡는다. make와 ant와 같은 빌드 엔진이라고 보면 된다.

 

2) 이미지 : 주로 압축된 바이너리 파일이며, 이미지는 부트로더, 운영체제 커널, 타깃 시스템이 부팅하고 실행하는 저장 매체에 복사할 루트 파일시스템을 갖는다. 이미지라는 용어는 주로 운영체제 커널(커널 이미지)과 루트 파일시스템(루트 파일시스템 이미지)을 뜻한다.

 

3) 레이어 : 비트베이크 내에서 레이어는 파일 및 디렉터리 구조 내에 구조화된 메타데이터(환경 설정 파일, 레시피 등)의 모음이다.

 

4) 패키지 : 패키지는 실행 가능 바이너리, 라이브러리, 문서, 환경 설정 정보, 운영체제의 패키지 관리 시스템이 설치 및 삭제를 할 수 있는 형태를 따르는 파일 등을 포함하는 소프트웨어 묶음이다. 패키지는 일반적으로 의존성 정보와 패키지 관리 시스템이 자동으로 해결하거나 사용자에게 그 정보를 전달할수 있는 호환성 정보를 포함한다. 

욕토 프로젝트는 또한 패키지라는 용어를 소프트웨어 묶음을 빌드하는 데 사용되는 레시피나 기타 메타데이터를 가리키는 데 사용한다. 내용에 따라서, 이 용어는 실제 소프트웨어 묶음을 가리키거나 소프트웨어 묶음을 빌드하기 위한 메타데이터를 가리키기도 한다.

 

5) 레시피 : 레시피는 비트베이크가 특정 소프트웨어 패키지를 빌드하는 방법을 지정하는 메타데이터 파일이다. 레시피는 소스 코드를 어디서 다운로드하는지부터 시작해서 어떤 패치를 적용할지, 어떻게 적용할지, 바이너리와 연관 파일들을 어떻게 빌드할지, 빌드 결과를 타깃 시스템에 어떻게 설치할지, 패키지 소프트웨어 번들을 어떻게 생성할지 등을 기술한다. 레시피는 또한 빌드와 실행 중에 필요한 타 소프트웨어 패키지와의 의존성 및 빌드 절차에 필요한 논리적 계층도 기술한다. 레시피는 bb 확장자를 사용한다.

 

 

'LINUX > yocto' 카테고리의 다른 글

yocto project 컨셉 이해(2)  (0) 2022.11.02
yocto project 컨셉 이해(1)  (0) 2022.11.02
local.conf 주요 환경 변수  (0) 2022.02.22
욕토 프로젝트 시작하기  (0) 2022.02.22

+ Recent posts