LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-11-2014, 03:33 AM   #1
xmllmx
LQ Newbie
 
Registered: May 2014
Posts: 5

Rep: Reputation: Disabled
How to understand “Building Separate Files” for a Linux kernel module?


Excerpted from the Linux kernel documentation:

https://www.kernel.org/doc/Documenta...ld/modules.txt

2.4 Building Separate Files

It is possible to build single files that are part of a module.
This works equally well for the kernel, a module, and even for
external modules.

Example (The module foo.ko, consist of bar.o and baz.o):
make -C $KDIR M=$PWD bar.lst
make -C $KDIR M=$PWD baz.o
make -C $KDIR M=$PWD foo.ko
make -C $KDIR M=$PWD /
I can't understand what these commands mean.

make -C $KDIR M=$PWD bar.lst

Does it mean: look for bar.c and compile it into bar.1st?

make -C $KDIR M=$PWD foo.ko

Does it mean: look for all *.o and link them into foo.ko? Does it also look for *.1st?

make -C $KDIR M=$PWD /

What does it mean?
 
Old 06-12-2014, 04:27 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,296

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
make -C $KDIR M=$PWD bar.lst
Make -C = change to dir -M will do something else on make - probably pass options, but man make is your friend here.

KDIR, and PWD are variables defined earlier. Quite probably KDIR is in a 'for dirs in i do' type of statement which means it cycles through all the directories doing this.

.lst looks like data; .o looks like code; .ko looks like the module containing both.
 
  


Reply

Tags
makefile



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
Building an out-of-tree module without building the kernel source lijodevasia Linux - General 2 08-01-2013 12:45 AM
[SOLVED] Trouble building VMware kernel module 8.0.3 on Slackware64-current with Linux 3.3.6 ack_iix Slackware 7 05-30-2012 06:32 PM
Fortran and separate module files Neruocomp Programming 4 04-14-2005 08:09 AM
Building kernel module from multiple source file in 2.6 kernel yogeshwar_s Programming 1 12-20-2004 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:55 AM.

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