No current kernel folder and insmod error invalid module format in/usr/src/kernels/

Source: Internet
Author: User
Tags dmesg

I encountered a problem when loading the device driver.

$ sudo insmod Dev_hello.ko


Then there is a problem:

Error: could not insert module Dev_hello.ko: Invalid module format


Check the *. Ko file vermagic and kernel version number:

[lgw@localhost shareArm]$ sudo modinfo Dev_hello.ko [sudo] password for lgw: filename: /home/lgw/shareArm/Dev_hello.ko depends: vermagic: 3.5.0-2.fc17.i686 SMP mod_unload 686

 

lgw@localhost shareArm]$ uname -r 3.5.0-2.fc17.i686.PAE


Then you can find the command CAT/var/log/message | tail on the Internet to view the log file error information.

Related part:

Aug 10 14:24:29 localhost kernel: [14410.773882] Dev_hello: version magic '3.5.0-2.fc17.i686 SMP mod_unload 686 ' should be '3.5.0-2.fc17.i686.PAE SMP mod_unload 686 ' 


========================================================== = Kernel problems ========================================

 

Then I will check if my kernel root directory is/usr/src/kernels/

There is only the 3.5.0-2. fc17.i686 folder, but my kernel version is PAE, but this option is not available.

The/lib/modules used in makefile contains three folders: 3.3.4-5. fc17.i686 3.5.0-2. fc17.i686 3.5.0-2. fc17.i686. PAE.

The related sentences in makefile are:

KERNEL_DIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) all: make -C $(KERNEL_DIR) M=$(PWD) modules

The result is a command: Make-C/lib/modules/3.5.0-2. fc17.i686. PAE/build M =/home/LGW/arm modules

The soft link of this build is linked to/usr/src/kernels/3.5.0-2. fc17.i686. PAE, but this link does not exist, so I changed this link to the folder without Pae. As a result, makefile can be made successfully, but insmod always reports an error. (I am so cool ~~~ After all, I tried every day to find methods and methods. At least I finally found a solution! Or Google is quite powerful. I 'd like to see it in various English forums)


========================================================== ==========================================

================================ Solution ========== ====================================

========================================================== ==========================================


sudo yum isntall kernel-PAE-devel



Then, the 3.5.0-2. fc17.i686. PAE folder appears in the/usr/src/kernels/folder.

Thank you for replying to my http://topic.csdn.net/u/20120810/14/a350bd84-ff57-4a44-bb88-1960fe5f21c3.html? Seed = 1160754062 & R = 79376733 # r_79376733 two friends in this post!


Let's get a picture of the loaded driver!

(The figure shows that the path to the folder is PAE ~)

(After loading, $Dmesg)

(After uninstalling, $Dmesg)


Refer:

 

Fedoraforum.org

 17th
2017l 2010, PM
Smr54OnlineRegistered User   Join Date: Jan 2010 posts: 4,055

Re: No kernel source files in/usr/src/kernels/directory Hrrm, looking at the fedora link cschwangler provided, it seems to me that they're making a very simple thing more complex than it is, as well as not even giving the necessary information.

If you have the i686 kernel, chances are that it runs the PAE kernel by default. rather than using the vanilla kernel, you're usually better off, when using fedora, to use its own kernel packages.

Do

Uname-R

If it has the letters PAE in it, then do

Yum install kernel-PAE-devel

Actually, probably better off doing Yum update Linux-kernel, and if a later kernel is available, reboot into it, then do Yum isntall kernel-PAE-devel, to make sure that there are no version mismatches. (I 'd also remove the links you 've ve already created to avoid
Conflicts .)

Then you're done, almost no muss, fuss, or bother.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.