Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: LKM compilation


  • Subject: Re: lug-bg: LKM compilation
  • From: alex@xxxxxx (Alexander Atanasov)
  • Date: Sat, 13 Apr 2002 19:08:21 +0300 (EEST)



On Fri, 12 Apr 2002, Ilia Trendafilov wrote:

>     Zdraveite,
>   Poslednite dni si namerih nova zanimavka - pisaneto na LKMs
> Ne mi triabva za neshto seriozno, samo s poznavatelna cel. Obache imam
> slednia problem: dolnia mnogo prost source:
> ------------------------------------------
> #define MODVERSIONS
> #include <linux/modversions.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> 
> int init_module()
> {
> 	printk("<1> Hello World Module Start\n");
> 	return 0;
> }
> 
> void cleanup_module()
> {
> 	printk("<1> Hello World Module Cleanup\n");
> }
> ------------------------------------------
> compiliram s komanden red:
> ------------------------------------------
> [edac kmod]$ gcc -c -DMODULE -D__KERNEL__ -DLINUX m1hw.c
> In file included from m1hw.c:3:
> /usr/include/linux/kernel.h:73: parse error before `size_t'
> /usr/include/linux/kernel.h:75: parse error before `size_t'
> In file included from /usr/include/asm/page.h:16,
>                  from /usr/include/asm/processor.h:13,
>                  from /usr/include/linux/prefetch.h:13,
>                  from /usr/include/linux/list.h:6,
>                  from /usr/include/linux/module.h:12,
>                  from m1hw.c:4:
> /usr/include/asm/mmx.h:10: parse error before `size_t'
> ------------------------------------------
> Rovih se iz .h files ama ne mojah da vidia neshto trevojno.
> gcc 2.95.3, 
  ^^^^^^^^^^ tova tochno kakvo e ?
> kernel 2.4.18
> /*
> #define CONFIG_MODULES 1
> #define CONFIG_MODVERSIONS 1
> #define CONFIG_KMOD 1
> */
> /usr/include/asm e symlink kym /usr/src/linux/include/asm, koeto
> pyk e symlink kym /usr/src/linux/include/asm-i386
> /usr/include/linux e symlink kum /usr/src/linux/include/linux
> /* ako gornite neshta imat niakakvo znachenie */
> 
        Slackware - ne pomnia kakuv e tochno (s libc-2.1.3.so):
root@mars:/tmp# gcc -Wall -c -DMODULE -D__KERNEL__ -DLINUX t.c
root@mars:/tmp# insmod t.o
 Hello World Module Start
root@mars:/tmp# rmmod t
 Hello World Module Cleanup
root@mars:/tmp# gcc --version
egcs-2.91.66 - tova syshto e kakto e doshlo ot slack-a
root@mars:/tmp# gcc-3.0.4 -Wall -c -DMODULE -D__KERNEL__ -DLINUX t.c
root@mars:/tmp# insmod t.o
 Hello World Module Start
root@mars:/tmp# rmmod t
 Hello World Module Cleanup
root@mars:/tmp# gcc-3.0.4 --version
3.0.4
kernel 2.4.17pre3

links sa po syshtia nachin i etc. 
Imal sym takiva problemi s po starite slackove, no tezi problemi vinagi sa
se okazvali ot gcc-to.
Imashe niakakvi griji iz includes na gcc no taka i ne mojah da nameria
tochno kude.
Kompilaciata na kernel module niama nishto obshto s tova kakvo libc
polzvash i negovite headers. niama da se linkva module kum libc-to a kum
kernela. Spored men tova si e 'compile insanity' da polzvash includes
ot libc kogato compilirash kernel module.

ize_t se definira:
 - za userspace: sys/types.h koeto go vzima ot stddef.h na gcc-to za
syotvetnata platforma
 - za kernelspace: linux/types.h  
asm/posix_types.h:typedef unsigned int  __kernel_size_t;
linux/types.h:typedef __kernel_size_t size_t;
koeto pak si stava za syotvetnata platforma.

Za MODVERSION ti triabva makefile koeto da gleda kernel config-a,
imashe i example v threada.


-- 
have fun,
alex

===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora




 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.