[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
slackbook:linux_kernel [2012/09/17 03:34 (UTC)] – Moved text to the proper section mfillpot | slackbook:linux_kernel [2012/09/17 03:35 (UTC)] – [Working with Modules] Aded original text and formatting mfillpot | ||
---|---|---|---|
Line 21: | Line 21: | ||
===== Working with Modules ===== | ===== Working with Modules ===== | ||
+ | The complexity of a modern linux kernel is staggering. The source code | ||
+ | for the kernel weighs in at nearly 400MB uncompressed. There are | ||
+ | thousands of developers, hundreds of options, and if everything were | ||
+ | built together, the kernel would soon pass 100MB in size itself. In | ||
+ | order to keep the size of the kernel down (as well as the amount of RAM | ||
+ | needed for the kernel), most of the kernel options are built as | ||
+ | modules. You can think of these modules as device drivers which can be | ||
+ | inserted or removed from a running kernel at will. In truth, many of | ||
+ | them aren't device drivers at all, but contain support for things such | ||
+ | as network protocols, security measures, and even filesystems. In | ||
+ | short, nearly any piece of the linux kernel can be built as a loadable | ||
+ | module. | ||
+ | |||
+ | It's important to realize that Slackware will automatically handle | ||
+ | loading most modules for you. When your system boots, | ||
+ | **// | ||
+ | system' | ||
+ | and created a device node in ''/ | ||
+ | means that you will not need to load any modules in order to use your | ||
+ | computer, but occasionally this is necessary. | ||
+ | |||
+ | So what modules are currently loaded on your computer and how do we | ||
+ | load and unload them? Fortunately we have a full suite of tools for | ||
+ | handling this. As you might have guessed, the tool for listing modules | ||
+ | is **// | ||
+ | |||
+ | |||
+ | < | ||
+ | darkstar:~# lsmod | ||
+ | Module | ||
+ | nls_utf8 | ||
+ | cifs 240600 | ||
+ | i915 168584 | ||
+ | drm | ||
+ | i2c_algo_bit | ||
+ | tun 12740 1 | ||
+ | ... many more lines ommitted ... | ||
+ | </ | ||
+ | |||
+ | |||
+ | In addition to showing you what modules are loaded, it displays the | ||
+ | size of each module and tells you what other modules are using it. | ||
+ | |||
+ | There are two applications for loading modules: | ||
+ | **// | ||
+ | **// | ||
+ | report any errors (such as loading a module for a device that isn't | ||
+ | present in your system), but **// | ||
+ | preferred because it can load any module dependencies. Using either is | ||
+ | straight-forward. | ||
+ | |||
+ | |||
+ | < | ||
+ | darkstar:~# insmod ext3 | ||
+ | darkstar:~# modprobe ext4 | ||
+ | darkstar:~# lsmod | grep ext | ||
+ | ext4 239928 | ||
+ | jbd2 | ||
+ | crc16 | ||
+ | ext3 139408 | ||
+ | jbd 48520 1 ext3 | ||
+ | mbcache | ||
+ | </ | ||
+ | |||
+ | Removing modules can be a tricky process, and once again we have two | ||
+ | programs for removing them: **// | ||
+ | **// | ||
+ | modprobe, you'll need to use the //-r// argument. | ||
+ | |||
+ | |||
+ | < | ||
+ | darkstar:~# rmmod ext3 | ||
+ | darkstar:~# modprobe -r ext4 | ||
+ | darkstar:~# lsmod | grep ext | ||
+ | </ | ||
===== Compiling A Kernel and Why to do So ===== | ===== Compiling A Kernel and Why to do So ===== | ||