I recently learned the linux course. I want to compile the system kernel for my experiments .. It took a whole morning to get it done.
Note: Some make commands in the following process may require permission.
1. At the beginning, check your current system version: uname-a; mine is 3.2.0.-23.
2. Then download an internal audit file at http://www.kernel.org/and upload it to 3.4.88.
3. Install the compilation tool:
sudo apt-get install libncurses-dev kernel-package bzip2 make ncurses-dev fakeroot module-init-tools patchsudo apt-get install libqt3-headers libqt3-mt-devsudo apt-get install libqt3-compat-headers
I installed these three in the morning...
4. decompress the downloaded kernel. // it seems that you can decompress the downloaded kernel directly in the downloaded directory without copying it to the src directory.
4.1. Copy the source code to the/usr/src/directory, cp linux-3.4.88.tar.xz/usr/src/; here note that my format is. tar. xz
4.2. Enter the/usr/src/directory cd/usr/src /;
4.3. decompress the package. Tar Jvfx linux-3.4.88.tar.xz; Note the uppercase J
5. Enter the directory of the decompressed source code: cd linux-3.4.88
6. Clear the temporary files left by the previous compilation. Make mrproper
7. Use make localmodconfig to automatically streamline the Kernel configuration. Make localmodconfig, all options. If you are not sure, press the Enter key and select the default configuration. // You can use make menuconfig to view other materials... But a little troublesome
8. After the configuration is complete, compile the kernel and enter the make command on the terminal.
Another troublesome method is to enter the following commands on the terminal in sequence: (add sudo before it, if you do not have the permission)
Make dep; the system may prompt that it is not required. If it is okay, run the "make clean" command directly. It seems that I used this command at the time... Sudo make-kpkg cleanmake bzlmage; note that the I behind bz is an uppercase make modules
It seems that it took dozens of minutes ........
9. Install the kernel module after compiling the kernel.
Sudo make modules_install
Sudo make install
10. Copy the generated bzImage and System. map files to the/boot/directory. The command is as follows: // you do not know this step...
Cp/usr/src/linux-3.4.88/arch/x86/boot/bzImage/boot/
Cp/usr/src/linux-3.4.88/System. map/boot/
12. Enter the following command on the terminal:
Mkinitramfs 3.4.88-o/boot/initrd/img-3.4.88 to create image files
Then enter the command:
Update-initramfs-c-k 3.4.88
Run the following command:
Update-grub2 //
13. Restart and check your kernel version.
Figure: