Re: Getting problem while building kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Thu, 11 Oct 2007 15:53:41 +0100 (BST)
mahamuni ashish <[email protected]> escribió:

> Hi all,
> I am trying to build the following module and getting
> below specified error.please help me for successful
> compilation
> here is my code(ins.c)
> --------------------------
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> 
> MODULE_LICENSE("Dual BSD/GPL");
> 
> static int hello_init(void)
> {
> 	printk(KERN_ALERT "Hello, world\n");
> 	return 0;
> }
> 
> static void hello_exit(void)
> {
> 	printk(KERN_ALERT "Goodbye, cruel world\n");
> }
> 
> module_init(hello_init);
> module_exit(hello_exit);
> --------------------------
> [root@localhost device_driver]# make
> 
> gcc -O2 -DMODULE -D__KERNEL__ -isystem 
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include   -c
> -o ins.o ins.c
> 'In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/thread_info.h:16,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/thread_info.h:21,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/preempt.h:9,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/spinlock.h:49,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/capability.h:45,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/sched.h:44,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:9,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/processor.h:80:
> error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here
> (not in a function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/processor.h:80:
> error: requested alignment is not a constant
> In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/sched.h:49,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:9,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:33:3:
> error: #error You lose.
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:210:31:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:254:46:
> error: division by zero in #if
> In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/sched.h:49,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:9,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_to_msecs’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:259:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:259:
> error: (Each undeclared identifier is reported only
> once
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:259:
> error: for each function it appears in.)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:265:46:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_to_usecs’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:270:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:278:46:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘msecs_to_jiffies’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:283:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:291:46:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘usecs_to_jiffies’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:296:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘timespec_to_jiffies’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:315:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:321:
> error: ‘SHIFT_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_to_timespec’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:334:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘timeval_to_jiffies’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:356:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:360:
> error: ‘SHIFT_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_to_timeval’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:372:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:385:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_to_clock_t’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:386:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘clock_t_to_jiffies’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:397:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:416:6:
> error: division by zero in #if
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:
> In function ‘jiffies_64_to_clock_t’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/jiffies.h:417:
> error: ‘CONFIG_HZ’ undeclared (first use in this
> function)
> In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/rwsem.h:24,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:42,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/sched.h:57,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:9,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:
> In function ‘__down_read’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:104:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:
> In function ‘__down_write_nested’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:156:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:
> In function ‘__up_read’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:198:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:
> In function ‘__up_write’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:224:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:
> In function ‘__downgrade_write’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/rwsem.h:249:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/sched.h:57,
>                  from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:9,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:
> In function ‘down’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:105:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:
> In function ‘down_interruptible’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:130:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:
> In function ‘down_trylock’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:155:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:
> In function ‘up’:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/semaphore.h:179:
> error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’
> In file included from
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/linux/module.h:22,
>                  from ins.c:2:
> /usr/src/kernels/2.6.18-1.2798.fc6-i686/include/asm/module.h:65:2:
> error: #error unknown processor family
> make: *** [ins.o] Error 1
> [root@localhost device_driver]# 
> 
> 
> 
> 
>       Get the freedom to save as many mails as you wish. To know how,
> go to
> http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
> 
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

here's a little tutorial
http://vmlinux.org/jocke/linux/external-modules-2.6.shtml

kbuild do the trick

-- 
Gustavo Chaín Dumit
Alumno de Ingeniería de Ejecución Informática
Pontificia Universidad Católica de Valparaiso
http://aleph.homeunix.com/~gchain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux