How to cross compile kernel driver on iMX6S ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to cross compile kernel driver on iMX6S ?

跳至解决方案
3,271 次查看
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

标签 (1)
1 解答
3,162 次查看
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

在原帖中查看解决方案

2 回复数
3,163 次查看
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

3,162 次查看
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 !