In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today I will show you what the steps of Linux kernel migration are. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.
How to port the Linux kernel? The so-called kernel migration is transferred from one hardware platform to another.
Method 1: compile and replace the source code package provided by kernel
1. First of all, there are two preparations for kernel compilation: one is to download the source code package on the linux kernel official website, and the other is to install any version of the linux Ubuntu system and download the corresponding compilation tools.
Download the source package on linux kernel at https://www.kernel.org/pub/linux/kernel/, and select the corresponding source package to download. Note that the size of the source package is generally about 10 megabytes, and the suffix is .tar.bz2, as shown below: take linux_3.2.1 as an example:
After the download is complete, do the second preparation, install any version of Ubuntu, install the image URL: http://www.ubuntu.org.cn/download, install the Ubuntu operating system like any other operating system, and then configure the network to download apk_get. The following procedure is performed under root permissions to install the relevant compiler. Install make, gcc, make-kpkg, run menuconfig and other tools related to compiling the kernel.
Relevant orders:
Sudo apt-get install build-essential kernel-package libncurses5-dev Note: (1) libncurses5-dev is the preparation for configuring the kernel to run the make menuconfig program. Build-essential is the compilation tool, and kernel-package is the kernel compilation tool.
(2) if the system shows that the three files cannot be found, enter # apt-get update to update the data source. Copy the source code package you just downloaded into the ubuntu system and decompress it to the / usr/src directory. You can right-click and decompress the package, or use the following command to decompress:
$sudo tar Jvfx linux-3.4.88.tar.xz2, start configuring the relevant files and environment for compilation, first of all, clean up the temporary files left behind during previous compilation. If you have just unpacked the package, you do not need to perform this step. If it is the second or nth compilation, be sure to execute it. The relevant commands are as follows:
# $sudo make mrproper then copy the configuration file of the original kernel to become the configuration file of the new kernel, and command:
# cp / boot/config- `uname-r`. / .config what needs to be explained here is that it is very convenient to copy it, which is equivalent to directly providing the corresponding configuration files for the new kernel compilation, telling the kernel which files need to be compiled and which do not need to be compiled, but after several compilation modifications, this part can be customized, using the tool menuconfig we downloaded earlier.
Enter the source directory of the kernel
# cd / usr/src/linux_3.2.1 executes the following command:
# make menuconfig Note: this command needs to be executed under superuser privileges, otherwise some strange errors may be reported. After executing this command, you can see the following picture: in this picture, you can make a change to the configuration file. If you copied the configuration file of the original kernel directly, select load an Alternate Configuration File on the penultimate line at this time, and then sava.
If you configure yourself, select any of the above directories to select which files to compile and which do not compile, generally need to choose the device driver, the option is Device Drivers, after the selection is also saved save.
Note that both ways are fine, depending on the user's own choice. For specific content analysis of each option, please see the blog: http://forum.ubuntu.org.cn/viewtopic.php?t=134404
3. Start compiling the new kernel compilation command:
# make all-j4 can compile the kernel after executing the above command. Make all compiles the kernel and the module together. The following parameter,-j4, indicates that cpu starts four threads to compile the kernel. Generally speaking, each cpu can open two threads to compile the kernel. My computer has two cpu, so four threads are started. Compiling in this way is really fast. I haven't found such compilation before, and only one thread can really wait a long time.
So the command to copy is:
# cp arch/x86_64/boot/bzImage / boot/vmlinuz-3.2.1 needs to be explained here. BzImage must be a generated file that has been compiled successfully. If you don't have this file, sorry, the compilation failed, please go back to compile. Vmlinuz-3.2.1 orders on its own initiative and can be changed by itself, but it is generally this way of command.
5. Copy the System.map from the source code directory to the / boot directory: command:
# cp / usr/src/linux-3.2.1/System.map System.map-3.2.16 、. Copy .config from the source code directory to the / boot/ directory: command:
# cp .config / boot/config-3.2.17, install module command:
# make modules_install8, generate initrd.img file # cd / lib/modules/3.2.1 # update-initramfs-c-k 3.2.19,. Switch to the / boot/grub/ directory, automatically find the new kernel, add it to the grub boot # update-grub10, and modify the boot grub startup interval. The command is as follows: # cd / ect/default # sudo nano. / grub comment out the two lines of hidden code, so that the boot grub will appear, and you can choose which kernel version to boot.
# GRUB_HIDDEN_TIMEOUT=0 # after the GRUB_HIDDEN_TIMEOUT_QUIET=tru changes are completed, regenerate the grub.cfg file with the same command as above:
# update-grub11, change to the grub.cfg directory to check whether the startup entry of the new kernel is updated. If so, there is no need to modify it. If not, modify it manually.
# cd / boot/grub # sudo nano. / grub.cfg is modified manually, according to the format of the original kernel, only by changing the name of the new kernel.
12. Restart the computer, select the newly compiled kernel in previous version, and successfully enter the system. Enter the kernel version detection command:
Command: # uname-r will show the name of the new kernel! Congratulations, the kernel has been replaced successfully!
Method 2: download the kernel installation package deb to upgrade and replace. First of all, I have tried two computers with two different kernel upgrades, both of which are successful. The reasons are unknown: the specific steps are as follows:
1. Download the deb package and download the required upgrade package on http://kernel.ubuntu.com/~kernel-ppa/mainline/. Downloaded here are three 64-bit version 3.5.4 deb packages:
Linux-headers-3.5.4-030504 030504-generic_3.5.4 3.5.4-030504.201209142010_all.deb linux-headers-3.5.4-030504-generic_3.5.4-030504.201209142010_amd64.deb linux-image-3.5.4-030504-generic_3.5.4-030504.201209142010_amd64.deb2. Install the deb package first install the schema-independent headers package with all
Sudo dpkg-I linux-headers-3.5.4-030504kernel 3.5.4-030504.201209142010_all.deb sudo dpkg-I linux-headers-3.5.4-030504-generic_3.5.4-030504.201209142010_amd64.deb sudo dpkg-I linux-image-3.5.4-030504-generic_3.5.4-030504.201209142010_amd64.deb is installed, the files related to the new kernel are generated in the / boot directory, and the corresponding modules are also generated in the / lib/modules directory.
3. The update launcher grub starts with step 9 above, as above. After updating the grub.cfg, reboot and start a new kernel.
The above is the whole content of what the steps of Linux kernel migration are, and for more information related to the steps of Linux kernel migration, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.