Part 1
요약·해설
Zephyr가 제공하는 7개 West extension command를 명령 예제와 함께 설명하며 SPDX 2.3 SBOM 생성 절차와 binary artifact 관리 범위를 구분합니다.
boards · completion · CMake export
SPDX 2.3 · hashes · licenses
blobs · Twister · bindesc
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
6FFCF4021BCF3373B2E7D935F7054CBE6EE90E98FBF9D91D5A892CC1C9D9ED89
.. _west-zephyr-ext-cmds:
Additional Zephyr extension commands
####################################
This page documents miscellaneous :ref:`west-zephyr-extensions`.
.. _west-boards:
Listing boards: ``west boards``
*******************************
The ``boards`` command can be used to list the boards that are supported by
Zephyr without having to resort to additional sources of information.
It can be run by typing::
west boards
This command lists all supported boards in a default format. If you prefer to
specify the display format yourself you can use the ``--format`` (or ``-f``)
flag::
west boards -f "{arch}:{name}"
Additional help about the formatting options can be found by running::
west boards -h
.. _west-completion:
Shell completion scripts: ``west completion``
*********************************************
The ``completion`` extension command outputs shell completion scripts that can
then be used directly to enable shell completion for the supported shells.
It currently supports the following shells:
- bash
- zsh
- fish
Additional instructions are available in the command's help::
west help completion
.. _west-zephyr-export:
Installing CMake packages: ``west zephyr-export``
*************************************************
This command registers the current Zephyr installation as a CMake
config package in the CMake user package registry.
In Windows, the CMake user package registry is found in
``HKEY_CURRENT_USER\Software\Kitware\CMake\Packages``.
In Linux and MacOS, the CMake user package registry is found in.
:file:`~/.cmake/packages`.
You may run this command when setting up a Zephyr workspace. If you do,
application CMakeLists.txt files that are outside of your workspace will be
able to find the Zephyr repository with the following:
.. code-block:: cmake
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
See :zephyr_file:`share/zephyr-package/cmake` for details.
.. _west-spdx:
Software bill of materials: ``west spdx``
*****************************************
This command generates SPDX 2.3 tag-value documents, creating relationships
from source files to the corresponding generated build files.
``SPDX-License-Identifier`` comments in source files are scanned and filled
into the SPDX documents.
To use this command:
#. Pre-populate a build directory :file:`BUILD_DIR` like this:
.. code-block:: bash
west spdx --init -d BUILD_DIR
This step ensures the build directory contains CMake metadata required for
SPDX document generation.
#. Enable :file:`CONFIG_BUILD_OUTPUT_META` in your project.
#. Build your application using this pre-created build directory, like so:
.. code-block:: bash
west build -d BUILD_DIR [...]
#. Generate SPDX documents using this build directory:
.. code-block:: bash
west spdx -d BUILD_DIR
This generates the following SPDX bill-of-materials (BOM) documents in
:file:`BUILD_DIR/spdx/`:
- :file:`app.spdx`: BOM for the application source files used for the build
- :file:`zephyr.spdx`: BOM for the specific Zephyr source code files used for the build
- :file:`build.spdx`: BOM for the built output files
- :file:`modules-deps.spdx`: BOM for modules dependencies. Check
:ref:`modules <modules-vulnerability-monitoring>` for more details.
Each file in the bill-of-materials is scanned, so that its hashes (SHA256 and
SHA1) can be recorded, along with any detected licenses if an
``SPDX-License-Identifier`` comment appears in the file.
SPDX Relationships are created to indicate dependencies between
CMake build targets, build targets that are linked together, and
source files that are compiled to generate the built library files.
``west spdx`` accepts these additional options:
- ``-n PREFIX``: a prefix for the Document Namespaces that will be included in
the generated SPDX documents. See `SPDX specification clause 6`_ for
details. If ``-n`` is omitted, a default namespace will be generated
according to the default format described in section 2.5 using a random UUID.
- ``-s SPDX_DIR``: specifies an alternate directory where the SPDX documents
should be written instead of :file:`BUILD_DIR/spdx/`.
- ``--analyze-includes``: in addition to recording the compiled source code
files (e.g. ``.c``, ``.S``) in the bills-of-materials, also attempt to
determine the specific header files that are included for each ``.c`` file.
This takes longer, as it performs a dry run using the C compiler for each
``.c`` file using the same arguments that were passed to it for the actual
build.
- ``--include-sdk``: with ``--analyze-includes``, also create a fourth SPDX
document, :file:`sdk.spdx`, which lists header files included from the SDK.
.. _SPDX specification clause 6:
https://spdx.github.io/spdx-spec/v2.2.2/document-creation-information/
.. _west-blobs:
Working with binary blobs: ``west blobs``
*****************************************
The ``blobs`` command allows users to interact with :ref:`binary blobs
<bin-blobs>` declared in one or more :ref:`modules <modules>` via their
:ref:`module.yml <module-yml>` file.
The ``blobs`` command has three sub-commands, used to list, fetch or clean (i.e.
delete) the binary blobs themselves.
You can list binary blobs while specifying the format of the output::
west blobs list -f '{module}: {type} {path}'
For the full set of variables available in ``-f/--format`` run
``west blobs -h``.
Fetching blobs works in a similar manner::
west blobs fetch
Note that, as described in :ref:`the modules section <modules-bin-blobs>`,
fetched blobs are stored in a :file:`zephyr/blobs/` folder relative to the root
of the corresponding module repository.
As does deleting them::
west blobs clean
Additionally the tool allows you to specify the modules you want to list,
fetch or clean blobs for by typing the module names as a command-line
parameter.
.. _west-twister:
Twister wrapper: ``west twister``
*********************************
This command is a wrapper for :ref:`twister <twister_script>`.
Twister can then be invoked via west as follows::
west twister -help
west twister -T tests/ztest/base
.. _west-bindesc:
Working with binary descriptors: ``west bindesc``
*************************************************
The ``bindesc`` command allows users to read :ref:`binary descriptors<binary_descriptors>`
of executable files. It currently supports ``.bin``, ``.hex``, ``.elf`` and ``.uf2`` files
as input.
You can search for a specific descriptor in an image, for example::
west bindesc search KERNEL_VERSION_STRING build/zephyr/zephyr.bin
You can search for a custom descriptor by type and ID, for example::
west bindesc custom_search STR 0x200 build/zephyr/zephyr.bin
You can dump all of the descriptors in an image using::
west bindesc dump build/zephyr/zephyr.bin
You can list all known standard descriptor names using::
west bindesc list
Part 3
한국어 전문 번역
이 페이지는 여러 Zephyr West extension command를 설명합니다.
Board 목록: west boards
boards command는 별도의 정보원을 찾지 않고도 Zephyr가 지원하는 board를 나열합니다.
기본 형식으로 모든 지원 board를 표시하려면 다음을 실행합니다.
west boards--format 또는 -f flag로 표시 형식을 직접 지정할 수 있습니다.
west boards -f "{arch}:{name}"Format option의 자세한 도움말은 다음 command로 확인합니다.
west boards -hShell completion script: west completion
completion extension command는 지원 shell에서 자동완성을 활성화할 때 바로 사용할 수 있는 completion script를 출력합니다.
현재 지원하는 shell은 다음과 같습니다.
bashzshfish
추가 사용법은 command help에서 확인합니다.
west help completionCMake package 설치: west zephyr-export
이 command는 현재 Zephyr installation을 CMake user package registry에 CMake config package로 등록합니다.
- Windows registry 위치:
HKEY_CURRENT_USER\Software\Kitware\CMake\Packages. - Linux와 macOS file 위치:
~/.cmake/packages.
Zephyr workspace를 설정할 때 이 command를 실행하면 workspace 밖의 application CMakeLists.txt도 다음 구문으로 Zephyr repository를 찾을 수 있습니다.
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})share/zephyr-package/cmake source directory에서 구현 세부 사항을 확인할 수 있습니다.
Software bill of materials: west spdx
west spdx는 SPDX 2.3 tag-value document를 만들고 source file과 그에 대응하는 build output 사이의 관계를 기록합니다. Source의 SPDX-License-Identifier comment를 scan해 SPDX document의 license 정보에 채웁니다.
사용 순서는 다음과 같습니다.
- Build directory
BUILD_DIR를 미리 초기화합니다.
이 단계는 SPDX 생성에 필요한 CMake metadata를 build directory에 넣습니다.west spdx --init -d BUILD_DIR - Project에서
CONFIG_BUILD_OUTPUT_META를 활성화합니다. - 미리 만든 build directory를 사용해 application을 build합니다.
west build -d BUILD_DIR [...] - 같은 build directory에서 SPDX document를 생성합니다.
west spdx -d BUILD_DIR
BUILD_DIR/spdx/에는 다음 bill-of-materials document가 생성됩니다.
app.spdx: build에 사용한 application source file의 BOM.zephyr.spdx: build에 실제 사용한 특정 Zephyr source file의 BOM.build.spdx: 생성된 build output file의 BOM.modules-deps.spdx: module dependency BOM. 자세한 내용은 module vulnerability monitoring을 참고합니다.
BOM의 모든 file을 scan해 SHA256과 SHA1 hash를 기록하고 SPDX-License-Identifier가 있으면 발견한 license도 기록합니다.
CMake build target 사이의 dependency, 서로 link된 target, compiled source file과 생성된 library file 사이에는 SPDX Relationship을 만듭니다.
west spdx가 받는 추가 option은 다음과 같습니다.
-n PREFIX: 생성할 SPDX document의 Document Namespace prefix입니다. SPDX specification clause 6을 참고합니다. 생략하면 section 2.5 기본 형식과 random UUID로 namespace를 만듭니다.-s SPDX_DIR: 기본BUILD_DIR/spdx/대신 SPDX document를 쓸 directory를 지정합니다.--analyze-includes: compiled source file인.c,.S뿐 아니라 각 C file이 include한 특정 header도 찾습니다. 실제 build와 같은 compiler argument로 C compiler dry run을 수행하므로 시간이 더 걸립니다.--include-sdk:--analyze-includes와 함께 사용해 SDK에서 include한 header를 나열하는sdk.spdx도 만듭니다.
Binary blob 작업: west blobs
blobs command는 하나 이상의 module이 module.yml에 선언한 binary blob을 다룹니다. List, fetch, clean 세 subcommand가 각각 blob 조회, 다운로드, 삭제를 수행합니다.
출력 형식을 지정해 binary blob을 나열할 수 있습니다.
west blobs list -f '{module}: {type} {path}'-f/--format에서 사용할 수 있는 모든 variable은 west blobs -h로 확인합니다.
Blob을 가져오려면:
west blobs fetch가져온 blob은 각 module repository root를 기준으로 zephyr/blobs/ directory에 저장됩니다.
Blob을 삭제하려면:
west blobs cleanList, fetch, clean 뒤에 module 이름을 command-line parameter로 적으면 처리할 module을 제한할 수 있습니다.
Twister wrapper: west twister
west twister는 Twister를 West extension 형태로 호출하는 wrapper입니다. 다음처럼 help를 보거나 특정 test root를 지정할 수 있습니다.
west twister -help
west twister -T tests/ztest/baseBinary descriptor 작업: west bindesc
bindesc command는 executable file의 binary descriptor를 읽습니다. 입력 형식으로 .bin, .hex, .elf, .uf2를 지원합니다.
Image에서 특정 standard descriptor를 검색하는 예입니다.
west bindesc search KERNEL_VERSION_STRING build/zephyr/zephyr.binType과 ID로 custom descriptor를 검색하는 예입니다.
west bindesc custom_search STR 0x200 build/zephyr/zephyr.binImage의 모든 descriptor를 출력하려면:
west bindesc dump build/zephyr/zephyr.bin알려진 standard descriptor 이름을 모두 나열하려면:
west bindesc list
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.