Google Coral Dev Linux内核V5.x支持

发布于 2025-01-23 12:21:14 字数 1053 浏览 5 评论 0 原文

  • 目前,Google Coral Dev在Mendel OS上运行,该操作系统支持Linux内核v4.14


  • ” IMX 已经支持i.mx8的v5.4


  • 我尝试从Vanilla内核来源构建v5.10
  • Mendel OS(或Google Coral Dev)何时支持Linux V5.x(例如v5.10,v5.4)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清引 2025-01-30 12:21:14

Google Coral Dev Edge TPU带有Linux-5.15.y

背景

  • Mendel OS不支持V5.x内核版本,
  • 能够使用Linux-5.15.y启动Coral Dev。

目标

  • 支持coral dev Edge tpu,linux-5.15.y内核版本

构建Linux-5.15.y for Google Coral Dev

$ 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}
  • checkout 靴子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文件复制到珊瑚开发和加载内核模块
# 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
  • 仍然无法检测到边缘TPU

Google Coral Dev Edge TPU with linux-5.15.y

Background

  • Currently Mendel OS does not support v5.x kernel version
  • Able to boot Coral dev with linux-5.15.y.

Goal

  • Support Coral dev Edge TPU with linux-5.15.y kernel version

Build linux-5.15.y for Google Coral Dev

$ 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}
  • Able to boot 5.15.y, but Edge TPU pci is not found
$ uname -a 
Linux coral-sdcard 5.15.35 #1 SMP PREEMPT Thu Apr 28 11:47:54 IST 2022 aarch64 GNU/Linux
$ lspci

Build and load Coral Gasket Driver

$ 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
  • Copy the .ko files to Coral dev and load kernel modules
# 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>
  • Running sample model
# 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
  • Still unable to detect the Edge TPU
盛夏已如深秋| 2025-01-30 12:21:14

@Chethansuresh我在这里使用了您的指南,最终进入了同一个地方。问题是PCI总线没有出现。在Google版本(4.x)与6.11上运行LSHW。我相信您对5.15的问题也是如此。

我还没有弄清楚丢失的DTSI / DTS文件。

通过将以下内容添加到IMX8MQ-Phanbell.dts来修复

&pcie0 {
    status = "okay";
};

&pcie1 {
    status = "okay";
};

@chethansuresh I have used you guide here and ended up in the same place. The issue is that the PCI buses are not showing up. run lshw on both the google release (4.x) versus 6.11. I believe the same issue you had with 5.15.

I haven’t figured out the missing dtsi / dts file yet.

It’s fixed by adding the following to imx8mq-phanbell.dts

&pcie0 {
    status = "okay";
};

&pcie1 {
    status = "okay";
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文