内核编译遇到的一些问题

我在编译内核的时候也不知道是我的编译方式有问题还是其他的原因(使用的是天嵌E8的开发板附带的源码,cpu是三星的s5pv210,内核版本3.0.8),遇到了很多的问题,下面就是我遇到的一些问题和解决方案,有些方案是我在网上找,有些是我自己想的,如果有什么不对的,请告知,谢谢!

问题1:
drivers/gpio/janz-ttl.c
implicit declaration of function 'iowrite16be'
解决方案:
添加宏定义:#define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr))

问题2:
drivers/char/s3c_mem.c中没有mach/map.h
解决方案:
去掉该文件中#include <mach/map.h>

问题3:
drivers/input/touchscreen/eeti_ts.c:65: error: implicit declaration of function 'irq_to_gpio'
解决方案:
a、raumfeld.c
static struct eeti_ts_platform_data eeti_ts_pdata = {
.irq_active_high = 1,
.gpio = GPIO_TOUCH_IRQ,//添加
};
b、/drivers/input/touchscreen/eeti_ts.c
struct eeti_ts_priv {
struct input_dev *input;
struct work_struct work;
struct mutex mutex;
int irq, irq_active_high;//删除
int irq, gpio, irq_active_high;//添加
};
static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
{
return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;//删除
return gpio_get_value(priv->gpio) == priv->irq_active_high;//添加
}

if (pdata)
priv->irq_active_high = pdata->irq_active_high;
替换为
if (pdata) {
priv->gpio = pdata->gpio;
priv->irq_active_high = pdata->irq_active_high;
}

c、/include/linux/input/eeti_ts.h
struct eeti_ts_platform_data {
unsigned int irq_active_high;
unsigned int gpio;//添加
};

问题4:
drivers/mfd/ezx-pcap.c:205: error: implicit declaration of function 'irq_to_gpio'
解决方案:
这个因为没有找到解决的办法,所以就自己定义了这个变量


问题5:
drivers/mmc/core/mmc_ops.c:20:22: error: plat/cpu.h: No such file or directory
解决方案:
将头文件去掉

问题6:
drivers/mmc/host/sdhci.c中:S3C64XX_SDHCI_CONTROL4,S3C64XX_SDHCI_CONTROL4_BUSY未定义
解决方案:
头文件所在arch/arm/plat-samsung/include/plat/regs-sdhci.h中
实在不行就将定义拷过去

问题7:
drivers/scsi/osd/osd_initiator.c:67: error: size of array 'type name' is negative
解决方案:
注释掉报错的行,该内容定义以后并未被使用

问题8:
drivers/scsi/advansys.c:8376: error: implicit declaration of function 'dma_cache_sync'
解决方案:
该函数已经被放弃了,直接注释

问题9:
EABI版本不一致,链接失败
解决方案:
这个是由编译器版本过高导致的,在内核编译选项中选择Kernel Features中的Use the ARM EABI to compile the kernel

问题10:
drivers/staging/dt3155v4l/dt3155v4l.c:434: error: implicit declaration of function 'kzalloc'
解决方案:
添加头文件<linux/slab.h>

问题11:
drivers/staging/iio/accel/lis3l02dq_core.c:708: error: implicit declaration of function 'irq_to_gpio'
drivers/staging/iio/accel/lis3l02dq_ring.c:297: error: implicit declaration of function 'irq_to_gpio'
drivers/staging/iio/accel/sca3000_core.c:1169: error: implicit declaration of function 'irq_to_gpio'
drivers/staging/iio/imu/adis16400_core.c:822: error: implicit declaration of function 'irq_to_gpio'
解决方案:
这几个文件中的引用头文件中<linux/gpio.h>包含了该函数的定义

问题12:
drivers/staging/solo6x10/core.c:140: error: implicit declaration of function 'kzalloc'
drivers/staging/solo6x10/p2m.c:52: error: implicit declaration of function 'kzalloc'
drivers/staging/solo6x10/enc.c:101: error: implicit declaration of function 'kzalloc'
drivers/staging/solo6x10/g723.c:139: error: implicit declaration of function 'kzalloc'
解决方案:
添加头文件#include <linux/slab.h>

问题13:
drivers/staging/vme/bridges/vme_tsi148.c:130: error: implicit declaration of function 'ioread32be'
drivers/staging/vme/bridges/vme_tsi148.c:133: error: implicit declaration of function 'ioread32be'
drivers/tty/serial/uartlite.c:79: error: implicit declaration of function 'ioread32be'
drivers/tty/serial/uartlite.c:125: error: implicit declaration of function 'iowrite32be'
解决方案:
#define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr))
#define ioread32be(addr) be32_to_cpu(ioread32(addr))

原文地址:https://www.cnblogs.com/CHYI1/p/5575591.html