LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2010, 08:46 AM   #1
vivignesh
LQ Newbie
 
Registered: Jul 2010
Posts: 18

Rep: Reputation: 0
Smile Linux Device driver - /usr/src/linux is empty


Hi, i am trying to write modular programm,
but when i try to compile i come to know i dont have any files in /usr/src/linux.

i have installed fedora 12 which has 2.6.31.5-127.fc12.i686.PAE

i am including in my code
linux/kernel.h
linux/module.h

Those are not present directory in /usr/src/linux is not present.

My goal is to compile modular programs.

I am newbie
Please help me how to do .....
 
Old 07-06-2010, 08:51 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Look in your yum repository for the linux headers or devel version related to your current kernel
 
Old 07-06-2010, 12:49 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# yum install glibc-headers
will provide /usr/include/linux/kernel.h

# yum install kernel-devel
provides /usr/src/kernels/linux-´uname -r´
Only a few files are included.

'module.h' : You may need the full kernel source,
not available as an rpm package. ( Only as SRC.RPM.)
..
 
Old 07-06-2010, 12:58 PM   #4
vivignesh
LQ Newbie
 
Registered: Jul 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Red face

Quote:
Originally Posted by knudfl View Post
# yum install glibc-headers
will provide /usr/include/linux/kernel.h

# yum install kernel-devel
provides /usr/src/kernels/linux-´uname -r´
Only a few files are included.

'module.h' : You may need the full kernel source,
not available as an rpm package. ( Only as SRC.RPM.)
..

i have installed fedora 12 which has 2.6.31.5-127.fc12.i686.PAE
is like i need to download only this particular
2.6.31.5-127.fc12.i686.PAE sourcecode and manually copy paste to this location?

where can i get this kernel source code .src.rpm for this particular kernel
 
Old 07-06-2010, 01:39 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
'kernel-2.6.31.5-127.fc12.src.rpm' is available.
wget http://download.fedora.redhat.com/pu...7.fc12.src.rpm

2.6.31.5-127 : This is the release version.
If you ever update, it will change.
( Latest is : kernel-2.6.32.14-127.fc12.src.rpm ).
......
 
Old 07-07-2010, 03:08 AM   #6
vivignesh
LQ Newbie
 
Registered: Jul 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by knudfl View Post
'kernel-2.6.31.5-127.fc12.src.rpm' is available.
wget http://download.fedora.redhat.com/pu...7.fc12.src.rpm

2.6.31.5-127 : This is the release version.
If you ever update, it will change.
( Latest is : kernel-2.6.32.14-127.fc12.src.rpm ).
......



Hi i have downloaded kernel-2.6.31.5-127.fc12.src.rpm
i extracted and i found there are lot of patches along with linux-2.6.31.tar.bz2.
I extracted linux-2.6.31.tar.bz2 and copied whole directory linux-2.6.31 to /usr/src/ , The code what i have written is
module1.c
[Code]
#include<linux/kernel.h>
#include<linux/module.h>

int init_module(void)
{

printk("In Init module \n");
}

void cleanup_module(void)
{

printk("In Cleanup module \n");
}


i compiled using
gcc -DMODULE -D__KERNEL__ -I /usr/src/linux-2.6.31/include/ -c module1.c

The error what i am getting is

In file included from /usr/src/linux-2.6.31/include/linux/kernel.h:11,
from module1.c:1:
/usr/src/linux-2.6.31/include/linux/linkage.h:5:25: error: asm/linkage.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/kernel.h:15,
from module1.c:1:
/usr/src/linux-2.6.31/include/linux/bitops.h:17:24: error: asm/bitops.h: No such file or directory
In file included from module1.c:1:
/usr/src/linux-2.6.31/include/linux/kernel.h:21:21: error: asm/bug.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/list.h:6,
from /usr/src/linux-2.6.31/include/linux/module.h:9,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/prefetch.h:14:27: error: asm/processor.h: No such file or directory
/usr/src/linux-2.6.31/include/linux/prefetch.h:15:23: error: asm/cache.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/module.h:9,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/list.h:7:24: error: asm/system.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/preempt.h:9,
from /usr/src/linux-2.6.31/include/linux/spinlock.h:50,
from /usr/src/linux-2.6.31/include/linux/seqlock.h:29,
from /usr/src/linux-2.6.31/include/linux/time.h:8,
from /usr/src/linux-2.6.31/include/linux/stat.h:60,
from /usr/src/linux-2.6.31/include/linux/module.h:10,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/thread_info.h:56:29: error: asm/thread_info.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/preempt.h:9,
from /usr/src/linux-2.6.31/include/linux/spinlock.h:50,
from /usr/src/linux-2.6.31/include/linux/seqlock.h:29,
from /usr/src/linux-2.6.31/include/linux/time.h:8,
from /usr/src/linux-2.6.31/include/linux/stat.h:60,
from /usr/src/linux-2.6.31/include/linux/module.h:10,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/thread_info.h:65: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-2.6.31/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-2.6.31/include/linux/thread_info.h: In function ‘set_ti_thread_flag’:
/usr/src/linux-2.6.31/include/linux/thread_info.h:67: error: dereferencing pointer to incomplete type
/usr/src/linux-2.6.31/include/linux/thread_info.h: At top level:
/usr/src/linux-2.6.31/include/linux/thread_info.h:70: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-2.6.31/include/linux/thread_info.h: In function ‘clear_ti_thread_flag’:
/usr/src/linux-2.6.31/include/linux/thread_info.h:72: error: dereferencing pointer to incomplete type
/usr/src/linux-2.6.31/include/linux/thread_info.h: At top level:
/usr/src/linux-2.6.31/include/linux/thread_info.h:75: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-2.6.31/include/linux/thread_info.h: In function ‘test_and_set_ti_thread_flag’:
/usr/src/linux-2.6.31/include/linux/thread_info.h:77: error: dereferencing pointer to incomplete type
/usr/src/linux-2.6.31/include/linux/thread_info.h: At top level:
/usr/src/linux-2.6.31/include/linux/thread_info.h:80: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-2.6.31/include/linux/thread_info.h: In function ‘test_and_clear_ti_thread_flag’:
/usr/src/linux-2.6.31/include/linux/thread_info.h:82: error: dereferencing pointer to incomplete type
/usr/src/linux-2.6.31/include/linux/thread_info.h: At top level:
/usr/src/linux-2.6.31/include/linux/thread_info.h:85: warning: ‘struct thread_info’ declared inside parameter list
/usr/src/linux-2.6.31/include/linux/thread_info.h: In function ‘test_ti_thread_flag’:
/usr/src/linux-2.6.31/include/linux/thread_info.h:87: error: dereferencing pointer to incomplete type
In file included from /usr/src/linux-2.6.31/include/linux/seqlock.h:29,
from /usr/src/linux-2.6.31/include/linux/time.h:8,
from /usr/src/linux-2.6.31/include/linux/stat.h:60,
from /usr/src/linux-2.6.31/include/linux/module.h:10,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/spinlock.h:364:24: error: asm/atomic.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/time.h:9,
from /usr/src/linux-2.6.31/include/linux/stat.h:60,
from /usr/src/linux-2.6.31/include/linux/module.h:10,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/math64.h:5:23: error: asm/div64.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/mmzone.h:9,
from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/wait.h:26:25: error: asm/current.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/bitmap.h:8,
from /usr/src/linux-2.6.31/include/linux/nodemask.h:95,
from /usr/src/linux-2.6.31/include/linux/mmzone.h:16,
from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/string.h:21:24: error: asm/string.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
/usr/src/linux-2.6.31/include/linux/mmzone.h:20:22: error: asm/page.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/mmzone.h: At top level:
/usr/src/linux-2.6.31/include/linux/mmzone.h:288: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)
/usr/src/linux-2.6.31/include/linux/mmzone.h:335: error: expected specifier-qualifier-list before ‘atomic_long_t’
In file included from /usr/src/linux-2.6.31/include/linux/notifier.h:14,
from /usr/src/linux-2.6.31/include/linux/memory_hotplug.h:6,
from /usr/src/linux-2.6.31/include/linux/mmzone.h:642,
from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/memory_hotplug.h:6,
from /usr/src/linux-2.6.31/include/linux/mmzone.h:642,
from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/notifier.h:62: error: field ‘rwsem’ has incomplete type
In file included from /usr/src/linux-2.6.31/include/linux/gfp.h:4,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/mmzone.h: In function ‘populated_zone’:
/usr/src/linux-2.6.31/include/linux/mmzone.h:675: error: ‘struct zone’ has no member named ‘present_pages’
/usr/src/linux-2.6.31/include/linux/mmzone.h: In function ‘is_normal’:
/usr/src/linux-2.6.31/include/linux/mmzone.h:724: error: ‘struct zone’ has no member named ‘zone_pgdat’
In file included from /usr/src/linux-2.6.31/include/linux/gfp.h:7,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/topology.h:34:26: error: asm/topology.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/gfp.h:8,
from /usr/src/linux-2.6.31/include/linux/kmod.h:22,
from /usr/src/linux-2.6.31/include/linux/module.h:13,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/mmdebug.h:4:28: error: linux/autoconf.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/module.h:14,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/elf.h:7:21: error: asm/elf.h: No such file or directory
In file included from /usr/src/linux-2.6.31/include/linux/tracepoint.h:18,
from /usr/src/linux-2.6.31/include/linux/module.h:19,
from module1.c:2:
/usr/src/linux-2.6.31/include/linux/rcupdate.h:64:2: error: #error "Unknown RCU implementation specified to kernel configuration"
In file included from module1.c:2:
/usr/src/linux-2.6.31/include/linux/module.h:20:23: error: asm/local.h: No such file or directory
/usr/src/linux-2.6.31/include/linux/module.h:22:24: error: asm/module.h: No such file or directory
In file included from module1.c:2:
/usr/src/linux-2.6.31/include/linux/module.h: At top level:
/usr/src/linux-2.6.31/include/linux/module.h:714: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token


if i give uname -r i am getting the following

[root@rajguruvin rgv]# uname -r
2.6.31.5-127.fc12.i686.PAE


if i give yum install kernel-devel i am getting

[root@rajguruvin rgv]# yum install kernel-devel
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Package kernel-devel-2.6.32.14-127.fc12.i686 already installed and latest version
Nothing to do


Where it went wrong.....
 
Old 07-07-2010, 03:17 AM   #7
vivignesh
LQ Newbie
 
Registered: Jul 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by grail View Post
Look in your yum repository for the linux headers or devel version related to your current kernel
what is yum repository , how to look at it
 
Old 07-07-2010, 03:56 AM   #8
tnathan
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
hp dx2480 linux lan drivers
 
Old 07-07-2010, 04:15 AM   #9
tnathan
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
my system hpdx2480 modle installed redhat5 server .but not supported lan how is solve problem.any lan drivers
 
Old 07-07-2010, 05:57 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
@ tnathan , posts #8 #9 :

Please start a new thread, when you have a new topic.

Using a thread with a different topic is not allowed, sorry.
..
 
Old 07-07-2010, 06:46 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
-I /usr/src/linux-2.6.31/include/
You will also need :
-I /usr/src/linux-2.6.31/arch/x86/include/asm/

..
 
  


Reply

Tags
device, drivers, linux



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeBSD 6.2, no /usr/src/tools and /usr/src/usr.bin, failed to build world. Mr_Shameless *BSD 4 05-16-2008 08:43 AM
/usr/src/linux/include/linux/version.h doesn't exsist itz2000 Linux - Newbie 1 10-26-2007 06:43 PM
linux kernal configurator tool points to /usr/src/linux-2.4/arch//config.in (BUG?) Stubzyboy Linux - Newbie 3 03-11-2004 03:03 AM
my /usr/src/linux folder is empty rokga Linux - Newbie 2 10-07-2003 08:53 AM
Creating /usr/src/linux-<xx> from kernel.<xx>.src.rpm jmourik Linux - Newbie 2 02-19-2003 03:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration