develop/west/why.html · develop/west/why.rst 공식 원문 ↗

Zephyr 3.7.0 · Develop · West · History and Motivation

West의 역사와 설계 동기

Zephyr가 왜 Git submodule이나 repo 대신 West를 만들었는지 요구 사항과 설계 원칙으로 살펴봅니다.

Official pathdevelop/west/why.html
Source filedevelop/west/why.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

R1~R4 요구, Google repo·Git submodule의 한계, 다중 저장소의 장점, optional·CMake-compatible·cross-platform 설계 제약을 설명합니다.

Requirements

R1 · R2 · R3 · R4

Repositories

separation · licensing · modules

Constraints

optional · portable · specified

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 0A36A4584B4BE2472439AE3768E4A5CC93FCA292E8C969FA65373995EBEA5C73
.. _west-history:

History and Motivation
######################

West was added to the Zephyr project to fulfill two fundamental requirements:

* The ability to work with multiple Git repositories
* The ability to provide an extensible and user-friendly command-line interface
  for basic Zephyr workflows

During the development of west, a set of :ref:`west-design-constraints` were
identified to avoid the common pitfalls of tools of this kind.

Requirements
************

Although the motivation behind splitting the Zephyr codebase into multiple
repositories is outside of the scope of this page, the fundamental requirements,
along with a clear justification of the choice not to use existing tools and
instead develop a new one, do belong here.

The basic requirements are:

* **R1**: Keep externally maintained code in separately maintained repositories
  outside of the main zephyr repository, without requiring users to manually
  clone each of the external repositories
* **R2**: Provide a tool that both Zephyr users and distributors can make use of
  to benefit from and extend
* **R3**: Allow users and downstream distributions to override or remove
  repositories without having to make changes to the zephyr repository
* **R4**: Support both continuous tracking and commit-based (bisectable) project
  updating


Rationale for a custom tool
***************************

Some of west's features are similar to those provided by
`Git Submodules <https://git-scm.com/book/en/v2/Git-Tools-Submodules>`_ and
Google's `repo <https://gerrit.googlesource.com/git-repo/>`_.

Existing tools were considered during west's initial design and development.
None were found suitable for Zephyr's requirements. In particular, these were
examined in detail:

* Google repo

  - Does not cleanly support using zephyr as the manifest repository (**R4**)
  - Python 2 only
  - Does not play well with Windows
  - Assumes Gerrit is used for code review

* Git submodules

  - Does not fully support **R1**, since the externally maintained repositories
    would still need to be inside the main zephyr Git tree
  - Does not support **R3**, since downstream copies would need to either
    delete or replace submodule definitions
  - Does not support continuous tracking of the latest ``HEAD`` in external
    repositories (**R4**)
  - Requires hardcoding of the paths/locations of the external repositories

Multiple Git Repositories
*************************

Zephyr intends to provide all required building blocks needed to deploy complex
IoT applications. This in turn means that the Zephyr project is much more than
an RTOS kernel, and is instead a collection of components that work together.
In this context, there are a few reasons to work with multiple Git
repositories in a standardized manner within the project:

* Clean separation of Zephyr original code and imported projects and libraries
* Avoidance of license incompatibilities between original and imported code
* Reduction in size and scope of the core Zephyr codebase, with additional
  repositories containing optional components instead of being imported
  directly into the tree
* Safety and security certifications
* Enforcement of modularization of the components
* Out-of-tree development based on subsets of the supported boards and SoCs

See :ref:`west-basics` for information on how west workspaces manage multiple
git repositories.

.. _west-design-constraints:

Design Constraints
******************

West is:

- **Optional**: it is always *possible* to drop back to "raw"
  command-line tools, i.e. use Zephyr without using west (although west itself
  might need to be installed and accessible to the build system). It may not
  always be *convenient* to do so, however. (If all of west's features
  were already conveniently available, there would be no reason to
  develop it.)

- **Compatible with CMake**: building, flashing and debugging, and
  emulator support will always remain compatible with direct use of
  CMake.

- **Cross-platform**: West is written in Python 3, and works on all
  platforms supported by Zephyr.

- **Usable as a Library**: whenever possible, west features are
  implemented as libraries that can be used standalone in other
  programs, along with separate command line interfaces that wrap
  them.  West itself is a Python package named ``west``; its libraries
  are implemented as subpackages.

- **Conservative about features**: no features will be accepted without
  strong and compelling motivation.

- **Clearly specified**: West's behavior in cases where it wraps other
  commands is clearly specified and documented. This enables
  interoperability with third party tools, and means Zephyr developers
  can always find out what is happening "under the hood" when using west.

See :github:`Zephyr issue #6205 <6205>` and for more details and discussion.

Part 3

한국어 전문 번역

역사와 도입 동기

West는 Zephyr project가 두 가지 근본 요구 사항을 충족하기 위해 추가한 도구입니다.

  • 여러 Git 저장소를 하나의 project처럼 함께 다루는 능력
  • 기본 Zephyr workflow를 위한 확장 가능하고 사용하기 쉬운 command-line interface

West 개발 과정에서는 이런 종류의 도구에서 자주 생기는 문제를 피하기 위한 설계 제약도 함께 정했습니다.

요구 사항

Zephyr codebase를 여러 저장소로 나눈 배경 자체는 이 페이지의 범위를 벗어나지만, West가 만족해야 했던 요구와 기존 도구 대신 새 도구를 선택한 이유는 다음과 같습니다.

  • R1: 외부에서 유지되는 code는 main zephyr 저장소 밖의 별도 저장소에 두되, 사용자가 각 저장소를 일일이 clone하지 않아도 되게 합니다.
  • R2: Zephyr 사용자와 배포판 제작자가 모두 활용하고 확장할 수 있는 도구를 제공합니다.
  • R3: 사용자와 downstream 배포판이 zephyr 저장소를 수정하지 않고도 저장소 정의를 덮어쓰거나 제거할 수 있게 합니다.
  • R4: 외부 project의 최신 상태를 계속 추적하는 방식과 특정 commit으로 고정해 bisect할 수 있는 갱신 방식을 모두 지원합니다.

전용 도구를 만든 이유

West 기능 일부는 Git submodule이나 Google repo와 비슷합니다. 초기 설계에서 기존 도구를 검토했지만 Zephyr 요구를 모두 만족하는 것은 없었습니다.

Google repo가 맞지 않았던 이유:

  • Zephyr 저장소 자체를 manifest 저장소로 사용하는 구성을 깔끔하게 지원하지 않아 R4와 맞지 않았습니다.
  • 당시 Python 2 전용이었습니다.
  • Windows에서 원활히 동작하지 않았습니다.
  • Code review에 Gerrit을 사용한다고 가정했습니다.

Git submodule이 맞지 않았던 이유:

  • 외부 유지 저장소의 정의가 여전히 main zephyr Git tree 안에 있어야 하므로 R1을 완전히 만족하지 못했습니다.
  • Downstream이 submodule 정의를 삭제하거나 교체해야 하므로 R3을 만족하지 못했습니다.
  • 외부 저장소의 최신 HEAD를 계속 추적하는 R4 방식을 지원하지 못했습니다.
  • 외부 저장소의 path와 위치를 고정해 적어야 했습니다.

여러 Git 저장소

Zephyr는 복잡한 IoT application 배포에 필요한 모든 building block을 제공하려 합니다. 따라서 Zephyr는 RTOS kernel 하나가 아니라 함께 동작하는 component 집합입니다. 이 구조에서 여러 Git 저장소를 표준 방식으로 관리하는 이유는 다음과 같습니다.

  • Zephyr 고유 code와 외부에서 가져온 project·library를 명확히 분리합니다.
  • 고유 code와 imported code 사이의 license 비호환을 피합니다.
  • 선택 component를 별도 저장소에 두어 core Zephyr codebase의 크기와 범위를 줄입니다.
  • Safety·security certification 경계를 관리합니다.
  • Component modularization을 구조적으로 강제합니다.
  • 지원 board와 SoC 일부만 선택한 out-of-tree 개발을 허용합니다.

West 기본 사용법에서 workspace가 여러 Git 저장소를 관리하는 방식을 확인할 수 있습니다.

설계 제약

  • 선택 사항: 불편할 수는 있어도 언제나 raw command-line tool로 돌아가 West 없이 Zephyr를 사용할 수 있어야 합니다. 다만 build system 접근을 위해 West package가 설치되어 있어야 하는 경우는 있습니다.
  • CMake 호환: Build, flash, debug, emulator 지원은 CMake를 직접 사용하는 방식과 계속 호환됩니다.
  • Cross-platform: West는 Python 3로 작성되며 Zephyr가 지원하는 모든 platform에서 동작합니다.
  • Library로 사용 가능: 가능한 기능은 독립적으로 재사용할 library로 구현하고, command-line interface는 그 library를 감쌉니다. West 자체는 west라는 Python package이고 library는 subpackage로 구현됩니다.
  • 기능 추가에 보수적: 강하고 설득력 있는 동기가 없는 기능은 받아들이지 않습니다.
  • 명확한 명세: 다른 command를 감싸는 경우에도 West의 동작을 명확히 정의하고 문서화합니다. 그래서 third-party tool과 상호 운용할 수 있고 개발자는 내부에서 실제로 무엇이 실행되는지 확인할 수 있습니다.

추가 배경과 논의는 Zephyr issue #6205를 참고합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.