2013-06-04 10 views
5

फेडोरा लिनक्स में अपना पहला कर्नेल मॉड्यूल संकलित करते समय त्रुटि प्राप्त करना।फेडोरा लिनक्स --- पहले लिनक्स मॉड्यूल संकलित

स्रोत कोड: -

#include <linux/module.h>  /* Needed by all modules */ 
#include <linux/kernel.h>  /* Needed for KERN_INFO */ 
#include <linux/init.h>   /* Needed for the macros */ 
static int __init hello_start(void) 
{ 
printk(KERN_INFO "Loading hello module...\n"); 
printk(KERN_INFO "Hello world\n"); 
return 0; 
} 
static void __exit hello_end(void) 
{ 
printk(KERN_INFO "Goodbye Mr.\n"); 
} 
module_init(hello_start); 
module_exit(hello_end); 

Makefile: ----

obj-m = hello.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 

मेकअप समय में त्रुटि: -

$ make 
make -C /lib/modules/3.8.6-203.fc18.x86_64/build M=/home/dinesh/development/linux/kernel_modules/hello modules 
make: *** /lib/modules/3.8.6-203.fc18.x86_64/build: No such file or directory. Stop. 
make: *** [default] Error 2 

अब अगर मैं देख निर्माण है वहाँ या नहीं, मुझे निम्नलिखित ओ/पी मिलता है। बिल्ड एक Softlink के रूप में दिखाया गया है: ---

$ ls -l /lib/modules/3.8.6-203.fc18.x86_64/ 
total 2632 
lrwxrwxrwx. 1 root root  38 Apr 15 21:32 build -> /usr/src/kernels/3.8.6-203.fc18.x86_64 
drwxr-xr-x. 

I got same error even after installing, kernel-devel :--

मेरे makefile सही है यह नियम पहले सही टैब की है। कृपया इस त्रुटि को हल करने का सुझाव दें?

+0

क्या/usr/src/kernels/3.8.6-203.fc18.x86_64' मौजूद है? –

+0

केवल इन दो फ़ोल्डर्स मौजूद हैं ----> /usr/src/kernels/3.8.7-201.fc18.x86_64 --- & --- /usr/src/kernels/3.9.4-200.fc18.x86_64 ----> सॉफ्टलिंक एक मौजूद नहीं है – Katoch

+0

अब क्या करना है? – Katoch

उत्तर

3

जैसा कि गिडो ने कहा था, आपको अपने वर्तमान कर्नेल और कर्नेल-डेवेल पैकेज से मेल खाना पड़ेगा।

अपने कर्नेल संस्करण रन

uname -r 

मैं 3.6.10-4.fc18.x86_64 मिल पाने के लिए, डाउनलोड कि कर्नेल-devel संस्करण

sudo yum install kernel-devel-3.6.10-4.fc18 

या के साथ अपने सिस्टम और बूट अद्यतन नया कर्नेल, मेरा मानना ​​है कि वे दोनों स्वचालित रूप से मेल खाते हैं।

संबंधित मुद्दे