Linux kernel compilation, kernel parameter modification

Source: Internet
Author: User

Core (Kernel):/boot/vmlinuz-version version with release package, local version
Kernel module (Kernel object):/lib/modules/version/

Kernel design:
Single Core
Modular design-small core, function module
Micro-core
Loading module:
Insmod
Modprobe

Kernel Download: www.kernel.org

2 (Master). 6 (Times). 17 (fixed)-->2.6.17.1 fix bug
2.6.18.RC1 (alternate) new features

User space access, how to monitor the kernel
Modify the/proc,/sys with these two pseudo-files

/proc/sys: Many of the files in this directory are readable and writable
/sys

How to set kernel parameters:
echo VALUE >/proc/sys/to/somefile
echo 1 >/proc/sys/vm/drop_caches | Free-m
echo www >/proc/sys/kernel/hostname

Sysctl-w (set Value)
Sysctl-w kernel.hostname= "Mylab.mageedu.com"
Sysctl-w Vm.drop_caches=1

The above is effective immediately and cannot be permanently valid

Permanently valid
Vim/etc/sysctl.conf
After editing, the immediate effect: sysctl-p let the kernel reload the configuration file
Sysctl-a: Displays all kernel parameters and their values


Kernel module Management
Module of current system: Lsmod
MoD size Usetimes

Modprobe Mod_name Loading Module
Modprobe-r mod_name Unload Module
Modprobe-r Floppy
Modprobe Floppy

Modinfo: View specific information about the module
Modinfo Mod_name
Modinfo Floppy

Insmod/path/to/module_file: Load Module
Rmmod Mod_name removing modules

Depmod/path/to/modiles_dir

Install the driver: Download the source code, compile into KO, load the module

Kernel and kernel modules must be fully consistent
2.6.32-1 kernel cannot use module (KO) edited on 2.6.32-2

Features in the kernel, in addition to the core functionality, at compile time, most features have three choices
1. Do not use this feature
2. Compile into kernel module requires modprobe mount
3. Compile into kernel kernel part, kernel load, he will load


How to manually compile the kernel
Need to install
Development Libraries
Development Tools

To install on a local optical drive:
Hanging in the mirror
cd/etc/yum.repos.d/
Vim Local.repo

[Base]
Name=server
Baseurl=file:///media/cdrom/server
Enabled=1
Gpgcheck=0

Mkdir/media/cdrom
Mount/dev/cdrom/media/cdrom

Yum Groupinstall "Development Tools" "Development Libraries"-y

#ls
Linux-2.6.28.10.tar.gz
#tar XF linux-2.6.28.10.tar.gz-c/usr/src
#cd/USR/SRC
#ls-SV linux-2.6.28.10 Linux
#cd Linux
#ls Arch
#ls FS

To manually compile the kernel:
Make Gconfig GNOME desktop environment GNOME software development
Make Kconfig KDE desktop environment KDE software development
Also need to install the Graphic Development Library "two different libraries"



You can modify the configuration of the system: LS/BOOT/CONFIG-2.6.18-308.EL5
[[Email Protected]]cp/boot/config-2.6.1-308.el5/usr/src/linux/.config
[[Email protected]]# make Menuconfig
[[Email protected]]# make
[[Email protected]]# make Modules_install
[[Email protected]]# make install

will automatically change Grub.menu
Restart

To prevent interruptions, you can use the screen


It's compiled, but it can't be used.
Two-time compilation:
Make clean
Make mrproper. config will also clean up
Both will clean up files such as. config.
And then compile the

Advanced: Only one module in the kernel is compiled, only one directory of the kernel is compiled
Grub->kernel->initrd->rootfs (/sbin/init,/bin/bash)

Linux kernel compilation, kernel parameter modification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.