Part 1
요약·해설
West workspace의 directory 구조, manifest repository와 project의 역할, west init과 west update의 동작 순서를 설명합니다.
topdir + manifest repository
project 목록과 revision
project clone·fetch·checkout
topdir · .west/config
repository · west.yml
init · update
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
47E88AAF826736A4C2206B06B5F7A15A8EE6C7ACD558B003EB2A859D2F11A683
.. _west-basics:
Basics
######
This page introduces west's basic concepts and provides references to further
reading.
West's built-in commands allow you to work with :term:`projects <west project>`
(Git repositories) under a common :term:`workspace <west workspace>` directory.
West works in the following manner: the ``west init`` command creates the
:term:`west workspace`, and clones the :term:`manifest repo <west manifest
repository>`, while the ``west update`` command initially clones, and later updates, the
:term:`projects <west project>` listed in the manifest in the workspace.
Example workspace
*****************
If you've followed the :ref:`getting_started`, your local
:term:`west workspace`, which in this case is the folder named
:file:`zephyrproject` as well as all its subfolders, looks like this:
.. code-block:: none
zephyrproject/ # west topdir
├── .west/ # marks the location of the topdir
│ └── config # per-workspace local configuration file
│
│ # The manifest repository, never modified by west after creation:
├── zephyr/ # .git/ repo
│ ├── west.yml # manifest file
│ └── [... other files ...]
│
│ # Projects managed by west:
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project
├── net-tools/ # .git/ project
└── [ ... other projects ...]
.. _west-workspace:
Workspace concepts
******************
Here are the basic concepts you should understand about this structure.
Additional details are in :ref:`west-workspaces`.
topdir
Above, :file:`zephyrproject` is the name of the workspace's top level
directory, or *topdir*. (The name :file:`zephyrproject` is just an example
-- it could be anything, like ``z``, ``my-zephyr-workspace``, etc.)
You'll typically create the topdir and a few other files and directories
using :ref:`west init <west-init-basics>`.
.west directory
The topdir contains the :file:`.west` directory. When west needs to find
the topdir, it searches for :file:`.west`, and uses its parent directory.
The search starts from the current working directory (and starts again from
the location in the :envvar:`ZEPHYR_BASE` environment variable as a
fallback if that fails).
configuration file
The file :file:`.west/config` is the workspace's :ref:`local configuration
file <west-config>`.
manifest repository
Every west workspace contains exactly one *manifest repository*, which is a
Git repository containing a *manifest file*. The location of the manifest
repository is given by the :ref:`manifest.path configuration option
<west-config-index>` in the local configuration file.
For upstream Zephyr, :file:`zephyr` is the manifest repository, but you can
configure west to use any Git repository in the workspace as the manifest
repository. The only requirement is that it contains a valid manifest file.
See :ref:`west-topologies` for information on other options, and
:ref:`west-manifests` for details on the manifest file format.
manifest file
The manifest file is a YAML file that defines *projects*, which are the
additional Git repositories in the workspace managed by west. The manifest
file is named :file:`west.yml` by default; this can be overridden using the
``manifest.file`` local configuration option.
You use the :ref:`west update <west-update-basics>` command to update the
workspace's projects based on the contents of the manifest file.
projects
Projects are Git repositories managed by west. Projects are defined in the
manifest file and can be located anywhere inside the workspace. In the above
example workspace, ``zcbor`` and ``net-tools`` are projects.
By default, the Zephyr :ref:`build system <build_overview>` uses west to get
the locations of all the projects in the workspace, so any code they contain
can be used as :ref:`modules`. Note however that modules and projects
:ref:`are conceptually different <modules-vs-projects>`.
extensions
Any repository known to west (either the manifest repository or any project
repository) can define :ref:`west-extensions`. Extensions are extra west
commands you can run when using that workspace.
The zephyr repository uses this feature to provide Zephyr-specific commands
like :ref:`west build <west-building>`. Defining these as extensions keeps
west's core agnostic to the specifics of any workspace's Zephyr version,
etc.
ignored files
A workspace can contain additional Git repositories or other files and
directories not managed by west. West basically ignores anything in the
workspace except :file:`.west`, the manifest repository, and the projects
specified in the manifest file.
west init and west update
*************************
The two most important workspace-related commands are ``west init`` and ``west
update``.
.. _west-init-basics:
``west init`` basics
--------------------
This command creates a west workspace.
.. important::
West doesn't change your manifest repository contents after ``west init`` is
run. Use ordinary Git commands to pull new versions, etc.
You will typically run it once, like this:
.. code-block:: shell
west init -m https://github.com/zephyrproject-rtos/zephyr --mr v2.5.0 zephyrproject
This will:
#. Create the topdir, :file:`zephyrproject`, along with
:file:`.west` and :file:`.west/config` inside it
#. Clone the manifest repository from
https://github.com/zephyrproject-rtos/zephyr, placing it into
:file:`zephyrproject/zephyr`
#. Check out the ``v2.5.0`` git tag in your local zephyr clone
#. Set ``manifest.path`` to ``zephyr`` in :file:`.west/config`
#. Set ``manifest.file`` to ``west.yml``
Your workspace is now almost ready to use; you just need to run ``west update``
to clone the rest of the projects into the workspace to finish.
For more details, see :ref:`west-init`.
.. _west-update-basics:
``west update`` basics
----------------------
This command makes sure your workspace contains Git repositories matching the
projects in the manifest file.
.. important::
Whenever you check out a different revision in your manifest repository, you
should run ``west update`` to make sure your workspace contains the
project repositories the new revision expects.
The ``west update`` command reads the manifest file's contents by:
#. Finding the topdir. In the ``west init`` example above, that
means finding :file:`zephyrproject`.
#. Loading :file:`.west/config` in the topdir to read the ``manifest.path``
(e.g. ``zephyr``) and ``manifest.file`` (e.g. ``west.yml``) options.
#. Loading the manifest file given by these options (e.g.
:file:`zephyrproject/zephyr/west.yml`).
It then uses the manifest file to decide where missing projects should be
placed within the workspace, what URLs to clone them from, and what Git
revisions should be checked out locally. Project repositories which already
exist are updated in place by fetching and checking out their respective Git
revisions in the manifest file.
For more details, see :ref:`west-update`.
Other built-in commands
***********************
See :ref:`west-built-in-cmds`.
.. _west-zephyr-extensions:
Zephyr Extensions
*****************
See the following pages for information on Zephyr's extension commands:
- :ref:`west-build-flash-debug`
- :ref:`west-sign`
- :ref:`west-zephyr-ext-cmds`
- :ref:`west-shell-completion`
Troubleshooting
***************
See :ref:`west-troubleshooting`.
Part 3
한국어 전문 번역
기본 개념
이 페이지는 west의 기본 개념을 소개하고 더 자세한 내용을 읽을 수 있는 문서를 안내합니다.
West의 내장 명령은 공통 workspace 디렉터리 아래에 있는 여러 project, 즉 Git 저장소를 함께 관리하게 해 줍니다.
west init은 west workspace를 만들고 manifest repository를 복제합니다. west update는 manifest에 나열된 project를 처음에는 복제하고, 이후에는 지정된 revision으로 갱신합니다.
작업공간 예
시작 안내를 따라 설치했다면 로컬 west workspace는 zephyrproject 디렉터리와 그 아래의 모든 디렉터리로 구성되며 다음과 같은 모양입니다.
workspace 최상위 디렉터리(topdir)
topdir 표시와 workspace 로컬 설정
manifest repository · west.yml 포함
modules/lib/zcbor · net-tools · 그 밖의 Git 저장소
zephyrproject/ # west topdir
├── .west/ # marks the location of the topdir
│ └── config # per-workspace local configuration file
│
│ # The manifest repository, never modified by west after creation:
├── zephyr/ # .git/ repo
│ ├── west.yml # manifest file
│ └── [... other files ...]
│
│ # Projects managed by west:
├── modules/
│ └── lib/
│ └── zcbor/ # .git/ project
├── net-tools/ # .git/ project
└── [ ... other projects ...]Workspace 구성 요소
이 구조를 이해하려면 다음 개념을 구분해야 합니다. 더 자세한 내용은 West workspaces에서 설명합니다.
topdir
위 예에서 zephyrproject는 workspace의 최상위 디렉터리, 즉 topdir입니다. 이 이름은 예일 뿐이며 z나 my-zephyr-workspace처럼 원하는 이름을 쓸 수 있습니다.
일반적으로 west init으로 topdir과 필요한 몇 가지 파일·디렉터리를 만듭니다.
.west 디렉터리
topdir에는 .west 디렉터리가 있습니다. West는 topdir을 찾아야 할 때 현재 작업 디렉터리에서 시작해 .west를 검색하고 그 부모 디렉터리를 topdir로 사용합니다. 이 검색이 실패하면 ZEPHYR_BASE 환경 변수의 위치에서 다시 검색합니다.
설정 파일
.west/config는 이 workspace의 로컬 설정 파일입니다.
Manifest repository
모든 west workspace에는 manifest file을 담은 Git 저장소인 manifest repository가 정확히 하나 있습니다. 로컬 설정 파일의 manifest.path option이 이 저장소의 위치를 지정합니다.
Upstream Zephyr workspace에서는 zephyr가 manifest repository입니다. 하지만 유효한 manifest file을 포함한다면 workspace 안의 어느 Git 저장소든 manifest repository로 지정할 수 있습니다. 다른 배치 방식은 West topologies를, manifest 형식은 West manifests를 참고합니다.
Manifest file
Manifest file은 west가 관리할 추가 Git 저장소인 project를 정의하는 YAML 파일입니다. 기본 이름은 west.yml이며 로컬 manifest.file 설정 option으로 바꿀 수 있습니다.
west update는 manifest file의 내용을 기준으로 workspace project를 갱신합니다.
Projects
Project는 west가 관리하는 Git 저장소입니다. Manifest file에서 정의하며 workspace 내부의 어느 위치에나 둘 수 있습니다. 위 예에서는 zcbor와 net-tools가 project입니다.
기본적으로 Zephyr build system은 west에서 workspace의 모든 project 위치를 얻고, 그 안의 code를 module로 사용할 수 있게 합니다. 다만 module과 project는 서로 관련되어 있어도 개념상 같은 것은 아닙니다.
Extensions
Manifest repository와 각 project repository를 포함해 west가 아는 모든 저장소는 추가 west 명령인 extension을 정의할 수 있습니다.
Zephyr repository는 이 기능으로 west build 같은 Zephyr 전용 명령을 제공합니다. Extension으로 분리하면 west core는 특정 workspace의 Zephyr version이나 세부 구현을 몰라도 됩니다.
무시되는 파일
Workspace에는 west가 관리하지 않는 추가 Git 저장소나 일반 파일·디렉터리도 둘 수 있습니다. West는 기본적으로 .west, manifest repository, manifest에 지정된 project를 제외한 나머지를 무시합니다.
west init과 west update
Workspace와 관련해 가장 중요한 두 명령은 west init과 west update입니다.
west init 기본
west init은 west workspace를 만듭니다.
일반적으로 다음 명령을 한 번 실행합니다.
west init -m https://github.com/zephyrproject-rtos/zephyr --mr v2.5.0 zephyrproject이 명령은 다음 작업을 수행합니다.
zephyrprojecttopdir을 만들고 그 안에.west와.west/config를 만듭니다.https://github.com/zephyrproject-rtos/zephyr에서 manifest repository를 복제해zephyrproject/zephyr에 둡니다.- 로컬 Zephyr clone에서
v2.5.0Git tag를 checkout합니다. .west/config의manifest.path를zephyr로 설정합니다.manifest.file을west.yml로 설정합니다.
이제 workspace는 거의 준비됐습니다. west update를 실행해 나머지 project를 복제하면 작업공간 구성이 끝납니다. 자세한 option은 west init 문서를 참고합니다.
west update 기본
west update는 workspace가 manifest file에 적힌 project와 일치하는 Git 저장소를 갖도록 맞춥니다.
west update는 다음 순서로 manifest file을 읽습니다.
- topdir을 찾습니다. 앞의
west init예에서는zephyrproject입니다. - topdir의
.west/config를 읽어manifest.path와manifest.fileoption을 얻습니다. 예제 값은 각각zephyr와west.yml입니다. - 두 option이 가리키는 manifest file, 예를 들면
zephyrproject/zephyr/west.yml을 불러옵니다.
그런 다음 manifest file을 사용해 빠진 project를 workspace 어디에 둘지, 어느 URL에서 복제할지, 어떤 Git revision을 checkout할지 결정합니다. 이미 존재하는 project 저장소는 각각 fetch한 뒤 manifest가 지정한 revision을 checkout하여 제자리에서 갱신합니다. 자세한 내용은 west update 문서를 참고합니다.
그 밖의 내장 명령
West 내장 명령 문서에서 전체 목록을 확인할 수 있습니다.
Zephyr extension
Zephyr가 제공하는 extension 명령은 다음 문서에서 설명합니다.
문제 해결
West troubleshooting 문서를 참고합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.