Sumbitted by, Guided by, R.Hanan Raj , Mrs.Tamilselvi,M.E , M.E(CSE), Assitant Professer , ARJ CET. Dept of CSE, ARJ CET. STUDY OF LINUX KERNEL AND KERNEL MODULES module.
AIM: To study of linux kernel and kernel modules . OBJECTIVE: Linux kernel: The Linux kernel is a Unix-like computer operating system kernel . The Linux kernel is a widely used operating system kernel world-wide . Kernel module: A loadable kernel module (or LKM ) is object file that contains code to extend the running kernel, or so-called base kernel,of an operating system.
Continue… LKMs are typically used to add support for new hardware and/or filesystems , or for adding system calls . Study of linux kernel and kernel modules divided into 4 parts: 1 . Development of a reasonably size dynamically loadable kernel module for Linux kernel . 2. Passing command line arguments to a module . 3 . Building modules for a precompiled kernel . 4 . Implementing module for linux kernel
History Linux is a modern, free operating system based on UNIX standards. First developed as a small but self-contained kernel in 1991 by Linus Torvalds . run efficiently and reliably on common PC hardware, but also runs on a variety of other platforms. Linux system has many, varying Linux distributions including the kernel,applications , and management tools.
The Linux Kernel: Version 0.01 (May 1991) No networking. ran only on 80386-compatible Intel Processors and on PC hardware. extremely limited device-drive support. supported only the Minix file system. Linux 1.0 (March 1994) o Support for UNIX’s standard TCP/IP networking protocols o Device-driver support for running IP over an Ethernet o Enhanced file system o Support for a range of SCSI controllers for high-performance disk access
Linux 2.0 Released in June 1996, 2.0 added two major new capabilities: o interfaceSupport for multiple architectures, including a fully 64-bit native Alpha port o Support for multiprocessor architectures Other new features included: Improved memory-management code Improved TCP/IP performance support for internal kernel threads, for handling dependencies between loadable modules, and for automatic loading of modules on demand o Standardized configuration
OTHER VERSION OF LINUX Available for Motorola 68000-series processors, Sun Sparc systems, and for PCand PowerMac system.. 2.4 and 2.6 increased SMP support, added journaling file system, preemptive kernel, 64-bit memory support . 3.0 released in 2011, 20 th anniversary of Linux, improved virtualization support, New page write-back facility, improved memory management. Latest release 4.0.2 (6 May 2015; 2 days ago)
Procedure: 1.Development of reasonably sized dynamic loadable kernel module for Linux kernel Modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system.
Continue…. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system. Without modules, we would have to build monolithic kernels and add new functionality directly into the kernel image.
Coding: #include < linux / module.h > /* Needed by all modules */ #include < linux / kernel.h > /* Needed for KERN_INFO */ int init_module (void) { printk (KERN_INFO "Hello world 1.\n"); /* * A non 0 return means init_module failed; module can't be loaded. */ return 0; } void cleanup_module (void) { printk (KERN_INFO "Goodbye world 1.\n");
Kernel modules must have at least two functions: a "start" (initialization) function called init_module () which is called when the module is insmoded into the kernel and an "end" (cleanup) function called cleanup_module () which is called just before it is rmmoded .
Linux command: lsmod – List Modules that Loaded Already. insmod – Insert Module into Kernel. modinfo – Display Module Info rmmod – Remove Module from Kernel
2.PASSING COMMAND LINE ARGUMENTS TO A MODULE : Modules can take command lin e arguments. To allow arguments to be passed to your module, declare the variables that will take the values of the command line arguments as global and then use the module_param () to setup. The variable declarations and macros should be placed at the beginning of the module.
Advantage of linux Cost – The most obvious advantage of using Linux is the fact that it is free to obtain, whileMicrosoft products are available for a hefty and sometimes recurring fee . Security – In line with the costs, the security aspect of Linux is much stronger than that of Windows. Choice (Freedom) – The power of choice is a great Linux advantage. .
Disadvantages of Linux: Understanding – Becoming familiar with the Linux operating system requires patience as well as a strong learning curve. Compatibility – Because of its free nature, Linux is sometimes behind the curve when it comes to brand new hardware compatibility .
Conclusions Linux is a flexible, robust node operating system for Beowulf computational clusters. Stability and adaptability set it apart from the legacy operating systems that dominate desktop environments. It has spread quickly from its humble beginnings as a student’s hobby project to a full-featured server operating system with advanced features and legendary stability .