Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2.A) Modify, compile, install, and uninstall a Loadable Kernel Module (LKM). Start with the code provided to students in the chapter 2 folder in

Part 2.A) Modify, compile, install, and uninstall a Loadable Kernel Module (LKM). Start with the code provided to students in the chapter 2 folder in the book source code Click here to Download Book Source Code Add a header block as described in the Coding Guidelines section below. .Change the fields of the MODULE_AUTHOR and MODULE_DESCRIPTION macros appropriately, .Compile your module by simply executing the make command at the shell prompt in the subdirectory that contains your kernel module source As root, run-lsmod. What do you see? Insert your module into the kernel by running insmod simple.ko'. Output produced by the printk) function invoked from kernel modules is displayed on the console and saved in /var/log/messages To save printk) output to a specified log file, insert the following line into the letc/rsyslog.conf file kern /var log kern log Then while logged on as root, execute the following command at the shell prompt to restart the system logger services service rsvslog restart .What message from your module do you see? Collect them. This will be part of your deliverables .Run 'lsmod' again. What do you see now? Unload your module Run 'smod again. What do you see now?

source code is below can you please also provide screenshots

-----------------------

Makefile

---------------------------------------

obj-m += simple.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

-----------------------------

simple.c

--------------------------------

#include #include #include

/* This function is called when the module is loaded. */ int simple_init(void) { printk(KERN_INFO "Loading Module ");

return 0; }

/* This function is called when the module is removed. */ void simple_exit(void) { printk(KERN_INFO "Removing 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");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Core Ios Developer S Cookbook Core Recipes For Programmers

Authors: Erica Sadun ,Rich Wardwell

5th Edition

0321948106, 978-0321948106

More Books

Students also viewed these Programming questions

Question

What does a high current ratio indicate about a company?

Answered: 1 week ago