Ask a question about loading the module: An error occurred in insmod!

Source: Internet
Author: User
Ask a question about loading the module: An error occurred in insmod! -- Linux general technology-Linux programming and kernel information. The following is a detailed description. This is a simple Start Program for driver learning:
// Hello. c
# Include
# Include
MODULE_LICENSE ("Dual BSD/GPL ");

Static int hello_init (void)
{
Printk (KERN_ALERT "Hello, world \ n ");
Return 0;
}

Static void hello_exit (void)
{
Printk (KERN_ALERT "Goodbye, cruel world \ n ");
}

Module_init (hello_init );
Module_exit (hello_exit );

I will not explain the program ......

Makefile

Obj-m: = hello. o
KERNELDIR: =/lib/modules/2.6.20/build
PWD: = $ (shell pwd)
Modules:
$ (MAKE)-C $ (KERNELDIR) M = $ (PWD) modules
Modules_install:
$ (MAKE)-C $ (KERNELDIR) M = $ (PWD) modules_install
If all of the above are complete, this error will occur during make.
Shana @ shana :~ /Linux _ driver development $ make
Make: There is nothing to do for 'modules '.
The reason is very simple. You must have copied it from me ~~~ The Makefile format is incorrect ~

They all follow the steps of others. Why is the error:
Insmod: error inserting './hello. ko':-1 Invalid module format
What's wrong with this?
Related Article

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.