Experimental EnvironmentArch Linux on VirtualBox
Download Kernelhttps://www.kernel.org/Download the kernel compression package:
Unpack the package$ sudo tar-xvjf
linux-4.1.tar.xz
to setHere I use the default settings for the current running kernel. Copy the configuration file (. config file) of the running kernel to the compiled root. $ zcat/proc/config.gz >. config of course, you can also manually set$ sudo make menuconfig(detailed instructions are available at the end of the resources section)
compiling the kernel$ sudo make [-j 2]The following parameter,-J2, indicates that the CPU has to turn on two threads to compile the kernel, which speeds up the compilation. after compiling the kernel file:
Mounting Module$ sudo make modules_install
Copy the compiled kernel to the/boot directory$ cp-v arch/x86/boot/bzimage/boot/vmlinuz-
yourkernelname here Yourkernelname for 4.1:$ cp-v arch/x86/boot/bzimage/boot/vmlinuz-
4.1
make initialize memory disk $ mkinitcpio-k
fullkernelname /etc/mkinitcpio.conf-g/boot/initramfs-
yourkernelname. img
The available fullkernelname can be queried through the ls/lib/modules command : here fullkernelname for
4.1.0-arch(e.g.): $ mkinitcpio-k
4.1.0-arch -c/etc/mkinitcpio.conf-g/boot/initramfs-
4.1. IMG
[Copy System.map]$ cp system.map/boot/system.map-
yourkernelname here Yourkernelname for 4.1:$ cp system.map/boot/system.map-
4.1 $ ln-sf/boot/system. Map-yourkernelname/boot/system.map
Set Startup Items$ grub-mkconfig-o/boot/grub/grub.cfgwe can see that grub automatically adds a new kernel
Restart$ reboot 0
kernel comparison before and after compilationbefore compiling:after compiling:
References1. Https://wiki.archlinux.org/index.php/GRUB
2. Https://wiki.archlinux.org/index.php/GRUB(Thanks to Arch-linux's detailed wiki documentation)
Linux 4.1 Kernel compilation report