Re: Getting problem while building kernel module

From: Gustavo Chain
Date: Thu Oct 11 2007 - 11:46:13 EST


El Thu, 11 Oct 2007 15:53:41 +0100 (BST)
mahamuni ashish <ash_lkp@xxxxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/