嵌入式内核编译错误解决办法

2019-07-12 21:09发布

本解决办法从网络搜集整理,仅供个人学习之用
1,implicit declaration of function 'kzalloc'
解决方法  #include
2,implicit declaration of function 'iowrite16be' 解决方法
gedit drivers/gpio/janz-ttl.c
在前面加上下述定义

#define iowrite16be(v, addr)    iowrite8(v,addr)

3,error: implicit declaration of function 'irq_to_gpio'
drivers/input/touchscreen/eeti_ts.c: In function 'eeti_ts_irq_active':
drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio'

解决办法 方法:
更改的地方总共包括三个文件
arch/arm/mach-pxa/raumfeld.c        |    1 +
drivers/input/touchscreen/eeti_ts.c |    8 +++++---
 include/linux/input/eeti_ts.h       |    1 +
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;//添加
}
static int __devinit eeti_ts_probe(struct i2c_client *client,
 
  pdata = client->dev.platform_data;
下面两句
==========================================
 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,implicit declaration of function `dma_cache_sync'表示隐式声明错 解决办法 直接在advansys.c中把
a,dma_cache_sync(board->dev, scp->sense_buffer,
               SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
注释掉,编译就OK了 b,drivers/scsi/osd/osd_initiator.c: In function 'build_test':
drivers/scsi/osd/osd_initiator.c:67: error: size of array 'type name' is negative
drivers/scsi/osd/osd_initiator.c:68: error: size of array 'type name' is negative

注释掉buildtest中的内容