Skip to content

Manual Setup Process

Ryan edited this page Jan 24, 2024 · 8 revisions

Manual Setup Process

The following instructions are detailed steps, all done manually. All terminal instructions are prefixed by $. It's assumed you will be starting in a fresh workspace at ~/yocto_ws/, but this location does not matter as long as it's the same for the whole tutorial.

Poky build process with meta-ros

  1. Read the yocto project quick build

    • This tutorial will be used as a reference, and you can always try it first without issue. Just make sure to use the kirkstone branch.
    • Don't add the meta-altera, we will add other layers for ROS instead.
  2. Instead of cloning meta-ros directly with git and creating our own branch, we will use vcs, which is commonly used in the ROS community for managing cloning multiple repositories.

    • In your yocto workspace, create ros-image-core.repos file with the following:
      • $ cd ~/yocto_ws
      • $ touch ros-image-core.repos
      repositories:
        poky:
          type: git
          url: git://git.yoctoproject.org/poky
          version: kirkstone
        meta-openembedded:
          type: git
          url: https://git.openembedded.org/meta-openembedded
          version: kirkstone
        meta-ros:
          type: git
          url: https://github.com/ros/meta-ros.git
          # TODO switch to kirkstone once kirkstone-next is merged
          version: kirkstone-next
    • Import the sources with vcs:
      $ vcs import --input ros-image-core.repos
      If you already followed the poky quick-build, vcs will just skip cloning poky automatically.
    • You can now see all repos are cloned:
      $ ls
      >>> meta-openembedded  meta-ros  poky  ros-image-core.repos
  3. While the poky tutorial clones meta-ros inside the poky directory, the above repos file clones poky next to meta-ros at the same level. This is called an "out of tree" build, which separates the repositories better.

  4. In building for specific hardware, we can now source the open-embedded build environment initialization script and add layers. Again, since the sources are cloned, the paths to the layers are slightly different than in the tutorial.

    # Add all the layers
    bitbake-layers add-layer ../../meta-openembedded/meta-oe/
    bitbake-layers add-layer ../../meta-openembedded/meta-python/
    bitbake-layers add-layer ../../meta-ros/meta-ros-common/
    bitbake-layers add-layer ../../meta-ros/meta-ros2
    bitbake-layers add-layer ../../meta-ros/meta-ros2-humble
  5. Finally, you are ready to build! It may take quite a while.

    bitbake ros-image-core

TLDR

Create the ros-image-core.repos per above, then dump this in terminal.

vcs import --input ros-image-core.repos
cd poky
source oe-init-build-env
bitbake-layers add-layer ../../meta-openembedded/meta-oe/
bitbake-layers add-layer ../../meta-openembedded/meta-python/
bitbake-layers add-layer ../../meta-ros/meta-ros-common/
bitbake-layers add-layer ../../meta-ros/meta-ros2
bitbake-layers add-layer ../../meta-ros/meta-ros2-humble
bitbake ros-image-core

Running meta-ros with the qemu simulator locally

runqemu qemux86-64 ros-image-core-humble
  1. TODO switch to using MCF: https://gist.github.com/robwoolley/e16f60e6e8483e7ea36f7616197bab11#file-build-ros-image-world-txt-L17

Running the ROS image locally

Let's run the image locally to make sure it works and demonstrate it's working.

  1. First, if it's a new terminal, make sure to source the workspace, and then run the image.
    cd yocto_ws/poky
    source oe-init-build-env
    runqemu qemux86-64 ros-image-core-humble
  2. When first running the image, it prompts for sudo. This is expected and only needed once.
    >>> runqemu - INFO - Setting up tap interface under sudo
  3. Next, you are prompted to log into the qemu account. The username is TBD and password is TBD [TODO add reference to docs]