Method and device for converting and generating binary loadable file and resource-constrained equipment

By obtaining the import and export segment information of binary loadable files to generate binary loadable files, the problem of time-consuming conversion of binary intermediate files in resource-constrained devices is solved, and the rapid installation speed is achieved.

CN119088758AActive Publication Date: 2024-12-06BEIJING TONGFANG MICROELECTRONICS

Patent Information

Application Number
CN202411202121.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-06
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

The prior art binary intermediate file conversion process in resource-constrained devices takes a long time, resulting in slow installation speed and multiple links are required to ensure the normal operation of the application.

Method used

By obtaining the conversion auxiliary file, based on the segment data of the binary intermediate file to be converted, the imported segment information and export segment information of the converted binary loadable file, as well as the corresponding binary link file, is reduced to the secondary link process of subsequent installation.

Benefits of technology

It improves the efficiency of binary intermediate files conversion, completes links between multiple intermediate files, and significantly improves installation speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088758A_ABST
    Figure CN119088758A_ABST
Patent Text Reader

Abstract

The invention discloses a binary loadable file conversion generation method and device and resource-constrained equipment, and the method comprises the steps: obtaining a conversion auxiliary file based on segment data of a to-be-converted binary intermediate file under the condition that any to-be-converted binary intermediate file is converted; the to-be-converted binary intermediate file is converted according to the conversion auxiliary file, import segment information and export segment information in the converted binary loadable file and a binary link file corresponding to the binary loadable file are obtained, and conversion of the binary intermediate file is achieved through the conversion auxiliary file. According to the technical scheme, the binary loadable file and the corresponding binary link file can be obtained, multiple binary intermediate files can still be achieved at the same time, the conversion efficiency is improved, link among the multiple binary intermediate files is completed, the subsequent secondary link process is reduced, and the conversion efficiency of the binary loadable file is improved. The mounting speed is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of file processing technology, and in particular to a conversion generation method and device for a binary loadable file and a resource-constrained device. Background Art

[0002] Currently, for resource-constrained devices, installing an application usually involves the conversion of binary intermediate files.

[0003] The current conversion method can only convert one binary intermediate file at a time, and the converted file still requires more secondary links when installed to ensure that the installed application can run normally. This will cause the conversion process to take a long time and the installation speed will be slow. Summary of the invention

[0004] The present invention provides a method and device for converting and generating a binary loadable file and a resource-constrained device, so as to solve the problem that the conversion process takes a long time and the installation speed is slow.

[0005] According to one aspect of the present invention, a method for converting and generating a binary loadable file is provided, the method comprising:

[0006] When converting any binary intermediate file to be converted, obtaining a conversion auxiliary file based on the segment data of the binary intermediate file to be converted;

[0007] The binary intermediate file to be converted is converted according to the conversion auxiliary file to obtain the import segment information and the export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file.

[0008] According to another aspect of the present invention, a binary loadable file conversion generation device is provided, the device comprising:

[0009] An acquisition module, used for acquiring a conversion auxiliary file based on the segment data of any binary intermediate file to be converted when converting the binary intermediate file to be converted;

[0010] The conversion module is used to convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file.

[0011] According to another aspect of the present invention, a resource-constrained device is provided, wherein an AOS operating system is installed on the resource-constrained device, wherein the AOS operating system includes a runtime environment, a virtual machine, and an application programming interface, and the resource-constrained device includes:

[0012] at least one processor; and

[0013] a memory communicatively connected to the at least one processor; wherein,

[0014] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for converting and generating a binary loadable file described in any embodiment of the present invention.

[0015] According to another aspect of the present invention, a computer program product is provided, characterized in that the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the conversion and generation method of the binary loadable file provided by any embodiment of the present invention.

[0016] The technical solution of the embodiment of the present invention is to obtain a conversion auxiliary file based on the segment data of the binary intermediate file to be converted when converting any binary intermediate file to be converted; convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file; use the conversion auxiliary file to realize the conversion of the binary intermediate file, obtain the import segment information and export segment information of the binary loadable file, and the corresponding binary link file; for multiple binary intermediate files, the solution of the present invention can still be implemented simultaneously, thereby improving the conversion efficiency; the transformation of the import segment of the binary intermediate file completes the link between multiple binary intermediate files, reduces the secondary link process required for subsequent installation, and improves the installation speed.

[0017] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0019] Figure 1 A flowchart of a method for converting and generating a binary loadable file is provided for the first embodiment of the present invention;

[0020] Figure 2 A flowchart of a method for converting and generating a binary loadable file provided in Embodiment 2 of the present invention;

[0021] Figure 3 A flowchart of a method for converting and generating a binary loadable file provided in Embodiment 3 of the present invention;

[0022] Figure 4 A schematic diagram of the structure of a binary loadable file conversion and generation device provided in Embodiment 4 of the present invention;

[0023] Figure 5 A schematic diagram of the structure of a resource-constrained device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Embodiment 1

[0027] Figure 1 A flowchart of a method for converting and generating a binary loadable file is provided for the first embodiment of the present invention. This embodiment is applicable to the conversion and generation of a binary loadable file. The method can be executed by a binary loadable file conversion and generation device. The binary loadable file conversion and generation device can be implemented in the form of hardware and / or software. The binary loadable file conversion and generation device can be configured in a resource-constrained device. Figure 1 As shown, the method includes:

[0028] Step 101: When converting any binary intermediate file to be converted, a conversion auxiliary file is obtained based on segment data of the binary intermediate file to be converted.

[0029] In this step, the binary intermediate file is generated by the WebAssembly compiler compiling the application source code. The application source code is a combination of multiple applications implemented in a high-level language. An application combination can use the API functions provided by the system or the API functions of other application combinations.

[0030] In this embodiment, the conversion auxiliary file can be obtained based on the segment data in the binary intermediate file to be converted. It should be noted that this step can obtain multiple binary intermediate files to be converted and perform parallel conversion. In addition, the segment data in the binary intermediate file to be converted mainly includes import segments, export segments, and function segments. In this embodiment, the conversion is mainly performed on the import segments and export segments.

[0031] In this step, the conversion auxiliary file is mainly obtained by relying on the import segment of the binary intermediate file to be converted. Specifically, the required binary intermediate file identifier can be obtained from the import segment of the binary intermediate file to be converted; then the conversion auxiliary file is obtained based on the binary intermediate file identifier.

[0032] Among them, the import segment stores several pieces of import function information, each piece of import information records the name of the binary intermediate file of the imported function, the function name, and the function signature information index. Therefore, the name of the binary intermediate file involved in the import segment can be determined as the required binary intermediate file identifier.

[0033] Then, the link status of the target binary intermediate file corresponding to the binary intermediate file identifier is queried, and the conversion configuration information corresponding to the binary intermediate file identifier is obtained.

[0034] It should be noted that the link status is used to identify whether the target binary intermediate file has been converted. Usually, different status values ​​can be set to identify different link statuses. For example, the status value "1" indicates that the corresponding target binary intermediate file is in a linked state, that is, it has been converted; the status value "0" indicates that the corresponding target binary intermediate file is in an unlinked state, that is, it has not been converted yet.

[0035] If the link status indicates that the target binary intermediate file is in a linked state, a target binary link file corresponding to the target binary intermediate file is obtained, and the target binary link file is determined as a conversion auxiliary file.

[0036] If the link status indicates that the target binary intermediate file is in an unlinked state, the target binary intermediate file and the conversion configuration information are determined as conversion auxiliary files.

[0037] Therefore, the content of the conversion auxiliary file will be different depending on the link status.

[0038] In addition, it should be noted that the conversion configuration information includes the configuration information required to convert the binary intermediate file to be converted into a binary loadable file; wherein the configuration information includes: the binary intermediate file identifier to be converted, the module information and export function information converted into the binary loadable file, the module information includes: the module version, the module AID length and the module AID, and the export function information includes: the name of the export function of the binary intermediate file to be converted.

[0039] Step 102: convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file.

[0040] In this step, the import segment in the binary intermediate file is mainly converted, and the converted import segment information is the import segment information in the binary loadable file; the export segment in the binary intermediate file is converted, and the converted export segment information is the export segment information in the binary loadable file.

[0041] The generated binary link file corresponds to the binary loadable file and the binary intermediate file to be converted, and the binary link file specifies the functions in the binary loadable file that can be called by other binary intermediate files.

[0042] In this embodiment, when converting any binary intermediate file to be converted, a conversion auxiliary file is obtained based on the segment data of the binary intermediate file to be converted; the binary intermediate file to be converted is converted according to the conversion auxiliary file to obtain the import segment information and the export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file; the conversion auxiliary file is used to realize the conversion of the binary intermediate file, and the import segment information and the export segment information of the binary loadable file, and the corresponding binary link file are obtained. For multiple binary intermediate files, the scheme of the present invention can still be implemented simultaneously, thereby improving the conversion efficiency; the transformation of the import segment of the binary intermediate file completes the link between multiple binary intermediate files, reduces the secondary link process required for subsequent installation, and improves the installation speed.

[0043] Embodiment 2

[0044] Figure 2 This is a flow chart of a method for converting and generating a binary loadable file provided in the second embodiment of the present invention. This embodiment is a process of converting and generating a target binary intermediate file when the target binary intermediate file is in a linked state. Figure 2 As shown, the method includes:

[0045] Step 201: Obtain a target binary link file corresponding to a target binary intermediate file, and determine the target binary link file as a conversion auxiliary file.

[0046] After the link status of the target binary intermediate file is determined in the foregoing embodiment, the present embodiment is in a linked state. Therefore, the target binary link file corresponding to the target binary intermediate file can be obtained and the target binary link file can be determined as a conversion auxiliary file.

[0047] That is to say, in this embodiment, the file used for subsequent conversion is the target binary link file corresponding to the target binary intermediate file.

[0048] It should be noted that in this step, after obtaining the target binary link file corresponding to the target binary intermediate file, the target binary link file may also be verified.

[0049] Specifically, a hash check method can be used to compare and check each target segment in the target binary link file to obtain a first check result; a magic number and a version in the target binary link file are checked to obtain a check result; a name of the target binary link file and a name of an internally stored binary intermediate file are compared for consistency to obtain a comparison result; a length and format of the AID in the target binary link file and information of each function are checked to obtain a second check result; if the first check result, the check result, the comparison result and the second check result are all passed, it is determined that the target binary link file has passed the check.

[0050] Among them, each target segment can include but is not limited to: magic, version, module_name_size, module_name, module_aid_size, module_aid, export_function_count, functions fields, and these fields are used as binary link file template files.

[0051] Step 202: Generate a binary link file export function information table according to the target binary link file in the conversion auxiliary file.

[0052] In this step, the target binary link file contains multiple export functions and related information, so the export functions and related information can be extracted to generate a binary link file export function information table.

[0053] The binary link file export function information table may contain multiple binary link file export function information, each binary link file export function information includes the following table items:

[0054] The name of the target binary intermediate file corresponding to the binary intermediate file identifier, the version of the target binary intermediate file corresponding to the binary intermediate file identifier, the AID of the target binary intermediate file corresponding to the binary intermediate file identifier, and the export function name, index, number of input parameters, and number of return values ​​contained in the binary link file export segment.

[0055] It should be noted that AID is an application identifier (Application Identifier). For the specific definition of the above table items, please refer to the relevant technology and will not be repeated here.

[0056] Step 203: Generate a binary intermediate file to be converted import function information table according to the binary intermediate file to be converted import segment.

[0057] It can be seen from the above embodiments that a number of import function information are stored in the import segment of the binary intermediate file to be converted, and each import information records the name of the binary intermediate file of the imported function, the function name, and the function signature information index. This step can generate an import function information table of the binary intermediate file to be converted based on the information of the import segment.

[0058] The binary intermediate file import function information table to be converted includes multiple pieces of binary intermediate file import function information to be converted, and each piece of binary intermediate file import function information to be converted includes the following table items:

[0059] The name of the binary intermediate file to which the import function in the import segment of the binary intermediate file to be converted belongs, the name of the import function in the import segment of the binary intermediate file to be converted, the number of input parameters of the import function in the type segment of the binary intermediate file to be converted, and the number of return values ​​of the import function in the type segment of the binary intermediate file to be converted.

[0060] Step 204: Generate an export function information table of the binary intermediate file to be converted according to the export segment of the binary intermediate file to be converted.

[0061] In this step, the export segment of the binary intermediate file to be converted contains the function name and function index of the exported function. The signature information and function bytecode of the exported function can be found based on this index.

[0062] Based on the information of the export segment, a binary intermediate file export function information table to be converted can be generated, and the binary intermediate file export function information table to be converted includes multiple binary intermediate file export function information to be converted, and each binary intermediate file export function information to be converted includes the following table items:

[0063] The name of the export function in the export segment of the binary intermediate file to be converted and the export function index of the binary intermediate file to be converted.

[0064] Step 205: According to the binary link file export function information table and the binary intermediate file import function information table to be converted, the import segment of the binary intermediate file to be converted is converted to obtain the import segment information of the converted binary loadable file.

[0065] In this step, when converting the import segment, it is mainly based on the binary link file export function information table and the to-be-converted binary intermediate file import function information table.

[0066] Since the binary intermediate file import function information table to be converted contains multiple pieces of binary intermediate file import function information, this step can traverse the binary intermediate file import function information one by one based on the order in the binary intermediate file import function information table to be converted. When traversing to any piece of binary intermediate file import function information, the following processing is performed for the piece of binary intermediate file import function information:

[0067] For any binary intermediate file import function information in the binary intermediate file import function information table to be converted, all the acquired binary link file export function information tables are traversed; each time a binary link file export function information in the binary link file export function information table is traversed, it is determined whether the name of the target binary intermediate file in the binary link file export function information is the same as the binary intermediate file name of the binary intermediate file import function information.

[0068] If they are not the same, traverse the next binary link file export function information; if they are the same, end the traversal, and replace the import module information corresponding to the import segment in the binary intermediate file to be converted with the AID of the target binary intermediate file corresponding to the binary intermediate file identifier in the binary link file export function information.

[0069] It should be noted that when traversing the above-mentioned export function information tables of all acquired binary link files, as long as the name of the target binary intermediate file that is the same as the binary intermediate file name of the binary intermediate file import function information is traversed, the traversal of the binary link file export function information table can be terminated.

[0070] Then, the traversed binary link file export function information having the same name as the target binary intermediate file is used as the data basis for conversion, and the binary intermediate file import function information is converted.

[0071] The specific conversion is to replace the AID of the target binary intermediate file corresponding to the binary intermediate file identifier in the binary link file export function information with the import module information corresponding to the import segment in the binary intermediate file to be converted, so that only the aforementioned AID is stored in the import module information.

[0072] After the replacement is completed, the next binary intermediate file import function information is processed.

[0073] After traversing all the binary intermediate file import function information in the binary intermediate file import function information table to be converted, the import information in the converted import segment is deduplicated to obtain the import segment information of the converted binary loadable file.

[0074] It should be noted that after the conversion is completed, the same AID may exist in each piece of imported information. In this case, deduplication is performed to keep only one piece of the same AID.

[0075] Step 206: convert the export segment of the binary intermediate file according to the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted, and obtain the export segment information of the converted binary loadable file.

[0076] The conversion of the export segment is mainly based on the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted.

[0077] Specifically, the binary intermediate file export function information in the binary intermediate file export function information table to be converted is traversed one by one, and each time a piece of binary intermediate file export function information is traversed, the binary intermediate file export function information is processed as follows:

[0078] For any binary intermediate file export function information in the binary intermediate file export function information table to be converted, the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is traversed; each time the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is traversed, it is determined whether the function name in the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is the same as the function name in the binary intermediate file export function information.

[0079] If the traversal finds the same, delete the function name in the export information in the export segment of the binary intermediate file; if the traversal does not find the same, delete the export function information in the binary intermediate file.

[0080] Based on the above processing, after completing the traversal of the export function information of all binary intermediate files, the export segment only contains other information except the function name in the export function information appearing in the conversion configuration information. The remaining information can be used as the export segment information of the converted binary loadable file.

[0081] Step 207: convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain a binary link file corresponding to the binary loadable file.

[0082] In this step, the main purpose is to obtain the function that is configured to be called externally. Specifically, an export function information table of the binary intermediate file to be converted can be generated based on the binary intermediate file to be converted; then, a binary link file corresponding to the converted binary loadable file can be generated based on the conversion configuration information corresponding to the export function information table of the binary intermediate file to be converted and the binary intermediate file identifier.

[0083] Among them, the export function information table of the binary intermediate file to be converted can refer to the above steps and will not be repeated here.

[0084] When generating a binary link file, the intersection of the export function table of the binary intermediate file to be converted and the export function in the conversion configuration information corresponding to the binary intermediate file identifier can be first determined; then the export function information of the converted binary loadable file is determined based on the export function in the intersection; finally, the export function information is added to the binary link file to obtain the binary link file corresponding to the converted binary loadable file.

[0085] It should be noted that the binary link file specifies which functions can be called externally, and this information will be pre-configured in the conversion configuration information. The intersection of the export function of the conversion configuration information and the export function table of the binary intermediate file to be converted is the function that can be added to the binary link file for external calls.

[0086] Embodiment 3

[0087] Figure 3 This is a flowchart of a method for converting and generating a binary loadable file provided in Embodiment 3 of the present invention. This embodiment is a process for converting and generating a target binary intermediate file when the target binary intermediate file is in an unlinked state. Figure 3 As shown, the method includes:

[0088] Step 301: Determine the target binary intermediate file and conversion configuration information as conversion auxiliary files.

[0089] In this embodiment, for an unlinked target binary intermediate file, the target binary intermediate file and the conversion configuration information may be used to perform conversion.

[0090] Step 302: Generate a binary intermediate file to be converted import function information table according to the binary intermediate file to be converted import segment.

[0091] It can be seen from the above embodiments that a number of import function information are stored in the import segment of the binary intermediate file to be converted, and each import information records the name of the binary intermediate file of the imported function, the function name, and the function signature information index. This step can generate an import function information table of the binary intermediate file to be converted based on the information of the import segment.

[0092] The binary intermediate file import function information table to be converted includes multiple pieces of binary intermediate file import function information to be converted, and each piece of binary intermediate file import function information to be converted includes the following table items:

[0093] The name of the binary intermediate file to which the import function in the import segment of the binary intermediate file to be converted belongs, the name of the import function in the import segment of the binary intermediate file to be converted, the number of input parameters of the import function in the type segment of the binary intermediate file to be converted, and the number of return values ​​of the import function in the type segment of the binary intermediate file to be converted.

[0094] Step 303: Generate a target binary intermediate file export function information table according to the export segment, type segment and configuration information file of the target binary intermediate file in the conversion auxiliary file.

[0095] In this step, the target binary intermediate file export function information table includes multiple target binary intermediate file export function information, and each target binary intermediate file export function information includes the following table items:

[0096] The name of the target binary intermediate file, the version of the target binary intermediate file, the AID of the target binary intermediate file, the name of the export function of the target binary intermediate file, the export function index of the target binary intermediate file, the number of input parameters of the export function of the target binary intermediate file, and the number of return values ​​of the export function of the target binary intermediate file.

[0097] It should be noted that, since the information stored in the export segment and type segment of the target binary intermediate file is limited, it can be merged with the corresponding export function information in the configuration information file.

[0098] Among them, the configuration information file is the configuration information file corresponding to the target binary intermediate file.

[0099] Step 304: Generate an export function information table of the binary intermediate file to be converted according to the export segment of the binary intermediate file to be converted.

[0100] In this step, the export segment of the binary intermediate file to be converted contains the function name and function index of the exported function. The signature information and function bytecode of the exported function can be found based on this index.

[0101] Based on the information of the export segment, a binary intermediate file export function information table to be converted can be generated, and the binary intermediate file export function information table to be converted includes multiple binary intermediate file export function information to be converted, and each binary intermediate file export function information to be converted includes the following table items:

[0102] The name of the export function in the export segment of the binary intermediate file to be converted and the export function index of the binary intermediate file to be converted.

[0103] Step 305: convert the import segment of the binary intermediate file to be converted according to the target binary intermediate file export function table and the binary intermediate file to be converted import function table to obtain the import segment information of the converted binary loadable file.

[0104] In this step, since the binary intermediate file import function information table to be converted contains multiple binary intermediate file import function information, this step can traverse the binary intermediate file import function information one by one based on the order in the binary intermediate file import function information table to be converted. When traversing to any binary intermediate file import function information, the following processing is performed for the binary intermediate file import function information:

[0105] For any piece of binary intermediate file import function information in the binary intermediate file import function table to be converted, all acquired target binary intermediate file export function information tables are traversed.

[0106] Each time the target binary intermediate file export function table information in the target binary intermediate file export function table information table is traversed, it is determined whether the name of the target binary intermediate file in the target binary intermediate file export function table information is the same as the binary intermediate file name in the binary intermediate file import function information.

[0107] If they are not the same, traverse the next target binary intermediate file export function table information; if they are the same, end the traversal, and replace the import module information corresponding to the import segment in the binary intermediate binary file to be converted with the AID of the target binary intermediate file corresponding to the binary intermediate file identifier in the target binary intermediate file export function table information.

[0108] After traversing all the binary intermediate file import function information in the binary intermediate file import function table to be converted, the import information in the converted import segment is deduplicated to obtain the import segment information of the converted binary loadable file.

[0109] Step 306: convert the export segment of the binary intermediate file to be converted according to the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted, and obtain the export segment information of the converted binary loadable file.

[0110] The conversion of the export segment is mainly based on the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted.

[0111] Specifically, the binary intermediate file export function information in the binary intermediate file export function information table to be converted is traversed one by one, and each time a piece of binary intermediate file export function information is traversed, the binary intermediate file export function information is processed as follows:

[0112] For any binary intermediate file export function information in the binary intermediate file export function information table to be converted, the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is traversed; each time the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is traversed, it is determined whether the function name in the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted is the same as the function name in the binary intermediate file export function information.

[0113] If the traversal finds the same, delete the function name in the export information in the export segment of the binary intermediate file; if the traversal does not find the same, delete the export function information in the binary intermediate file.

[0114] Based on the above processing, after completing the traversal of the export function information of all binary intermediate files, the export segment only contains other information except the function name in the export function information appearing in the conversion configuration information. The remaining information can be used as the export segment information of the converted binary loadable file.

[0115] Step 307: convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain a binary link file corresponding to the binary loadable file.

[0116] In this step, the main purpose is to obtain the function that is configured to be called externally. Specifically, an export function information table of the binary intermediate file to be converted can be generated based on the binary intermediate file to be converted; then, a binary link file corresponding to the converted binary loadable file can be generated based on the conversion configuration information corresponding to the export function information table of the binary intermediate file to be converted and the binary intermediate file identifier.

[0117] When generating a binary link file, the intersection of the export function table of the binary intermediate file to be converted and the export function in the conversion configuration information corresponding to the binary intermediate file identifier can be determined first; then the export function information of the converted binary loadable file is determined based on the export function in the intersection; finally, the export function information is added to the binary link file template file and the checksum is calculated to obtain the binary link file corresponding to the converted binary loadable file.

[0118] It should be noted that the binary link file specifies which functions can be called externally, and this information will be pre-configured in the conversion configuration information. The intersection of the export function of the conversion configuration information and the export function table of the binary intermediate file to be converted is the function that can be added to the binary link file for external calls.

[0119] Embodiment 4

[0120] Figure 4 This is a schematic diagram of the structure of a binary loadable file conversion and generation device provided by the fourth embodiment of the present invention. Figure 4 As shown, the device comprises:

[0121] An acquisition module 401 is used to acquire a conversion auxiliary file based on the segment data of the binary intermediate file to be converted when converting any binary intermediate file to be converted;

[0122] The conversion module 402 is used to convert the binary intermediate file to be converted according to the conversion auxiliary file, and obtain the import segment information and export segment information in the converted binary loadable file, as well as the binary link file corresponding to the binary loadable file.

[0123] Embodiment 5

[0124] Figure 5 A schematic diagram of the structure of a resource-constrained device provided for Embodiment 5 of the present invention. Resource-constrained devices are intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Resource-constrained devices may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0125] like Figure 5As shown, the resource-constrained device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the resource-constrained device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0126] A number of components in the resource-constrained device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the resource-constrained device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0127] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a conversion generation method for a binary loadable file.

[0128] In some embodiments, the conversion generation method of a binary loadable file can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the resource-constrained device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the conversion generation method of the binary loadable file described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the conversion generation method of the binary loadable file by any other appropriate means (for example, by means of firmware).

[0129] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0130] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0131] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0132] To provide interaction with a user, the systems and techniques described herein may be implemented on a resource-constrained device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the resource-constrained device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0133] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0134] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0135] Embodiment 6

[0136] Embodiment 6 of the present invention provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the conversion and generation method of a binary loadable file provided in any embodiment of the present application.

[0137] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0138] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for converting and generating a binary loadable file, It is characterized in that The method comprises: Acquire multiple binary intermediate files to be converted, perform parallel conversion, and when converting any binary intermediate file to be converted, acquire a conversion auxiliary file based on segment data of the binary intermediate file to be converted; The binary intermediate file to be converted is converted according to the conversion auxiliary file to obtain the import segment information and the export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file.

2. The method according to claim 1, It is characterized in that The step of obtaining a conversion auxiliary file based on the segment data of the binary intermediate file to be converted includes: Obtaining the required binary intermediate file identifier from the import segment of the binary intermediate file to be converted; A conversion auxiliary file is obtained based on the binary intermediate file identifier.

3. The method according to claim 2, It is characterized in that The acquiring of the conversion auxiliary file based on the binary intermediate file identifier includes: Querying the link status of the target binary intermediate file corresponding to the binary intermediate file identifier, and obtaining conversion configuration information corresponding to the binary intermediate file identifier; If the link status indicates that the target binary intermediate file is in a linked state, a target binary link file corresponding to the target binary intermediate file is obtained, and the target binary link file is determined as the conversion auxiliary file.

4. The method according to claim 3, It is characterized in that The step of converting the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and the export segment information in the converted binary loadable file includes: Generate a binary link file export function information table according to the target binary link file in the conversion auxiliary file; Generate a binary intermediate file import function information table to be converted according to the binary intermediate file import segment to be converted; Generate a binary intermediate file export function information table to be converted according to the binary intermediate file export segment to be converted; According to the binary link file export function information table and the binary intermediate file import function information table to be converted, the import segment of the binary intermediate file to be converted is converted to obtain the import segment information of the converted binary loadable file; The export segment of the binary intermediate file is converted according to the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted, so as to obtain the export segment information of the converted binary loadable file.

5. The method according to claim 3, It is characterized in that Converting the binary intermediate file to be converted according to the conversion auxiliary file to obtain a binary link file corresponding to the binary loadable file includes: Generate a binary intermediate file export function information table to be converted according to the binary intermediate file to be converted; A binary link file corresponding to the converted binary loadable file is generated according to the to-be-converted binary intermediate file export function information table and the conversion configuration information corresponding to the binary intermediate file identifier.

6. The method according to claim 3, It is characterized in that The acquiring of the conversion auxiliary file based on the intermediate file identifier includes: If the link status indicates that the target binary intermediate file is in an unlinked state, the target binary intermediate file and the conversion configuration information are determined as the conversion auxiliary file.

7. The method according to claim 6, It is characterized in that The step of converting the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and the export segment information in the converted binary loadable file includes: Generate a binary intermediate file import function information table to be converted according to the binary intermediate file import segment to be converted; Generate a target binary intermediate file export function information table according to the export segment, type segment and configuration information file of the target binary intermediate file in the conversion auxiliary file; Generate a binary intermediate file export function information table to be converted according to the binary intermediate file export segment to be converted; Convert the import segment of the binary intermediate file to be converted according to the target binary intermediate file export function table and the binary intermediate file to be converted import function table to obtain the import segment information of the converted binary loadable file; The export segment of the binary intermediate file to be converted is converted according to the export function information table of the binary intermediate file to be converted and the export function information in the conversion configuration information corresponding to the binary intermediate file to be converted, so as to obtain the export segment information of the converted binary loadable file.

8. A binary loadable file conversion and generation device, It is characterized in that The device comprises: An acquisition module, used for acquiring a plurality of binary intermediate files to be converted, performing parallel conversion, and acquiring a conversion auxiliary file based on segment data of the binary intermediate file to be converted when converting any binary intermediate file to be converted; The conversion module is used to convert the binary intermediate file to be converted according to the conversion auxiliary file to obtain the import segment information and export segment information in the converted binary loadable file, and the binary link file corresponding to the binary loadable file.

9. A resource-constrained device, It is characterized in that An embedded operating system is installed on the resource-constrained device, a runtime environment is executed in the embedded operating system, and the resource-constrained device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for converting and generating a binary loadable file according to any one of claims 1 to 7.

10. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the method for converting and generating a binary loadable file according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data conversion method, data conversion system and electronic equipment

    CN115795629A

  • Application updating method and device, computer equipment and storage medium

    CN116088917A

  • Data processing method and device, electronic equipment and storage medium

    CN117033304A

  • Program file loading method and system

    CN118113343A

  • Dynamic linking in constrained environment

    US20060080635A1

Cited By

  • Method and device for converting and generating binary loadable file and resource-constrained equipment

    CN121501748A

  • Conversion generation method and device of binary loadable file and resource-restricted device

    CN121501748B