编写驱动时会用到内核提供的头文件。
比如
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm-generic/uaccess.h>
#include <asm-generic/irq.h>
#include <asm-generic/io.h>
#include <asm-generic/hardware.h>
使用gcc 编译:arm-linux-gcc -c -I/home/oxape/linux-3.0.1/include firstdev.c -o -firstdev.o
会出现
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:257:31: error: division by zero in #if
/home/oxape/linux-3.0.1/include/linux/jiffies.h:306: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jiffies_to_clock_t'
/home/oxape/linux-3.0.1/include/linux/jiffies.h:308: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jiffies_64_to_clock_t'
/home/oxape/linux-3.0.1/include/linux/jiffies.h:309: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'nsec_to_clock_t'
/home/oxape/linux-3.0.1/include/linux/jiffies.h:310: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'nsecs_to_jiffies64'
/home/oxape/linux-3.0.1/include/linux/jiffies.h:311: error: expected ')' before 'n'
In file included from /home/oxape/linux-3.0.1/include/linux/timer.h:5,
from /home/oxape/linux-3.0.1/include/linux/workqueue.h:8,
from /home/oxape/linux-3.0.1/include/linux/kmod.h:26,
from /home/oxape/linux-3.0.1/include/linux/module.h:13,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/ktime.h:47: error: expected specifier-qualifier-list before 's64'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_set':
/home/oxape/linux-3.0.1/include/linux/ktime.h:153: error: unknown field 'tv' specified in initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:153: error: extra brace group at end of initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:153: error: (near initialization for '(anonymous)')
/home/oxape/linux-3.0.1/include/linux/ktime.h:153: warning: excess elements in union initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:153: warning: (near initialization for '(anonymous)')
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_sub':
/home/oxape/linux-3.0.1/include/linux/ktime.h:167: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:167: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:167: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:168: error: 'ktime_t' has no member named 'tv'
/home/oxape/linux-3.0.1/include/linux/ktime.h:169: error: 'ktime_t' has no member named 'tv'
/home/oxape/linux-3.0.1/include/linux/ktime.h:169: error: 'NSEC_PER_SEC' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_add':
/home/oxape/linux-3.0.1/include/linux/ktime.h:185: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:185: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:185: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:194: error: 'ktime_t' has no member named 'tv'
/home/oxape/linux-3.0.1/include/linux/ktime.h:194: error: 'NSEC_PER_SEC' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h:195: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:195: error: 'u32' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h: At top level:
/home/oxape/linux-3.0.1/include/linux/ktime.h:207: error: expected declaration specifiers or '...' before 'u64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:216: error: expected declaration specifiers or '...' before 'u64'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'timespec_to_ktime':
/home/oxape/linux-3.0.1/include/linux/ktime.h:226: error: unknown field 'tv' specified in initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:226: error: extra brace group at end of initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:226: error: (near initialization for '(anonymous)')
/home/oxape/linux-3.0.1/include/linux/ktime.h:226: error: 's32' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h:226: error: expected '}' before 'ts'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'timeval_to_ktime':
/home/oxape/linux-3.0.1/include/linux/ktime.h:238: error: unknown field 'tv' specified in initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:238: error: extra brace group at end of initializer
/home/oxape/linux-3.0.1/include/linux/ktime.h:238: error: (near initialization for '(anonymous)')
/home/oxape/linux-3.0.1/include/linux/ktime.h:238: error: 's32' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h:238: error: expected '}' before 'tv'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_to_timespec':
/home/oxape/linux-3.0.1/include/linux/ktime.h:250: error: 'time_t' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h:250: error: expected '}' before 'kt'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_to_timeval':
/home/oxape/linux-3.0.1/include/linux/ktime.h:263: error: 'time_t' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/ktime.h:263: error: expected '}' before 'kt'
/home/oxape/linux-3.0.1/include/linux/ktime.h: At top level:
/home/oxape/linux-3.0.1/include/linux/ktime.h:273: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ktime_to_ns'
/home/oxape/linux-3.0.1/include/linux/ktime.h: In function 'ktime_equal':
/home/oxape/linux-3.0.1/include/linux/ktime.h:289: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h:289: error: 'ktime_t' has no member named 'tv64'
/home/oxape/linux-3.0.1/include/linux/ktime.h: At top level:
/home/oxape/linux-3.0.1/include/linux/ktime.h:292: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ktime_to_us'
/home/oxape/linux-3.0.1/include/linux/ktime.h:298: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ktime_to_ms'
/home/oxape/linux-3.0.1/include/linux/ktime.h:304: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ktime_us_delta'
/home/oxape/linux-3.0.1/include/linux/ktime.h:309: error: expected ';', ',' or ')' before 'usec'
/home/oxape/linux-3.0.1/include/linux/ktime.h:314: error: expected ';', ',' or ')' before 'usec'
/home/oxape/linux-3.0.1/include/linux/ktime.h:336: error: expected ')' before 'ns'
In file included from /home/oxape/linux-3.0.1/include/linux/timer.h:7,
from /home/oxape/linux-3.0.1/include/linux/workqueue.h:8,
from /home/oxape/linux-3.0.1/include/linux/kmod.h:26,
from /home/oxape/linux-3.0.1/include/linux/module.h:13,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/debugobjects.h:28: error: field 'node' has incomplete type
In file included from /home/oxape/linux-3.0.1/include/linux/workqueue.h:8,
from /home/oxape/linux-3.0.1/include/linux/kmod.h:26,
from /home/oxape/linux-3.0.1/include/linux/module.h:13,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/timer.h:17: error: field 'entry' has incomplete type
In file included from /home/oxape/linux-3.0.1/include/linux/kmod.h:26,
from /home/oxape/linux-3.0.1/include/linux/module.h:13,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/workqueue.h:80: error: expected specifier-qualifier-list before 'atomic_long_t'
/home/oxape/linux-3.0.1/include/linux/workqueue.h: In function 'to_delayed_work':
/home/oxape/linux-3.0.1/include/linux/workqueue.h:99: error: expected expression before 'struct'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:99: warning: return makes pointer from integer without a cast
/home/oxape/linux-3.0.1/include/linux/workqueue.h: At top level:
/home/oxape/linux-3.0.1/include/linux/workqueue.h:370: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flush_work'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:371: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flush_work_sync'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:372: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cancel_work_sync'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:374: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flush_delayed_work'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:375: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flush_delayed_work_sync'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:376: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cancel_delayed_work_sync'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:380: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'workqueue_congested'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:390: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cancel_delayed_work'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:405: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cancel_delayed_work'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:417: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/oxape/linux-3.0.1/include/linux/workqueue.h:425: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
In file included from /home/oxape/linux-3.0.1/include/linux/module.h:13,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/kmod.h:72: error: expected declaration specifiers or '...' before 'gfp_t'
/home/oxape/linux-3.0.1/include/linux/kmod.h: In function 'call_usermodehelper_fns':
/home/oxape/linux-3.0.1/include/linux/kmod.h:94: error: 'gfp_t' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/kmod.h:94: error: expected ';' before 'gfp_mask'
/home/oxape/linux-3.0.1/include/linux/kmod.h:96: error: 'gfp_mask' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/linux/kmod.h:96: error: too many arguments to function 'call_usermodehelper_setup'
/home/oxape/linux-3.0.1/include/linux/kmod.h: At top level:
/home/oxape/linux-3.0.1/include/linux/kmod.h:113: error: array type has incomplete element type
/home/oxape/linux-3.0.1/include/linux/kmod.h:119: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'usermodehelper_is_disabled'
In file included from /home/oxape/linux-3.0.1/include/linux/kobject.h:21,
from /home/oxape/linux-3.0.1/include/linux/module.h:16,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/sysfs.h:28: error: expected specifier-qualifier-list before 'mode_t'
/home/oxape/linux-3.0.1/include/linux/sysfs.h:58: error: expected specifier-qualifier-list before 'mode_t'
/home/oxape/linux-3.0.1/include/linux/sysfs.h:92: error: expected specifier-qualifier-list before 'ssize_t'
/home/oxape/linux-3.0.1/include/linux/sysfs.h:113: error: expected specifier-qualifier-list before 'ssize_t'
/home/oxape/linux-3.0.1/include/linux/sysfs.h:223: error: expected declaration specifiers or '...' before 'mode_t'
/home/oxape/linux-3.0.1/include/linux/sysfs.h:338: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sysfs_init'
In file included from /home/oxape/linux-3.0.1/include/linux/kobject.h:24,
from /home/oxape/linux-3.0.1/include/linux/module.h:16,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/kref.h:21: error: expected specifier-qualifier-list before 'atomic_t'
In file included from /home/oxape/linux-3.0.1/include/linux/module.h:16,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/kobject.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'uevent_seqnum'
/home/oxape/linux-3.0.1/include/linux/kobject.h:62: error: field 'entry' has incomplete type
/home/oxape/linux-3.0.1/include/linux/kobject.h:78: error: expected declaration specifiers or '...' before 'va_list'
/home/oxape/linux-3.0.1/include/linux/kobject.h:86: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_add'
/home/oxape/linux-3.0.1/include/linux/kobject.h:90: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_init_and_add'
/home/oxape/linux-3.0.1/include/linux/kobject.h:98: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_create'
/home/oxape/linux-3.0.1/include/linux/kobject.h:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_create_and_add'
/home/oxape/linux-3.0.1/include/linux/kobject.h:102: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_rename'
/home/oxape/linux-3.0.1/include/linux/kobject.h:103: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kobject_move'
/home/oxape/linux-3.0.1/include/linux/kobject.h:108: error: expected declaration specifiers or '...' before 'gfp_t'
/home/oxape/linux-3.0.1/include/linux/kobject.h:134: error: expected specifier-qualifier-list before 'ssize_t'
/home/oxape/linux-3.0.1/include/linux/kobject.h:162: error: field 'list' has incomplete type
/home/oxape/linux-3.0.1/include/linux/kobject.h:169: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kset_register'
/home/oxape/linux-3.0.1/include/linux/kobject.h:171: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kset_create_and_add'
/home/oxape/linux-3.0.1/include/linux/kobject.h: In function 'to_kset':
/home/oxape/linux-3.0.1/include/linux/kobject.h:177: error: expected expression before 'struct'
/home/oxape/linux-3.0.1/include/linux/kobject.h:177: warning: pointer/integer type mismatch in conditional expression
In file included from /home/oxape/linux-3.0.1/include/linux/module.h:17,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/moduleparam.h: At top level:
/home/oxape/linux-3.0.1/include/linux/moduleparam.h:51: error: expected specifier-qualifier-list before 'u16'
In file included from /home/oxape/linux-3.0.1/include/linux/rcupdate.h:42,
from /home/oxape/linux-3.0.1/include/linux/tracepoint.h:19,
from /home/oxape/linux-3.0.1/include/linux/module.h:18,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/completion.h:27: error: expected specifier-qualifier-list before 'wait_queue_head_t'
/home/oxape/linux-3.0.1/include/linux/completion.h: In function 'init_completion':
/home/oxape/linux-3.0.1/include/linux/completion.h:76: error: 'struct completion' has no member named 'wait'
/home/oxape/linux-3.0.1/include/linux/completion.h: At top level:
/home/oxape/linux-3.0.1/include/linux/completion.h:88: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'try_wait_for_completion'
/home/oxape/linux-3.0.1/include/linux/completion.h:89: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'completion_done'
In file included from /home/oxape/linux-3.0.1/include/linux/tracepoint.h:19,
from /home/oxape/linux-3.0.1/include/linux/module.h:18,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/rcupdate.h:160:2: error: #error "Unknown RCU implementation specified to kernel configuration"
In file included from /home/oxape/linux-3.0.1/include/linux/tracepoint.h:19,
from /home/oxape/linux-3.0.1/include/linux/module.h:18,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/rcupdate.h:666: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/oxape/linux-3.0.1/include/linux/rcupdate.h:685: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/oxape/linux-3.0.1/include/linux/rcupdate.h:812: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__is_kfree_rcu_offset'
/home/oxape/linux-3.0.1/include/linux/rcupdate.h: In function '__kfree_rcu':
/home/oxape/linux-3.0.1/include/linux/rcupdate.h:822: error: size of array 'type name' is negative
In file included from /home/oxape/linux-3.0.1/include/linux/tracepoint.h:20,
from /home/oxape/linux-3.0.1/include/linux/module.h:18,
from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/jump_label.h: At top level:
/home/oxape/linux-3.0.1/include/linux/jump_label.h:62: error: expected specifier-qualifier-list before 'atomic_t'
/home/oxape/linux-3.0.1/include/linux/jump_label.h:65: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'static_branch'
/home/oxape/linux-3.0.1/include/linux/jump_label.h: In function 'jump_label_inc':
/home/oxape/linux-3.0.1/include/linux/jump_label.h:74: error: 'struct jump_label_key' has no member named 'enabled'
/home/oxape/linux-3.0.1/include/linux/jump_label.h: In function 'jump_label_dec':
/home/oxape/linux-3.0.1/include/linux/jump_label.h:79: error: 'struct jump_label_key' has no member named 'enabled'
/home/oxape/linux-3.0.1/include/linux/jump_label.h: At top level:
/home/oxape/linux-3.0.1/include/linux/jump_label.h:90: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jump_label_enabled'
In file included from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/module.h:21:24: error: asm/module.h: No such file or directory
In file included from firstdev.c:1:
/home/oxape/linux-3.0.1/include/linux/module.h:53: error: expected specifier-qualifier-list before 'ssize_t'
/home/oxape/linux-3.0.1/include/linux/module.h:67: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__modver_version_show'
/home/oxape/linux-3.0.1/include/linux/module.h:608: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'is_module_address'
/home/oxape/linux-3.0.1/include/linux/module.h:613: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'is_module_percpu_address'
/home/oxape/linux-3.0.1/include/linux/module.h:618: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'is_module_text_address'
/home/oxape/linux-3.0.1/include/linux/module.h:737: error: expected ';', ',' or ')' before '*' token
In file included from firstdev.c:5:
/home/oxape/linux-3.0.1/include/linux/delay.h:14:23: error: asm/delay.h: No such file or directory
In file included from firstdev.c:6:
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:13:25: error: asm/segment.h: No such file or directory
In file included from firstdev.c:6:
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:29: error: expected ')' before 'fs'
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:78: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'long'
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:108: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'long'
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:311: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
/home/oxape/linux-3.0.1/include/asm-generic/uaccess.h:319: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
In file included from firstdev.c:8:
/home/oxape/linux-3.0.1/include/asm-generic/io.h:15:28: error: asm/cacheflush.h: No such file or directory
In file included from firstdev.c:8:
/home/oxape/linux-3.0.1/include/asm-generic/io.h:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__raw_readb'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__raw_readw'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__raw_readl'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:59: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:66: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:73: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:106: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'inb'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:111: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'inw'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:116: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'inl'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:121: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:126: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:131: error: expected ')' before 'b'
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'insb':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:147: error: 'u8' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:147: error: 'buf' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:149: error: expected ';' before 'x'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:150: error: 'x' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'insw':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:160: error: 'u16' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:160: error: 'buf' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:162: error: expected ';' before 'x'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:163: error: 'x' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'insl':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:173: error: 'u32' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:173: error: 'buf' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h:175: error: expected ';' before 'x'
/home/oxape/linux-3.0.1/include/asm-generic/io.h:176: error: 'x' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'outsb':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:186: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/home/oxape/linux-3.0.1/include/asm-generic/io.h:186: error: 'buf' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'outsw':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:198: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/home/oxape/linux-3.0.1/include/asm-generic/io.h:198: error: 'buf' undeclared (first use in this function)
/home/oxape/linux-3.0.1/include/asm-generic/io.h: In function 'outsl':
/home/oxape/linux-3.0.1/include/asm-generic/io.h:210: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/home/oxape/linux-3.0.1/include/asm-generic/io.h:210: error: 'buf' undeclared (first use in this function)
firstdev.c:9:34: error: asm-generic/hardware.h: No such file or directory
firstdev.c: At top level:
firstdev.c:11: warning: 'struct inode' declared inside parameter list
firstdev.c:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'first_dev_write'
firstdev.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'file_operations'
firstdev.c: In function 'first_dev_init':
firstdev.c:30: error: 'first_dev_fops' undeclared (first use in this function)
firstdev.c: At top level:
firstdev.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__used'
firstdev.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' be发布fore '__used'
看到网上说需要在内核源文件中使用 make header_install安装内核头文件,之后内核会吧头文件拷到usr/include目录下
执行后发现有写头文件没有拷过去,如modules.h