A cross-platform compilation method, device, computer equipment and medium for Linux modules

By receiving and adjusting compiled file packages, the Linux module code is compiled across the platform, which solves the problem of failed Linux module cross-platform compilation, and improves the development efficiency and stability of the compilation environment.

CN119645422BActive Publication Date: 2025-05-13KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510162021.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-05-13
Estimated Expiration
2045-02-14

AI Technical Summary

Technical Problem

During the cross-compilation process of Linux modules, it is difficult for existing technology to achieve cross-platform compilation, resulting in compilation failure and development efficiency decline.

Method used

Provides a cross-platform compilation method for Linux modules. By receiving the compiled file package sent by the development platform and decompressing it to the target compiled directory, adjusting the compiled file package according to the adaptation of the application platform, and compiling the Linux module code through the adjusted compiled file package.

Benefits of technology

It realizes the establishment of a stable compilation environment on the application platform, avoiding the need for technicians to regenerate compiled file packages every time they switch the compilation environment, reduces the management complexity and number of compiled files, and improves the development efficiency of Linux modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645422B_ABST
    Figure CN119645422B_ABST
Patent Text Reader

Abstract

The present invention relates to a cross-platform compilation method, device, computer equipment and medium for Linux modules. The method comprises: receiving a compilation file package sent by a development platform, and decompressing the compilation file package to a target compilation directory; adjusting the compilation file package according to the adaptation result between the compilation file package and the target platform; receiving the Linux module code sent by the development platform; and compiling the Linux module code through the adjusted compilation file package. The method can facilitate the management of the compilation file package; through the transmission of a single compilation file package, a stable compilation environment can be established on the application platform, avoiding the need for technicians to regenerate the compilation file package every time they switch the compilation environment, reducing the number of compilation files that technicians need to manage, shortening the compilation environment construction time required in the Linux module code compilation process, and thus improving the development efficiency of the Linux module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of embedded technology, and in particular to a cross-platform compilation method, device, computer equipment and medium for a Linux module. Background Art

[0002] Linux is an open-source, Unix-like operating system kernel. Due to its stability and customizability, it's often used to develop applications for embedded devices. During cross-compilation of Linux modules, development and application must be performed separately on platforms with different architectures, which can easily lead to cross-platform compilation failures.

[0003] To avoid cross-platform Linux module compilation failures, existing developers configure the Linux module compilation environment on platforms with different architectures and continually switch between them during development to verify the compilation. However, each time a developer switches between compilation environments, they must regenerate the compilation files, increasing the complexity of compiling file management and reducing Linux module development efficiency. Summary of the Invention

[0004] Based on this, it is necessary to provide a cross-platform compilation method, device, computer equipment and medium for Linux modules to address the above technical problems, so as to improve the development efficiency of Linux modules.

[0005] In a first aspect, the present invention provides a cross-platform compilation method for a Linux module, applicable to an application platform, the method comprising:

[0006] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0007] Adjust the compiled file package based on its compatibility with the application platform;

[0008] Receive the Linux module code sent by the development platform;

[0009] Compile the Linux module code using the adjusted compilation file package.

[0010] In one embodiment, the compiled file package is adjusted according to the adaptation result between the compiled file package and the application platform, including: if the compiled file package is not compatible with the application platform, modifying the configuration file in the compiled file package.

[0011] In one embodiment, compiling the Linux module code using the adjusted compilation file package includes: setting the compilation directory of the Linux module code as the target compilation directory; and compiling the Linux module code using the adjusted compilation file package under the target compilation directory.

[0012] In one embodiment, the compiled Linux module code is installed into the Linux kernel; the Linux module code is run and the running status of the Linux module code is monitored; based on the running status of the Linux module code, a running log file of the Linux module code is generated; the running log file includes fault information of the Linux module code; and the running log file is sent to a development platform.

[0013] In a second aspect, the present invention provides a cross-platform compilation method for a Linux module, applicable to a development platform, the method comprising:

[0014] Compile the Linux kernel source code to obtain the compiled file package;

[0015] Send the compiled file package to the application platform so that the application platform can decompress the compiled file package to the target compilation directory and adjust the compiled file package according to the compatibility between the compiled file package and the application platform;

[0016] The constructed Linux module code is sent to the application platform, so that the application platform compiles the Linux module code through the adjusted compilation file package.

[0017] In one embodiment, compiling the Linux kernel source code includes: installing a Linux kernel compilation dependency file; and compiling the Linux kernel source code according to the Linux kernel compilation dependency file to obtain a compilation file package.

[0018] In one embodiment, a running log file sent by an application platform is received; and the Linux module code is corrected according to the fault information in the running log file.

[0019] In a third aspect, the present invention further provides a cross-platform compilation device for a Linux module, comprising:

[0020] The first receiving module is used to receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0021] An adjustment module, used to adjust the compiled file package according to the adaptation result between the compiled file package and the application platform;

[0022] The second receiving module is used to receive the Linux module code sent by the development platform;

[0023] The compilation module is used to compile the Linux module code through the adjusted compilation file package.

[0024] In a fourth aspect, the present invention further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0025] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0026] Adjust the compiled file package based on the adaptation results between the compiled file package and the application platform;

[0027] Receive the Linux module code sent by the development platform;

[0028] Compile the Linux module code using the adjusted compilation file package.

[0029] In a fifth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0030] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0031] Adjust the compiled file package based on the adaptation results between the compiled file package and the application platform;

[0032] Receive the Linux module code sent by the development platform;

[0033] Compile the Linux module code using the adjusted compilation file package.

[0034] The cross-platform compilation method, device, computer equipment and medium of the Linux module receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory, thereby facilitating the management of the compilation file package; according to the adaptation result of the compilation file package and the application platform, the compilation file package is adjusted so that the compilation file package can adapt to the architecture of the application platform, thereby establishing a stable compilation environment on the application platform through the transmission of a single compilation file package, avoiding the need for technical personnel to regenerate the compilation file package every time the compilation environment is switched, and reducing the number of compilation files that technical personnel need to manage; receiving the Linux module code sent by the development platform, and then compiling the Linux module code through the adjusted compilation file package, shortening the compilation environment setup time required during the Linux module code compilation process, thereby improving the development efficiency of the Linux module. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present invention or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0036] Figure 1 1 is a flow chart of a cross-platform compilation method for a Linux module in one embodiment;

[0037] Figure 2 A flowchart of steps related to Linux module code execution feedback in one embodiment;

[0038] Figure 3 Schematic diagram of a cross-platform compilation method for a Linux module in another embodiment;

[0039] Figure 4 A flowchart of steps for adjusting Linux module code according to an embodiment;

[0040] Figure 5 is a structural block diagram of a cross-platform compilation device for Linux modules in one embodiment;

[0041] Figure 6 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0043] In an alternative embodiment, if Figure 1 As shown, a cross-platform compilation method for Linux modules is provided, which is applicable to application platforms. In this embodiment, the method includes the following steps:

[0044] S110: Receive the compilation file package sent by the development platform, and decompress the compilation file package to the target compilation directory.

[0045] The development platform can be understood as a platform equipped with the necessary configurations for Linux module development, and the application platform can be understood as a platform equipped with the necessary configurations for running Linux module code. Data transmission between the development platform and the application platform can include network transmission and physical transmission. For example, physical transmission can include data storage via a data storage device (e.g., a USB flash drive).

[0046] Furthermore, the compilation file package can be understood as a file package that can be used to compile Linux module code, such as a Linux kernel header file package. The compilation file package may include data declaration files and configuration files, etc. The data declaration file can be understood as a file that declares constants, variables, data structures, and function prototypes, etc. The configuration file can be understood as a file used to match the platform configuration. The target compilation directory can be understood as the directory where the compilation file package is stored. Optionally, those skilled in the art can specify the target compilation directory or set the target compilation directory to any directory based on actual needs or experience, and this is not limited here.

[0047] In an optional embodiment, the application platform may accept a Linux kernel header file package sent by a developer, decompress the Linux kernel header file package to any directory, and then use the decompressed directory of the Linux kernel header file as the target compilation directory.

[0048] S120: Adjust the compiled file package according to the adaptation result between the compiled file package and the application platform.

[0049] It should be noted that if the compiled file package is incompatible with the application platform, it may cause compilation errors and abnormal operation of the Linux module code, so the compiled file package needs to be adjusted. Such incompatibility may include the configuration information in the compiled file package not matching the application platform architecture.

[0050] In an optional embodiment, if the compiled file package is not compatible with the application platform, the configuration file in the compiled file package is modified.

[0051] Optionally, the configuration file may include executable files such as modpost and fixdep that are relevant to the application platform.

[0052] S130, receiving the Linux module code sent by the development platform.

[0053] A Linux module can be understood as an extendable module of the Linux kernel. By installing a Linux module into the Linux kernel, the functionality of the Linux kernel can be extended. Linux module code can be understood as program code used to extend the functionality of the Linux kernel. By installing this Linux module code into the Linux kernel, tasks that meet specific requirements can be achieved.

[0054] S140, compile the Linux module code using the adjusted compilation file package.

[0055] Optionally, the process of compiling the Linux module code may include processing other codes or libraries that the Linux module code depends on to avoid the problem of missing Linux module code dependencies; generating a specific format file that the kernel can recognize, such as a .ko file (kernel module file), to prevent the Linux kernel from being unable to recognize the Linux module code format.

[0056] In an optional embodiment, the compilation directory of the Linux module code may be set as the target compilation directory; and the Linux module code is compiled using the adjusted compilation file package in the target compilation directory.

[0057] In this embodiment, the compilation file package sent by the development platform is received and the compilation file package is unzipped to the target compilation directory, thereby facilitating the management of the compilation file package; according to the adaptation result of the compilation file package and the application platform, the compilation file package is adjusted so that the compilation file package can adapt to the architecture of the application platform, so that a stable compilation environment can be established on the application platform through the transmission of a single compilation file package, avoiding the need for technicians to regenerate the compilation file package every time the compilation environment is switched, and reducing the number of compilation files that technicians need to manage; receiving the Linux module code sent by the development platform, and then compiling the Linux module code through the adjusted compilation file package, shortening the compilation environment setup time required in the Linux module code compilation process, thereby improving the development efficiency of the Linux module.

[0058] Based on the technical solutions of the above embodiments, the present invention further provides an optional embodiment, in which a dependency step of Linux module code running feedback is added.

[0059] See also Figure 2 The Linux module code shown runs the feedback dependency steps, including:

[0060] S210: Install the compiled Linux module code into the Linux kernel.

[0061] Specifically, the installation of the Linux module code may include providing the required permissions for installation, moving the compiled Linux module code to a suitable location, loading the Linux module through a load command, and determining whether the Linux module is successfully loaded through relevant commands.

[0062] S220: Run the Linux module code and monitor the running status of the Linux module code.

[0063] The running status of the Linux module code may include normal running, running failure, error running, etc.

[0064] S230: Generate a Linux module code operation record file according to the operation status of the Linux module code.

[0065] Optionally, the operation log file may include failure information of the Linux module code (for example, operation failure due to incorrect reference of the Linux module code), etc.

[0066] S240: Send the operation record file to the development platform.

[0067] In this embodiment, the compiled Linux module code is installed into the Linux kernel; the Linux module code is run, and the running status of the Linux module code is monitored; based on the running status of the Linux module code, a running log file of the Linux module code is generated, which can record relevant fault information when problems occur in the Linux module operation, and then send the running log file to the development platform, which helps technicians to modify the Linux module code, thereby eliminating faults in the rapid iteration of the Linux module and improving the functionality of the Linux module.

[0068] In another alternative embodiment, Figure 3 As shown, a cross-platform compilation method for Linux modules is provided, which is applicable to development platforms. In this embodiment, the method includes the following steps:

[0069] S310, compile the Linux kernel source code to obtain a compiled file package.

[0070] It should be noted that technicians can obtain the appropriate version of the Linux kernel source code based on development requirements. When compiling Linux module code, the Linux module needs to interact and connect with the Linux kernel. The compilation file package provides the Linux module with internal information and interface specifications of the Linux kernel, allowing the Linux module code to be correctly compiled and run according to the requirements of the Linux kernel.

[0071] In an optional embodiment, the Linux kernel source code may be compiled to obtain a Linux header file package.

[0072] Optionally, the compilation process of the Linux kernel source code may include: installing a Linux kernel compilation dependency file; and compiling the Linux kernel source code according to the Linux kernel compilation dependency file to obtain a compilation file package.

[0073] The Linux kernel compilation dependency files can be understood as files required for Linux kernel compilation. Exemplarily, the Linux kernel compilation dependency files may include compiler (such as GCC, etc.) files, Make tool files, dependency library files, and kernel configuration files.

[0074] S320: Send the compiled file package to the application platform, so that the application platform decompresses the compiled file package to the target compilation directory and adjusts the compiled file package according to the compatibility between the compiled file package and the application platform.

[0075] S330: Send the constructed Linux module code to the application platform, so that the application platform compiles the Linux module code through the adjusted compilation file package.

[0076] The Linux module code can be constructed based on functional requirements. For example, if a hardware driver function needs to be added to the Linux kernel, a Linux module code with the hardware driver function is constructed.

[0077] In this embodiment, by compiling the Linux kernel source code, obtaining a compiled file package, and sending the compiled file package to the application platform, the application platform can be initially provided with the compilation environment required for Linux module compilation. After adjustment of the application platform, the application platform has a stable compilation environment, and there is no need to regenerate the compiled file package every time the compilation environment is switched, thereby reducing the number of compiled files that technical personnel need to manage; sending the constructed Linux module code to the application platform, and compiling the Linux module code in the compilation environment of the application platform can effectively avoid the problem of cross-platform compilation failure of the Linux module.

[0078] Based on the technical solutions of the above embodiments, the present invention further provides an optional embodiment, in which a step of adjusting the relevance of the Linux module code is added.

[0079] See also Figure 4 The steps shown to adjust the dependencies of Linux module code include:

[0080] S410: Receive a running record file sent by the application platform.

[0081] S420: Modify the Linux module code according to the fault information in the operation log file.

[0082] In an optional embodiment, if the fault information in the operation log file includes an operation failure caused by an incorrect reference to the Linux module code, the Linux module code can be checked based on the fault information, and the incorrect reference statement in the Linux module code can be modified to avoid the operation failure of the Linux module code.

[0083] In this embodiment, the development platform receives the operation log file sent by the application platform, and modifies the Linux module code based on the fault information in the operation log file, which can quickly correct the problems in the Linux module code, thereby ensuring the operational stability of the Linux module code. It should be understood that although the steps in the flowcharts involved in the various embodiments described above are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0084] Based on the same inventive concept, embodiments of the present invention further provide a cross-platform compilation device for Linux modules for implementing the cross-platform compilation method for Linux modules described above. The solution provided by this device is similar to the solution described in the method described above. Therefore, the specific limitations of the embodiments of the cross-platform compilation device for Linux modules provided below can be found in the above-mentioned method limitations and will not be further elaborated here.

[0085] In an exemplary embodiment, Figure 5 As shown, a cross-platform compilation device for Linux modules is provided, comprising: a first receiving module 510, an adjustment module 520, a second receiving module 530 and a compilation module 540, wherein:

[0086] The first receiving module 510 is configured to receive a compilation file package sent by a development platform and decompress the compilation file package into a target compilation directory.

[0087] The adjustment module 520 is configured to adjust the compiled file package according to the adaptation result between the compiled file package and the application platform.

[0088] The second receiving module 530 is configured to receive the Linux module code sent by the development platform.

[0089] The compiling module 540 is used to compile the Linux module code using the adjusted compilation file package.

[0090] In one embodiment, the first receiving module 510 includes: a modifying unit, configured to modify a configuration file in the compiled file package if the compiled file package is not compatible with the application platform.

[0091] In one embodiment, the compilation module 540 includes: a setting unit for setting the compilation directory of the Linux module code as a target compilation directory; and a compilation unit for compiling the Linux module code using the adjusted compilation file package under the target compilation directory. Each module in the above apparatus can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in a computer device in software form, so that the processor can call and execute operations corresponding to each module.

[0092] In an exemplary embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 6As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a cross-platform compilation method for Linux modules. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.

[0093] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0094] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0095] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0096] Adjust the compiled file package based on its compatibility with the application platform;

[0097] Receive the Linux module code sent by the development platform;

[0098] Compile the Linux module code using the adjusted compilation file package.

[0099] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: if the compiled file package is not compatible with the application platform, modifying the configuration file in the compiled file package.

[0100] In one embodiment, when executing the computer program, the processor further implements the following steps: setting the compilation directory of the Linux module code as the target compilation directory; and compiling the Linux module code using the adjusted compilation file package under the target compilation directory.

[0101] In one embodiment, when the processor executes the computer program, the processor also implements the following steps: installing the compiled Linux module code into the Linux kernel; running the Linux module code and monitoring the running status of the Linux module code; generating a running log file of the Linux module code based on the running status of the Linux module code; the running log file includes fault information of the Linux module code; and sending the running log file to the development platform.

[0102] In one embodiment, when the processor executes the computer program, it further implements the following steps: compiling the Linux kernel source code to obtain a compiled file package; sending the compiled file package to the application platform so that the application platform decompresses the compiled file package to a target compilation directory and adjusts the compiled file package according to the compatibility between the compiled file package and the application platform; sending the constructed Linux module code to the application platform so that the application platform compiles the Linux module code using the adjusted compiled file package.

[0103] In one embodiment, when executing the computer program, the processor further implements the following steps: installing a Linux kernel compilation dependency file; and compiling the Linux kernel source code according to the Linux kernel compilation dependency file to obtain a compilation file package.

[0104] In one embodiment, when executing the computer program, the processor further implements the following steps: receiving a running log file sent by the application platform; and modifying the Linux module code according to the fault information in the running log file.

[0105] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0106] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0107] Adjust the compiled file package based on its compatibility with the application platform;

[0108] Receive the Linux module code sent by the development platform;

[0109] The Linux module code is compiled using the adjusted compiled file package. In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: if the compiled file package is not compatible with the application platform, the configuration file in the compiled file package is modified.

[0110] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: setting the compilation directory of the Linux module code as the target compilation directory; and compiling the Linux module code using the adjusted compilation file package under the target compilation directory.

[0111] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: installing the compiled Linux module code into the Linux kernel; running the Linux module code and monitoring the running status of the Linux module code; generating a running log file of the Linux module code based on the running status of the Linux module code; the running log file includes fault information of the Linux module code; and sending the running log file to the development platform.

[0112] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: compiling the Linux kernel source code to obtain a compiled file package; sending the compiled file package to the application platform so that the application platform decompresses the compiled file package to a target compilation directory and adjusts the compiled file package according to the compatibility between the compiled file package and the application platform; sending the constructed Linux module code to the application platform so that the application platform compiles the Linux module code using the adjusted compiled file package.

[0113] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: installing a Linux kernel compilation dependency file; and compiling the Linux kernel source code according to the Linux kernel compilation dependency file to obtain a compilation file package.

[0114] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: receiving a running log file sent by the application platform; and modifying the Linux module code according to the fault information in the running log file.

[0115] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0116] Receive the compilation file package sent by the development platform and decompress the compilation file package to the target compilation directory;

[0117] Adjust the compiled file package based on its compatibility with the application platform;

[0118] Receive the Linux module code sent by the development platform;

[0119] Compile the Linux module code using the adjusted compilation file package.

[0120] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: if the compiled file package is not compatible with the application platform, modifying the configuration file in the compiled file package.

[0121] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: setting the compilation directory of the Linux module code as the target compilation directory; and compiling the Linux module code using the adjusted compilation file package under the target compilation directory.

[0122] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: installing the compiled Linux module code into the Linux kernel; running the Linux module code and monitoring the running status of the Linux module code; generating a running log file of the Linux module code based on the running status of the Linux module code; the running log file includes fault information of the Linux module code; and sending the running log file to the development platform.

[0123] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: compiling the Linux kernel source code to obtain a compiled file package; sending the compiled file package to the application platform so that the application platform decompresses the compiled file package to a target compilation directory and adjusts the compiled file package according to the compatibility between the compiled file package and the application platform; sending the constructed Linux module code to the application platform so that the application platform compiles the Linux module code using the adjusted compiled file package.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: installing a Linux kernel compilation dependency file; and compiling the Linux kernel source code according to the Linux kernel compilation dependency file to obtain a compilation file package.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: receiving a running log file sent by the application platform; and modifying the Linux module code according to the fault information in the running log file.

[0126] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. For purposes of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The processors involved in the various embodiments provided herein may be general-purpose processors, central processing units (CPUs), graphics processors (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, artificial intelligence (AI) processors, and the like, without limitation.

[0127] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.

[0128] The above-described embodiments merely represent several implementation methods of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.

Claims

1. A cross-platform compilation method for Linux modules, characterized in that: Applicable to the application platform, the method comprises: Receive the compilation file package sent by the development platform, and decompress the compilation file package to the target compilation directory; According to the compatibility of the compiled file package with the application platform, the compiled file package is adjusted; if the compiled file package is not compatible with the application platform, the configuration file in the compiled file package is modified; Receiving a Linux module code sent by the development platform; the Linux module is an extensible module of the Linux kernel; The Linux module code is compiled through the adjusted compilation file package; compiling the Linux module code is to process other codes or libraries that the Linux module code depends on, and generate a specific format file that can be recognized by the kernel; when compiling the Linux module code, the Linux module needs to interact and connect with the Linux kernel, and the compilation file package provides the Linux module with internal information and interface specifications of the Linux kernel.

2. The method according to claim 1, characterized in that The step of compiling the Linux module code by using the adjusted compilation file package includes: Setting the compilation directory of the Linux module code to the target compilation directory; The Linux module code is compiled using the adjusted compilation file package under the target compilation directory.

3. The method according to claim 2, characterized in that Also includes: Install the compiled Linux module code into the Linux kernel; Running the Linux module code and monitoring the running status of the Linux module code; Generate an operation record file of the Linux module code according to the operation status of the Linux module code; the operation record file includes fault information of the Linux module code; The operation record file is sent to the development platform.

4. A cross-platform compilation method for Linux modules, characterized in that: Applicable to the development platform, the method comprises: Compile the Linux kernel source code to obtain the compiled file package; Sending the compiled file package to the application platform so that the application platform decompresses the compiled file package to a target compilation directory and adjusts the compiled file package according to the compatibility between the compiled file package and the application platform; if the compiled file package is not compatible with the application platform, modifying the configuration file in the compiled file package; The constructed Linux module code is sent to the application platform so that the application platform compiles the Linux module code through the adjusted compilation file package; the Linux module is an extensible module of the Linux kernel; compiling the Linux module code is to process other codes or libraries that the Linux module code depends on, and generate a specific format file that can be recognized by the kernel; when compiling the Linux module code, the Linux module needs to interact and connect with the Linux kernel, and the compilation file package provides the Linux module with internal information and interface specifications of the Linux kernel.

5. The method according to claim 4, characterized in that The compiling of the Linux kernel source code includes: Install Linux kernel compilation dependency files; According to the Linux kernel compilation dependency file, the Linux kernel source code is compiled to obtain a compilation file package.

6. The method according to claim 4, characterized in that Also includes: Receive the operation record file sent by the application platform; Modify the Linux module code according to the fault information in the operation log file.

7. A cross-platform compilation device for Linux modules, characterized in that: The device comprises: A first receiving module, used for receiving a compilation file package sent by a development platform, and decompressing the compilation file package into a target compilation directory; an adjustment module, configured to adjust the compiled file package according to the adaptation result between the compiled file package and the application platform; if the compiled file package is not compatible with the application platform, modify the configuration file in the compiled file package; A second receiving module, used for receiving a Linux module code sent by a development platform; the Linux module is an extensible module of the Linux kernel; A compilation module is used to compile the Linux module code through the adjusted compilation file package; compiling the Linux module code is to process other codes or libraries that the Linux module code depends on, and generate a specific format file that can be recognized by the kernel; when compiling the Linux module code, the Linux module needs to interact and connect with the Linux kernel, and the compilation file package provides the Linux module with internal information and interface specifications of the Linux kernel.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method and module for emergently probing system information

    CN102314382A

  • Method and device for inserting kernel based on Docker container

    CN117271051A