Linux Source tree Compilation

Source: Internet
Author: User

Write Linux NIC driver, need to move arm version to x86 version test, this need to recompile to adapt to x86 PC's source tree. In fact, the installation of the system already has a source tree, do not need to recompile as the arm version, located under the/lib/modules/3.0.0-14-generic/build. It is also important to note that the 2.6.32 version and the 3.0.0-14 kernel appear incompatible on some of the structures. Direct compilation will appear:

Error: An unknown field ' ioctl ' in the initializer

This is because the 3.0.0.15 version of the kernel file_operation struct has deleted the IOCTL function, instead:

Long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long), Long (*compat_ioctl) (struct file *, unsigned int, uns igned long);

Changes need to be made in the corresponding structure.

Makefile Write it like this.

obj-m:=ed_device.okerneldir:=/lib/modules/3.0.0-14-generic/buildpwd:=$ (shell pwd) modules:        $ (make)-C $ ( Kerneldir) m=$ (PWD) modules
What does the source tree do?

The source tree is the library functions and resources required to compile the kernel driver.

From the formal perspective, the kernel tree and the kernel source directory structure form is the same, are composed of various levels of file directory structure, but the specific content is certainly different.

Functionally, the kernel tree contains some kernel libraries that are needed to write or compile kernel programs or drivers, as well as some data structures, data types, etc. that are well defined.

Reference

[1].http://blog.csdn.net/freedom2028/article/details/7879574

Linux Source tree Compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.