Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
01-08-2009, 05:40 PM
|
#1
|
|
Member
Registered: Apr 2006
Posts: 46
Rep:
|
Have a trouble with compiling simple dirver.
Hi, ppl. I'm from windows world, but very much like to switch to real
working with hardwere, here is my problem:
i need to compile such a simple dirver(using Fedora 8):
<code>
#include <linux/module.h>
static int hello_init(void)
{
return 0;
}
static void hello_exit(void)
{
return;
}
module_init(hello_init);
module_exit(hello_exit);
</code>
While trying to compile a this simple piece of software I have went through many difficulties such as compiling and installing kernel and
learned much things but still have errors. I learned that some headers needed to be installed, but there so many Linux clones and everyone of them use different schedules to do this. There comes errors:
Code:
gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes -Wmissing-prototypes -isystem /lib/modules/`uname -r`/build/include -c -o hello.o hello.c
In file included from /lib/modules/2.6.28/build/include/linux/prefetch.h:13,
from /lib/modules/2.6.28/build/include/linux/list.h:6,
from /lib/modules/2.6.28/build/include/linux/module.h:9,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/types.h:198: error: expected =', ,', ;', asm' or __attribute__' before phys_addr_t'
/lib/modules/2.6.28/build/include/linux/types.h:201: error: expected =', ,', ;', asm' or __attribute__' before resource_size_t'
In file included from /lib/modules/2.6.28/build/include/linux/list.h:6,
from /lib/modules/2.6.28/build/include/linux/module.h:9,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
/lib/modules/2.6.28/build/include/linux/prefetch.h:15:23: error: asm/cache.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/module.h:9,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/list.h:7:24: error: asm/system.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/kernel.h:11,
from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/linkage.h:5:25: error: asm/linkage.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/kernel.h:15,
from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/bitops.h:17:24: error: asm/bitops.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/kernel.h:16,
from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/log2.h:32: error: expected )' before n'
/lib/modules/2.6.28/build/include/linux/log2.h:40: error: expected )' before n'
In file included from /lib/modules/2.6.28/build/include/linux/byteorder/little_endian.h:106,
from /usr/include/asm/byteorder.h:53,
from /lib/modules/2.6.28/build/include/linux/kernel.h:20,
from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:143: error: expected declaration specifiers or ...' before u16'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function le16_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:145: error: val' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:145: error: (Each undeclared identifier is reported only once
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:145: error: for each function it appears in.)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: At top level:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:148: error: expected declaration specifiers or ...' before u32'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function le32_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:150: error: val' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: At top level:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:153: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function le64_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:155: error: val' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: At top level:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:158: error: expected declaration specifiers or ...' before u16'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function be16_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:160: error: val' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: At top level:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:163: error: expected declaration specifiers or ...' before u32'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function be32_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:165: error: val' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: At top level:
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:168: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h: In function be64_add_cpu':
/lib/modules/2.6.28/build/include/linux/byteorder/generic.h:170: error: val' undeclared (first use in this function)
In file included from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/kernel.h:21:21: error: asm/bug.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/cache.h:4,
from /lib/modules/2.6.28/build/include/linux/time.h:7,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/kernel.h: At top level:
/lib/modules/2.6.28/build/include/linux/kernel.h:314: error: expected declaration specifiers or ...' before u8'
/lib/modules/2.6.28/build/include/linux/kernel.h: In function pack_hex_byte':
/lib/modules/2.6.28/build/include/linux/kernel.h:316: error: byte' undeclared (first use in this function)
In file included from /lib/modules/2.6.28/build/include/linux/preempt.h:9,
from /lib/modules/2.6.28/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.28/build/include/linux/seqlock.h:29,
from /lib/modules/2.6.28/build/include/linux/time.h:8,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/thread_info.h: At top level:
/lib/modules/2.6.28/build/include/linux/thread_info.h:26: error: expected specifier-qualifier-list before u32'
/lib/modules/2.6.28/build/include/linux/thread_info.h:39: error: expected specifier-qualifier-list before u64'
In file included from /lib/modules/2.6.28/build/include/linux/preempt.h:9,
from /lib/modules/2.6.28/build/include/linux/spinlock.h:50,
from /lib/modules/2.6.28/build/include/linux/seqlock.h:29,
from /lib/modules/2.6.28/build/include/linux/time.h:8,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/thread_info.h:55:29: error: asm/thread_info.h: No such file or directory
/lib/modules/2.6.28/build/include/linux/thread_info.h: In function set_ti_thread_flag':
/lib/modules/2.6.28/build/include/linux/thread_info.h:66: error: dereferencing pointer to incomplete type
/lib/modules/2.6.28/build/include/linux/thread_info.h: In function clear_ti_thread_flag':
/lib/modules/2.6.28/build/include/linux/thread_info.h:71: error: dereferencing pointer to incomplete type
/lib/modules/2.6.28/build/include/linux/thread_info.h: In function test_and_set_ti_thread_flag':
/lib/modules/2.6.28/build/include/linux/thread_info.h:76: error: dereferencing pointer to incomplete type
/lib/modules/2.6.28/build/include/linux/thread_info.h: In function test_and_clear_ti_thread_flag':
/lib/modules/2.6.28/build/include/linux/thread_info.h:81: error: dereferencing pointer to incomplete type
/lib/modules/2.6.28/build/include/linux/thread_info.h: In function test_ti_thread_flag':
/lib/modules/2.6.28/build/include/linux/thread_info.h:86: error: dereferencing pointer to incomplete type
In file included from /lib/modules/2.6.28/build/include/linux/seqlock.h:29,
from /lib/modules/2.6.28/build/include/linux/time.h:8,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/spinlock.h:348:24: error: asm/atomic.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/seqlock.h:29,
from /lib/modules/2.6.28/build/include/linux/time.h:8,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/spinlock.h: At top level:
/lib/modules/2.6.28/build/include/linux/spinlock.h:357: error: expected )' before *' token
In file included from /lib/modules/2.6.28/build/include/linux/time.h:9,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/math64.h:5:23: error: asm/div64.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/time.h:9,
from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/math64.h:66: error: expected =', ,', ;', asm' or __attribute__' before div_u64'
/lib/modules/2.6.28/build/include/linux/math64.h:77: error: expected =', ,', ;', asm' or __attribute__' before div_s64'
/lib/modules/2.6.28/build/include/linux/math64.h:84: error: expected =', ,', ;', asm' or __attribute__' before iter_div_u64_rem'
/lib/modules/2.6.28/build/include/linux/math64.h:87: error: expected =', ,', ;', asm' or __attribute__' before __iter_div_u64_rem'
In file included from /lib/modules/2.6.28/build/include/linux/stat.h:60,
from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/time.h:133: error: expected )' before nsec'
/lib/modules/2.6.28/build/include/linux/time.h:145: error: expected =', ,', ;', asm' or __attribute__' before timespec_to_ns'
/lib/modules/2.6.28/build/include/linux/time.h:157: error: expected =', ,', ;', asm' or __attribute__' before timeval_to_ns'
/lib/modules/2.6.28/build/include/linux/time.h:169: error: expected ;', ,' or )' before nsec'
/lib/modules/2.6.28/build/include/linux/time.h:177: error: expected ;', ,' or )' before nsec'
/lib/modules/2.6.28/build/include/linux/time.h:187: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/time.h: In function timespec_add_ns':
/lib/modules/2.6.28/build/include/linux/time.h:189: error: ns' undeclared (first use in this function)
In file included from /lib/modules/2.6.28/build/include/linux/module.h:10,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/stat.h: At top level:
/lib/modules/2.6.28/build/include/linux/stat.h:63: error: expected specifier-qualifier-list before u64'
In file included from /lib/modules/2.6.28/build/include/linux/mmzone.h:9,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/wait.h:26:25: error: asm/current.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/bitmap.h:8,
from /lib/modules/2.6.28/build/include/linux/nodemask.h:89,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/string.h:19:24: error: asm/string.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/nodemask.h:89,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:16,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_zero':
/lib/modules/2.6.28/build/include/linux/bitmap.h:142: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_fill':
/lib/modules/2.6.28/build/include/linux/bitmap.h:157: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_copy':
/lib/modules/2.6.28/build/include/linux/bitmap.h:163: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_and':
/lib/modules/2.6.28/build/include/linux/bitmap.h:174: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_or':
/lib/modules/2.6.28/build/include/linux/bitmap.h:183: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_xor':
/lib/modules/2.6.28/build/include/linux/bitmap.h:192: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_andnot':
/lib/modules/2.6.28/build/include/linux/bitmap.h:201: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_complement':
/lib/modules/2.6.28/build/include/linux/bitmap.h:210: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_equal':
/lib/modules/2.6.28/build/include/linux/bitmap.h:219: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_intersects':
/lib/modules/2.6.28/build/include/linux/bitmap.h:228: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_subset':
/lib/modules/2.6.28/build/include/linux/bitmap.h:237: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_empty':
/lib/modules/2.6.28/build/include/linux/bitmap.h:245: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_full':
/lib/modules/2.6.28/build/include/linux/bitmap.h:253: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_weight':
/lib/modules/2.6.28/build/include/linux/bitmap.h:261: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_shift_right':
/lib/modules/2.6.28/build/include/linux/bitmap.h:269: error: BITS_PER_LONG' undeclared (first use in this function)
/lib/modules/2.6.28/build/include/linux/bitmap.h: In function bitmap_shift_left':
/lib/modules/2.6.28/build/include/linux/bitmap.h:278: error: BITS_PER_LONG' undeclared (first use in this function)
In file included from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/mmzone.h: At top level:
/lib/modules/2.6.28/build/include/linux/mmzone.h:333: error: expected specifier-qualifier-list before atomic_long_t'
In file included from /lib/modules/2.6.28/build/include/linux/notifier.h:13,
from /lib/modules/2.6.28/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:640,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/mutex.h:50: error: expected specifier-qualifier-list before atomic_t'
/lib/modules/2.6.28/build/include/linux/mutex.h: In function mutex_is_locked':
/lib/modules/2.6.28/build/include/linux/mutex.h:117: error: struct mutex' has no member named count'
In file included from /lib/modules/2.6.28/build/include/linux/notifier.h:14,
from /lib/modules/2.6.28/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:640,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/memory_hotplug.h:6,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:640,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/notifier.h: At top level:
/lib/modules/2.6.28/build/include/linux/notifier.h:62: error: field rwsem' has incomplete type
In file included from /lib/modules/2.6.28/build/include/linux/mmzone.h:640,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/memory_hotplug.h:214: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/memory_hotplug.h:214: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/memory_hotplug.h:215: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/memory_hotplug.h:215: error: expected declaration specifiers or ...' before u64'
/lib/modules/2.6.28/build/include/linux/memory_hotplug.h:216: error: expected )' before start'
In file included from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/mmzone.h: In function populated_zone':
/lib/modules/2.6.28/build/include/linux/mmzone.h:673: error: struct zone' has no member named present_pages'
/lib/modules/2.6.28/build/include/linux/mmzone.h: In function is_normal':
/lib/modules/2.6.28/build/include/linux/mmzone.h:722: error: struct zone' has no member named zone_pgdat'
In file included from /lib/modules/2.6.28/build/include/linux/topology.h:30,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:763,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/cpumask.h: At top level:
/lib/modules/2.6.28/build/include/linux/cpumask.h:279: error: BITS_PER_LONG' undeclared here (not in a function)
In file included from /lib/modules/2.6.28/build/include/linux/topology.h:33,
from /lib/modules/2.6.28/build/include/linux/mmzone.h:763,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/smp.h:20: error: expected specifier-qualifier-list before u16'
In file included from /lib/modules/2.6.28/build/include/linux/mmzone.h:763,
from /lib/modules/2.6.28/build/include/linux/gfp.h:4,
from /lib/modules/2.6.28/build/include/linux/kmod.h:22,
from /lib/modules/2.6.28/build/include/linux/module.h:13,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/topology.h:34:26: error: asm/topology.h: No such file or directory
In file included from /lib/modules/2.6.28/build/include/linux/kobject.h:24,
from /lib/modules/2.6.28/build/include/linux/module.h:16,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/kref.h:22: error: expected specifier-qualifier-list before atomic_t'
In file included from /lib/modules/2.6.28/build/include/linux/module.h:16,
from hello.c:1:
/lib/modules/2.6.28/build/include/linux/kobject.h:37: error: expected =', ,', ;', asm' or __attribute__' before uevent_seqnum'
In file included from /lib/modules/2.6.28/build/include/linux/rcupdate.h:39,
from /lib/modules/2.6.28/build/include/linux/tracepoint.h:18,
from /lib/modules/2.6.28/build/include/linux/module.h:19,
from hello.c:1:
Last edited by sulacco; 01-09-2009 at 01:04 PM.
|
|
|
|
01-08-2009, 07:34 PM
|
#2
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
|
Please use CODE /CODE tags arounf long listings as it's a pain to scroll through it all.
I find that creating a Makefile saves a lot of effort when compiling - especially kernel modules. Here's one that should work to test your hello.c program.
Code:
obj-m := hello.o
KERNELDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
Just create a textfile called Makefile in the directory of hello.c and run "make" from the console.
|
|
|
|
01-09-2009, 12:53 AM
|
#3
|
|
Member
Registered: Jun 2007
Distribution: Slackware, Gentoo, Debian
Posts: 36
Rep:
|
by the way
Hi sulacco,
I have a question, where is the <linux/init.h> #include command?
Regards,
|
|
|
|
01-09-2009, 12:34 PM
|
#4
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
Quote:
Originally Posted by Neuzen
Hi sulacco,
I have a question, where is the <linux/init.h> #include command?
Regards,
|
It's right at the top. Look closer. 
|
|
|
|
01-09-2009, 12:45 PM
|
#5
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
Quote:
Originally Posted by bgeddy
Please use CODE /CODE tags arounf long listings as it's a pain to scroll through it all.
I find that creating a Makefile saves a lot of effort when compiling - especially kernel modules. Here's one that should work to test your hello.c program.
Code:
obj-m := hello.o
KERNELDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
Just create a textfile called Makefile in the directory of hello.c and run "make" from the console.
|
I'm using this kind of makefile, but will try your version
Code:
TARGET:= hello
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf{target}.o
Last edited by sulacco; 01-09-2009 at 12:47 PM.
|
|
|
|
01-09-2009, 12:47 PM
|
#6
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
... but have a very distant understanding how it works
|
|
|
|
01-09-2009, 12:53 PM
|
#7
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
Quote:
Originally Posted by bgeddy
Please use CODE /CODE tags arounf long listings as it's a pain to scroll through it all.
I find that creating a Makefile saves a lot of effort when compiling - especially kernel modules. Here's one that should work to test your hello.c program.
Code:
obj-m := hello.o
KERNELDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
Just create a textfile called Makefile in the directory of hello.c and run "make" from the console.
|
I'm running your version of makefile but it says only that:
"Nothing can be done for `hello.c`"
What it is?
|
|
|
|
01-09-2009, 12:58 PM
|
#8
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
I think that the most important error string is this:
/lib/modules/2.6.28/build/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
maybe I shoud to create somewhere a link?
|
|
|
|
01-09-2009, 01:21 PM
|
#9
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
|
Sorry I'm sure what's going on here as your code compiles fine on my system with the Makefile. Maybe something worng with your kernel source ?
|
|
|
|
01-09-2009, 01:41 PM
|
#10
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
Quote:
Originally Posted by bgeddy
Sorry I'm sure what's going on here as your code compiles fine on my system with the Makefile. Maybe something worng with your kernel source ?
|
How to understand wrong something or not with kernel source?
I've just downloaded it from kernel.org and configured, compiled, compiled
modules, installed modules, then make install.
this is the schedule which I did:
make menuconfig
make
make modules
make modules_install
make install
then I checked grub.conf and saw that make utility already changed it.
Then I restarted comp and choose kernel 2.6.28 to load.
C programms compiled successfully, but with driver program there is problem.
|
|
|
|
01-09-2009, 02:00 PM
|
#11
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
here what i've got while using your version of makefile.
First it have to be such a command:
make hello.
Code:
[root@localhost ushka]# make hello
cc hello.c -o hello
hello.c:1:26: error: linux/module.h: No such file or directory
hello.c:15: warning: data definition has no type or storage class
hello.c:15: warning: parameter names (without types) in function declaration
hello.c:16: warning: data definition has no type or storage class
hello.c:16: warning: parameter names (without types) in function declaration
make: *** [hello] Error 1
|
|
|
|
01-09-2009, 02:01 PM
|
#12
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
the current path is /home/ushka
|
|
|
|
01-09-2009, 09:01 PM
|
#13
|
|
Member
Registered: Aug 2007
Distribution: Debian Squeeze
Posts: 46
Rep:
|
If I google linux/types.h:198: error: expected, I get several results.
http://lkml.indiana.edu/hypermail/li...10.1/1854.html
What I searched for is part of the first line with an error.
Assuming the link I provided helps, the problem is that you compiled in the same directory that the source is in. You're allowed to, but I think it's frowned upon. What I do is to use O=../build2.6.28 as one of the args for make each time. (do mkdir ../build2.6.28 first though!)
|
|
|
|
01-10-2009, 06:28 AM
|
#14
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
|
DO NOT run this ! It won't work.
Quote:
|
Just create a textfile called Makefile in the directory of hello.c and run "make" from the console.
|
This is all you need to do. Create the file and type "make".
Quote:
|
Assuming the link I provided helps, the problem is that you compiled in the same directory that the source is in. You're allowed to, but I think it's frowned upon. What I do is to use O=../build2.6.28 as one of the args for make each time. (do mkdir ../build2.6.28 first though!)
|
There's absolutely nothing wrong in compiling in the source directory. The error is due to incorrectly running make.
Just to be sure all is well try this :
Quote:
rm hello.{mod.*,o,ko}
make
|
|
|
|
|
01-10-2009, 04:01 PM
|
#15
|
|
Member
Registered: Apr 2006
Posts: 46
Original Poster
Rep:
|
2bgeddy
if I run only:
here what I've got for answer:
Code:
make: Nothing to be done for `default'.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:11 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|