search

Home  >  Q&A  >  body text

为什么要编译linux内核?

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

高洛峰高洛峰2796 days ago783

reply all(5)I'll reply

  • 怪我咯

    怪我咯2017-04-17 14:31:54

    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.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 14:31:54

    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.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 14:31:54

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 14:31:54

    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

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:31:54

    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.

    reply
    0
  • Cancelreply