| Embedded operating systems are the infrastructure for Io T and intelligent electronic products.Linux has become one of the mainstream choices of embedded operating systems because of its open source code,good usability and tailorability.However,due to the huge scale of the Linux system,if it is to be applied to embedded devices with limited hardware resources,it is necessary to tailor the Linux source code accordingly.Although the native conditional compilation mechanism and module configuration mechanism of Linux provide certain support for code tailoring,the tailoring granularity is coarse and only supports module-level tailoring.In order to meet the characteristics of limited hardware resources and application diversity of embedded devices,Linux embedded requires more fine-grained function-level tailoring of source code.Therefore,this paper intends to carry out research on automatic tailoring methods and technologies based on Linux kernel dependencies,which has important practical significance and application value.This paper proposes and implements a function-level automatic tailoring method based on Linux kernel source code dependencies.This method can automatically delete redundant functions on the basis of Linux native configuration tailoring,and obtain a more streamlined kernel source code.The innovative work of this paper mainly includes:(1)A multi-level dependency analysis method is proposed and implemented.First,the dependencies between compilation options and files are extracted from the Makefile file,and the source code scope for building a specific kernel is determined in combination with a specific configuration file.Then,based on this source code range,analyze the function call relationship covering the function pointer,and obtain the function call relationship of a specific kernel source code.(2)A function-level automatic tailoring method of Linux kernel source code is proposed and implemented,which refines the granularity of the native Linux tailoring method,and the tailoring method is automatically performed by the built prototype tool,and does not depend on the developer’s understanding of the kernel source code.The prototype test results show that the method in this paper can accurately extract the dependencies between compilation options and files and the calling relationship between functions,and can automatically trim the Linux source code at the function level,and the trimmed kernel can successfully run on the target development board.This verifies the feasibility and correctness of the function-level tailoring method based on dependency analysis.Furthermore,the dependency analysis and function-level automatic tailoring method proposed in this paper can provide a more fine-grained,more reliable and efficient tailoring scheme for Linux embeddedness,and can help Linux kernel developers understand the dependencies of kernel source code and improve the development of the kernel and maintenance efficiency. |