ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 8.00

Create a Kernel Module “simple”

PART 1

Create a Kernel Module “simple”.

– Create a program named simple.c (prints appropriate messages when the kernel module is loaded and unloaded).

– Create a Makefile for compiling the program.

simple.c

#include <linux/init.h>

#include <linux/module.h>

#include <linux/kernel.h>

/* This cis called when the module is loaded. */int simple_init(void)

{

printk(KERN_INFO "Loading Modulen");

return 0;}

/* This function is called when the module is removed. */

void simple_exit(void) {

printk(KERN_INFO "Removing Modulen");

}

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

Note: Makefile should be in the same directory as simple.c

1.Compile kernel module simple.c $make Note: if the compiling succeeds, several files are produced.

2.Load Kernel Module $sudo insmod simple.ko Check out contents in kernel log buffer. $dmesg

3.Remove Kernel Module $sudo rmmod simple Check out contents in kernel log buffer. $dmesg

PART 2

Create a Kernel Module “simple-solution”.

Create a program named simple-solution.c.

- In the module entry point, create a linked list containing five struct birthday elements and traverse the linked list.

-The name of first struct birthday element should be Alex

-In the module exit point, remove the elements from the linked list and return the free memory back to the kernel

– Create a Makefile for compiling the program

simple-solution.c (incomplete version )

#include <linux/init.h>

#include <linux/module.h>

#include <linux/kernel.h>

#include <linux/list.h>

#include <linux/slab.h>

struct birthday

{

int month;

int day;

int year;

char *name;

struct list_head list;

};

static LIST_HEAD(birthday_list);

int simple_init(void)

{

Makefile

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

Note: Makefile should be in the same directory as simple_solution.c

For Part II: – Add codes in simple-solution.c based on the instruction in Part 2

-Compile simple-solution.c and then try to load and remove kernel module.

-Use dmesg to check out the kernel log content right after loading and removing kernel module.

- Save the kernel log contents into screenshots.

What's needed?

-A complete version of simple-solution.c

-Report including required screenshots and source code of simple-solution.c

Answers

(11)
Status NEW Posted 02 May 2017 03:05 AM My Price 8.00

-----------

Attachments

file 1493694104-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)