今天要試著編譯 zd1211 的驅動程式時, 出現了下面這個錯誤

error: linux/config.h: No such file or directory

 

在 mailing list 尋找相關的線索時, 發現其實不少人也有遇到類似的問題,  其中一種解決的方法如下

linux/config.h is deprecated from 2.6.19.
Simply sed or patch out any references to linux/config.h with linux/autoconf.h

 

我的 kernel 版本是 3.0.0-16-generic , 而 linux/config.h 在 2.6.19 時就被移除掉了, 

所以需要尋找 autoconf.h 這個標頭檔來替代,   尋找的方式是先到 /usr/src 這個目錄,

目錄內應該會有核心的標頭檔,  如  linux-headers-3.0.0-16-generic

 

尋找 autoconf.h

Allanh@/usr/src# find . -name autoconf.h -print
./linux-headers-3.0.0-16-generic/include/generated/autoconf.h
./linux-headers-3.0.0-17-generic/include/generated/autoconf.h
./linux-headers-3.0.0-15-generic/include/generated/autoconf.h
./linux-headers-3.0.0-14-generic/include/generated/autoconf.h
./linux-headers-3.0.0-12-generic/include/generated/autoconf.h

 

修改原始碼出錯的部份

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
#include <linux/autoconf.h>
#else
#include <generated/autoconf.h>
#endif

再重新編譯一次就過去了 :)

 

接下來第二個問題是 RW_LOCK_UNLOCKED 也被刪掉了, 

可參考 [PATCH] Fix deprecated RW_LOCK_UNLOCKED  的作法來解決, 

Linux kernel 2.6.39 removes deprecated RW_LOCK_UNLOCKED. It has been 
stated in include/linux/rwlock_types.h that one should use 
__RW_LOCK_UNLOCKED(lockname) or DEFINE_RWLOCK(x) marcros for static 
initialization

 

ref:

[教学] ubuntu 2.6.22 内核树建立

arrow
arrow
    創作者介紹
    創作者 allanh 的頭像
    allanh

    ンアハ的記事本

    allanh 發表在 痞客邦 留言(0) 人氣()