How to build kernel module for apalis imx6

Can you please provide the steps to build kernel module for Apalis imx6

Hi @bevincb and Welcome to the Toradex Community!

What exactly do you mean with building kernel module?
Do you want to write your own kernel modules or just build the ones, which are already in the kernel?
For Building kernel modules where the kernel source already exist, please have a look here.

Best regards,
Jaski

Hi Jaski,

As a work arround, I have build my module by placing inside the imx6 driver folder and modifying the makefile. I was able to insert the module successfully.

Now I am facing issue while building my application that ‘sqrt, insw and outsw’ are undefined.
Is this functions present or any alternatives available?

Thanks,
bevincb

I want to build my own kernel modules using cross compilation for apalis imx6

You should read this Documentation.

What application are you building? Could you provide a sample code?

Now I am facing issue while building my application that ‘sqrt, insw and outsw’ are undefined. Is this functions present or any alternatives available?

Did you include the math header files in your code?

Best regards,
Jaski

Hi Jaski,

I have added math.h header file
But it was throwing error of undefined reference to sqrt
I compiled with -lm option and the error for sqrt is solved

But undefined reference to insw and outsw are still not solved.
I have added sys/io.h header file in code
Can you please provide your inputs on this error.

I am doing cross compilation from Ubuntu 16.04 64-bit OS for apalis imx6

Thanks,
bevincb

Can you please provide the steps to build kernel module for Apalis imx6

Please find this explained here:

https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code#kernel-module-compilation-all-modules

Should you have any further questions, please open a new question including sufficient information for us to know exactly what it is that you are trying to achieve (e.g. including textual console output of failing commands and example source code if possible). Thanks!