Google Coral Dev Linux 内核 v5.x 支持

问题描述 投票:0回答:2
google-coral imx8 mendel-os
2个回答
1
投票

Google Coral Dev Edge TPU 与 linux-5.15.y

背景

  • 目前Mendel OS不支持v5.x内核版本
  • 能够使用 linux-5.15.y 启动 Coral 开发。

目标

  • 支持 Linux-5.15.y 内核版本的 Coral dev Edge TPU

为 Google Coral Dev 构建 linux-5.15.y

$ git log --oneline -1 
81d8d30c35ed (HEAD -> linux-5.15.y, tag: v5.15.35, origin/linux-5.15.y) Linux 5.15.35

$ export ARCH=arm64; export CROSS_COMPILE=aarch64-linux-gnu-
$ make O=build defconfig 
$ make O=build menuconfig 
$ make O=build -j8 Image dtbs 
$ cp build/arch/arm64/boot/Image build/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dtb /tftpboot/coral/

// u-boot commands
tftpboot ${fdt_addr} 192.168.0.xx:coral/imx8mq-phanbell.dtb
tftpboot ${loadaddr} 192.168.0.xx:coral/Image
setenv bootargs console=ttymxc0,115200 console=tty0 earlycon=ec_imx6q,0x30860000,115200 root=/dev/mmcblk1p2 rootfstype=ext4 rw rootwait init=/sbin/init net.ifnames=0 pci=pcie_bus_perf
booti ${loadaddr} - ${fdt_addr}
  • 能够启动5.15.y,但找不到Edge TPU pci
$ uname -a 
Linux coral-sdcard 5.15.35 #1 SMP PREEMPT Thu Apr 28 11:47:54 IST 2022 aarch64 GNU/Linux
$ lspci

构建并加载珊瑚垫片驱动程序

$ git clone https://github.com/google/gasket-driver
$ export ARCH=arm64; export CROSS_COMPILE=aarch64-linux-gnu-
$ cd gasket-driver
$ cd src

// In Makefile update linux src path
// -C /path/to/linux/build

$ make 
$ file apex.ko gasket.ko 
apex.ko:   ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=b49b35e0e0747682a5d0e7a085dc424991c3327e, with debug_info, not stripped
gasket.ko: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=cdb25b4ecf240c3b3ff8cacbcc5c533da377aa36, with debug_info, not stripped
  • 将 .ko 文件复制到 Coral dev 并加载内核模块
# uname -a 
Linux coral-sdcard 5.15.35 #1 SMP PREEMPT Thu Apr 28 11:47:54 IST 2022 aarch64 GNU/Linux

# insmod gasket.ko 
# insmod apex.ko 
# lsmod 
Module                  Size  Used by
apex                   20480  0
gasket                 98304  1 apex

# lspci -nn
<empty>
  • 运行示例模型
# python3 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "examples/classify_image.py", line 121, in <module>
    main()
  File "examples/classify_image.py", line 71, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 163, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from libedgetpu.so.1
  • 仍然无法检测到Edge TPU

0
投票

@chethansuresh 我在这里使用了你的指南并最终到达了同一个地方。问题是 PCI 总线没有显示。在 google 版本 (4.x) 和 6.11 上运行 lshw。我相信您在 5.15 中也遇到了同样的问题。

我还没有弄清楚丢失的 dtsi / dts 文件。

© www.soinside.com 2019 - 2024. All rights reserved.