[BPI-R64] PCIe issues

i have the hardware changes

I have updated the gasket_core.c by replacing ioremap_nocache as ioremap_cache

Now I get the following error

make[1]: Entering directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

Makefile:719: recipe for target 'include/config/auto.conf' failed
make[1]: *** [include/config/auto.conf] Error 1
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 2

on building the 5.8 kernel source on R64 following is the output

root@bpi-iot-ros-ai:/usr/src/linux-headers-5.8.0-rc6-bpi-r64# ./build.sh 
do not run as root!
do not run as root!
Build Kernel
Cleanup Kernel Build
needed: make u-boot-tools bc gcc libc6-dev libncurses5-dev ccache libssl-dev
generate branch vars...
getting git branch: 
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

kernbranch:,gitbranch:
  HOSTLD  scripts/kconfig/conf
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
scripts/kconfig/conf.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
scripts/Makefile.host:112: recipe for target 'scripts/kconfig/conf' failed
make[2]: *** [scripts/kconfig/conf] Error 1
Makefile:606: recipe for target 'syncconfig' failed
make[1]: *** [syncconfig] Error 2
Makefile:711: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2

In order to get the config i executed the command ./build.sh importconfig on R64 where I get following error

root@bpi-iot-ros-ai:/usr/src/linux-headers-5.8.0-rc6-bpi-r64# ./build.sh importconfig
do not run as root!
import a defconfig file
Import r64 config
  HOSTLD  scripts/kconfig/conf
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: scripts/kconfig/conf.o: Relocations in generic ELF (EM: 62)
scripts/kconfig/conf.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
scripts/Makefile.host:112: recipe for target 'scripts/kconfig/conf' failed
make[1]: *** [scripts/kconfig/conf] Error 1
Makefile:606: recipe for target 'mt7622_bpi-r64_defconfig' failed
make: *** [mt7622_bpi-r64_defconfig] Error 2

oh, i see you have missing packages:

needed: make u-boot-tools bc gcc libc6-dev libncurses5-dev ccache libssl-dev

you can try steps advertised there ( make oldconfig && make prepare)

maybe building on r64 is not same as building with crosscompiler (if you downloaded built kernel from my gdrive/github-releases)

try make clean/mrproper and then importconfig (maybe build kernel) again

Before running the first ./build.sh command I had loaded the packages needed

I already tried make oldconfig && make prepare

Even this Fails

Please share link of your gdrive.

how have you β€œinstalled” the kernel-sources? is this a git-checkout or have you installed with deb/tar.gz?

try a β€œmake clean” before the importconfig

files on my gdrive may cause but not fix this…

I did a make clean on the linux source in R64.

Then I executed the ./build.sh command to execute all the script related commands

After that I have compiled the Gasket source and i get the following Error.

root@bpi-iot-ros-ai:/var/lib/dkms/gasket/1.0/source# make
make -C /lib/modules/5.8.0-rc6-bpi-r64/build M=/var/lib/dkms/gasket/1.0/source modules
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'
  CC [M]  /var/lib/dkms/gasket/1.0/source/gasket_core.o
  CC [M]  /var/lib/dkms/gasket/1.0/source/gasket_ioctl.o
  CC [M]  /var/lib/dkms/gasket/1.0/source/gasket_interrupt.o
  CC [M]  /var/lib/dkms/gasket/1.0/source/gasket_page_table.o
  CC [M]  /var/lib/dkms/gasket/1.0/source/gasket_sysfs.o
  LD [M]  /var/lib/dkms/gasket/1.0/source/gasket.o
  CC [M]  /var/lib/dkms/gasket/1.0/source/apex_driver.o
  LD [M]  /var/lib/dkms/gasket/1.0/source/apex.o
  MODPOST /var/lib/dkms/gasket/1.0/source/Module.symvers
ERROR: modpost: "dma_buf_detach" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
ERROR: modpost: "dma_buf_put" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
ERROR: modpost: "dma_buf_get" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
ERROR: modpost: "dma_buf_unmap_attachment" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
ERROR: modpost: "dma_buf_map_attachment" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
ERROR: modpost: "dma_buf_attach" [/var/lib/dkms/gasket/1.0/source/gasket.ko] undefined!
scripts/Makefile.modpost:111: recipe for target '/var/lib/dkms/gasket/1.0/source/Module.symvers' failed
make[2]: *** [/var/lib/dkms/gasket/1.0/source/Module.symvers] Error 1
make[2]: *** Deleting file '/var/lib/dkms/gasket/1.0/source/Module.symvers'
Makefile:1669: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 2

Looks like you need to compile kernel with dma_buf support

https://elixir.bootlin.com/linux/latest/A/ident/dma_buf_detach

At least CONFIG_DMA_SHARED_BUFFER on a quick look this seems enough (all functions listed are inside dma-buf.c and i see no idefs around

Hi Do I need to recompile and reinstall the kernel or just recompile on the R64

Imho recompile to compile the gasket,but reinstall to use :slight_smile:

In command β€˜./build.sh config’ which setting refers to dma_buf support. Alternatively is it possible to directly provide this setting via some file?

Press / in menuconfig (build.sh config) to search and search for CONFIG_DMA_SHARED_BUFFER then press 1 and space to set,exit with save

I am looking in include/config/auto.conf file. There is no β€˜CONFIG_DMA_SHARED_BUFFER’ kernel configuration setting present.

It looks like is is a hidden option set by config_sync_file

https://elixir.bootlin.com/linux/latest/source/drivers/dma-buf/Kconfig#L7

On searching β€œCONFIG_DMA_SHARED_BUFFER” i am unable to highlight the menu option to set it.

see my posting before…search with / for CONFIG_SYNC_FILE

 .config - Linux/arm64 5.8.0-rc6 Kernel Configuration
 > Search (CONFIG_SYNC_FILE) ──────────────────────────────────────────────────
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Search Results ─────────────────────────────┐
  β”‚ Symbol: SYNC_FILE [=n]                                                  β”‚  
  β”‚ Type  : bool                                                            β”‚  
  β”‚ Defined at drivers/dma-buf/Kconfig:4                                    β”‚  
  β”‚   Prompt: Explicit Synchronization Framework                            β”‚  
  β”‚   Location:                                                             β”‚  
  β”‚     -> Device Drivers                                                   β”‚  
  β”‚ (1)   -> DMABUF options                                                 β”‚  
  β”‚ Selects: DMA_SHARED_BUFFER [=n]    <<<<<<<<<<<<<<

press 1

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ DMABUF options ─────────────────────────────┐
  β”‚  Arrow keys navigate the menu.  <Enter> selects submenus ---> (or empty β”‚  
  β”‚  submenus ----).  Highlighted letters are hotkeys.  Pressing <Y>        β”‚  
  β”‚  includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to β”‚  
  β”‚  exit, <?> for Help, </> for Search.  Legend: [*] built-in  [ ]         β”‚  
  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  
  β”‚ β”‚    [ ] Explicit Synchronization Framework <<<<<<<<

and select with space

[*] Explicit Synchronization Framework

if you now search again for DMA_SHARED_BUFFER ist is selected

Symbol: DMA_SHARED_BUFFER [=y]

have added it to defconfig…and updated 5.8-rc to rc7

Hi

Yes this setting worked. I have managed to compile the gasket driver on R64 successfully. Thanks

Remember, you need to boot kernel with this option or you get errors when loading the module

Have you tried booting+loading it? Does it work with hw-modifications?

I have managed to load the gasket drivers and can see the PCI Google coral in /dev/ as apex_0.

Now I am trying to load the tflite library on R64. For that I have already upgraded to Python 3.6.11.

While loading tflite for coral R64 also tries to install numpy and fails with the BPI5.8_tfliteLoading.txt (60.6 KB)

If you can suggest something to resolve this it will be of great help

It seems that specific libs like

mkl_rt,blis,openblas,…

Not found. Seems not kernel-related

Yes, its not related to kernel.

Just thought if you could help

Hi,

I have managed to resolve the issue. Now I am trying to run the Classification example.

When executing this I get the following error

root@bpi-iot-ros-ai:~/coral/tflite/python/examples/classification# python3 classify_image.py \
> --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
> --labels models/inat_bird_labels.txt \
> --input images/parrot.jpg
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/tflite_runtime/interpreter_wrapper.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/python3.6/site-packages/tflite_runtime/_interpreter_wrapper.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "classify_image.py", line 36, in <module>
    import tflite_runtime.interpreter as tflite
  File "/usr/local/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 46, in <module>
    from tflite_runtime import interpreter_wrapper as _interpreter_wrapper
  File "/usr/local/lib/python3.6/site-packages/tflite_runtime/interpreter_wrapper.py", line 17, in <module>
    _interpreter_wrapper = swig_import_helper()
  File "/usr/local/lib/python3.6/site-packages/tflite_runtime/interpreter_wrapper.py", line 16, in swig_import_helper
    return importlib.import_module('_interpreter_wrapper')
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_interpreter_wrapper'

He I need to install the GLIBC_2.27 library. If you could help with this