Compile the makefile file of the 2.6.x kernel driver

Source: Internet
Author: User
Compile the makefile file of the 2.6.x kernel driver-general Linux technology-Linux programming and kernel information. For more information, see the following. # File Description: Compile the makefile file of the linux driver 2.6.x
# Author: wyj
# Creation Time:
# Instructions:
# The variable DRI_NAME MOD_NAME NOD_NAME sets the names of the pseudo-driver, generating the name of the module and the name of the device node respectively.
# Use make install to install the driver requires the root permission
# Use make uninstall to uninstall the driver requires the root permission
# Use make clean to clear unnecessary files, including generated module code

# Driver name
DRI_NAME: = demo
# Module name
MOD_NAME: = IMTI_DEMO
# Node name
NOD_NAME: =/dev/demo

Obj-m: = $ (DRI_NAME). o
KERNELDIR? =/Lib/modules/$ (shell uname-r)/build
PWD? = $ (Shell pwd)

Default:
$ (MAKE)-C $ {KERNELDIR} M =$ {PWD} modules
# Install pseudocode
. PHONY: install uninstall clean
Install: default
Insmod demo. ko
Mknod $ (NOD_NAME) c 'awk' $2 = "'$ {MOD_NAME}'" {print $1} '/proc/devices '0
# Uninstalled pseudocode
Uninstall:
Rm-f $ (NOD_NAME)
Rmmod $ (DRI_NAME)
# Clear junk pseudocode
Clean:
@ Rm-rf *. o *. ko. tmp_versions *~ Module. symvers. *. cmd *. mod. c
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.