需求
用户驱动一般都会有这样类似的文件包含:
#include <asm/arch/hardware.h>
这就要求平台相关的头文件必须放在include/asm/arch/目录下,而LPC3250的平台相关头文件却放在arch/arm/mach-lpc32xx/include/mach/目录下,如下所示:
[chenxibing@localhost linux-2.6.27.8]$ ls arch/arm/mach-lpc32xx/include/mach/
board.h i2c.h lpc32xx_gpio.h lpc32xx_rtc.h lpc32xx_uart.h uncompress.h
clock.h io.h lpc32xx_hsuart.h lpc32xx_sdcard.h lpc32xx_usbd.h vmalloc.h
debug-macro.S irqs.h lpc32xx_i2c.h lpc32xx_slcnand.h memory.h
dma.h lpc32xx_clcdc.h lpc32xx_i2s.h lpc32xx_ssp.h platform.h
entry-macro.S lpc32xx_clkpwr.h lpc32xx_kscan.h lpc32xx_timer.h system.h
hardware.h lpc32xx_dmac.h lpc32xx_mac.h lpc32xx_tsc.h timex.h
为了不修改驱动程序代码,以保证代码的最大兼容性,我们可以做一个连接,将arch/arm/mach-lpc32xx/include/mach/连接到include/asm/arch/目录:
[chenxibing@localhost asm-arm]$ pwd
/home/chenxibing/lpc3250/linux-2.6.27.8/include/asm-arm
[chenxibing@localhost asm-arm]$ ln -s http://www.cnblogs.com/arch/arm/mach-lpc32xx/include/mach/ arch
最后得到的结果就是:
[chenxibing@localhost linux-2.6.27.8]$ ls include/asm-arm/arch/
board.h i2c.h lpc32xx_gpio.h lpc32xx_rtc.h lpc32xx_uart.h uncompress.h
clock.h io.h lpc32xx_hsuart.h lpc32xx_sdcard.h lpc32xx_usbd.h vmalloc.h
debug-macro.S irqs.h lpc32xx_i2c.h lpc32xx_slcnand.h memory.h
dma.h lpc32xx_clcdc.h lpc32xx_i2s.h lpc32xx_ssp.h platform.h
entry-macro.S lpc32xx_clkpwr.h lpc32xx_kscan.h lpc32xx_timer.h system.h
hardware.h lpc32xx_dmac.h lpc32xx_mac.h lpc32xx_tsc.h timex.h
这样,使用了#include <asm/arch/hardware.h> 的文件编译也不会出错了。