How to cross compile kernel driver on iMX6S ?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to cross compile kernel driver on iMX6S ?

Jump to solution
611 Views
toanjunifer
Senior Contributor I

Hi,

I'm using iMX6S-EVK with kernel version 4.9.88. I'm writing some simple kernel driver. I also download kernel linux 4.9.88. But when I compile, I got this error: 

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.
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.

CC [M] /home/user1/Desktop/exploringBB/extras/kernel/gpio_test/gpio_test.o
In file included from <command-line>:0:0:
././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: No such file or directory
compilation terminated.

This is my Makefile: 

KERNEL ?= /home/user1/Desktop/linux
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabihf-
obj-m+=hello.o

all:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL) M=$(PWD) modules
clean:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL) M=$(PWD) clean

I execute this command to build: 

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Did I missing something ? What should I do now ?

Thank you so much,

Toan

Labels (1)
1 Solution
502 Views
shivanipatel
Senior Contributor II

Hi toanjunifer@gmail.com‌,

You need to give a compiled kernel path in the "KERNEL" variable in your Makefile.

Do you have the yocto setup for i.MX6S EVK? If so then you need to give this path in your {yocto_build_dir}/tmp/work/imx6slevk-poky-linux-gnueabi/linux-imx/4.9.88-r0/build to KERNEL variable in Makefile. Then after try to compile your module.

Let us know in case of any concerns.

Hope this will help you.

Regards,

Shivani

View solution in original post

2 Replies
503 Views
shivanipatel
Senior Contributor II

Hi toanjunifer@gmail.com‌,

You need to give a compiled kernel path in the "KERNEL" variable in your Makefile.

Do you have the yocto setup for i.MX6S EVK? If so then you need to give this path in your {yocto_build_dir}/tmp/work/imx6slevk-poky-linux-gnueabi/linux-imx/4.9.88-r0/build to KERNEL variable in Makefile. Then after try to compile your module.

Let us know in case of any concerns.

Hope this will help you.

Regards,

Shivani

View solution in original post

502 Views
toanjunifer
Senior Contributor I

Hi shivanipatel‌,

Sorry for late response. I also done it like your guide.

Thank you so much.

Have a nice day !