SlideServe
Menu
Préférences
© SlideServe · v2026

Linux Loadable Module

osric avatar
9 diapositives · 277 Views · Sep 19, 2014

Computer Science & Engineering Department. The University of Connecticut. 191 Auditorium Road, Box U-155. Storrs, CT 06269-3155. Linux Loadable Module. A. Paul Heely Jr. and Mike Stack. What are Modules?. Linux Kernel Monolithic Originally all functions were built in at compile time

Linux Loadable Module - slide 1
01 / 9Linux Loadable Module
1 / 17

Télécharger la présentation

Linux Loadable Module
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Computer Science & Engineering Department The University of Connecticut 191 Auditorium Road, Box U-155 Storrs, CT 06269-3155 Linux Loadable Module A. Paul Heely Jr. and Mike Stack

  2. What are Modules? • Linux Kernel • Monolithic • Originally all functions were built in at compile time • Loadable Modules • Compile Object Files • Inserted and Removed from a Running Kernel • Run in the context of the Kernel • Contain any number of functions or types of data • Must contain an init_module() and cleanup_module function

  3. Why Use Modules • Why Use Modules at All? • Reduce size of running kernel • Network Protocol Drivers (TCP/IP, IPX, AppleTalk, etc) can be loaded only when needed • Single hardware device can provide different functionality • Parallel Port can be used for printing, zip drives, and “higher” speed networking (PLIP) • These cannot co-exist at the same time • Modules allow these to co-exist at different times without loading a new kernel • New devices can be added dynamically • Rot-13 device

  4. Loading Modules • 4 Steps In Loading a Module • Preparing the module • Allocating Kernel Memory • Copying the Module to the Kernel • Executing the Modules Init Function

  5. Preparing Modules • Handled by the module loader insmod • Module File Opened and Read Piece by Piece • header • text segment • data segment • text relocation information • data relocation information • symbol table • string table • Symbol Table Stored in a Binary Tree to Speedup Symbol Resolution

  6. Preparing Modules • External References Resolved • Kernel object or other modules • Symbol Table Updated • Text and Data Segments also Updated with Kernel address

  7. Allocating Memory, Copying, Module Init • Kernel Memory Allocation • create_module(): Kernel function • Passed module name and size • Returns address in Kernel where module will reside • Copying Module to Kernel Space • init_module(): Kernel function • Updates all offsets in the modules object code to reflect actual kernel location • Copies object code from user space to the kernel • Module Initialization • Final step, Kernel invokes the modules init_module() function

  8. Example Module • Rot-13 Encoding Device • New device added to running Linux System • Performs Rot-13 encoding/decoding on a character stream • Linux: The Choice of a GNU Generation becomes Yvahk: Gur Pubvpr bs TAH Trarengvba • New device can be opened, closed, and written • Handled the same as a “file” • Kernel maintains open count • Module cannot be removed while it is opened

  9. Conclusions • Loadable Modules Provide Simple Method of modifying a running Kernel • multiple drivers can share same hardware resource • Modules can be used to reduce a kernels size • seldom used drivers unloaded until needed • Trade Off between kernel size and performance • Loadable modules reduce size but require time to load.