Linux brain "kernel" kernel compilation (NTFS)

Source: Internet
Author: User



Linux brain "kernel" about it


What is a kernel

Kernel (kernel) is the core of the operating system, the equivalent of the human brain, the control of all hardware devices, that is, you want the computer to help you do all the work, it needs to be done through the kernel's help, of course, if you want to implement a function kernel is not provided, then you must add the relevant modules to the kernel, Just like the driver, with the support of the module our computer can control the hardware, complete the work we want to do

The kernel is actually the system above a file, this file contains the driver hardware detection program and Driver module, the kernel file in the/boot directory next to Vmlinuz beginning of the file, sometimes/boot below a few vmlinuz start of the file, but the start can only load one, So the Linux system is a single core, multi-module system

The official website of the Linux kernel is http://www.kernel.org, which accesses the website to obtain the code for each version of the kernel. The latest stable version of the current kernel is displayed on the home page of the site.

You can use https://www.kernel.org/pub/linux/kernel/to find any kernel version you want, and use wget to download his

The following instance does a kernel compilation (NTFS supported)

Kernel compilation Specific steps

To perform the steps:

1、到www.kernel.org上下载相应的内核源码包 
2、确认你的系统中已经具备了编译软件的基本条件,也就是要安装make ,gcc, gcc-c++ ,ncurses-devel和库工具等等 。  开发工具和库
3、解压内核源码包
4、配置内核编译参数
5、编译内核、安装编译好的内核与模块
6、查看或修改GRUB菜单(为了确认你是不是真的把内核安装好了)
7、重新启动系统,测试新内核的工作情况
1, download the corresponding kernel source package

I will not be here, (the speed is too slow/(ㄒoㄒ)/~~) but I have linux-3.16.2.tar local you can go to the official website to download and see

2. Install Development Group Tools

[email protected] ~]# yum groupinstall "Server Platform Development" "Development tools"


3, decompression kernel source package

[Email protected] sdb1]# tar xvf linux-3.16.2.tar.xz

[Email protected] sdb1]# Du-sh linux-3.16.2/

634Mlinux-3.16.2/

4. Configuring kernel compilation Parameters

Since we only add one NTFS, we copy our existing environment. config to the source package directory

[Email protected] linux-3.16.2]# cp/boot/config-2.6.32-642.el6.x86_64./.config

[[email protected] linux-3.16.2]# make Menuconfig Open the text window and configure the kernel options (here according to the definition in the. config file)

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/38/wKiom1fXxdOC61STAADVxKAnPdg358.png "title=" Qq20160913092425.png "alt=" Wkiom1fxxdoc61staadvxkanpdg358.png "/>

If you want to query, where is a parameter, in this interface, enter:/And then enter: NTFS is displayed as follows:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/38/wKiom1fXxh7C1PHjAAFKEdMnFb8234.gif "title=" Gif.gif "alt=" Wkiom1fxxh7c1phjaafkedmnfb8234.gif "/> The NTFS option is selected, save. After saving, press ESC or select the exit process to exit

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/38/wKiom1fXxxvQUCGwAAqJ0mTvtAI428.gif "title=" Gif2.gif "alt=" Wkiom1fxxxvqucgwaaqj0mtvtai428.gif "/>

During the configuration process:

[]: Indicates no compilation

[M]: means to compile as a module

[*]: compiled into the kernel


5. Compile the kernel

[[email protected] linux-3.16.2]# make [-j 2] indicates CPU thread compilation

[[email protected] linux-3.16.2]# make Modules_install installation module

[[email protected] linux-3.16.2]# make install kernel-related files

6. View or modify the Grub menu (to make sure you've actually installed the kernel)

[Email protected] linux-3.16.2]# vim/boot/grub/grub.conf

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/36/wKioL1fX1tqSS1n1AAD4MtEPa0A863.png "title=" QQ picture 20160913103706.png "alt=" Wkiol1fx1tqss1n1aad4mtepa0a863.png "/>

7. Restart the system to test the new kernel's performance

Note that in the start, you need to come in to choose, otherwise the default or the previous kernel boot Oh. Unless you change the default startup item in the previous step.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/87/39/wKiom1fX2FLSm4vuAAEpo3dgNyo833.gif "title=" Gif.gif "alt=" Wkiom1fx2flsm4vuaaepo3dgnyo833.gif "/> My first item is the new kernel.

8. After booting the system with the new kernel, view the kernel version

[Email protected] ~]# uname-r

3.16.2

[Email protected] ~]# uname-a

Linux localhost.localdomain 3.16.2 #1 SMP Mon Jul 10:34:36 CST x86_64 x86_64 x86_64 gnu/linux

[Email protected] ~]#


Kernel module operation


Kernel (module) management commands:

The function of a module: A program that encapsulates a specific function. For example, Oki Bao. All phones can be flushed.

The target path of the kernel module is stored:

[Email protected] ~]# ll/lib/modules/

Total 8

Drwxr-xr-x. 7 root root 4096 Jul 08:43 2.6.32-642.el6.x86_64

Drwxr-xr-x 3 root root 4096 Jul 25 12:31 3.16.2

[Email protected] ~]# cd/lib/modules/3.16.2/kernel/fs/

[[email protected] fs]# ls fat/

Fat.ko Msdos.ko Vfat.ko

#Linux可以直接支持FAT32文件系统


Insert module:

Insmod

Function: Load Module

Example: Loading module Fat.ko

[Email protected] fs]# Insmod Fat/fat.ko


View modules loaded in the current system

#lsmod List the current module

[Email protected] fs]# Lsmod | grep fat

Fat 59379 0


Deleting a module

#rmmod Fat #删除模块. Keep up with the name of the module

[Email protected] fs]# rmmod fat

[Email protected] fs]# Lsmod | grep fat

[Email protected] fs]#


View module Information

#modinfo Viewing module information

[Email protected] fs]# Modinfo VFAT

FileName:/lib/modules/3.16.2/kernel/fs/fat/vfat.ko

Author:gordon Chaffee

DESCRIPTION:VFAT filesystem Support

License:gpl

Alias:fs-vfat

Srcversion:d2372bc4e9386742f7ae1a6

Depends:fat

Intree:y

vermagic:3.16.2 SMP mod_unload modversions


#modprobe plug -in module (can automatically resolve dependencies between modules, like Yum automatically resolves dependencies between RPMs)

[Email protected] fat]# modprobe VFAT

[Email protected] fat]# Lsmod | grep fat

VFAT 10575 0

Fat 59379 1 VFAT


#modprobe-R removes the same module as Rmmod. Cannot automatically resolve dependencies when deleting


Load a driver on boot:

[Email protected] ~]# ll/etc/rc.local

lrwxrwxrwx. 1 root root 08:37/etc/rc.local-rc.d/rc.local

[Email protected] ~]# vim/etc/rc.local

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/87/39/wKiom1fX35LyyA8iAAA-gyR9D5I534.png "title=" Qq20160913111357.png "alt=" Wkiom1fx35lyya8iaaa-gyr9d5i534.png "/>


Actual combat-Compile an NTFS kernel module to implement Linux mounted NTFS file system

To install fuse:

[Email protected] ~]# tar zxvf fuse-2.8.3.tar.gz

[Email protected] ~]# CD fuse-2.8.3

[Email protected] fuse-2.8.3]#./configure

[[email protected] fuse-2.8.3]# make && make install

Installation: ntfs-3g

[Email protected] ~]# tar zxvf ntfs-3g-2011.1.15.tgz

[Email protected] ~]# CD ntfs-3g-2011.1.15

[Email protected] ntfs-3g-2011.1.15]#./configure

[[email protected] ntfs-3g-2011.1.15]# make && make install


Mount:

Plug in an NTFS-formatted USB flash drive. Then import the USB stick into the virtual machine

[Email protected] ~]# mount-t ntfs-3g/dev/sdb1/opt/


Automatic mount on Boot:

[Email protected] ~]# Vim/etc/fstab

/dev/sdb1/opt ntfs-3g Defaults 0 0


This article is from the "Restart under test" blog, please be sure to keep this source http://zhang789.blog.51cto.com/11045979/1852406

Linux brain "kernel" kernel compilation (NTFS)

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.