/******************************************************************************** * I.MX6 linux kernel编译错误处理 * 声明: * 本文仅仅是对I.MX6的linux内核编译出错,记录其对应的处理方法。 * * 2015-10-15 晴 深圳 南山平山村 曾剑锋 *******************************************************************************/ 参考文章: 1. Android JB4.2.2_1.0.0 issue: MFG Firmware build does not compile https://community.freescale.com/thread/307477 2. honycomb-x86: build failed on ubuntu for traget-product 'vm' https://code.google.com/p/android-x86/issues/detail?id=487 3. AR1021In Production http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en557224 一、编译错误: LD init/built-in.o LD .tmp_vmlinux1 drivers/built-in.o: In function `mxc_hdmi_remove': clkdev.c:(.text+0x125e0): undefined reference to `switch_dev_unregister' clkdev.c:(.text+0x125ec): undefined reference to `switch_dev_unregister' drivers/built-in.o: In function `hotplug_worker': clkdev.c:(.text+0x1445c): undefined reference to `switch_set_state' clkdev.c:(.text+0x1446c): undefined reference to `switch_set_state' clkdev.c:(.text+0x1466c): undefined reference to `switch_set_state' clkdev.c:(.text+0x1467c): undefined reference to `switch_set_state' drivers/built-in.o: In function `mxc_hdmi_probe': clkdev.c:(.devinit.text+0x3c8): undefined reference to `switch_dev_register' clkdev.c:(.devinit.text+0x3d4): undefined reference to `switch_dev_register' sound/built-in.o: In function `usb_audio_disconnect': last.c:(.text+0x16b20): undefined reference to `switch_set_state' last.c:(.text+0x16b28): undefined reference to `switch_dev_unregister' sound/built-in.o: In function `usb_audio_probe': last.c:(.text+0x16f84): undefined reference to `switch_dev_register' last.c:(.text+0x17008): undefined reference to `switch_set_state' last.c:(.text+0x170e4): undefined reference to `switch_dev_register' sound/built-in.o: In function `hp_jack_status_check': last.c:(.text+0x368b0): undefined reference to `switch_set_state' last.c:(.text+0x36944): undefined reference to `switch_set_state' sound/built-in.o: In function `imx_wm8962_remove': last.c:(.devexit.text+0x2b8): undefined reference to `switch_dev_unregister' sound/built-in.o: In function `imx_wm8962_probe': last.c:(.devinit.text+0x6e4): undefined reference to `switch_dev_register' last.c:(.devinit.text+0x718): undefined reference to `switch_set_state' make: *** [.tmp_vmlinux1] Error 1 解决方法: 主要是make menuconfig打开swith这个选项,详情参考文章1。 二、编译错误: LD kernel/built-in.o CC drivers/gpu/drm/drm_auth.o In file included from include/drm/drmP.h:76:0, from drivers/gpu/drm/drm_auth.c:36: include/drm/drm.h:48:23: fatal error: sys/types.h: No such file or directory compilation terminated. make[3]: *** [drivers/gpu/drm/drm_auth.o] Error 1 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2 make: *** [drivers] Error 2 解决方法: 由于采用了Android自带的编译器,本来就不能用Android的编译器,导致出现了这个问题,所以换成Linux Qt的编译器就行了。 三、编译错误: CC [M] drivers/usb/gadget/audio.o CC [M] drivers/usb/gadget/ether.o drivers/usb/gadget/ether.c: In function 'rndis_do_config': drivers/usb/gadget/ether.c:249:2: error: too few arguments to function 'rndis_bind_config' drivers/usb/gadget/f_rndis.c:788:1: note: declared here drivers/usb/gadget/ether.c:250:1: warning: control reaches end of non-void function [-Wreturn-type] make[3]: *** [drivers/usb/gadget/ether.o] Error 1 make[2]: *** [drivers/usb/gadget] Error 2 make[1]: *** [drivers/usb] Error 2 make: *** [drivers] Error 2 解决方法: make menuconfig 去掉这部分驱动也许就行了。目前本人通过选择一个能够编译通过的文件系统 Device Drivers ---> [*] USB support ---> <*> USB Gadget Support ---> <*> USB Gadget Drivers (Gadget Filesystem (EXPERIMENTAL)) ---> (X) Gadget Filesystem (EXPERIMENTAL) 四、编译错误: Qt@aplex:~/kernel/linuxQt_kernel$ make uImage CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' is up to date. CALL scripts/checksyscalls.sh CHK include/generated/compile.h CC drivers/input/touchscreen/ar1020-spi.o drivers/input/touchscreen/ar1020-spi.c: In function 'ar1020_spi_probe': drivers/input/touchscreen/ar1020-spi.c:801:2: error: implicit declaration of function 'set_irq_type' [-Werror=implicit-function-declaration] drivers/input/touchscreen/ar1020-spi.c:802:13: warning: ignoring return value of 'request_irq', declared with attribute warn_unused_result [-Wunused-result] cc1: some warnings being treated as errors make[3]: *** [drivers/input/touchscreen/ar1020-spi.o] Error 1 make[2]: *** [drivers/input/touchscreen] Error 2 make[1]: *** [drivers/input] Error 2 make: *** [drivers] Error 2 解决方法: //set_irq_type(i, IRQ_TYPE_EDGE_RISING); // 将中断引发类型放在request_irq()中 if (0 >= (ret=request_irq(i, test_irq_handler_func, IRQ_TYPE_EDGE_RISING, "AR1020 IRQ", priv))){ ...... }