为什么要编译linux内核?
高洛峰
高洛峰 2017-04-17 14:29:54
0
5
772

鄙人新手,对一些概念不能很理解,总有人说自己编译了一下linux内核,这个具体什么意思呢?有什么好处?还有模块编译又是个啥?编译会不会导致原来的linux炸掉?原来的内核是不是就是被卸载了?或者推荐一些关于这方面的网站博客之类……我实在搜不到自己想要的……谢谢了

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(5)
刘奇

The purpose of this type of compilation is mainly to understand the Linux kernel compilation process through compilation, become familiar with the working principle of the kernel, and even try to make some modifications.

Compilation only compiles the source code into a program. It will not replace the current system, nor will it affect the operation of the current system.

伊谢尔伦

There is no essential difference between compiling the kernel and compiling other software. It’s all a process from code to binary. Compiling the kernel is just a little more complicated.
After compilation is completed, you can use the new kernel to boot or choose the previous kernel to boot.
Generally, there is no need to recompile the kernel, unless you need to customize the kernel, such as cutting the kernel, applying a new patch, or writing a kernel module yourself.

大家讲道理

He changed something and it felt good, so he said... I compiled the Linux kernel
Recommended "In-depth Understanding of the Linux Kernel"

洪涛

Compiling the kernel may be due to certain needs, such as kernel size requirements and removing some unused parts of the kernel. This scenario is often embedded systems.
Or you have modified some part of the kernel code yourself and need to verify the function after compilation.

When compiling the module, some functional modules are compiled into .ko. You can insmod xxx.ko to use the written code functions in the system without recompiling the kernel.

After compiling the kernel, the current kernel will not be replaced. The new compiled kernel is often in a directory similar to the following, and its name is mostly bzImage
/usr/src/kernels/3.xx.x-.x86_64/arch/ x86/boot/

Then you can edit the system's grub list to add the latest kernel to use it

迷茫

No need to compile, install the latest version of the Linux kernel officially built by Ubuntu in 1 minute
The new kernel integrates new drivers, such as Intel Core Display:

/lib/modules/`uname -r`/kernel/drivers/gpu/drm/i915/i915.ko

A system can install multiple kernels, such as startup files, and the new kernel will not overwrite the old kernel:

/boot/vmlinuz-VERSION
/boot/initrd.img-VERSION

During the installation of a new kernel, some kernel modules need to be recompiled, such as VirtualBox:

/lib/modules/`uname -r`/updates/dkms/vboxdrv.ko

If the new kernel does not run properly, you can select the old kernel to start in the GRUB boot process.
You can also change back to the original kernel like this:

ln -sf /boot/vmlinuz-VERSION /vmlinuz
ln -sf /boot/initrd.img-VERSION /initrd.img

Where VERSION is the original kernel version.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template