Ubuntu12.04 Detailed Explanation of the Implementation Process of Establishing Kernel Tree
- 2021-08-31 09:48:40
- OfStack
Check the kernel version you use first
lin@lin-virtual-machine:~$ uname -r
3.2.0-23-generic
If the system is installed, the source code is automatically installed. There is a corresponding version directory for use under the/usr/src directory.
lin@lin-virtual-machine:~$ cd /usr/src
lin@lin-virtual-machine:/usr/src$ ls
linux-headers-3.2.0-23 linux-headers-3.2.0-23-generic
View the downloadable source package under 1
lin@lin-virtual-machine:/usr/src$ apt-cache search linux-source
linux-source - Linux kernel source with Ubuntu patches
linux-source-3.2.0 - Linux kernel source for version 3.2.0 with Ubuntu patches
I choose here so "linux-source-3. 2.0-Linux kernel source for version 3.2. 0 with Ubuntu patches" direct install
lin@lin-virtual-machine:/usr/src$ sudo apt-get install linux-source-3.2.0
After downloading, under/usr/src, the file name is: linux-source-3. 2.0. tar. bz2, which is a compressed package, and the source code of the whole kernel can be obtained by decompressing.
Use pwd to view the current path
ls to see what files are in the folder
lin@lin-virtual-machine:/usr/src$ pwd
/usr/src
lin@lin-virtual-machine:/usr/src$ ls
linux-headers-3.2.0-23 linux-source-3.2.0
linux-headers-3.2.0-23-generic linux-source-3.2.0.tar.bz2
Decompression
lin@lin-virtual-machine:/usr/src#sudo tar jxvf linux-source-3.2.0.tar.bz2
Enter this directory (cd linux-source-3. 2.0)
lin@lin-virtual-machine:/usr/src$ cd linux-source-3.2.0/
lin@lin-virtual-machine:/usr/src/linux-source-3.2.0$ pwd
/usr/src/linux-source-3.2.0
Start configuring the kernel and choose the fastest original configuration (default) method
lin@lin-virtual-machine:/usr/src/linux-source-3.2.0$ sudo make oldconfig
make needs to wait for more than one hour. . .
lin@lin-virtual-machine:/usr/src/linux-source-3.2.0$ sudo make
A few hours later
...System is 4826 kB
CRC d5a51584
Kernel: arch/x86/boot/bzImage is ready (#1)
Building modules, stage 2.
MODPOST 3304 modules
ERROR: "__modver_version_show" [drivers/staging/rts5139/rts5139.ko] undefined!
WARNING: modpost: Found 4 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Solution: From http://ubuntuforums.org/showthread.php? t=1931029
lin@lin-virtual-machine:/usr/src/linux-source-3.2.0$ sudo gedit .config
RTS5139 driver is estimated to be the problem. Anyway, do not use this driver, do not add compile, edit. config, will
CONFIG_RTS5139=m
Amend it to the following form:
CONFIG_RTS5139=n
Continue with make
Compile the compressed kernel
make bzImage
Compile module:
make modules
Installation module:
make modules_install
After execution, a new directory is generated under/lib/modules
lin@lin-virtual-machine:/lib/modules$ ls
3.2.0-23-generic 3.2.79
Restart after success.