Skip to content

Commit

Permalink
feat(yocto): add support for RPi Zero 2 W
Browse files Browse the repository at this point in the history
  • Loading branch information
nikAizuddin committed May 17, 2023
1 parent 97e7a16 commit 3e5df99
Show file tree
Hide file tree
Showing 15 changed files with 633 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@
[submodule "project/yocto/rpi4b/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python"]
path = project/yocto/rpi4b/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python
url = https://github.com/extra2000/ros2_helloworld_python.git
[submodule "project/yocto/rpizero2-w/layers/poky"]
path = project/yocto/rpizero2-w/layers/poky
url = https://github.com/yoctoproject/poky.git
[submodule "project/yocto/rpizero2-w/layers/meta-openembedded"]
path = project/yocto/rpizero2-w/layers/meta-openembedded
url = https://github.com/openembedded/meta-openembedded.git
[submodule "project/yocto/rpizero2-w/layers/meta-raspberrypi"]
path = project/yocto/rpizero2-w/layers/meta-raspberrypi
url = https://git.yoctoproject.org/meta-raspberrypi
[submodule "project/yocto/rpizero2-w/layers/meta-ros"]
path = project/yocto/rpizero2-w/layers/meta-ros
url = https://github.com/ros/meta-ros.git
[submodule "project/yocto/rpizero2-w/layers/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp"]
path = project/yocto/rpizero2-w/layers/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp
url = https://github.com/extra2000/ros2-helloworld-cpp.git
[submodule "project/yocto/rpizero2-w/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python"]
path = project/yocto/rpizero2-w/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python
[submodule "project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp"]
path = project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp
url = https://github.com/extra2000/ros2-helloworld-cpp.git
Expand Down
71 changes: 71 additions & 0 deletions docs/yocto/rpizero2-w.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Raspberry Pi Zero 2 W


## Prerequisites

* [extra2000/xilinx-toolkit v3.x image](https://github.com/extra2000/xilinx-toolkit)
* SDCard with at least 4GB.
* Digilent Analog Discovery 2 for accessing serial console through UART pins.


## Building

Allow source files to be mounted into container:
```
chcon -R -t container_file_t project
```

Create container:
```
podman run -it --rm \
--network=host \
--userns="keep-id:uid=1000,gid=1000" \
-v ${PWD}/project:${PWD}/project:rw \
--workdir ${PWD}/project/yocto/rpizero2-w \
--security-opt label=type:xilinx_toolkit_podman.process \
localhost/extra2000/xilinx-toolkit:latest \
bash
source layers/poky/oe-init-build-env build
```

Check dependencies:
```
bitbake -p ros-core
```

Build:
```
bitbake ros-image-core
```

Flash to SD card:
```
bzcat project/yocto/rpizero2-w/build/tmp/deploy/images/raspberrypi0-2w-64/ros-image-core-humble-raspberrypi0-2w-64-*.rootfs.wic.bz2 | sudo dd bs=4M iflag=fullblock oflag=direct status=progress of=/dev/sdX; sudo sync
```


## Testing

Insert SD card and power on Raspberry Pi Zero 2 W. Access serial console and login with `root` user. Then, follow [Testing](common/testing.md) instructions.


## Cleaning Up

To clean build:
```
rm -rf project/yocto/rpizero2-w/build/{sstate-cache,tmp}
```


## Known Issues

When entering ROS2 environment using command:
```
source /etc/profile.d/ros/setup.bash
```

there will be errors such that:
```
Usage: head [OPTIONS] [FILE]...
head: invalid option -- 'c'
```
26 changes: 26 additions & 0 deletions project/yocto/rpizero2-w/build/conf/bblayers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

ROS_OE_RELEASE_SERIES = "honister"
ROS_DISTRO = "humble"

YOCTOROOT = "${@os.path.abspath(os.path.join("${TOPDIR}", os.pardir))}"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
${YOCTOROOT}/layers/poky/meta \
${YOCTOROOT}/layers/poky/meta-poky \
${YOCTOROOT}/layers/poky/meta-yocto-bsp \
${YOCTOROOT}/layers/meta-openembedded/meta-oe \
${YOCTOROOT}/layers/meta-openembedded/meta-multimedia \
${YOCTOROOT}/layers/meta-openembedded/meta-networking \
${YOCTOROOT}/layers/meta-openembedded/meta-python \
${YOCTOROOT}/layers/meta-raspberrypi \
${YOCTOROOT}/layers/meta-ros/meta-ros-common \
${YOCTOROOT}/layers/meta-ros/meta-ros2 \
${YOCTOROOT}/layers/meta-ros/meta-ros2-humble \
${YOCTOROOT}/layers/meta-user \
"
Loading

0 comments on commit 3e5df99

Please sign in to comment.