Skip to content

Commit

Permalink
Compile hailo_pci module from original sources on RPi 5
Browse files Browse the repository at this point in the history
Instead of using in-tree module on RPi 5, build it as a module from the
original sources. This will give us better control over the version used and
will also allow us for easier way to add the module to other platforms.

This also makes 017d172 unnecessary anymore.
  • Loading branch information
sairon committed Dec 10, 2024
1 parent 2b30e2b commit bc19509
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions buildroot-external/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source "$BR2_EXTERNAL_HASSOS_PATH/package/eq3_char_loop/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/gasket/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/generic_raw_uart/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/hailo8-firmware/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/hailo-pci/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/hardkernel-boot/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/hassio/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/khadas-boot/Config.in"
Expand Down
3 changes: 3 additions & 0 deletions buildroot-external/board/raspberrypi/kernel.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ CONFIG_LOCALVERSION="-haos-raspi"
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_DISK=y
CONFIG_LEDS_TRIGGER_ACTIVITY=y

# do not use RPi in-tree driver, use one from BR package instead
# CONFIG_MEDIA_PCI_HAILO is not set
1 change: 1 addition & 0 deletions buildroot-external/configs/rpi5_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_GASKET=y
BR2_PACKAGE_HAILO8_FIRMWARE=y
BR2_PACKAGE_HAILO_PCI=y
BR2_PACKAGE_HASSIO=y
BR2_PACKAGE_HASSIO_ARCH="aarch64"
BR2_PACKAGE_HASSIO_MACHINE="raspberrypi5-64"
Expand Down
7 changes: 7 additions & 0 deletions buildroot-external/package/hailo-pci/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config BR2_PACKAGE_HAILO_PCI
bool "Hailo PCIe Driver"
depends on BR2_LINUX_KERNEL
help
Kernel driver for interacting with Hailo devices over PCIe.
Used e.g. for Hailo-8(L) PCIe device found e.g. on Raspberry
Pi AI Kit and Raspberry Pi AI HAT+.
3 changes: 3 additions & 0 deletions buildroot-external/package/hailo-pci/hailo-pci.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Locally computed
sha256 f9c375a1be4a41f7b70301dd83c91cb89e41567478859b77eef375a52d782505 LICENSE
sha256 0c687d229968ba3092ee214ed45be8ccaedf005f8a2c4fb8f26c439608c960e9 hailo-pci-v4.19.0.tar.gz
8 changes: 8 additions & 0 deletions buildroot-external/package/hailo-pci/hailo-pci.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
HAILO_PCI_VERSION = v4.19.0
HAILO_PCI_SITE = $(call github,hailo-ai,hailort-drivers,$(HAILO_PCI_VERSION))
HAILO_PCI_LICENSE = GPL-2.0
HAILO_PCI_LICENSE_FILES = LICENSE
HAILO_PCI_MODULE_SUBDIRS = linux/pcie

$(eval $(kernel-module))
$(eval $(generic-package))
6 changes: 3 additions & 3 deletions buildroot-external/package/hailo8-firmware/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config BR2_PACKAGE_HAILO8_FIRMWARE
bool "Hailo-8 Firmware"
help
Firmware for Hailo-8 PCIe device found e.g. on Raspberry Pi AI
Kit and Raspberry Pi AI HAT+. Requires the hailo kernel driver
(included in Raspberry Pi's downstream kernel).
Firmware for Hailo-8 PCIe device found e.g. on Raspberry Pi
AI Kit and Raspberry Pi AI HAT+. Required for hailo_pci kernel
module.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ define HAILO8_FIRMWARE_EXTRACT_CMDS
cp $(HAILO8_FIRMWARE_DL_DIR)/$(HAILO8_FIRMWARE_SOURCE) $(@D)
endef

define HAILO8_FIRMWARE_BUILD_CMDS
cp $(@D)/$(HAILO8_FIRMWARE_SOURCE) $(@D)/hailo8_fw.bin
endef

define HAILO8_FIRMWARE_INSTALL_TARGET_CMDS
$(INSTALL) -d $(TARGET_DIR)/lib/firmware/hailo
$(INSTALL) -m 0644 $(@D)/$(HAILO8_FIRMWARE_SOURCE) $(TARGET_DIR)/lib/firmware/hailo/
$(INSTALL) -m 0644 $(@D)/hailo8_fw.bin $(TARGET_DIR)/lib/firmware/hailo/
endef

$(eval $(generic-package))

0 comments on commit bc19509

Please sign in to comment.