-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: Add sdk nrf toolchain docker image
Added nRF connect SDK docker image. Signed-off-by: divya pillai <[email protected]>
- Loading branch information
1 parent
2e06803
commit 6f0a7a2
Showing
6 changed files
with
107 additions
and
104 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
.. _nrf_toolchain_docker_image: | ||
|
||
|NCS| toolchain Docker image | ||
############################ | ||
|
||
.. contents:: | ||
:local: | ||
:depth: 2 | ||
|
||
The image is based on Linux - Ubuntu 22.04 Docker image with the following additional tools: | ||
|
||
* Git | ||
* `nRF Util`_ with following commands: | ||
|
||
* ``toolchain-manager`` | ||
* ``device`` | ||
|
||
* |NCS| toolchain bundle | ||
* JLink |jlink_ver| (installation requires accepting SEGGER License) | ||
|
||
Building image | ||
************** | ||
|
||
To build a Docker image, you have to provide a ``VERSION`` argument containing the ID of the Linux toolchain bundle you want to install. | ||
You can use `print_toolchain_checksum.sh`_ to get ID proper for your |NCS| revision. | ||
|
||
.. code-block:: shell | ||
TOOLCHAIN_ID=$(../print_toolchain_checksum.sh) | ||
docker build --build-arg VERSION=$TOOLCHAIN_ID | ||
Accepting JLink license | ||
*********************** | ||
|
||
To install and use JLink software you have to accept `JLink License Agreement`_. | ||
|
||
If the container is run in an interactive mode, you will be asked to accept the license at the start of the container. | ||
|
||
You can also start the container with the ``ACCEPT_JLINK_LICENSE=1`` environment variable, and JLink will be installed without prompting. | ||
|
||
During post installation steps, JLink configures ``udev`` roles. | ||
This operation requires running a container with the ``--privileged`` flag to grant permissions needed for the container. | ||
|
||
Running container | ||
***************** | ||
|
||
Toolchain environment variables are set only in Bash sessions. | ||
Outside the Bash session, these variables are not set, and tools delivered in the toolchain bundle cannot be found on the path. | ||
|NCS| toolchain image uses ``bash`` command as entry point. | ||
If the entry point is not overwritten, you can start your Docker container in both interactive and non-interactive mode. | ||
|
||
Locally | ||
======= | ||
|
||
To run the |NCS| toolchain container to build and flash HEX files, run the following command. | ||
|
||
.. code-block:: none | ||
docker run -ti ghcr.io/nrfconnect/sdk-nrf-toolchain:<TAG> -v /dev:/dev --privileged -e ACCEPT_JLINK_LICENSE=1 bash | ||
.. tip:: | ||
|
||
You can also add the ``-v <PATH-TO-NCS-PROJECT-ON-DOCKER-HOST>:/ncs`` argument to the ``docker run`` command to mount the |NCS| project to the container. | ||
In such cases, you might encounter issues with repositories, ownership, and west project configuration. | ||
To resolve them, perform the following: | ||
|
||
* Run the ``git config --global --add safe.directory '*'`` command to mark mounted git repositories as trusted. | ||
* Run the ``west update`` command to import west commands delivered in the |NCS| project (for example, ``west build``) | ||
* Add ``--pristine`` argument to ``west build`` command to avoid path mismatch issues. | ||
|
||
In CI | ||
===== | ||
|
||
CI systems usually run the Docker container in detached mode and can override the default entry point and command. | ||
However, it is still possible to use the |NCS| toolchain images in pipelines. | ||
|
||
GitHub Actions | ||
-------------- | ||
|
||
GitHub action starts container with overwritten default entry point. That means you have to set ``bash`` as a default shell to load all required environment variables. | ||
|
||
If the container is started with the ``ACCEPT_JLINK_LICENSE`` env variable set to ``1``, JLink will be installed just before the first bash command is executed. | ||
|
||
Example job configuration: | ||
|
||
.. code-block:: yaml | ||
jobs: | ||
build-in-docker: | ||
runs-on: ubuntu-22.04 | ||
container: | ||
image: ghcr.io/nrfconnect/sdk-nrf-toolchain:<TAG> # steps in this job are executed inside sdk-nrf-toolchain container | ||
env: | ||
ACCEPT_JLINK_LICENSE: 1 # set if you want to install JLink | ||
defaults: | ||
run: | ||
shell: bash # It is required to set `bash` as default shell | ||
steps: | ||
- name: Run command in NCS toolchain environment | ||
run: "west --version" # This command is executed in bash shell `docker exec <container> bash -c west --version` | ||
# It will also install JLink if ACCEPT_JLINK_LICENSE is set to 1 |