In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Linux how to compile ko files", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux how to compile ko files" bar!
Introduction to ko file: the driver modules loaded under Linux are .o files, which are also called object files.
The .ko file is a kernel object file, which differs from .o in that it has more sections, such as .modinfo. The meaning of this file is to move some functions of the kernel outside the kernel, insert the kernel when needed, and uninstall it when not needed.
Linux system compiles ko files detailed tutorial: 1. First, extract the downloaded kernel source code and copy it to the / usr/src path:
two。 Switch to the kernel source folder cd / usr/src/linux-2.6.32 under root permission:
3. Configure config:
Here, because my menuconfig cannot be started (according to the online reference materials, I installed ncurses and set the desktop resolution, I can only open it through the command display page (ctrl+alt+f1).), I skipped this step and went straight to make oldconfig (finally, setting the settings for compiling the kernel); 1
4. Compile the kernel make:
5. Install the module make modules_install:
6.make install:
7. Create the initrd file: mkinitramfs-o / boot/initrd.img-2.6.32 (the image is generated after the execution of this step), but the generated image cannot enter the installed kernel after restart. After this execution, continue to execute the next command.
8. Update image: update-initramfs-c-k 2.6.32, where the kernel installation is complete (here I worship the great god I referred to, who thought that different kernel versions could not be accessed after installation, this instruction changed my mind.)
9. Change the startup file: enter the / boot/grub folder and enter the command update-grub
10. Change the startup file: gedit / boot/grub/grub.cfg, then locate the installed kernel information and put it on top of the original kernel information (kernel startup information in curly braces)
11. Change the dwell time of the kernel selection page: or find all the timeout in the grub.cfg to make the change (in seconds). The if judgment does not need to change.
After rebooting, you can choose your new kernel to enter.
The following is the compilation of the .ko file.
1. First write a Makefile:
two。 Compile the file: I added the make compilation specification, make-C / lib/modules/2.6.32/build M=/home/linux/work/Testlinux/Testhallo (the .ko file was successfully compiled in this way as well in other projects)
Thank you for your reading, these are the contents of "how Linux compiles ko files". After the study of this article, I believe you have a deeper understanding of how Linux compiles ko files, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.