You should modify the program on page 97 so that your name would appear in the s
ID: 3745002 • Letter: Y
Question
You should modify the program on page 97 so that your name would appear in the screen print out. This is my code, am i missing something? wont print out my name still says "Loading Module"
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
/* This function is called when the module is loaded. */
int simple init(void) { printk(KERN INFO "Loading Jessa's Module ");
return 0; }
/* This function is called when the module is removed. */
void simple exit(void)
{
printk(KERN INFO "Removing Jessa's Module "); }
/* Macros for registering module entry and exit points. */
module init(simple init); module exit(simple exit);
MODULE LICENSE("GPL");
MODULE DESCRIPTION("Simple Module");
MODULE AUTHOR("SGG");
Explanation / Answer
try this code and let me know if any error comes , thanks
Makefile
***********
obj-m = Jessa.o
all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(shell PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell PWD) clean
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static int __init jessa_start(void)
{
printk(KERN_INFO "Loading Jessa's Module ");
printk(KERN_INFO "Hello Jessa ");
return 0;
}
static void __exit jessa_end(void)
{
printk(KERN INFO "Removing Jessa's Module ");
printk(KERN_INFO "Goodbye Mr Jessa. ");
}
module_init(jessa_start);
module_exit(jessa_end);
MODULE LICENSE("GPL");
MODULE DESCRIPTION("Simple Module");
MODULE AUTHOR("SGG");
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.