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