TorizonCore Builder VS Code Integration
Introduction
Toradex offers integration between the VS Code Extension for Torizon and TorizonCore Builder, allowing the user to create Torizon/TorizonCore Builder Image Customization projects that handle the tcbuild.yaml
configuration file and provide IntelliSense, validation between other customization files and integration with the TorizonCore Builder commands.
Prerequisites
Read the article Visual Studio Code Extension for Torizon
Have one of the OS below:
Windows 10 Pro / Enterprise / Education or more recent
Linux (it was validated using Debian based distros)
Toradex Hardware with TorizonCore installed.
YAML Language Support by Red Hat extension installed.
Create a New Torizon/TorizonCore Builder Image Customization Project
Press F1
or CTRL+SHIFT+P
to access the command pallet and then type TorizonCore Builder
:
Select the command Torizon/TorizonCore Builder: Create Torizon Image customization project
. After the selection a new input will be shown to type a name for the project:
This name will be used to create a folder, so it must be a valid folder name.
After the input of the project name, select a folder on the system to store the project files:
This will be the path where the extension will create the folder with the project name.
After the folder selection, select the Toradex hardware platform that will be the base for the customization image:
All Toradex platforms that support Torizon will be listed and can be selected. The platforms listed with a plug icon are the platforms from devices connected to the extension, facilitating for the user to choose a device under test.
After the platform selection, select the TorizonCore base image for the customization project:
All base images that support the previously selected platform will be listed and can be selected. The base images listed from a device connected to the extension are marked with a plug icon, facilitating for the user to choose the same TorizonCore version from a device under test and use it as a base image.
After this setup the project will be created and opened, with the following folder organization:
.vscode
: folder with the VS Code configurations for Torizon/TorizonCore Builder Image Customization projects;appconfig_0
: folder with the configuration for themoses
backend;customLogo.png
: the project template comes with this custom logo image that is linked on the TorizonCore Builder configuration file, so the user can perform a quick "hello world" customization to check the sanity of the environment.tcbuild.yaml
: "hello world" TorizonCore Builder configuration file, filled with the data from the base image in theinput
section, the custom logo in thecustomization
section, and the output directory in theoutput
section;
TorizonCore Builder Configuration File IntelliSense
The TorizonCore Builder Configuration ile is a file in YAML format that follows an expected schema. To make editing the TorizonCore Builder configuration file easier, the VS Code integration offers autocompletion hints for it:
In addition to autocompletion with the expected values and properties in the schema, the integration offers extra autocompletion and validation in the context of the project workspace directory for the following properties:
input
:easy-installer
:toradex-feed
:version
: autocomplete with the possible TorizonCore versions depending on themachine
,distro
,variant
andrelease
selected;release
: autocomplete withnightly
,monthly
orquarterly
;machine
: autocomplete with the supported Toradex hardware platforms;distro
: autocomplete withtorizon
,torizon-rt
,torizon-upstream
ortorizon-upstream-rt
;variant
: autocomplete withtorizon-core-docker
ortorizon-core-podman
;build-number
: autocomplete with the possible TorizonCore build numbers depending on themachine
,release
,version
,build-date
selected;build-date
: autocomplete with the possible TorizonCore build dates depending on themachine
,release
,version
selected;
customization
:splash-screen
: autocomplete with the.png
files from the workspace directory;device-tree
:overlays
:add
: autocomplete with thedevice-trees/overlays/**/*.dts
files from the workspace directory;
custom
: autocomplete with the*.dts
or*.dtsi
files from the workspace directory;include-dirs
: autocomplete with all the valid folders from the workspace directory;
filesystem
: autocomplete with all the valid folders from the workspace directory;kernel
:modules
:source-dir
: autocomplete with all valid folders from the workspace directory;
Quick Build/Deploy To The Target Pressing F5
To quickly generate a customized image based on the TorizonCore Builder configuration file and deploy it to a device under test, press F5
and select the target device:
After the target device selection, input the target device login password:
TorizonCore Builder uses the ssh
protocol to deploy an image to the target device. The username is the same as the one used from the connection on the VS Code Add Device
This will run the following TorizonCore Builder commands in sequence Build -> Unpack -> Deploy
. A progress notification will be presented:
Wait until the tasks finish executing. After they finish the progress notification will be automatically closed and the output panel will have the following success messages:
Build/Unpack/Deploy Command
In addition to pressing F5
in a Torizon/TorizonCore Builder Image Customization project, the user can also run the automated sequence Build -> Unpack -> Deploy
through the command palette (pressing F1
or CTRL+SHIFT+P
):
Or when the TorizonCore Builder configuration file is in focus on the editor, through the respective context button:
Build Command
The user can also run commands individually. The Build command can be executed through the command palette:
Or through the respective context button, when the TorizonCore Builder configuration file is in focus on the editor:
After selecting or clicking on the button to execute the command, wait for the end of execution (a progress notification will be present):
Upon successful completion of the execution, the progress notification will be closed automatically and something like the following messages will be displayed in the output panel:
Images Unpack Command
The Images Unpack command can be executed through the command palette:
Or through the respective context button, when the TorizonCore Builder configuration file is in focus on the editor:
After selecting or clicking the button to execute the command, wait for the end of execution (a progress notification will be present):
Upon successful completion of the execution, the progress notification will be closed automatically and something like the following messages will be displayed in the output panel:
Deploy Command
The Deploy command can be executed through the command palette:
Or through the respective context button, when the TorizonCore Builder configuration file is in focus on the editor:
After selecting or clicking on the button to execute the command, select the target device to deploy the image:
After the target device selection, input the target device login password:
TorizonCore Builder uses ssh
connection to deploy an image to the target device. The username is the same used from the connection on the VS Code Add Device
After selecting, or clicking on the button, to execute the command, wait for the end of execution (a progress notification will be present). Upon successful completion of the execution, the progress notification will be closed automatically and something like the following messages will be displayed in the output panel:
Push Command
The Push command can be executed through the command palette:
Or through the respective context button, when the TorizonCore Builder configuration file is in focus on the editor:
This command uses the credentials.zip
file to perform a secure upload for the user account. The user must download the file from their Torizon Platform account section and copy it to the Torizon/TorizonCore Builder Image Customization project workspace.
After selecting or clicking on the button to execute the command, wait for the end of execution (a progress notification will be present). Upon successful completion of the execution, the progress notification will be closed automatically and something like the following messages will be displayed in the output panel:
dt checkout Command
The dt checkout command can be executed through the command palette:
Wait for the end of the command execution (a progress notification will be present). Upon successful completion of the execution, the progress notification will be closed automatically and there will be a new folder called device-trees
in the project workspace:
Troubleshooting
HTTP request failed
When an exception occurs during a TorizonCore Builder command execution, a generic error HTTP request failed
is presented:
To verify the root cause of the problem, open the Output
panel and select the Torizon
channel to check the logs:
Impossible to build
The following error message is displayed when the user tries to execute the Build
command and there are validation errors in the TorizonCore Builder configuration file:
TorizonCore Builder configuration file has errors, impossible to build. Solve the problems and try again.
Check the problems listed and the tips to solve them in the Problems
panel.
TorizonCore Configuration File IntelliSense/validation not working
First of all, make sure to have the YAML Language Support by Red Hat extension installed:
Open the Output
panel and select the Torizon
channel to check the logs. There should be the following messages:
if you don't have these messages in the output some issue has occurred and it could be a bug. Please report the logs in the Toradex Developer Community.
There is no "credentials.zip"
The following error message is displayed when the user tries to execute the Push to OTA
command and there is no credentials.zip
file in the workspace:
There is no "credentials.zip" in your workspace. Please download the "credentials.zip" from https://app.torizon.io/#/account in your workspace.
The Push to OTA
command uses the credentials.zip
file to perform a secure upload for the user account. The user must download the file from their Torizon Platform account section and copy it to the Torizon/TorizonCore Builder Image Customization project workspace.