-1

I have a Zynq Ultrascale board and I want to use its DMA interface from Aarch64 processor which is running Linux as OS. for this purpose I should place .ko driver file in kernel and load it into Linux kernel.

currently, I use Petalinux and build driver .ko file by it, and Petalinux place this .ko file in rootfs and Petalinux kernel.

now, I want to move from Petalinux to Ubuntu and use Ubuntu on Zynq board, so I want to know could I build a DMA driver separately from the ubuntu kernel and add it to its kernel afterward?

formerly, Petalinux built my driver while it built whole linux kernel. but I want to build only driver and use existing kernel(without building ubuntu kernel)

if yes and I could build the driver separately, how could I build a driver for Ubunto?

hamed
  • 471
  • 1
  • 9
  • 22
  • A Linux kernel driver should be built against those configuration and headers files, against which the kernel itself has been built. "how could I build my c++ code as a driver for Ubunto?" - You cannot. Linux kernel is built from the C code, it doesn't support C++. – Tsyvarev Dec 20 '21 at 16:49
  • @Tsyvarev Excuse me. I mean c, not c++. – hamed Dec 20 '21 at 17:14
  • 1
    You will still need the Ubuntu kernel config and source. Also, you will need to do something about module signing, since Ubuntu modules are signed. – stark Dec 20 '21 at 19:36

1 Answers1

0

fortunately, I copied the driver built by Petalinux to Ubuntu and it works properly.

It means I could use Petalinux for building drivers without compiling Ubuntu's kernel, I added driver's .c file to Petalinux as a module then build Petalinux entirely, then pick the driver's .ko file from /lib/modules/5.10.0-xilinx-v2021.2/extra/ path in Petalinux and copied it to somewhere in Ubuntu and call insmod command.

I know this solution isn't respectful but it works for me and pulled me out of the swamp.

hamed
  • 471
  • 1
  • 9
  • 22