How user space accesses and monitors the kernel:
/proc,/sys
Pseudo File System:
/proc/sys: Files in this directory a lot of things to read and write
/sys/: Some files can be written
Setting kernel parameters is worth the method:
Echo Value>/proc/sys/to/somefile
Sysctl-w Kernel.hostname=hostname Here is the equivalent of
echo HOSTNAME >/proc/sys/kernel/hostname
Permanently valid:/etc/sysctl.conf immediately after modification effective: sysctl-p
SYSCTL-A: Show all kernel parameters and values
Kernel Module Management:
Lsmod: View
Modprobe mod_name Loading a module
Modprobe-r Mod_name Uninstalling a module
Modinfo: View specific information about the module
Insmod/path/to/module_file Loading Module
Rmmod Mod_name
Depmod/path/tp/modiles_dir
Compile the kernel:
3 Options for compiling:
1. Do not use this feature
2. Compile into kernel module
3. Compiling into the kernel
How to manually compile the kernel:
Make Gconfig:gnome desktop use, need to install the Graphics Development Library tool
Make Kconfig:kde Desktop use
Make Menuconfig: File interface
(By default, when we finish, we will build the. config file in the directory of the compiled kernel, and you can copy the/boot/config-' uname-r ' file to the current one if you don't want to choose it. config, and then select Modify)
Make
Make Module_install
Make install
Two compile-time cleanup, before cleaning, remember to back up if necessary. config
Make clean deletes most of the compiled build files, but retains the kernel's configuration files. config, and enough compilation
Make Mrproper Delete all compiled build files, as well as kernel configuration files, plus various backup files
Make Distclean mrproper deleted files, plus edit backup files and some patch files.
Start DIY Mini Linux below
Mount a new hard disk to a virtual machine
Process slightly
partition, format, and mount a new hard disk
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/83/5C/wKiom1dxMsKQv3x9AAM2cKGlAKE685.png-wh_500x0-wm_3 -wmp_4-s_1319868316.png "title=" ML) O ' rp% ({22wfh6~)]m5uq.png "alt=" Wkiom1dxmskqv3x9aam2ckglake685.png-wh_50 "/>
Mke2fs-j/DEV/SDB1
Mke2fs-j/DEV/SDB2
Mkdir/mnt/{boot,sysroot}-P
Mount/dev/sdb1/mnt/boot
Mount/dev/sdb2/mnt/sysroot
Install the boot partition and provide the grub.conf file
Grub-install--root-directory=/mnt//dev/sdb
(This directory specifies the parent directory where the boot directory of the new hard disk is located, and the grub file directory will be generated in boot after completion)
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/83/5B/wKioL1dxNSuRo7X1AABRZUEhOBI391.png-wh_500x0-wm_3 -wmp_4-s_4002726397.png "title=" 6n{0} ' Ihmyu4nn@5@5biqxn.png "alt=" Wkiol1dxnsuro7x1aabrzuehobi391.png-wh_50 "/>
4. Copy the kernel and INITRD files to/boot
cp/boot/vmlinuz-' Uname-r '/mnt/boot/vmlinuz
(INITRD file can not be used directly, need to modify a few places, so we first extract to a directory)
Mkdir/mnt/init
Cd/mnt/init
zcat/boot/initrd-' uname-r '. IMG |cpio-id
Vi/mnt/init/init Modify the following items:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/5B/wKioL1dxOIPSgwyMAACgDp58hu8770.png-wh_500x0-wm_3 -wmp_4-s_303952852.png "title=" R ' 649kzhk[gn{] $FQ $cv{og.png "alt=" Wkiol1dxoipsgwymaacgdp58hu8770.png-wh_50 "/>
(LVM we do not need to use, so first write off, Mkrootdev inside the device to pay attention to a little, we currently have SDA on the system, so identify the new hard disk as SDB, but the new hard disk will be recognized as SDA when used alone, and the root file system is located in the partition 2nd partition, So we'll replace it with/dev/sda2.
Find. |cpio-h NEWC--quiet-o|gzip-9 >/mnt/boot/initrd.img
5. Create the root file system and copy the program:
mkdir bin sbin Boot etc/{rc.d,init.d} usr/{local,bin,sbin,lib} lib lib64 proc sys Dev TMP home-p
(To save time, write a script that directly copies the commands of Bash, init, LS, etc.)
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/5C/wKiom1dxOwPDOpkwAAFqXhRfUcA262.png-wh_500x0-wm_3 -wmp_4-s_4015231191.png "title=" _]d ' ig]n[[) wx[0}[f~p~q6.png "alt=" Wkiom1dxowpdopkwaafqxhrfuca262.png-wh_50 "/>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/83/5B/wKioL1dxO3qTb9ucAADfp885NzE914.png-wh_500x0-wm_3 -wmp_4-s_3328924576.png "title=" $4a4xz) V0)]z08_q ' 8y]_1r.png ' alt= ' wkiol1dxo3qtb9ucaadfp885nze914.png-wh_50 '/>
Test if you can chroot
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/83/5C/wKiom1dxO-2xDoHGAAA7UN6TE8M371.png-wh_500x0-wm_3 -wmp_4-s_699212660.png "title=" HIJ ' W8) hdjd1fs@fn@) ait9.png "alt=" Wkiom1dxo-2xdohgaaa7un6te8m371.png-wh_50 "/>
6. Provide configuration file Inittab, and Rc.sysinit
Vi/mnt/sysroot/etc/inittab Add the following two lines:
Id:3:initdefault:
Si::sysinit:/etc/rc.d/rc.sysinit
Vi/mnt/sysroot/etc/rc.d/rc.sysinit
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/83/5B/wKioL1dxP3mi8mk1AAAZ6xpp_A8964.png-wh_500x0-wm_3 -wmp_4-s_281992419.png "title=" 5{g2i4%h22}[y2wgojfmm2x.png "alt=" Wkiol1dxp3mi8mk1aaaz6xpp_a8964.png-wh_50 "/>
chmod +x/mnt/sysroot/etc/rc.d/rc.sysinit
7. At this point, a not perfect mini Linux has been able to start, the next one to talk about how to perform the run level characters and mount the root partition for reading and writing, so that the system can switch machine, and now test, should be able to start the.
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/83/5D/wKiom1dxQC7SB0x4AAASKrBaPtQ348.png-wh_500x0-wm_3 -wmp_4-s_975634639.png "style=" Float:none; "title="%o}%) 1) 2_N{4DFWA (iqpo%c.png "alt=" Wkiom1dxqc7sb0x4aaaskrbaptq348.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/83/5B/wKioL1dxQC7gtg_lAAAa5bVyfDU811.png-wh_500x0-wm_3 -wmp_4-s_1922372783.png "style=" Float:none; "title=" 4vz~)%kk[%di) 29[bmt]n3e.png "alt=" Wkiol1dxqc7gtg_ Laaaa5bvyfdu811.png-wh_50 "/>
Redhat 5 Series DIY Mini Linux One