内核编译遇到的一些问题
编译内核遇到的问题,结合网上现有问题总结,mark。
问题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;//添加
};
报:
CC [M] drivers/input/touchscreen/cy8ctmg110_ts.o
CC [M] drivers/input/touchscreen/da9034-ts.o
CC [M] drivers/input/touchscreen/dynapro.o
CC [M] drivers/input/touchscreen/hampshire.o
CC [M] drivers/input/touchscreen/gunze.o
CC [M] drivers/input/touchscreen/eeti_ts.o
drivers/input/touchscreen/eeti_ts.c: In function 'eeti_ts_probe':
drivers/input/touchscreen/eeti_ts.c:209: error: 'struct eeti_ts_platform_data' has no member named 'gpio'
make[3]: *** [drivers/input/touchscreen/eeti_ts.o] Error 1
make[2]: *** [drivers/input/touchscreen] Error 2
make[1]: *** [drivers/input] Error 2
make: *** [drivers] Error 2
问题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))
问题14:
drivers/scsi/qla4xxx/ql4_nx.c: In function 'qla4_8xxx_pci_mem_read_direct':
drivers/scsi/qla4xxx/ql4_nx.c:717: error: implicit declaration of function 'readq'
drivers/scsi/qla4xxx/ql4_nx.c: In function 'qla4_8xxx_pci_mem_write_direct':
drivers/scsi/qla4xxx/ql4_nx.c:788: error: implicit declaration of function 'writeq'
make[3]: *** [drivers/scsi/qla4xxx/ql4_nx.o] Error 1
make[2]: *** [drivers/scsi/qla4xxx] Error 2
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2
解决方案:
/drivers/scsi/qla4xxx/ql4_nx.h
在#define MIU_TEST_AGT_WRDATA_UPPER_LO (0x0b0)
#define MIU_TEST_AGT_WRDATA_UPPER_HI (0x0b4)
添加下面内容
#ifndef readq
static inline u64 readq(void __iomem *addr)
{
return readl(addr) | (((u64) readl(addr + 4)) << 32LL);
}
#endif
#ifndef writeq
static inline void writeq(u64 val, void __iomem *addr)
{
writel(((u32) (val)), (addr));
writel(((u32) (val >> 32)), (addr + 4));
}
#endif