# Build ROS2 Foxy with Yocto kirkstone on RSB3720

**URL:** <https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732>\
**Category:** Technical Supports\
**Tags:** imx8mplus\
**Created:** [March 18, 2024, 2:52am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732 "2024-03-18T02:52:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tetsuya\_Kawahara](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aim-linux.advantech.com/tetsuya_kawahara/32/476_2.png) [@Tetsuya\_Kawahara](https://forum.aim-linux.advantech.com/u/Tetsuya_Kawahara)\
**Post date:** [March 18, 2024, 2:52am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/1 "2024-03-18T02:52:33Z")

</div>

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.

> [@\[How-to Article\] Get started with ROS on Yocto](https://forum.aim-linux.advantech.com/t/how-to-article-get-started-with-ros-on-yocto/129):
>
> 1 Introduction ROS is a set of software libraries and utilities that help users build robotic applications. A ROS distribution is a versioned set of ROS packages. These are akin to Linux distributions (e.g. Ubuntu) and is primarily tested on Ubuntu. Consequently, it is fully tested with the specific Ubuntu versions. Users can install and run ROS on any Unix-based platform. Questions or problems may arise when integrating certain solutions. These issues are usually related to compatibility or t…

I came across the repository at [dev.azure.com/advcharles/IMX-Robot/\_git/adv-arm-yocto-bsp](http://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.

---

<div class="post-metadata">

**Author:** ![charles.huang](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@charles.huang](https://forum.aim-linux.advantech.com/u/charles.huang)\
**Post date:** [March 18, 2024, 9:03am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/2 "2024-03-18T09:03:13Z")

</div>

> [@Tetsuya\_Kawahara](#):
>
> ou please provide guidance or point me to documentation on how to proceed with buildi

@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.

---

<div class="post-metadata">

**Author:** ![Tetsuya\_Kawahara](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aim-linux.advantech.com/tetsuya_kawahara/32/476_2.png) [@Tetsuya\_Kawahara](https://forum.aim-linux.advantech.com/u/Tetsuya_Kawahara)\
**Post date:** [April 3, 2024, 11:02am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/3 "2024-04-03T11:02:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hideo\_Nakajima](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Hideo\_Nakajima](https://forum.aim-linux.advantech.com/u/Hideo_Nakajima)\
**Post date:** [October 5, 2024, 11:49pm UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/4 "2024-10-05T23:49:24Z")

</div>

> [@Tetsuya\_Kawahara](#):
>
> I’ve resolved the issue on my own.  
> I successfully built an image where ROS2 operates and set up the cross-compilation environment.

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.

---

<div class="post-metadata">

**Author:** ![Tetsuya\_Kawahara](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aim-linux.advantech.com/tetsuya_kawahara/32/476_2.png) [@Tetsuya\_Kawahara](https://forum.aim-linux.advantech.com/u/Tetsuya_Kawahara)\
**Post date:** [October 30, 2024, 8:59am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/5 "2024-10-30T08:59:58Z")

</div>

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:

> **[NXP iMX8基于Ycoto Project编译ROS2](https://www.toradex.com/ja-jp/blog/nxp-imx8ji-yuycoto-project-bian-yiros2)**
>
> 基于类似NXP iMX8这样性能强劲的ARM平台处理器，越来越多的工业智能/机器人应用比如AGV/AMR产品控制器在ARM平台上面实现，在这个过程中不可避免的就涉及到将机器人应用开发框架移植到ARM平台来运行，因此本文就着重示例基于Ycoto Project/Openembedded环境，将ROS（Robot Operating System）编译集成到嵌入式Linux中运行。 

> **[みつきんのメモ](https://mickey-happygolucky.hatenablog.com/)**
>
> 組み込みエンジニアです。Interface誌で「Yocto Projectではじめる 組み込みLinux開発入門」連載中

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`

 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/2X/b/b85750e8cee713cfc46ac3190f368ebda569f129.png)

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.

---

<div class="post-metadata">

**Author:** ![Tetsuya\_Kawahara](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aim-linux.advantech.com/tetsuya_kawahara/32/476_2.png) [@Tetsuya\_Kawahara](https://forum.aim-linux.advantech.com/u/Tetsuya_Kawahara)\
**Post date:** [October 30, 2024, 9:13am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/6 "2024-10-30T09:13:41Z")

</div>

`> 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](https://issincjp-my.sharepoint.com/:u:/g/personal/kawahara_tetsuya_iss_ai/EdirvfGVYwdOrmfiWQ_hazUBWJ1IMRhH6SJWfarmmpMMxw?e=aqFZWn)

---

<div class="post-metadata">

**Author:** ![Hideo\_Nakajima](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Hideo\_Nakajima](https://forum.aim-linux.advantech.com/u/Hideo_Nakajima)\
**Post date:** [October 31, 2024, 9:39am UTC](https://forum.aim-linux.advantech.com/t/build-ros2-foxy-with-yocto-kirkstone-on-rsb3720/732/7 "2024-10-31T09:39:35Z")

</div>

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