Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hailo8 support on pi5 machines #1202

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

shaunmulligan
Copy link

@shaunmulligan shaunmulligan commented Jan 20, 2025

⚠️ Warning: ⚠️ Before merging, we need to confirm that our including the firmware in balenaOS conforms to hailo's License

This PR introduces support for the hailo8 chip found in the raspberry pi AI Kits on the raspberrypi5 family of machines by adding the following components:

  • A new recipe for hailo firmware (hailo-firmware_4.19.0.bb) that installs the firmware binary to /lib/firmware/hailo.
  • an extra udev rule (51-hailo-udev.rules) has been added to the extra-udev-rules.bbappend file to support the new hardware.

It depends on #1201 being merged to support kernel 6.6 on the pi5 first.

This can be tested from a container/app using the following dockerfile:

FROM balenalib/raspberrypi5-debian:bookworm-build

WORKDIR /root

# Install generic requirements
RUN install_packages software-properties-common wget

# Need to create a sources.list file for apt-add-repository to work correctly:
# https://groups.google.com/g/linux.debian.bugs.dist/c/6gM_eBs4LgE
RUN echo "# See sources.lists.d directory" > /etc/apt/sources.list

# Add Raspberry Pi repository, as this is where we will get the Hailo deb packages
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E && \
    apt-add-repository -y -S deb http://archive.raspberrypi.com/debian/ bookworm main

# Fake systemd so hailoRT will install in container:
RUN echo '#!/bin/sh\nexec "$@"' > /usr/bin/sudo && chmod +x /usr/bin/sudo
RUN echo '#!/bin/bash\nexit 0' > /usr/bin/systemctl && chmod +x /usr/bin/systemctl
RUN mkdir -p /run/systemd && echo 'docker' > /run/systemd/container

# Dependencies for hailo
RUN install_packages hailo-all

CMD [ "balena-idle" ]

You should then be able to run hailortcli scan from within the container and have the device correctly detected.

At this moment, when building with OS_DEVELOPMENT=1, earlycon is added
to kernel command line, however the current configuration is only
valid on the Pi4 family. Using it with any other device type will make
the kernel hang.

This patch limits the configuration to Pi4, Pi400 and CM4.

Change-type: patch
Signed-off-by: Michal Toman <[email protected]>
At this moment the RPi5 image does not build properly, and CM5
and RPi500 are not supported at all.

This patch does several things:
* Bumps kernel to 6.6 on the Pi5 image
* Bumps the balena bootloader kernel to 6.6
* Adds CM5 and RPi500 device trees to the RPi5 image

It was necessary to backport the 6.6 recipe from meta-raspberrypi,
as 6.6 is only available from scarthgap up, and balena-raspberrypi
is still on kirkstone.

RPi5, RPi500 and CM5 are therefore supported by a single device type.

Change-type: minor
Changelog-entry: Add support for CM5 and RPi500
Signed-off-by: Michal Toman <[email protected]>
@n1mda
Copy link

n1mda commented Jan 21, 2025

Hi balena-os developers, very cool to see this is worked on!

Just a comment, hailo 4.20.0 is available. Is there a reason you use 4.19.0 here?

Looking forward to using this!

@shaunmulligan
Copy link
Author

shaunmulligan commented Jan 21, 2025

Hi @n1mda yeah, I saw that 4.20 is available but planned to try align the version to what is officially shipped with raspberry Pi OS currently which today ships with 4.19.0, which means that installing this in your docker container doesn't require building the userspace libs from source, its just a matter of doing apt install hailo-all

@shaunmulligan shaunmulligan marked this pull request as ready for review January 21, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants