include/linux/autoconf.h or include/config/auto.conf are missing.

來源:互聯網
上載者:User

做了一個簡單的裝置驅動程式:

ARM_hello.c

#include <linux/module.h>static int hello_init(void){    printk("Hello, I am coming !\n");    return 0;}static void hello_exit(void){    printk("Goodbye, I Love Linux ! I Love ARM ! \n");}module_init(hello_init);module_exit(hello_exit);

Makefile:

#--------------------------for ARM----------------------------------CROSS_COMPILE := /opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-CC :=$(CROSS_COMPILE)gccKERNEL_DIR := /opt/FriendlyARM/mini2440/linux-2.6.32.2#------------------------------------------------------------------obj-m :=ARM_hello.oPWD := $(shell pwd)all:make -C $(KERNEL_DIR) M=$(PWD) modulesclean:rm -fr *.o *.ko *.mod.o *.mod.c .*.cmd *.order *.*s *~ .tmp*

執行

$ sudo make

出現如下錯誤:

ERROR: Kernel configuration is invalid.         include/linux/autoconf.h or include/config/auto.conf are missing.         Run 'make oldconfig && make prepare' on kernel src to fix it.

網上都說是要編譯核心什麼,make menuconfig 什麼的,當時不敢隨便編譯核心,怕把這個系統搞死了。

後來,突然想起來手冊我沒有完全看完,於是去翻手冊,原來真的要編譯核心,這個核心是ARM的核心,因為需要在PC上製造出一個和ARM也一樣的核心編譯環境,也就是交叉編譯環境,所以,按照手冊,編譯了一下ARM的那個核心。

具體操作在我的另一篇博文中:交叉編譯環境之編譯核心階段各種錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.