Find the kernel source code corresponding to the running Ubuntu version

This article mainly describes how to find the corresponding kernel source code according to the currently running Ubuntu version.

First, download the corresponding kernel source code repository according to the content in the link below.

https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide

If you think the content in the link is too long, you can try the following command.

git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/$(lsb_release -cs)

This command will download the corresponding kernel code according to your current Ubuntu version.

If this command reports no error, it means everything went well, just wait for the download to complete.

After the Ubuntu kernel code is downloaded, the default is the master branch. This branch usually does not exactly correspond to the Ubuntu version we are currently running, so we have to switch branches.

First, find the exact version number of Ubuntu currently running through the following command.

➜ bionic git:(master) cat /proc/version_signature
Ubuntu 4.15.0-45.48-generic 4.15.18

Among them, the information before -generic corresponds to the tag of the Ubuntu kernel source code, but the space after Ubuntu should be replaced with a dash. For example, the tag corresponding to the output of the above command is Ubuntu-4.15.0-45.48.

Then, we enter the downloaded kernel source code directory and execute the following command to switch the source code to the version corresponding to the tag.

➜ bionic git:(master) git checkout Ubuntu-4.15.0-45.48
HEAD is now at ffdd392b8196 UBUNTU: Ubuntu-4.15.0-45.48

Well, now we have the kernel source code of the currently running Ubuntu version, and can start to read the source code and do experiments.

Get it done.

Recommended Posts

Find the kernel source code corresponding to the running Ubuntu version
ubuntu16.04 method steps to upgrade the kernel
Use the command line to detect the Ubuntu version method
Python code to find bugs (2)
Python code to find bugs(7)
Python code to find bugs(4)
Python code to find bugs (3)
Python code to find bugs(9)
Python code to find bugs(6)
Minimalism is the soul of Python | Python code to find bugs (10)
Python code to find bugs (1)
Python code to find bugs(8)
Python code to find bugs(5)
ubuntu 12.04 configure the kernel crash to automatically restart and dump
Android source code compilation (ubuntu16.04 64-bit)
How to compile and install xdebug from source code in Ubuntu environment
Install the latest Python 3.6 version on Ubuntu
Modify the software default source to Tencent source
How to replace apt-get source on Ubuntu 18.04
Download OpenJDK11 source code in Ubuntu environment
Ubuntu modified the default sh to bash
How to modify software source in Ubuntu 7.10
The relationship between Open3D version and Ubuntu
Ubuntu 18.04 install Odoo14 tutorial through source code
How to modify the hostname on Ubuntu 20.04
Edit OpenJDK11 source code in Ubuntu environment