Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand Linux kernel compilation

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to understand Linux kernel compilation, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Preface (for reference only)

How to learn the linux kernel

1. Install the vmware virtual machine or virtualbox, and then install the distribution version linux

2. Www.kernel.org, pick a kernel version

3. Decompress and compile

4. Write some modules yourself (for example, you can try to solve some bug of the official website), as shown in the following figure:

Below we can see that there are still a lot of unsolved problems with kernel bug:

The following is the submitted bug test report:

Finally, if possible, you can try to solve these bugbacks!

5. Kernel source code (network) read: tcp_input.c tcp_out.c tcp_ipv4.c tcp.c

Process management: task_struct

1. Download linux kernel version:

1. We can download the linux kernel version: www.kernel.org:

Note: what I download here is the latest kernel for compilation. The environment is in ubuntu18.04;. Note that if a lower version of ubuntu compiles a version of linux kernel, there may be some environment configuration problems, such as the low version of make and so on.

2. Decompress and configure and compile:

(1) here I use the smbd server to share the windows file. Now I begin to extract the linux kernel file I just downloaded:

Note: the linux kernel file downloaded at the beginning ends with ".xz". We will extract it with the following command:

Xz-d linux-5.8.10.tar.xz

(2) then you will get the file shown above; here is the official decompression of the file:

Root@txp-virtual-machine:/home/txp/share01# tar xvf linux-5.8.10.tar

(3) then switch to the directory of the extracted files, and make some preparations:

Root@txp-virtual-machine:/home/txp/share01# cd linux-5.8.10 root@txp-virtual-machine:/home/txp/share01/linux-5.8.10# ls arch certs CREDITS Documentation fs init Kbuild kernel LICENSES Makefile net samples security tools virt block COPYING crypto drivers include ipc Kconfig lib MAINTAINERS mm README scripts sound usr

(4) then install some plug-ins. Here I have already tried and made an error in advance, so just install the following installation configuration (you can install some configurations according to the error message when you perform make menuconfig for the first time):

Sudo apt-get install libncurses5-dev flex bison libssl-dev

(5) make menuconfig, the interface appears and save exits (you can directly press the ESC key on the keyboard to exit):

(6) start compiling the kernel, which can be compiled and configured according to how many core processors your computer is (my computer is Ares, quad-core processor)

Root@txp-virtual-machine:/home/txp/share01/linux-5.8.10# make-j4 CC [M] net/bridge/br_vlan.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clock_source.o LD [M] net/dsa/dsa_core.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_scl_filters.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.o CC [M] drivers/gpu/drm/i915/gvt/mmio.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_opp.o CC [M] net/appletalk/aarp.o CC [M] net/bridge/br_vlan_tunnel.o CC [M] drivers/gpu/drm / i915/gvt/display.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_dmcu.o CC [M] net/appletalk/ddp.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_abm.o CC [M] net/bridge/br_vlan_options.o CC [M] drivers/gpu/drm/i915/gvt/edid.o CC [ M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_ipp.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.o CC [M] net/bridge/br_switchdev.o CC [M] net/appletalk/dev.o CC [M] drivers/gpu/drm/i915/gvt/execlist.o CC [M] drivers/gpu/drm/amd/amdgpu/ .. / display/dc/dce/dce_i2c.o CC [M] net/appletalk/atalk_proc.o CC [M] net/bridge/br_netfilter_hooks.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_i2c_hw.o CC [M] drivers/gpu/drm/i915/gvt/scheduler.o

Note: because it is the latest kernel, it takes a long time to compile, so just wait patiently (probably at least dozens of minutes.) When compiling, we can also take a look at memory

Htop

(7) if you want to modify the current kernel version of ubuntu, you can follow the following steps. I am not going to replace the kernel here. I have configured too many things, so.

Current kernel version:

Root@txp-virtual-machine:/home/txp/share01/linux-5.8.10# uname-r 5.3.0-28-generic

A. Install and compile the kernel module first:

Make modules_installmake bzImage

B. Install the newly compiled kernel (replace the current kernel with the new kernel we just compiled):

$cp arch/x86/boot/bzImage / boot/vmlinuz-5.8.10$ cp .config / boot/config-5.8.10$ cd / lib/modules/5.8.10/ $update-initramfs-c-k 5.8.10$ update-grub on how to understand the compilation of the Linux kernel is shared here. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report