Build ROS2 Foxy with Yocto kirkstone on RSB3720

Hello.
I’ve been trying to find information on how to build ROS2 Foxy with Yocto kirkstone on RSB3720 for a project I’m working on.

I came across the repository at dev.azure.com/advcharles/IMX-Robot/_git/adv-arm-yocto-bsp, but it seems like the commits only go up to hardknott.

Could you please provide guidance or point me to documentation on how to proceed with building for kirkstone from this repository?

Thanks.

@Tetsuya_Kawahara
It was a POC on Yocto Zeus BSP and has no plan on kirkstone BSP.
But you can try to copy the “meta-robot-platform” folder from Zeus BSP and modify “imx/meta-robot/conf/distro/layer.conf” for LAYERSERIES_COMPAT_imx-robot with kirkstone support.

I’ve resolved the issue on my own.
I successfully built an image where ROS2 operates and set up the cross-compilation environment.
I’m closing this topic. No reply necessary.

Hi @Tetsuya_Kawahara
Could you please tell me how you solved this issue?

  • How to build ROS2 Foxy with Yocto kirkstone
  • How to make a cross-compilation environment

Thank you.

Hi @Hideo_Nakajima , sorry to late reply.
Since my memory is a bit unclear, please feel free to fix any mistakes.

I primarily built it based on the information from the following links:

In my environment, I added the following to local.conf and bblayers.conf. The working directory is set to /home/adv/adv-release-bsp/build_ros.
・local.conf

hostname:pn-base-files = “imx-robot-foxy”
IMAGE_INSTALL:append = " \
ros-core \
clblast \
libeigen \
spdlog \
demo-nodes-cpp \
demo-nodes-cpp-rosnative \
demo-nodes-py \
cyclonedds \
"

ROS_WORLD_SKIP_GROUPS = " opengl qt5 qt5-widgets pyqt5 qt6 qt6-widgets pyqt6 qt-gui-cpp x11 ffmpeg webots-python-modules java libomp connext gazebo \
coinor-libipopt gurumdds ignition doosan-robot2 clang launch pugixml lanelet2-traffic-rules mongodb kobuki-ftdi ros1 renderdoc rqt-runtime-monitor spacenav wiimote \
"

TOOLCHAIN_TARGET_TASK:append = " \
rclcpp \
std-msgs \
geometry-msgs \
tf2-geometry-msgs \
cv-bridge \
image-common \
image-transport \
tf2-ros \
sensor-msgs \
foonathan-memory-staticdev \
foonathan-memory-vendor \
libstdc++-staticdev \
libgcc-dev \
libyaml-vendor \
ament-cmake-auto \
ament-cmake-core \
ament-cmake-export-definitions \
ament-cmake-export-dependencies \
ament-cmake-export-include-directories \
ament-cmake-export-interfaces \
ament-cmake-export-libraries \
ament-cmake-export-link-flags \
ament-cmake-export-targets \
ament-cmake-gmock \
ament-cmake-gtest \
ament-cmake-include-directories \
ament-cmake-libraries \
ament-cmake \
ament-cmake-pytest \
ament-cmake-python \
ament-cmake-ros \
ament-cmake-target-dependencies \
ament-cmake-test \
ament-cmake-version \
ament-cmake-flake8 \
ament-cmake-pep257 \
ament-copyright \
ament-cpplint \
ament-flake8 \
ament-index-python \
ament-lint-cmake \
ament-lint-auto \
ament-package \
ament-pclint \
ament-pep257 \
ament-pycodestyle \
ament-pyflakes \
ament-xmllint \
cmake \
eigen3-cmake-module \
fastcdr \
fastrtps-cmake-module \
fastrtps \
python-cmake-module \
python3-numpy \
python3-catkin-pkg \
python3-empy \
python3 \
python3-pytest \
rcutils \
rmw \
rmw-cyclonedds-cpp \
rmw-dds-common \
rmw-fastrtps-cpp \
rmw-fastrtps-dynamic-cpp \
rmw-fastrtps-shared-cpp \
rmw-implementation \
rmw-implementation-cmake \
rosidl-cmake \
rosidl-default-generators \
rosidl-generator-c \
rosidl-generator-cpp \
rosidl-generator-dds-idl \
rosidl-generator-py \
rosidl-parser \
rosidl-runtime-c \
rosidl-runtime-cpp \
rosidl-typesupport-c \
rosidl-typesupport-cpp \
rosidl-typesupport-fastrtps-cpp \
rosidl-typesupport-interface \
rosidl-typesupport-introspection-c \
rosidl-typesupport-introspection-cpp \
"

TOOLCHAIN_HOST_TASK:append = " \
nativesdk-ament-cmake-auto \
nativesdk-ament-cmake-core \
nativesdk-ament-cmake-export-definitions \
nativesdk-ament-cmake-export-dependencies \
nativesdk-ament-cmake-export-include-directories \
nativesdk-ament-cmake-export-interfaces \
nativesdk-ament-cmake-export-libraries \
nativesdk-ament-cmake-export-link-flags \
nativesdk-ament-cmake-export-targets \
nativesdk-ament-cmake-gmock \
nativesdk-ament-cmake-gtest \
nativesdk-ament-cmake-include-directories \
nativesdk-ament-cmake-libraries \
nativesdk-ament-cmake \
nativesdk-ament-cmake-pytest \
nativesdk-ament-cmake-python \
nativesdk-ament-cmake-ros \
nativesdk-ament-cmake-target-dependencies \
nativesdk-ament-cmake-test \
nativesdk-ament-cmake-version \
nativesdk-ament-copyright \
nativesdk-ament-cpplint \
nativesdk-ament-index-python \
nativesdk-ament-lint-cmake \
nativesdk-ament-package \
nativesdk-ament-pclint \
nativesdk-ament-pycodestyle \
nativesdk-ament-pyflakes \
nativesdk-ament-xmllint \
nativesdk-rmw \
nativesdk-rosidl-cmake \
nativesdk-rosidl-default-generators \
nativesdk-rosidl-generator-c \
nativesdk-rosidl-generator-cpp \
nativesdk-rosidl-generator-dds-idl \
nativesdk-rosidl-generator-py \
nativesdk-rosidl-parser \
nativesdk-rosidl-runtime-c \
nativesdk-rosidl-runtime-cpp \
nativesdk-rosidl-typesupport-c \
nativesdk-rosidl-typesupport-cpp \
nativesdk-rosidl-typesupport-interface \
nativesdk-rosidl-typesupport-introspection-c \
nativesdk-rosidl-typesupport-introspection-cpp \
nativesdk-python3-numpy \
nativesdk-python3-catkin-pkg \
nativesdk-python3-empy \
nativesdk-python3 \
nativesdk-python3-pytest \
"

・bblayers.conf:I’m attaching meta-ros2-bbappend.

ROS_OE_RELEASE_SERIES = “kirkstone”
ROS_DISTRO = “foxy”
BBLAYERS += " ${BSPDIR}/sources/meta-ros-official/meta-ros2-foxy "
BBLAYERS += " ${BSPDIR}/sources/meta-ros-official/meta-ros2 "
BBLAYERS += " ${BSPDIR}/sources/meta-ros-official/meta-ros-common "
BBLAYERS += " ${BSPDIR}/sources/meta-ros-official/meta-python2 "
BBLAYERS += " ${BSPDIR}/build_ros/meta-ros2-bbappend "

Build the image and SDK with the above settings

========================================

For the steps following a successful build, this explanation assumes that the SDK is installed in ‘/opt/env-rsb3720-ros2foxy’. If you installed it in a different path, please replace this part of the path accordingly and proceed with the subsequent steps.

1. Add the following to /opt/env-rsb3720-ros2foxy/environment-setup-armv8a-poky-linux.
export AMENT_PREFIX_PATH=$OECORE_NATIVE_SYSROOT/usr:$OECORE_TARGET_SYSROOT/usr

2. There are parts in the .cmake files within the SDK that contain the path for the Docker environment used for building the SDK (/home/adv/adv-release-bsp/build_ros). Replace all of these paths at once with the SDK installation path using the following command:

sudo find /opt/env-rsb3720-ros2foxy/sysroots/armv8a-poky-linux/ -type f -name "*.cmake" -exec sed -i 's|/home/adv/adv-release-bsp/build_ros/.*/usr/|/opt/env-rsb3720-ros2foxy/sysroots/armv8a-poky-linux/usr/|g' {} +

With these steps, the preparation for cross-compilation is complete. After that, simply use the source command as usual to set up environment-setup-armv8a-poky-linux.

3. When using ROS2 on rsb3720, the setup.bash file is likely located at the following path, so set the environment variables using the source command:
source /etc/profile.d/ros/setup.bash

I have confirmed that ROS 2 is working by creating a simple test publisher and subscriber. However, other features have not been tested.

> bblayers.conf:I’m attaching meta-ros2-bbappend.
Could not attach tar file.
The link expires at the end of November.
meta-ros2-bbappend.tar.gz

Hi, @Tetsuya_Kawahara
Thank you very much for the valuable information.
I’ll try this.