LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-25-2006, 08:08 PM   #1
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Compiling an unconfigured module


I'm trying to debug a module in Debian, or at least learn something trying. Is there a way to make the module without adding it to the config for the source tree? Running "make M=whatever" doesn't seem to pick it up unless it's configged. What am I missing, or is it normal practice to run an "a" and a "b" directory to do this as protection against brain-fade? I have no real aspirations of actually getting this working and uploading it. I have working fallbacks in grub.
 
Old 12-27-2006, 09:08 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
gcc -c module.c
 
Old 12-27-2006, 12:49 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Original Poster
Rep: Reputation: 141Reputation: 141
"gcc -c module.c"

Thanks for the try, but I get about 7 bazillion warnings and errors when I try that. The subdir makefile is heavily dependent on info from the topdir one, I think.
 
Old 12-30-2006, 01:29 AM   #4
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
try putting the code you are working on in a seperate directory and making a makefile there like this
Code:
obj-m = foo.o
KVERSION = $(shell uname -r)
all:
     make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
     make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
then just make and your module shoud show up foo.ko
 
Old 01-02-2007, 04:55 PM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Smile

Quote:
Originally Posted by Quakeboy02
"gcc -c module.c"

Thanks for the try, but I get about 7 bazillion warnings and errors when I try that. The subdir makefile is heavily dependent on info from the topdir one, I think.
Gcc spews more cryptic messages than you can imagine. It is pretty typical for gcc to warn of all kinds of things, even though the compile worked. It is possible you are missing a prototype header in /usr/include. In this case you can put the module in the kernel tree, according to the README file, and after you compile it run:
depmod
 
Old 01-02-2007, 05:03 PM   #6
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Original Poster
Rep: Reputation: 141Reputation: 141
"In this case you can put the module in the kernel tree, according to the README file, and after you compile it run:"

This is what I was trying to avoid: putting the module in the kernel tree. Thanks anyway, guys. It's simple enough to just have a "clean" version of the kernel that I normally boot from, and another version with the module I'm messing with configured in. It's not like a few megabytes costs anything anymore.
 
  


Reply



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
Compiling one module n00bified Slackware 3 09-03-2006 12:35 PM
seems to contain unconfigured kernel source Acron_0248 Debian 14 04-06-2006 01:45 PM
compiling a module eltn Programming 5 04-01-2006 07:30 PM
Use of MODULE macro while compiling a module fssengg Linux - Newbie 0 03-31-2006 07:13 AM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:23 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