Xilinx / XRT

Run Time for AIE and FPGA based platforms
https://xilinx.github.io/XRT
Other
555 stars 471 forks source link

how to cross-compile XRT for edge #6143

Open oimasa5 opened 2 years ago

oimasa5 commented 2 years ago

I referred to https://github.com/Xilinx/XRT/issues/2841, but it seemed to be about self-building for the edge. I would like to know how to cross-compile XRT for a ZCU102 board using Ubuntu on an x86 machine without Petalinux. Is it possible to make for edge by adding the -driver option to build.sh in build directory?

Add the -driver option to build.sh, change CPU = uname -m to CPU = aarch64, and ran ./build.sh -driver.

The following error occurred

make: Entering directory '/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl'
make -C /lib/modules/5.4.0-90-generic/build M=/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-90-generic'
  CC [M]  /home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.o
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c: In function ‘zocl_load_sect’:
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:610:25: error: ‘struct fpga_manager’ has no member named ‘flags’
   flags = zdev->fpga_mgr->flags;
                         ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:611:17: error: ‘struct fpga_manager’ has no member named ‘flags’
   zdev->fpga_mgr->flags |= FPGA_MGR_CONFIG_DMA_BUF;
                 ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:611:28: error: ‘FPGA_MGR_CONFIG_DMA_BUF’ undeclared (first use in this function); did you mean ‘CONFIG_UDMABUF’?
   zdev->fpga_mgr->flags |= FPGA_MGR_CONFIG_DMA_BUF;
                            ^~~~~~~~~~~~~~~~~~~~~~~
                            CONFIG_UDMABUF
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:611:28: note: each undeclared identifier is reported only once for each function it appears in
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:612:17: error: ‘struct fpga_manager’ has no member named ‘dmabuf’
   zdev->fpga_mgr->dmabuf = drm_gem_prime_export(&bo->gem_base, 0);
                 ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:616:18: error: ‘struct fpga_manager’ has no member named ‘flags’
    zdev->fpga_mgr->flags = flags;
                  ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:617:18: error: ‘struct fpga_manager’ has no member named ‘dmabuf’
    zdev->fpga_mgr->dmabuf = NULL;
                  ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:630:17: error: ‘struct fpga_manager’ has no member named ‘flags’
   zdev->fpga_mgr->flags = flags;
                 ^~
/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.c:631:17: error: ‘struct fpga_manager’ has no member named ‘dmabuf’
   zdev->fpga_mgr->dmabuf = NULL;
                 ^~
scripts/Makefile.build:270: recipe for target '/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.o' failed
make[2]: *** [/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl/zocl_xclbin.o] Error 1
Makefile:1762: recipe for target '/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl' failed
make[1]: *** [/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-90-generic'
Makefile:65: recipe for target 'modules' failed
make: *** [modules] Error 2
make: Leaving directory '/home/XXX/workspace/initrd/XRT/src/runtime_src/core/edge/drm/zocl'
ghost commented 2 years ago

It sounds that you did not define the FPGA manager options for the Linux Kernel. And, the ZOCL module requires a Xilinx linux kernel, linux-xlnx, to build . Mainstream kernels doesn't provide the suitable fpga-manager interfaces over edge boards (like zynqmp).