robertofem / CycloneVSoC-examples

Examples using the Cyclone V SoC chip
GNU General Public License v3.0
104 stars 40 forks source link

Making *.ko in Linux-modules/DMA_PL330_LKM/ #14

Open SuchangKim opened 3 years ago

SuchangKim commented 3 years ago

Hi, robertofem

I have tried to run supplied examples in Linux environment for HAN pilot platform from Terasic that uses Arria 10 SoC FPGA.

However, I met several problems..

First, supplied DMA_PL330.ko was compiled for Kernel version of 3.1, so i cannot use it directly.

After then, I tried to make DMA_PL330.ko using the makefile provided, but I cannot understand what "ROOTDIR" means.. does it means zImage?..

I am new for making SD card, so i just want to import LKM (*.ko) into the provided SD card image by Terasic. (https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=216&No=1133&PartNo=4) Can you give me some guidance for it?..

I also wonder whether I have to recompile GHRD quartus project to use DMA_PL330, as GHRD project doe not enable the DMA peripheral request in Qsys, and have to rebuild SD card including modifed device tree infomation in Uboot Image..

Thank you..

robertofem commented 3 years ago

To insert a driver in a kernel it has to be compiled with the same toolchain (kernel version) used to compile the kernel. Otherwise the tag of the kernel when you do "uname -r" and the tag inside the driver will missmatch and the OS wont allow the driver to be inserted.

That is why in order to use that driver you need to compile the OS, generate an SD card based in that OS, compile the driver using some tools generated during OS compilation and finally insert the driver in the OS. Some of the tools generated by the OS are a cross-compiler that is used to compile the driver and "ROOTDIR", which is like a copy of the kernel files in the board, and that are used by the compiler to find the different kernel functions used inside the driver (its like the libraries when you compile a C program that uses third party libraries).

This driver was specifically designed to move data between FPGA and CPU and this implied the allocation of contiguous physical memory and this cannot be done from user space. Please, tell me from where to where you want to move data and the size of each transfer and I may suggest you a better way to move data without the need of OS compilation.

Regarding Amgstrom, most of metalayers are missing from the internet, so trying to recompile Amgstrom 2016 like the giude explains will be impossible. We suffered this this year. If you want to have a Custom Linux for these types of boards Poky Linux is the best. We can help you building it throgh our comany (https://logicmelt.com/)