-
-
Save dataslayermedia/714ec5a9601249d9ee754919dea49c7e to your computer and use it in GitHub Desktop.
#!/bin/bash | |
cd / | |
sudo apt update | |
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install libedgetpu1-std | |
sudo apt install -y devscripts debhelper | |
sudo apt install dkms | |
sudo apt-get install dh-dkms | |
# Clone the Gasket driver repository | |
sudo git clone https://github.com/google/gasket-driver.git | |
# Change directory to the cloned repository | |
cd gasket-driver | |
# Build the Gasket driver package | |
sudo debuild -us -uc -tc -b | |
# Go back to the parent directory | |
cd .. | |
# Install the built Gasket driver package | |
sudo dpkg -i gasket-dkms_1.0-18_all.deb | |
sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules" | |
sudo groupadd apex | |
sudo adduser $USER apex | |
# Update the boot configuration for Raspberry Pi | |
echo "kernel=kernel8.img" | sudo tee -a /boot/firmware/config.txt | |
# Back up the Device Tree Blob (DTB) | |
sudo cp /boot/firmware/bcm2712-rpi-5-b.dtb /boot/firmware/bcm2712-rpi-5-b.dtb.bak | |
# Decompile the DTB into a DTS file | |
sudo dtc -I dtb -O dts /boot/firmware/bcm2712-rpi-5-b.dtb -o ~/test.dts | |
# Modify the Device Tree Source (DTS) | |
sudo sed -i '/pcie@110000 {/,/};/{/msi-parent = <[^>]*>;/{s/msi-parent = <[^>]*>;/msi-parent = <0x67>;/}}' ~/test.dts | |
# Recompile the DTS back into a DTB | |
sudo dtc -I dts -O dtb ~/test.dts -o ~/test.dtb | |
# Replace the old DTB with the new one | |
sudo mv ~/test.dtb /boot/firmware/bcm2712-rpi-5-b.dtb | |
sudo reboot now |
FYI: There is an updated rpi-source which fixes the "ERROR: Unexpected processor 4 (use --processor argument)" issue https://github.com/RPi-Distro/rpi-source I installed from master and it fixed it on my RPI 5.
Todays attempt with a clean SD Card image from the Raspiberry Pi Image
I ran lines 1-46 Up to adding the user to the group and then rebooted.
~ $ uname -a
Linux frigate 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux~ $ ls /dev/a*
/dev/apex_0 /dev/autofs
~ $ lspci -nn | grep 089a
0000:01:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
Hi, I found out that when I upgrade to 6.6.31+rpt-rpi-v8
~ $ sudo lspci -vvv|grep -i MSI-X
Capabilities: [d0] MSI-X: Enable- Count=128 Masked-
Capabilities: [b0] MSI-X: Enable+ Count=61 Masked-
this will fail [d0] MSI-X: Enable-, going back to 6.6.20+rpt-rpi-v8 everything will work again (as in the sample in pycoral will run). Not sure if its related to your issue. Anyone know why it breaks when upgrade to 6.6.31+rpt-rpi-v8?
Following up on this, i use apt-mark to lock the kernel:
~ $ sudo apt-mark hold linux-headers-rpi-2712
linux-headers-rpi-2712 set on hold.
~ $ sudo apt-mark hold linux-headers-rpi-v8
linux-headers-rpi-v8 set on hold.
~ $ sudo apt-mark hold linux-image-rpi-2712
linux-image-rpi-2712 set on hold.
~ $ sudo apt-mark hold linux-image-rpi-v8
linux-image-rpi-v8 set on hold.
~ $ sudo apt-mark hold linux-libc-dev
linux-libc-dev set on hold.
after upgrade the kernel remain the same but the same issue occurs, so its some other package that got updated and cause the MSI-X issue
This can happen if the board you use does not have proper routing and a high quality FPC cable: raspberrypi/linux#6126
That is why the kernel overlay is not for coral itself, it does not work on all PCIe hats.
You can check for dmesg errors, but I think this is the problem
The Pineberry board has just arrived and it solved all of my problems. Works like magic.
It just works, both cores are visible and usable.
—-
I noticed a new kernel version is available. Do you know if it included everything required to let the hat work just from the box?
This can happen if the board you use does not have proper routing and a high quality FPC cable: raspberrypi/linux#6126
That is why the kernel overlay is not for coral itself, it does not work on all PCIe hats.
You can check for dmesg errors, but I think this is the problem