Question: Note that on the last line MODULE LICENSE ( GPL ) , there s an underscore between MODULE and LICENSE. This module defines
Note that on the last line MODULE LICENSEGPL theres an underscore between
MODULE and LICENSE. This module defines two functions. init module is invoked when
the module is loaded into the kernel and cleanup module is called when the module is re
moved from the kernel. module init and module exit are special kernel macros to indicate
the role of these two functions.
Use the Makefile below to compile the module. Even though for regular C pro
grams both Makefile and makefile would work, the kernel build scripts expect
Makefile as a convention. Also, please make sure that your project directory
and subdirectory names do not have any white spaces, eg do not name your
directory Project Because this Makefile uses PWD any white spaces in your project di
rectorys path will lead to errors that are very hard to troubleshoot. Please use underscores
and dashes instead, or simply remove any white space.
obj m hello o
all :
make C lib modules $ shell uname r build M $ PWD modules
clean :
make C lib modules $ shell uname r build M $ PWD clean
Do you see any errors when you type make? If so how to fix the error pts To remove
all compiled output, do make clean. After fixing, you will need to load your module into
the kernel. Run this command using sudo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
