摘要 |
Disclosed are a method and device for binding a kernel symbol in a Linux driver, the method comprising: defining a pointer for each of kernel symbols required in a driver; upon initializing the driver, searching a kernel symbol list for the kernel symbol required by the driver by analyzing the kernel symbol list; assigning an address of each of the found kernel symbols in the kernel to the pointer corresponding to each of the kernel symbols defined by the driver; and accessing the kernel symbol in the driver by means of the pointer. The technical solution of the present invention can develop a general-purpose driver compatible with different versions of kernels, eliminating the need of compiling source code of the different versions of the kernels separately, thus reducing workloads of developing and adaptation. |