LinuxQuestions.org
Visit Jeremy's Blog.
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 01-12-2014, 02:47 PM   #1
purnish_dave
LQ Newbie
 
Registered: Jan 2014
Location: India
Distribution: Slackware 14.2
Posts: 18

Rep: Reputation: Disabled
Kbuild problem when trying to build module with make: cannot find Kbuild.include


Hi,

I am trying to build a simply helloworld module into the kernel.

I have a file called helloworldk.c with init and exit functions to be invoked with insmod and rmmod.

My kernel source tree is in /usr/src/linux-3.12.7

I created a Makefile with the line
Code:
obj-m :=helloworldk.o
and am executing the command

Code:
make -C /usr/src/linux-3.12.7 M='pwd' modules
However, I get the following output

Code:
make: Entering directory `/usr/src/linux-3.12.7'
Makefile:323: /usr/src/linux-3.12.7/scripts/Kbuild.include: No such file or directory
Makefile:579: /usr/src/linux-3.12.7/arch/x86/Makefile: No such file or directory
/bin/bash: /usr/src/linux-3.12.7/scripts/gcc-goto.sh: No such file or directory
make: *** No rule to make target `/usr/src/linux-3.12.7/arch/x86/Makefile'.  Stop.
make: Leaving directory `/usr/src/linux-3.12.7'
What am I doing wrong?
 
Old 01-13-2014, 04:35 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
What are you exactly trying to compile? Did you put your code in the kernel source or is it separate? Is your kernel source configured (have you run make menuconfig or a similar command inside)?
 
Old 01-13-2014, 05:40 PM   #3
purnish_dave
LQ Newbie
 
Registered: Jan 2014
Location: India
Distribution: Slackware 14.2
Posts: 18

Original Poster
Rep: Reputation: Disabled
I was trying to build it as an external module. I had to point the make -C command/argument to /lib/modules/kernel-name/build and I was just pointing it to the download location where I had downloaded the code. I finally did get it to work. I used fakeroot and make-kpkg to build the kernel and later inserted the module.
 
  


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
LXer: Kbuild: the Linux Kernel Build System LXer Syndicated Linux News 0 12-26-2012 08:30 PM
help w/ kbuild rrlangly Linux - Kernel 1 03-21-2010 06:05 AM
linking .o files built in user space against kernel module using kbuild santigopal_mondal Linux - Newbie 1 01-03-2009 02:42 PM
Can kbuild execute non-kbuild makefiles? xuanadoo Linux - Newbie 0 10-15-2006 02:41 AM
2.6.17 fails to compile, kbuild.include not found rhauff Linux - Server 1 09-13-2006 06:28 AM

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

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