The following program (named simple.c and available with the source code for this text) illustrates a very basic kemel module that prints appropriate messages when the kemel module is loaded and unloaded #include #include inux/kernel.h> #include /* This function is called when the module is loaded. Part I-Creating Kernel Modules The first part of this project involves following a series of steps for creating and inserting a module into the Linux kernel Programming Projects You can list all kernel modules that are currently loaded by entering the command lsmod This command will list the current kemel modules in three columns name, size, and where the module is being used. That normally means that any errors in the code could crash the system! However, since you will be using a virtual machine, any failures will at worst only require rebooting the system. It is important for you to keep in mind that you are indeed writing kernel code that directly interacts with the kernel. As you'll discover, the advantage of developing kernel modules is that it is a relatively easy method of interacting with the kernel, thus allowing you to write programs that directly invoke kernel functions. Although you may use an editor to write these C programs, you will have to use the terminal application to compile the programs, and you will have to enter commands on the command line to manage the modules in the kernel. ![]() The project can be completed using the Linux virtual machine that is available with this text. Linux Kernel Modules In this project, you will learn how to create a kernel module and load it into the Linux kernel.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |