Adding GIT to Torizon Core image?

How would I go about installing another package in Torizon Core such as “git”. For my dev environment, I would like to have git in the main Torizon core so that I can easily clone projects with their docker files and use the cloned files as a bind mount. This seems simpler than having to manually copy/paste the docker file, start and enter the container and then checkout the project files.

I’ve read through and watched the video on using Torizon builder to modify the Torizon Core image, but it doesn’t seem that it can add another package? Is the path forward for this to rebuild the image from scratch with Yocto or can Torizon builder do this?

Hi @joejankowiak ,

Unfortunately it’s not possible to add packages in TorizonCore using TorizonCore Builder. To do that you have to rebuild it using Yocto.

If you intend to go this route you can take a look at this article: Build TorizonCore from Source With Yocto Project/OpenEmbedded | Toradex Developer Center.
To add git to your image: after setting everything up following the article above and before running bitbake torizon-core-docker append this line in conf/local.conf:

CORE_IMAGE_EXTRA_INSTALL += "git"

Let me know if this helps you.

Best regards,
Lucas Akira

Thanks for the quick response. I’m going through the build from source instructions and am trying to do it via Docker on Windows. I think there might be an issue with the guide though as binding the volume to my wsl$ directory as docker returns an error about special characters.

docker run --rm -it --name=crops -v \wsl$\Ubuntu\home\joe:/workdir --workdir=/workdir -e MACHINE=colibri-imx8x -e IMAGE=torizon-core-docker torizon/crops:dunfell-5.x.y startup-tdx.sh

docker: Error response from daemon: create \wsl$Ubuntuhomejoe: "\\wsl$Ubuntuhomejoe" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

If I change that to forward slashes it does accept it but I then run into another error about workdir having 0:0 for its uid:gid.

docker run --rm -it --name=crops -v //wsl$/Ubuntu/home/joe:/workdir --workdir=/workdir -e MACHINE=
colibri-imx8x -e IMAGE=torizon-core-docker torizon/crops:dunfell-5.x.y startup-tdx.sh

The uid:gid for "/workdir" is "0:0". The uid and gid must be non-zero. Please check to make sure the "volume" or "bind" specified using either "-v" or "--mount" to docker, exists and has a non-zero uid:gid.

@lucas_a.tx I’ve managed to get it working. While the /workdir folder existed, it was owned by root. Changing the owner and group of the folder is the missing step in the guide.

Heres my exact steps I did. Would be nice if the guide is updated to include the ownership step:

wsl
explorer.exe .

Copy path and change backslash to forward slash

\\wsl$\Ubuntu -> //wsl$/Ubuntu

Modify the owner/group:

chown -R 1000:1000 //wsl$/Ubuntu/workdir

Run it!

docker run --rm -it --name=crops -v //wsl$/Ubuntu/workdir:/workdir --workdir=/workdir -e MACHINE=colibri-imx8x -e IMAGE=torizon-core-docker torizon/crops:dunfell-5.x.y startup-tdx.sh

Glad you were able to run the Yocto container!

I have reproduced both your error messages from your previous reply on a Windows 10 machine.

While your solution works, I think an easier way (with no need to change folder ownership) would be to bind mount like this:

-v /home/<username>:/workdir

Rather than:

-v \wsl$\Ubuntu\home\<username>:/workdir

Because it isn’t necessary to use the wsl$ path inside WSL itself: \\wsl$\ is used to access Linux partitions (such as ext4) in Windows Explorer.

In fact, when you execute in WSL docker run with -v //wsl$/Ubuntu/workdir:/workdir Docker literally creates a directory called ‘wsl$’ (along with the other folders inside) in / inside your WSL partition. This newly created path is owned by root by default, that’s why you needed to change the ownership afterwards.

In any case, thanks for the feedback! I’ll contact the team to correct the Windows instructions in the article.

Let me know if you have other questions.

Best regards,
Lucas Akira