Hybrid format software packaging and installation method based on ELF executable file

Through the hybrid format software packaging and installation method based on ELF executable files, the defects of shared module dependency installation in the existing technology are solved, and multiple format components are independently installed, cross-platform operation and dynamic management of the installation process is realized, and user interaction and component integrity verification are supported.

CN114327514BActive Publication Date: 2025-04-08SHANGHAI DRAGONNET TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111627656.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-04-08
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

The existing software installation method has defects in dealing with shared module dependencies, including the need to install additional software, occupies a large amount of disk and memory, and the inability to manage interactively, and the inability to effectively integrate component installations in different formats.

Method used

Using a hybrid format software packaging and installation method based on ELF executable files, the installation bootloader, XML file and related installation files are combined into a runnable installation program, using XML to describe the installation process and component relationships, dynamically determine the installation sequence and support user interaction.

Benefits of technology

It realizes the independent installation of multiple interdependent components, supports cross-platform operation, dynamic management of installation processes, supports user interaction and component integrity verification, and avoids additional software dependencies and resource occupation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114327514B_ABST
    Figure CN114327514B_ABST
Patent Text Reader

Abstract

The present invention relates to a mixed format software packaging and installation method based on ELF executable files. The packaging method utilizes the characteristic of ELF format dynamically inserting data sections to package the installation boot program, XML file and related installation files of the software to be installed into an executable installation program, wherein the XML file is used to describe the installation process, the information of each installation file and the related information between each installation file, integrate multiple mixed format components, and use extensible markup language to describe the relationship between each component and the installation process. Compared with the prior art, the present invention utilizes the characteristic of ELF format dynamically inserting data sections to combine a fixed boot program, a process configuration XML and all components into a single executable installation file, does not need to rely on additional software to run the installation program, can execute the installation program on different operating system platforms supporting the ELF format, and has the advantages of being able to integrate various formats and be independently installed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a software packaging and installation method, in particular to a mixed format software packaging and installation method based on ELF executable files. Background Art

[0002] Most of the current operating system software installations use the method of copying files to a specific directory and modifying relevant system parameters to complete the software installation. This method is more friendly to software that does not rely on third-party shared modules. But in fact, modern general operating systems, whether Linux, MacOS or Windows, have a large number of shared software modules (tools or dynamic libraries). In order to solve the problem of these shared file dependencies, there are currently two solutions:

[0003] 1. Establish a package management system and use related software such as yum and dpkg for installation. It will parse the required shared modules according to the installation files and install the shared dependent modules;

[0004] 2. Establish an independent virtual operating environment and install all software dependencies in the virtual environment.

[0005] But both of the above methods have their own disadvantages:

[0006] 1. The package management system installation method has the following disadvantages:

[0007] 1) Additional software needs to be installed for installation;

[0008] 2) All modules are required to be produced according to the specified unified installation format.

[0009] 2. Virtual operating environment mode has the following disadvantages:

[0010] 1) It takes up a lot of disk space, and a large number of duplicate module files exist in each virtual environment;

[0011] 2) Consumes running memory. Loading the same module in different locations requires opening up independent memory space.

[0012] 3) Dependency module upgrades require checking all virtual environments.

[0013] In addition, neither of the above two methods can perform interactive management during the installation process.

[0014] Currently, there is more than one way to install software on any operating system. There are still a large number of software modules installed through various scripts, especially software modules provided by various manufacturers. These customized modules exist and have dependencies on each other. In the face of increasing demands, it is necessary to propose a new software installation method. Summary of the invention

[0015] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a mixed format software packaging and installation method based on ELF executable files that can integrate various formats and be independently installed, so as to realize the simultaneous installation of multiple interdependent components in different formats.

[0016] The purpose of the present invention can be achieved by the following technical solutions:

[0017] A hybrid format software packaging method based on ELF executable files, which utilizes the characteristic of ELF format to dynamically insert data sections, and packages the installation boot program, XML file and related installation files of the software to be installed into an executable installation program, wherein:

[0018] The XML file is used to describe the installation process, information of each installation file, and related information between each installation file.

[0019] Furthermore, the installation boot program, XML file and related installation files are packaged into an executable installation program as follows:

[0020] Read the XML file and find all installation file paths;

[0021] Add a header area to each file;

[0022] All installation files with the header area added are concatenated into an independent data file;

[0023] The XML file with the added header area is used as the configuration section of the ELF file, and the generated independent data file is used as the data section of the ELF file, which are inserted into the installation boot program to form the executable installation program.

[0024] Furthermore, the header area includes a characteristic data field, a header data integrity check, a header length, a file type, a reserved field, a file length, a file ID and a file MD5 check.

[0025] Furthermore, each of the installation files corresponds to a component set divided by type and installation order, and the relationship between the components in the component set satisfies any of the following conditions:

[0026] A) The dependencies between components can be resolved through package management software in the corresponding format;

[0027] B) There is no dependency between components.

[0028] Furthermore, the installation file information described in the XML file and the related information between each installation file include a list of subsequent adjacent sets of component sets and component description information within the component set, and the component description information within the component set includes a component path, a custom pre-checker path, a custom installer path, and a custom subsequent processing program path.

[0029] Furthermore, the component set subsequent adjacent set list is marked with a user selection mark.

[0030] The present invention also provides a hybrid format software installation method based on ELF executable files. The method implements software installation through an ELF file. The ELF file is a chain structure including an installation boot program, a configuration section and a data section. The configuration section stores an XML file with a header area added, and the data section stores an independent data file. The independent data file is formed by splicing a plurality of installation files with a header area added. The XML file is used to describe the installation process, information of each installation file and related information between each installation file. The installation method comprises the following steps:

[0031] S1. Get and parse the XML file in the configuration section;

[0032] S2, determine whether the XML file contains the preparation phase program, if so, find the corresponding installation file in the data section and execute the installation file, if not, execute step S3;

[0033] S3, parsing the XML file to obtain an installation phase program, the installation phase program including at least one installation file, and forming a directed acyclic graph based on the installation file information and related information between the installation files;

[0034] S4. Execute each installation file in sequence based on the directed acyclic graph;

[0035] S5. Determine whether the XML file contains a subsequent stage program. If so, find the corresponding installation file in the data section, execute the installation file, and complete the installation. If not, the installation is completed.

[0036] Furthermore, each of the installation files corresponds to a component set divided by type and installation order. In step S4, when executing each installation file, the set type is determined. If the set type is a format type related to the package management software, all components in the set are obtained and all components in the set are installed according to the package management software rules. If the set type is a custom format type, a component in the set is obtained in any order and the custom component installation process is executed.

[0037] Furthermore, when executing the defined component installation process, it is first determined whether there is a pre-check program in the component description.

[0038] Furthermore, the method further comprises:

[0039] Get the header area of ​​the installation file, and get the component according to the length information described in the header area and the relative position between the header area and the component;

[0040] Verify whether the obtained component is complete based on the MD5 described in the header area.

[0041] The current software packaging and installation methods generally require the installation of additional installation software, such as rpm, deb, etc., which cannot support the installation of a large number of components in different formats, and the installation process has no user interaction and does not support the installation of different components according to user needs. Compared with the prior art, the present invention can integrate various formats and independently install software, and has the following beneficial effects:

[0042] (1) The present invention utilizes the characteristic of the ELF format that data sections can be dynamically inserted, combines a fixed boot program, a process configuration XML, and all components into a single independent executable installation file, adds the data required for installation by section in the ELF boot program, and dynamically assembles it into an executable installation program. The installation program does not need to rely on additional software to run, and can run independently. The installation program can be executed on different operating system platforms that support the ELF format, and has cross-platform operation capabilities.

[0043] (2) The present invention integrates installation methods of various file formats, and uses XML to describe directed graphs to solve the interdependencies between components of different formats. It uses topological sorting methods to dynamically determine the installation order and implement dynamic management of the installation process. It can support the installation and inspection of shared modules in multiple formats.

[0044] (3) The present invention supports user interaction during the installation process, supports dynamic modification of the installation process, and installs related components on demand.

[0045] (4) The present invention supports the inspection, installation and post-installation processing of components through optional customized programs during the installation process.

[0046] (5) The present invention has formulated verification data for each component file, and supports searching and verifying the intact components integrated therein by searching the file feature fields when the installation file is partially damaged, thereby realizing component integrity verification and repair. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 The data layout diagram of the file header area of ​​the present invention;

[0048] Figure 2 It is the layout diagram of the installation procedure of the present invention;

[0049] Figure 3 It is the installation flow chart of the present invention;

[0050] Figure 4 It is a component set relationship diagram of the present invention;

[0051] Figure 5 A flow chart for selecting a component assembly installation for the present invention;

[0052] Figure 6 Customizing the installation flow chart for the components of the present invention DETAILED DESCRIPTION

[0053] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0054] The present embodiment provides a hybrid format software packaging method based on ELF executable files. The method utilizes the characteristic of ELF format to dynamically insert data sections, and packages the installation boot program, XML (Extensible Markup Language) file and related installation files of the software to be installed into an executable installation program. The installation program is an ELF file, including a configuration section and a data section. The configuration section is used to place the XML file, and the data section is used to place each installation file. All files (including XML files) are spliced ​​together after setting the header area. The XML file is used to describe the installation process, the information of each of the installation files (component files) and the related information (interdependencies) between the installation files. Each file has a unique ID during an installation process, and the ID is added to each file description of the XML file. The format of the header area is as follows: Figure 1 As shown, the ELF file formed is as follows Figure 2 shown.

[0055] like Figure 1 As shown, the header area is used to describe the file and installation related information, including magic (characteristic data field, used for legality verification), type, head size, data size, head size, head crc32, MD5 and ID.

[0056] Table 1

[0057] Fields Length (bytes) meaning magic 8 Feature data fields head crc32 4 Header data integrity check head size 4 Head length type 1 File Type reserved 3 Reserved Fields data size 4 File Length ID 8 Document ID MD5 16 File MD5 checksum reserved 16 Reserved Fields

[0058] The head area position of the next file adjacent to it can be calculated by the head size and data size of the head area, and the process can be repeated to obtain all file contents. The data integrity of the head area can be ensured by the head size and headcrc32 of the head area. The integrity of the file can be verified by the MD5 of the head area. By the ID of the head area, the file description information corresponding to the ID can be found in the XML file of the configuration section of the ELF file. In the present embodiment, the specific length and meaning of each field are as shown in Table 1.

[0059] The above software packaging method is implemented by executing a packaging program. Specifically, the packaging program reads the XML file, finds all components (packages) and related program file paths, and adds the following to each file (including the XML file): Figure 1 The header area shown in the figure, where the description of each field is shown in Table 1. Then all the installation files with the header area added (excluding XML files) are spliced ​​into an independent data file, which can be dynamically inserted into the boot program as a non-loaded, read-only section to form an independent executable installation file. Figure 2 As shown, the XML file with the added header area is used as a configuration section, and the generated independent data file is used as a data section, which are inserted into the boot program to generate an executable installation program.

[0060] Each of the above-mentioned installation files corresponds to a component set divided by type and installation order. The component formats in the set must be the same. The only condition that the relationship between the components in the component set must comply with is that no additional information is required to describe the dependency relationship between them, that is, any of the following conditions is met:

[0061] A) The dependencies between components can be resolved through package management software in the corresponding format;

[0062] B) There is no dependency between components.

[0063] The installation file information described in the XML file and the related information between the installation files include a list of subsequent adjacent sets of component sets and component description information within the component set, wherein the component description information within the component set includes component path, custom pre-checker path, custom installer path, and custom post-processor path. The component path is a mandatory attribute, and the rest are optional according to the actual installation needs of the component. The list of subsequent adjacent sets of the component set describes its dependency relationship with other groups, that is, which sets this set needs to be installed before.

[0064] The component set subsequent adjacent set list has a user selection mark. If there are multiple subsequent adjacent sets and optional installation is required, the optional installation can be achieved through the user selection mark set in the current set and the selected option parameters set in the subsequent adjacent sets.

[0065] The above-mentioned installation boot program can read its own running program file, parse its own sections according to the ELF file format, obtain the inserted XML description file and data file, obtain each installation file by matching the ID recorded in the header area of ​​each file in the data file according to the component ID described in the XML file, generate a directed acyclic graph (DAG-Directed Acyclic Graph) according to the installation process steps described in the XML file and user input, topologically sort the directed acyclic graph, and install each component in the sorted order.

[0066] The installation process of the installer obtained based on the above packaging method can be divided into three stages: preparation stage, installation stage and subsequent stage. Specifically:

[0067] 1) In the preparation phase, the installer can customize the required preparation phase program and specify the path of the program file in XML, which can be used to check the current system environment, determine the installation program parameters, and other operations.

[0068] 2) Installation phase, describing the path where each component file is located, the path where the related programs required for installation are located, and the installation order and installation options between components.

[0069] 3) In the subsequent stage, after all components are successfully installed, the installer can customize the subsequent processing program and specify its path in XML, which can be used to initialize related programs, start services, and other operations.

[0070] The installation method of the installer obtained based on the above packaging method is as follows Figure 3 As shown, the following steps are included:

[0071] S101, parsing the currently running ELF file;

[0072] S102, determine whether there is an XML configuration section, if yes, execute step S103, if no, execute step S110;

[0073] S103, determine whether there is an installation data section, if yes, execute step S104, if no, execute step S110;

[0074] S104, obtaining and parsing the XML file in the configuration section;

[0075] S105, determining whether the XML file contains a preparation phase program, if so, finding the corresponding installation file in the data section, executing the preparation phase program, if the preparation phase program deems that the installation conditions are not met, executing step S110, if the XML file does not contain a preparation phase program, or the preparation phase program deems that the installation conditions are met, continuing to execute step S106;

[0076] S106, parsing the XML file to obtain an installation phase program, the installation phase program including at least one installation file, and forming a directed acyclic graph based on the installation file information and related information between the installation files;

[0077] S107, executing each installation file in sequence based on the directed acyclic graph;

[0078] S108, determine whether the installation is successful, if so, execute step S109, if not, execute step S110;

[0079] S109, determining whether the XML file contains a subsequent stage program, if so, finding the corresponding installation file in the data section, executing the installation file, and executing step S110, if not, directly executing step S110;

[0080] S110. Installation is completed.

[0081] In steps S106 and S107, the installation phase component set list in the XML file is parsed, and the user installation options are obtained by interacting with the user according to the set attributes. The generated directed acyclic graph is as follows: Figure 4 Each of the installation files corresponds to a component set divided by type and installation order, such as Figure 5 As shown, each time the user inputs an option, it needs to be put into the option list. The subsequent collections need to be processed according to the existing options in the option list. If there is no valid option, then interact with the user to obtain the installation option to avoid repeated interaction. According to the topological sorting method, the collections in the generated directed acyclic graph are sorted, and the components in each collection are installed in the sorted order.

[0082] When executing each installation file, determine the collection type. If the collection type is a package management software related format type, obtain all components in the collection and install all components in the collection according to the package management software rules. If the collection type is a custom format type, obtain a component in the collection in any order and execute the custom component installation process. The custom component installation process is to use a custom program to complete any format installation program. If the installation of any component in the collection fails, the installation is terminated.

[0083] In a preferred embodiment, Figure 6As shown, if there is a pre-check program in the component description, the pre-check program is executed to determine whether the component needs to be installed. If there is no pre-check program or the pre-check program believes that the component needs to be installed, the custom installation program in the component description is obtained and executed. If the installation fails, the entire installation process is terminated.

[0084] In a preferred embodiment, the above installation method further comprises: finding a complete component in a damaged ELF installation file.

[0085] like Figure 1 As shown in the figure, each file in the data section has a header area, which contains an 8-byte characteristic data field (magic). In the damaged ELF file, search for the characteristic field, and then find the header area where the characteristic field is located through the relative position of the characteristic field in the header area. Verify the integrity of the header area through the head size and headcrc32 of the header area. If it fails, search for the next characteristic field until a complete and valid header area is found.

[0086] According to the relative position between the header area and the file, as well as the data size in the header area, the file corresponding to the header area can be obtained. The integrity of the obtained file can be verified through the MD5 value of the header area. If the verification is successful, a complete and valid file is obtained.

[0087] Repeat the above process to search the entire ELF file to obtain all complete and valid components and related installation program files.

[0088] The above software packaging and installation method has an independent executable installation file, which can solve the installation dependency relationship between components of different formats, and can realize dynamic management of the installation process and component integrity verification and repair.

[0089] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A hybrid format software installation method based on ELF executable file, characterized in that: The method realizes software installation through an ELF file. The ELF file is a chain structure including an installation boot program, a configuration section and a data section. The configuration section stores an XML file with a header area added, and the data section stores an independent data file. The independent data file is formed by splicing a plurality of installation files with a header area added. The XML file is used to describe the installation process, information of each installation file and related information between each installation file. The installation method includes the following steps: S1. Get and parse the XML file in the configuration section; S2, determine whether the XML file contains the preparation phase program, if so, find the corresponding installation file in the data section and execute the installation file, if not, execute step S3; S3, parsing the XML file to obtain an installation phase program, the installation phase program including at least one installation file, and forming a directed acyclic graph based on the installation file information and related information between the installation files; S4. Execute each installation file in sequence based on the directed acyclic graph; S5. Determine whether the XML file contains a subsequent stage program. If so, find the corresponding installation file in the data section, execute the installation file, and complete the installation. If not, the installation is completed.

2. The hybrid format software installation method based on ELF executable file according to claim 1, characterized in that: Each of the installation files corresponds to a component set divided by type and installation order. In step S4, when executing each installation file, the set type is determined. If the set type is a format type related to the package management software, all components in the set are obtained and all components in the set are installed according to the package management software rules. If the set type is a custom format type, a component in the set is obtained in any order and the custom component installation process is executed.

3. The hybrid format software installation method based on ELF executable file according to claim 2, characterized in that: When executing the defined component installation process, first determine whether there is a pre-check program in the component description.

4. The hybrid format software installation method based on ELF executable file according to claim 2, characterized in that: The relationship between the components in the component set meets any of the following conditions: A) Dependencies between components can be resolved through package management software in corresponding formats; B) There is no dependency between components.

5. The hybrid format software installation method based on ELF executable file according to claim 2, characterized in that: The installation file information described in the XML file and the related information between each installation file include a list of subsequent adjacent sets of component sets and component description information within the component set. The component description information within the component set includes component path, custom pre-checker path, custom installer path and custom subsequent processing program path.

6. The hybrid format software installation method based on ELF executable file according to claim 5, characterized in that: The component set subsequent adjacent set list is marked with a user selection mark.

7. The hybrid format software installation method based on ELF executable file according to claim 1, characterized in that: The header area includes a characteristic data field, a header data integrity check, a header length, a file type, a reserved field, a file length, a file ID and a file MD5 check.

8. The hybrid format software installation method based on ELF executable file according to claim 1, characterized in that: The method further includes: Get the header area of ​​the installation file, and get the component according to the length information described in the header area and the relative position between the header area and the component; Verify whether the obtained component is complete based on the MD5 described in the header area.