.. _wrynose-vscode: VS Code + DevContainer ====================== Here's a guide for using Visual Studio Code (VS Code) to develop with Yocto in a containerized environment. If your host is already a Yocto-supported Linux distribution, you can also build natively — see :doc:`Native Build Environment <../native/index>`. .. admonition:: Linux distribution :class: tip When using a containerized environment for building yocto, the host does not have to be a Yocto-supported distro. Requirements ------------ - Linux system (**Ubuntu-based** distribution recommended) - Docker Engine installed and running (see `Docker Engine Installation Guide`_) - VS Code installed (see `VS Code Setup Guide`_) - VS Code **Dev Containers** extension Setup ----- **1**. Check out the BSP as described in the :doc:`BSP Setup <../../bsp-setup/index>` page. **2**. Open the cloned BSP repository with VS Code. The Wrynose BSP ships its own ``.devcontainer`` configuration (``Dockerfile`` and ``devcontainer.json``), so VS Code should directly prompt you to reopen the current directory in a Container. **3**. In VS Code reopen the folder in a Container. If not prompted, search for ``Dev Container: Reopen in Container`` command using ``strg + shift + P``. .. admonition:: Shared Yocto files :class: tip The dev container uses a shared docker volume (``yocto-shared-wrynose``) for Yocto downloads (``DL_DIR``) and the sstate-cache, so they are reused across builds and containers. | The container is set up automatically to be able to build Yocto. Key aspects include: - Supported Linux distribution for building with Yocto (Ubuntu 24.04) - ``bitbake-setup`` preinstalled - ``uuu`` (NXP's USB flashing tool) preinstalled - Shared Yocto downloads and sstate-cache in a docker volume **4**. Open a terminal in the container and run the interactive setup as described on the :doc:`Building Images <../../build/index>` page: .. prompt:: :prompts: $ bitbake-setup init **5**. (Optional) Install the recommended `Yocto Project BitBake`_ extension and open the ``bitbake.code-workspace`` file generated in your setup directory under ``bitbake-builds``. The extension provides a GUI to manage, build and develop recipes. A devtool workspace can be created to directly edit a recipe's source and also create patches automatically. For more information on how to use the Yocto Project Extension see `Yocto Project BitBake`_. .. _`Docker Engine Installation Guide`: https://docs.docker.com/engine/install/ .. _`VS Code Setup Guide`: https://code.visualstudio.com/docs/setup/setup-overview .. _`Yocto Project BitBake`: https://marketplace.visualstudio.com/items?itemName=yocto-project.yocto-bitbake