From bc19509c9c5c1d3bfd1368f763176d60828add46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Tue, 10 Dec 2024 17:50:11 +0100 Subject: [PATCH] Compile hailo_pci module from original sources on RPi 5 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. --- buildroot-external/Config.in | 1 + buildroot-external/board/raspberrypi/kernel.config | 3 +++ buildroot-external/configs/rpi5_64_defconfig | 1 + buildroot-external/package/hailo-pci/Config.in | 7 +++++++ buildroot-external/package/hailo-pci/hailo-pci.hash | 3 +++ buildroot-external/package/hailo-pci/hailo-pci.mk | 8 ++++++++ buildroot-external/package/hailo8-firmware/Config.in | 6 +++--- .../package/hailo8-firmware/hailo8-firmware.mk | 6 +++++- 8 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 buildroot-external/package/hailo-pci/Config.in create mode 100644 buildroot-external/package/hailo-pci/hailo-pci.hash create mode 100644 buildroot-external/package/hailo-pci/hailo-pci.mk diff --git a/buildroot-external/Config.in b/buildroot-external/Config.in index 1227e1c654a..1bdb1b9225b 100644 --- a/buildroot-external/Config.in +++ b/buildroot-external/Config.in @@ -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" diff --git a/buildroot-external/board/raspberrypi/kernel.config b/buildroot-external/board/raspberrypi/kernel.config index 7409b137eaa..2189f9b821d 100644 --- a/buildroot-external/board/raspberrypi/kernel.config +++ b/buildroot-external/board/raspberrypi/kernel.config @@ -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 diff --git a/buildroot-external/configs/rpi5_64_defconfig b/buildroot-external/configs/rpi5_64_defconfig index b57fc3a3ce7..78882ebe453 100644 --- a/buildroot-external/configs/rpi5_64_defconfig +++ b/buildroot-external/configs/rpi5_64_defconfig @@ -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" diff --git a/buildroot-external/package/hailo-pci/Config.in b/buildroot-external/package/hailo-pci/Config.in new file mode 100644 index 00000000000..8eb8c9942c0 --- /dev/null +++ b/buildroot-external/package/hailo-pci/Config.in @@ -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+. diff --git a/buildroot-external/package/hailo-pci/hailo-pci.hash b/buildroot-external/package/hailo-pci/hailo-pci.hash new file mode 100644 index 00000000000..13e5a59c227 --- /dev/null +++ b/buildroot-external/package/hailo-pci/hailo-pci.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 f9c375a1be4a41f7b70301dd83c91cb89e41567478859b77eef375a52d782505 LICENSE +sha256 0c687d229968ba3092ee214ed45be8ccaedf005f8a2c4fb8f26c439608c960e9 hailo-pci-v4.19.0.tar.gz diff --git a/buildroot-external/package/hailo-pci/hailo-pci.mk b/buildroot-external/package/hailo-pci/hailo-pci.mk new file mode 100644 index 00000000000..3751e103082 --- /dev/null +++ b/buildroot-external/package/hailo-pci/hailo-pci.mk @@ -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)) diff --git a/buildroot-external/package/hailo8-firmware/Config.in b/buildroot-external/package/hailo8-firmware/Config.in index 841f660f639..a5779b467e1 100644 --- a/buildroot-external/package/hailo8-firmware/Config.in +++ b/buildroot-external/package/hailo8-firmware/Config.in @@ -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. diff --git a/buildroot-external/package/hailo8-firmware/hailo8-firmware.mk b/buildroot-external/package/hailo8-firmware/hailo8-firmware.mk index 08c324f4dbc..872e83ca1ce 100644 --- a/buildroot-external/package/hailo8-firmware/hailo8-firmware.mk +++ b/buildroot-external/package/hailo8-firmware/hailo8-firmware.mk @@ -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))