아래의 기본 hello.c 모듈 컴파일 에러가 나길래 Makefile을 이용하지 않고 커맨드로
gcc -D__KERNEL__ -DMODULE -I/usr/src/linux-headers-2.6.32-21-generic/include/ -g -Wall -c hello.c
라고 주어봤더나 아래와 같은 에러가 나오네요
무언가 제가 기본적인 설정을 안한것인가요?
우분투 버젼은 10.04 LTS입니다.
[code:2gk58um5]
gcc -D__KERNEL__ -DMODULE -I/usr/src/linux-headers-2.6.32-21-generic/include/ -g -Wall -c hello.c
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/list.h:6,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:9,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
/usr/src/linux-headers-2.6.32-21-generic/include/linux/prefetch.h:15:23: error: asm/cache.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:9,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/list.h:7:24: error: asm/system.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kernel.h:11,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/linkage.h:5:25: error: asm/linkage.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kernel.h:15,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:17:24: error: asm/bitops.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kernel.h:15,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h: In function ‘get_bitmask_order’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:29: warning: implicit declaration of function ‘fls’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h: In function ‘hweight_long’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight32’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:45: warning: implicit declaration of function ‘hweight64’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h: In function ‘fls_long’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:112: warning: implicit declaration of function ‘fls64’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h: In function ‘__ffs64’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/bitops.h:127: warning: implicit declaration of function ‘__ffs’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/cache.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:7,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/kernel.h:21:21: error: asm/bug.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/preempt.h:9,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/spinlock.h:50,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:56:29: error: asm/thread_info.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/preempt.h:9,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/spinlock.h:50,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:65: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:65: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: In function ‘set_ti_thread_flag’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:67: warning: implicit declaration of function ‘set_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:67: error: dereferencing pointer to incomplete type
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:70: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: In function ‘clear_ti_thread_flag’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:72: warning: implicit declaration of function ‘clear_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:72: error: dereferencing pointer to incomplete type
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:75: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: In function ‘test_and_set_ti_thread_flag’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:77: warning: implicit declaration of function ‘test_and_set_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:77: error: dereferencing pointer to incomplete type
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:80: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: In function ‘test_and_clear_ti_thread_flag’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:82: warning: implicit declaration of function ‘test_and_clear_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:82: error: dereferencing pointer to incomplete type
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:85: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h: In function ‘test_ti_thread_flag’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:87: warning: implicit declaration of function ‘test_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/thread_info.h:87: error: dereferencing pointer to incomplete type
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/spinlock.h: In function ‘smp_mb__after_lock’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/spinlock.h:137: warning: implicit declaration of function ‘smp_mb’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:29,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/spinlock.h:321:24: error: asm/atomic.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h: In function ‘write_seqlock’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:64: warning: implicit declaration of function ‘smp_wmb’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h: In function ‘read_seqbegin’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:92: warning: implicit declaration of function ‘smp_rmb’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/seqlock.h:94: warning: implicit declaration of function ‘cpu_relax’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:9,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/math64.h:5:23: error: asm/div64.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/time.h:9,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/stat.h:60,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:10,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/math64.h: In function ‘div_u64_rem’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/math64.h:43: warning: implicit declaration of function ‘do_div’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:9,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/wait.h:26:25: error: asm/current.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/bitmap.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h:95,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:16,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/string.h:21:24: error: asm/string.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:16,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h: In function ‘__first_node’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h:239: warning: implicit declaration of function ‘find_first_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h: In function ‘__next_node’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h:245: warning: implicit declaration of function ‘find_next_bit’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h: In function ‘__first_unset_node’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/nodemask.h:263: warning: implicit declaration of function ‘find_first_zero_bit’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:20:22: error: asm/page.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:346: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/notifier.h:13,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/memory_hotplug.h:6,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:653,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mutex.h: In function ‘mutex_is_locked’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mutex.h:118: warning: implicit declaration of function ‘atomic_read’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/notifier.h:14,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/memory_hotplug.h:6,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:653,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/memory_hotplug.h:6,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:653,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/notifier.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/notifier.h:62: error: field ‘rwsem’ has incomplete type
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h: In function ‘populated_zone’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:686: error: ‘struct zone’ has no member named ‘present_pages’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h: In function ‘is_normal’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:735: error: ‘struct zone’ has no member named ‘zone_pgdat’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:7,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/topology.h:34:26: error: asm/topology.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmdebug.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:8,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/autoconf.h:989:1: warning: "CONFIG_NR_CPUS" redefined
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/mmzone.h:12,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:4,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/threads.h:16:1: warning: this is the location of the previous definition
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/kmod.h:22,
from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:13,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h: In function ‘allocflags_to_migratetype’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:121: warning: implicit declaration of function ‘WARN_ON’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h: In function ‘gfp_zone’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:219: error: ‘ZONE_DMA’ undeclared (first use in this function)
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:219: error: (Each undeclared identifier is reported only once
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:219: error: for each function it appears in.)
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:219: error: ‘ZONE_HIGHMEM’ undeclared (first use in this function)
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h: In function ‘alloc_pages_node’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/gfp.h:284: warning: implicit declaration of function ‘cpu_to_node’
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:14,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/elf.h:7:21: error: asm/elf.h: No such file or directory
In file included from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:20:23: error: asm/local.h: No such file or directory
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:21:24: error: asm/module.h: No such file or directory
In file included from /usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:23,
from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/trace/events/module.h: In function ‘trace_module_load’:
/usr/src/linux-headers-2.6.32-21-generic/include/trace/events/module.h:18: warning: implicit declaration of function ‘smp_read_barrier_depends’
In file included from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:302: error: field ‘arch’ has incomplete type
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:319: error: expected specifier-qualifier-list before ‘Elf_Sym’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h: In function ‘__module_get’:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:470: warning: implicit declaration of function ‘local_inc’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:470: warning: implicit declaration of function ‘__module_ref_addr’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:472: warning: implicit declaration of function ‘local_read’
In file included from hello.c:2:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h: At top level:
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:712: warning: type defaults to ‘int’ in declaration of ‘Elf_Ehdr’
/usr/src/linux-headers-2.6.32-21-generic/include/linux/module.h:712: error: expected ‘;’, ‘,’ or ‘)’ before ‘’ token
hello.c: In function ‘hello_init’:
hello.c:6: error: expected ‘)’ before ‘Hello’
hello.c:6: error: stray ‘\’ in program
hello.c:6:39: warning: missing terminating " character
hello.c:6: error: missing terminating " character
hello.c:8: error: expected ‘;’ before ‘}’ token
hello.c:8: warning: no return statement in function returning non-void
root@hejeon-desktop:/study/chapter01#
[/code:2gk58um5]