CN111552479A - Mirror image file compiling method and device and electronic equipment - Google Patents

Mirror image file compiling method and device and electronic equipment Download PDF

Info

Publication number
CN111552479A
CN111552479A CN202010374721.4A CN202010374721A CN111552479A CN 111552479 A CN111552479 A CN 111552479A CN 202010374721 A CN202010374721 A CN 202010374721A CN 111552479 A CN111552479 A CN 111552479A
Authority
CN
China
Prior art keywords
mirror image
core function
file
image
core
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010374721.4A
Other languages
Chinese (zh)
Inventor
魏强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Goke Microelectronics Co Ltd
Original Assignee
Hunan Goke Microelectronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Goke Microelectronics Co Ltd filed Critical Hunan Goke Microelectronics Co Ltd
Priority to CN202010374721.4A priority Critical patent/CN111552479A/en
Publication of CN111552479A publication Critical patent/CN111552479A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a method and a device for compiling an image file and electronic equipment, wherein the method comprises the steps of rearranging object files in an object file set by acquiring the object file set required by generating a complete image, wherein the rearranged object file set comprises a first file set and a second file set which are sequentially arranged. And modifying the link script of the complete mirror image so as to distribute the first file set to the front end of the complete mirror image to obtain a core function mirror image and distribute the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image. Therefore, the target files are classified and sequenced, and then the core function mirror image and the non-core function mirror image are separated, so that the core function mirror image can be read at first in the follow-up reading process, the starting of the core function of the equipment is completed, and the requirement for quickly starting the core function is met.

Description

Mirror image file compiling method and device and electronic equipment
Technical Field
The application relates to the technical field of computer equipment, in particular to a method and a device for compiling an image file and electronic equipment.
Background
Currently, when an embedded operating system is started, an image file in a flash is read into a memory to execute and complete a starting process. That is to say, the starting of the core function of the device also needs to read the complete image file from the flash to the memory for execution, and the time overhead for reading the flash is large, so that the core function needs to be started for a long time, and the requirement for quickly starting the core function of the device at present is difficult to meet.
Disclosure of Invention
The application aims to provide a method, a device and an electronic device for compiling an image file, so as to improve the starting speed of a core function and meet the requirement of quick starting.
The embodiment of the application can be realized as follows:
in a first aspect, an embodiment of the present application provides an image file compiling method, where the method includes:
acquiring a target file set required by generating a complete mirror image, wherein the complete mirror image comprises a core function mirror image and a non-core function mirror image;
rearranging the target files in the target file set to obtain a rearranged target file set, wherein the rearranged target file set comprises a first file set and a second file set which are sequentially arranged, the first file set comprises the target files corresponding to the core function mirror images, and the second file set comprises the target files corresponding to the non-core function mirror images;
and modifying the link script of the complete mirror image according to the rearranged target file set, laying the first file set to the front end of the complete mirror image to obtain a core function mirror image, and laying the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image.
In an alternative embodiment, the method further comprises:
separating a core function image and a non-core function image in the complete image;
compressing the separated core function mirror image to obtain a core compression file, and adding attribute information of the core function mirror image at the front end of the core compression file;
and compressing the separated non-core function mirror image to obtain a non-core compressed file, and adding the attribute information of the non-core function mirror image at the front end of the non-core compressed file.
In an alternative embodiment, the method further comprises:
and when a starting instruction is received, reading the core compressed file and decompressing and writing the core compressed file into the memory to execute the starting of the core function, and reading the non-core compressed file and decompressing and writing the non-core compressed file into the memory to execute the starting of the non-core function.
In an optional embodiment, the step of reading the core compressed file and decompressing the write-in memory to execute the start of the core function, and the step of reading the non-core compressed file and decompressing the write-in memory to execute the start of the non-core function includes:
reading the core compressed file, decompressing and writing the core compressed file into a memory, and executing to complete the starting of the core function;
and reading the non-core compressed file, decompressing, and writing the non-core compressed file into a memory to execute non-core function starting.
In an alternative embodiment, the method further comprises:
and after the core function mirror image and the non-core function mirror image are obtained, modifying the link script of the complete mirror image to carry out alignment operation.
In an alternative embodiment, the step of modifying the fully mirrored link script to perform the alignment operation includes:
and modifying the link script of the complete mirror image so that the offset position of the non-core function mirror image in the complete mirror image is aligned in a preset size.
In an optional embodiment, the step of rearranging the target files in the target file set to obtain an rearranged target file set includes:
acquiring all first class files corresponding to the core function mirror images in the target file set and all second class files corresponding to the non-core function mirror images in the target file set;
and rearranging the first class files and the second class files in the target file set so that any one of the first class files is arranged at the front ends of all the second class files to obtain an rearranged target file set, wherein the rearranged target file set comprises a first file set formed by the first class files and a second file set formed by the second class files which are sequentially arranged.
In an optional embodiment, the step of obtaining all first class files corresponding to the core function image in the target file set and all second class files corresponding to the non-core function image in the target file set includes:
shielding codes irrelevant to the core function in the system, and compiling the unshielded codes to generate a target mirror image;
acquiring a target file required when the target mirror image is generated in the target file set, and taking the target file as a first type of file corresponding to the core function mirror image;
and taking other target files except the first type of files in the target file set as second type of files corresponding to the non-core function mirror image.
In a second aspect, an embodiment of the present application provides an image file compiling apparatus, where the apparatus includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a target file set required by generating a complete mirror image, and the complete mirror image comprises a core function mirror image and a non-core function mirror image;
a rearrangement module, configured to rearrange the target files in the target file set to obtain a rearranged target file set, where the rearranged target file set includes a first file set and a second file set that are sequentially arranged, the first file set includes the target file corresponding to the core function mirror image, and the second file set includes the target file corresponding to the non-core function mirror image;
and the layout module is used for modifying the link script of the complete mirror image according to the rearranged target file set, laying the first file set to the front end of the complete mirror image to obtain a core function mirror image, and laying the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing a computer program;
and the processor is connected with the memory and is used for executing the computer program so as to realize the image file compiling method in any item.
The beneficial effects of the embodiment of the application include, for example:
the embodiment of the application provides a method and a device for compiling an image file and electronic equipment, wherein the method comprises the steps of rearranging target files in a target file set by acquiring the target file set required by generating a complete image, wherein the rearranged target file set comprises a first file set and a second file set which are sequentially arranged, modifying a link script of the complete image so as to arrange the first file set to the front end of the complete image to obtain a core function image, and arranging the second file set to the rear end of the complete image to obtain a non-core function image. Therefore, the target files are classified and sequenced, and then the core function mirror image and the non-core function mirror image are separated, so that the core function mirror image can be read at first in the follow-up reading process, the starting of the core function of the equipment is completed, and the requirement for quickly starting the core function is met.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a block diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a method for compiling an image file according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a target file set rearrangement method according to an embodiment of the present application;
fig. 4 is a flowchart of a method for acquiring a first type file and a second type file according to an embodiment of the present application;
FIG. 5 is another flowchart of a method for compiling an image file according to an embodiment of the present disclosure;
fig. 6 is a functional block diagram of an image file compiling device according to an embodiment of the present application.
Icon: 10-an electronic device; 110-a processor; 120-a memory; 130-a communication module; 140-mirror image file compiling device; 141-an acquisition module; 142-a rearrangement module; 143-layout module.
Detailed Description
When the device based on the embedded operating system is started, the starting function is executed by reading the image file in the flash into the memory, and the starting of the core function can be realized only after the image file is completely read into the memory, so that the starting speed of the core function of the device is influenced. At present, the problem is solved in the following two ways.
One is to cut and optimize source codes to make the mirror image file smaller, thereby prolonging the time required by reading and accelerating the starting speed. However, the redundant code is few under the condition that the application framework is designed reasonably, and the effect of reducing the image file by removing the redundant code is very limited. If the image file is reduced by modifying the adjustment code, not only is technically complicated and time-consuming and labor-consuming, but also code logic may be damaged, and the obtained effect is very little.
The other mode is that a small enough image file only containing the core function is manufactured, and after the core function is started based on the image file, the complete image file is read from the flash to the memory to execute other related function starting. In this way, since the newly manufactured image file and the complete image file belong to different images, independent system resources are occupied after the images are respectively started, synchronous sharing needs to be realized, the operation is very complicated, errors are easy to occur, resources are wasted, and the core function even needs to be restarted in many cases.
Based on the above research, the present application provides a method for compiling an image file, which includes obtaining a first file set that a core function image in a target file set depends on and a second file set that a non-core function image depends on, and sequentially ordering the first file set and the second file set. And modifying the link script of the complete mirror image according to the rearranged target file set so as to lay out the first file set to the front end of the complete mirror image to obtain a core function mirror image, and lay out the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image. Therefore, the core function mirror image and the non-core function mirror image are separated, so that the core function mirror image can be read firstly when being read subsequently, the starting of the core function of the equipment is completed, and the requirement for quickly starting the core function is met.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. In the description of the present application, it is noted that the terms "first", "second", and the like are used merely for distinguishing between descriptions and are not intended to indicate or imply relative importance. It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
Referring to fig. 1, a block diagram of an electronic device 10 according to an embodiment of the present disclosure is provided, where the electronic device 10 may be a device installed with an embedded operating system, and may include, but is not limited to, a computer, a server, and other devices.
The electronic device 10 may include a memory 120, a processor 110, and a communication module 130. The memory 120, the processor 110 and the communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 120 is used for storing programs or data. The Memory 120 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an erasable Read-Only Memory (EPROM), an electrically erasable Read-Only Memory (EEPROM), and the like.
The processor 110 is used for reading/writing data or programs stored in the memory 120 and executing the image file compiling method provided by any embodiment of the present application.
The communication module 130 is used for establishing a communication connection between the electronic device 10 and another communication terminal through a network, and for transceiving data through the network.
It should be understood that the configuration shown in fig. 1 is merely a schematic diagram of the configuration of the electronic device 10, and that the electronic device 10 may include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 2, fig. 2 is a flowchart illustrating an image file compiling method according to an embodiment of the present application, where the image file compiling method can be executed by the electronic device 10 shown in fig. 1. It should be understood that, in other embodiments, the order of some steps in the image file compiling method of the embodiment may be interchanged according to actual needs, or some steps may be omitted or deleted. The detailed steps of the image file compiling method are described as follows.
Step S210, a target file set required by generating a complete mirror image is obtained, wherein the complete mirror image comprises a core function mirror image and a non-core function mirror image.
Step S220, rearranging the target files in the target file set to obtain an rearranged target file set, where the rearranged target file set includes a first file set and a second file set that are sequentially arranged, the first file set includes the target files corresponding to the core function mirror image, and the second file set includes the target files corresponding to the non-core function mirror image.
Step S230, modifying the link script of the complete mirror image according to the rearranged target file set, laying out the first file set to the front end of the complete mirror image to obtain a core function mirror image, and laying out the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image.
The image file exec (executable file) is an executable file, and is one of the types of elf (executable and linkable format). Among them, ELF is an executable and linkable format, developed and released by UNIX Systems Laboratories (USL) as Application Binary Interface (ABI), and is also the main executable file format of LINUX.
The generation of the mirror image file depends on a target file rel (relocatable file), which is a kind of redirectable file, i.e. only the compilation is completed and the file without link is also one of the ELF types. When the device based on the embedded operating system is started, the image file in the flash area needs to be read and loaded into the memory for execution, so that the starting process is completed.
In this embodiment, the image file is modified so that the image file related to the core function can be read and executed first subsequently. The modification of the mirror image file can be realized only by modifying the target file. In this embodiment, a target file set required for generating a complete mirror image is obtained, for example, denoted as a set a, where the target file set is composed of target files related to the complete mirror image extracted from a static library file and original target files in a compilation environment. And the full image includes a core function image associated with a core function of the device and a non-core function image associated with a non-core function other than the core function.
If the core function mirror image and the non-core function mirror image contained in the complete mirror image are to be separated, and the core function mirror image is to be read in a subsequent priority manner, the target files in the target file set need to be classified and sorted.
In this embodiment, the target file set includes a plurality of target files, where the plurality of target files includes a target file on which the core function image depends and a target file on which the non-core function image depends. The target files included in the target file set may be rearranged, and the rearranged target file set may be divided into a first file set (denoted as set B) and a second file set (denoted as set C). The first set of files and the second set of files are subsets of the target set of files. And the target files contained in the first file set are all target files corresponding to the core function mirror image. The target files contained in the second file set are all target files related to the non-core function mirror image.
In the rearranged target file set, the first file set is arranged at the front end of the second file set. And then the complete mirror image is rearranged according to the link script of the rearranged target file set, so that the link disorder caused by the change of the link mode can be avoided when a new local complete mirror image is compiled. On the basis, the first file set can be arranged at the front end of the complete mirror image to serve as a core function mirror image, and the second file set can be arranged at the rear end of the complete mirror image to form a non-core function mirror image. The link script is also called a program loading file, and determines how to allocate storage base addresses of related data when generating the image file.
In this embodiment, the link script of the complete mirror image is modified by classifying and reordering the target files in the target file set in the above manner, so as to obtain the complete mirror image with the front end serving as the core function mirror image and the rear end serving as the non-core function mirror image. Therefore, when the complete mirror image is read subsequently, the core function mirror image can be preferentially read so as to quickly finish the starting of the core function.
Typically, the ratio of the core function image of the front end in the full image is small, for example, it may be only one tenth of the full image. Therefore, based on the mode of arranging the core function mirror image at the front end, the time delay caused by reading the flash can be greatly reduced, and the starting of the core function is accelerated. In addition, because the core function mirror image at the front end and the non-core function mirror image at the rear end belong to a complete mirror image, the resources of the two can be shared without additional synchronous work. From the view point of complete operation of the program, the mode of starting the core function mirror image of the front end firstly and then starting the non-core function mirror image of the rear end is adopted subsequently, and almost no difference exists between the mode of directly starting the complete mirror image and the mode of starting the non-core function mirror image of the rear end.
Referring to fig. 3, in the embodiment, the foregoing may be specifically implemented in the following manner when the target file set is rearranged:
step S221, obtaining all first class files corresponding to the core function mirror image in the target file set and all second class files corresponding to the non-core function mirror image in the target file set.
Step S222, rearranging the first class files and the second class files in the target file set so that any one of the first class files is arranged at the front ends of all the second class files to obtain an rearranged target file set, where the rearranged target file set includes a first file set composed of the first class files and a second file set composed of the second class files, which are arranged in sequence.
In this embodiment, all the target files included in the target file set are classified first, so as to obtain a first type of file related to the core function image and a second type of file related to the non-core function image. And rearranging all the first-class files and the second-class files so as to arrange all the first-class files at the front end and all the second-class files at the rear end. And the two types of files are divided into a first file set and a second file set respectively.
Alternatively, in practice, it may not be clear which target files in the set of target files are the target files on which the core function image depends. Therefore, referring to fig. 4, the first type of file related to the core function image in the target file set can be determined by the following method, and then the second type of file related to the non-core function image can be determined by the following method:
and step S2211, shielding codes irrelevant to the core function in the system, and compiling the unshielded codes to generate a target image.
Step S2212, obtaining the target file required when the target image is generated in the target file set, as the first type of file corresponding to the core function image.
Step S2213, regarding other target files except the first type of file in the target file set as second type of files corresponding to the non-core function image.
In implementation, the code irrelevant to the core function can be shielded, and a target image only containing the core function and the core part of the operating system is generated by compiling, wherein the target image is the core function image. And analyzing all target files depended by the target image through a compiler tool, namely the target files are first-class files corresponding to the core function image. And the other target files except the first type of files in the target file set are second type files corresponding to the non-core function mirror image.
In this embodiment, after the core function image and the non-core function image are obtained, in order to facilitate subsequent separation of the core function image and the non-core function image, the link script of the complete image may be modified to perform the alignment operation. The relative positions of the core function mirror image and the non-core function mirror image in the complete mirror image can be adjusted by the link script, the core function mirror image is arranged at the front end of the complete mirror image, the non-core function mirror image is arranged at the rear end of the complete mirror image, and the offset position of the non-core function mirror image can be understood as a connection point between the core function mirror image and the non-core function mirror image. Alternatively, the link script of the full image may be modified so that the offset position of the non-core function image in the full image is aligned by a preset size. In this embodiment, the unit of M is too large, so the preset size is 1K.
In this embodiment, in order to perform reading with the core function image and the non-core function image as a single whole when reading the image file subsequently, please refer to fig. 5, and on the basis, the following steps are further included:
step S310, separating the core function image and the non-core function image in the complete image.
Step S320, compressing the separated core function mirror image to obtain a core compressed file, and adding the attribute information of the core function mirror image to the front end of the core compressed file.
And step S330, compressing the separated non-core function mirror image to obtain a non-core compressed file, and adding the attribute information of the non-core function mirror image at the front end of the non-core compressed file.
In this embodiment, when the core function image and the non-core function image are separated, the connection point of the core function image and the non-core function image is used as a separation point to separate. The core function mirror image and the non-core function mirror image can be compressed to save the storage space of Flash. When the core function image and the non-core function image are compressed, the same compression format may be used, or different compression formats may be used, and the embodiment is not limited specifically.
After the core function mirror image is compressed, adding header information containing the attribute information of the core function mirror image at the front end of the core compressed file. The attribute information of the core function image includes the size of the core function image, the offset address of the core function image, and the like. Similarly, after the non-core function image is compressed, header information containing the attribute information of the non-core function image is added to the front end of the non-core compressed file. The attribute information of the non-core function image includes the size of the non-core function image, the offset address of the non-core function image, and the like.
After the header information is compressed and added, the core compressed file and the non-core compressed file can be stored in different flash areas, or the core compressed file and the non-core compressed file can be combined to form a complete image file, and the complete image file is completely stored in one flash area.
On the basis, when the device receives the starting instruction, the core compressed file can be read, decompressed and written into the memory so as to execute the starting of the core function. Reading the non-core compressed file, decompressing and writing the non-core compressed file into the memory so as to execute the starting of the non-core function. Therefore, the core compressed file is preferentially read from the flash area and written into the memory, the read time consumption of the flash area is reduced, and the core function can be quickly started.
Optionally, as a possible implementation manner, the core function start may be completed by reading the core compressed file, decompressing, and writing into the memory. After the core function is started, reading the non-core compressed file, decompressing and writing the non-core compressed file into the memory for execution so as to execute the starting of the non-core function, thereby finishing the starting of the whole image file.
Or, as another possible implementation, when the core compressed file and the non-core compressed file are stored in different Flash areas, the non-core compressed file may be read while the core compressed file is read, the core compressed file is decompressed and written into the memory to execute the start of the core function, and the non-core compressed file is decompressed and written into the memory to execute the start of the non-core function. Therefore, the whole starting speed of the operating system can be accelerated on the basis of quickly starting the core function.
The method for compiling the image file, provided by the embodiment, classifies and sorts all target files on which the complete image file depends in advance, and modifies the link script based on the sorted information to re-lay the complete image file, so that link disorder caused by change of a link mode can be avoided while compiling the newly laid complete image file. The rearranged complete mirror image comprises a front-end core function mirror image and a rear-end non-core function mirror image, and the size ratio of the core function mirror image is very small, so that the core function mirror image is read from a Flash area to an internal memory in the subsequent reading process, and the starting time of the complete core function is greatly reduced.
In addition, as the core function mirror image and the non-core function mirror image belong to a complete mirror image, resources can be shared without additional synchronous work. Therefore, based on the scheme, the core function mirror image of the front end is started first and then the non-core function mirror image of the rear end is started, so that the method is almost indistinguishable from the method of directly starting a complete mirror image, and the problem of complex process or resource waste does not exist.
Referring to fig. 6, in order to execute corresponding steps in the foregoing embodiment and various possible manners, an implementation manner of the image file compiling apparatus 140 is given below, and optionally, the image file compiling apparatus 140 may adopt the device structure of the electronic device 10 shown in fig. 1. Further, fig. 6 is a functional block diagram of an image file compiling apparatus 140 according to an embodiment of the present application. It should be noted that the basic principle and the generated technical effect of the image file compiling device 140 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and corresponding contents in the above embodiments may be referred to. The image file compiling apparatus 140 includes:
an obtaining module 141, configured to obtain a target file set required to generate a complete mirror image, where the complete mirror image includes a core function mirror image and a non-core function mirror image; it is understood that the obtaining module 141 may be configured to perform the step S210, and for a detailed implementation of the obtaining module 141, reference may be made to the content related to the step S210.
A rearranging module 142, configured to rearrange the target files in the target file set to obtain a rearranged target file set, where the rearranged target file set includes a first file set and a second file set that are sequentially arranged, the first file set includes the target file corresponding to the core function mirror image, and the second file set includes the target file corresponding to the non-core function mirror image; it is understood that the rearrangement module 142 can be used to perform the step S220, and for the detailed implementation of the rearrangement module 142, reference can be made to the above description about the step S220.
The layout module 143 is configured to modify the link script of the complete mirror image according to the rearranged target file set, lay out the first file set to the front end of the complete mirror image to obtain a core function mirror image, and lay out the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image. It is understood that the layout module 143 can be used to execute the step S230, and for the detailed implementation of the layout module 143, reference can be made to the above description related to the step S230.
In a possible implementation, the image file compiling apparatus 140 further includes a compression module, and the compression module may be configured to:
separating a core function image and a non-core function image in the complete image;
compressing the separated core function mirror image to obtain a core compression file, and adding attribute information of the core function mirror image at the front end of the core compression file;
and compressing the separated non-core function mirror image to obtain a non-core compressed file, and adding the attribute information of the non-core function mirror image at the front end of the non-core compressed file.
In a possible implementation manner, the image file compiling apparatus 140 further includes a starting module, and the starting module is configured to:
and when a starting instruction is received, reading the core compressed file and decompressing and writing the core compressed file into the memory to execute the starting of the core function, and reading the non-core compressed file and decompressing and writing the non-core compressed file into the memory to execute the starting of the non-core function.
In one possible embodiment, the start module may be configured to perform system start-up by:
reading the core compressed file, decompressing and writing the core compressed file into a memory, and executing to complete the starting of the core function;
and reading the non-core compressed file, decompressing, and writing the non-core compressed file into a memory to execute non-core function starting.
In a possible embodiment, the image file compiling apparatus 140 further includes a modification module, and the modification module is configured to:
and after the core function mirror image and the non-core function mirror image are obtained, modifying the link script of the complete mirror image to carry out alignment operation.
In one possible embodiment, the modification module may be configured to perform the link script modification by:
and modifying the link script of the complete mirror image so that the offset position of the non-core function mirror image in the complete mirror image is aligned in a preset size. In one possible implementation, the rearrangement module 142 may be used to rearrange by:
acquiring all first class files corresponding to the core function mirror images in the target file set and all second class files corresponding to the non-core function mirror images in the target file set;
and rearranging the first class files and the second class files in the target file set so that any one of the first class files is arranged at the front ends of all the second class files to obtain an rearranged target file set, wherein the rearranged target file set comprises a first file set formed by the first class files and a second file set formed by the second class files which are sequentially arranged.
In a possible implementation manner, the rearrangement module 142 may be configured to perform the acquisition of the first type file and the second type file by:
shielding codes irrelevant to the core function in the system, and compiling the unshielded codes to generate a target mirror image;
acquiring a target file required when the target mirror image is generated in the target file set, and taking the target file as a first type of file corresponding to the core function mirror image;
and taking other target files except the first type of files in the target file set as second type of files corresponding to the non-core function mirror image.
In an embodiment of the present application, a computer-readable storage medium is provided, where a computer program is stored in the computer-readable storage medium, and the computer program executes the steps of the image file compiling method when running.
The steps executed when the computer program runs are not described in detail herein, and reference may be made to the explanation of the image file compiling method above.
To sum up, the embodiment of the present application provides a method and an apparatus for compiling an image file, and an electronic device 10, where an object file set required for generating a complete image is obtained, and an object file in the object file set is rearranged, where the rearranged object file set includes a first file set and a second file set that are sequentially arranged, and a link script of the complete image is modified, so as to lay out the first file set to a front end of the complete image to obtain a core function image, and lay out the second file set to a rear end of the complete image to obtain a non-core function image. Therefore, the target files are classified and sequenced, and then the core function mirror image and the non-core function mirror image are separated, so that the core function mirror image can be read at first in the follow-up reading process, the starting of the core function of the equipment is completed, and the requirement for quickly starting the core function is met.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. An image file compiling method, characterized in that the method comprises:
acquiring a target file set required by generating a complete mirror image, wherein the complete mirror image comprises a core function mirror image and a non-core function mirror image;
rearranging the target files in the target file set to obtain a rearranged target file set, wherein the rearranged target file set comprises a first file set and a second file set which are sequentially arranged, the first file set comprises the target files corresponding to the core function mirror images, and the second file set comprises the target files corresponding to the non-core function mirror images;
and modifying the link script of the complete mirror image according to the rearranged target file set, laying the first file set to the front end of the complete mirror image to obtain a core function mirror image, and laying the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image.
2. The image file compilation method of claim 1, further comprising:
separating a core function image and a non-core function image in the complete image;
compressing the separated core function mirror image to obtain a core compression file, and adding attribute information of the core function mirror image at the front end of the core compression file;
and compressing the separated non-core function mirror image to obtain a non-core compressed file, and adding the attribute information of the non-core function mirror image at the front end of the non-core compressed file.
3. The image file compilation method of claim 2, further comprising:
and when a starting instruction is received, reading the core compressed file and decompressing and writing the core compressed file into the memory to execute the starting of the core function, and reading the non-core compressed file and decompressing and writing the non-core compressed file into the memory to execute the starting of the non-core function.
4. The method for compiling an image file according to claim 3, wherein the steps of reading the core compressed file and decompressing the write memory to execute the start of the core function, and reading the non-core compressed file and decompressing the write memory to execute the start of the non-core function comprise:
reading the core compressed file, decompressing and writing the core compressed file into a memory, and executing to complete the starting of the core function;
and reading the non-core compressed file, decompressing, and writing the non-core compressed file into a memory to execute non-core function starting.
5. The image file compilation method of claim 1, further comprising:
and after the core function mirror image and the non-core function mirror image are obtained, modifying the link script of the complete mirror image to carry out alignment operation.
6. The image file compilation method of claim 5, wherein the step of modifying the full image linking script to perform an alignment operation comprises:
and modifying the link script of the complete mirror image so that the offset position of the non-core function mirror image in the complete mirror image is aligned in a preset size.
7. The method for compiling an image file according to claim 1, wherein the step of rearranging the object files in the object file set to obtain an rearranged object file set comprises:
acquiring all first class files corresponding to the core function mirror images in the target file set and all second class files corresponding to the non-core function mirror images in the target file set;
and rearranging the first class files and the second class files in the target file set so that any one of the first class files is arranged at the front ends of all the second class files to obtain an rearranged target file set, wherein the rearranged target file set comprises a first file set formed by the first class files and a second file set formed by the second class files which are sequentially arranged.
8. The method for compiling image files according to claim 7, wherein the step of obtaining all first class files corresponding to the core function images in the target file set and all second class files corresponding to the non-core function images in the target file set comprises:
shielding codes irrelevant to the core function in the system, and compiling the unshielded codes to generate a target mirror image;
acquiring a target file required when the target mirror image is generated in the target file set, and taking the target file as a first type of file corresponding to the core function mirror image;
and taking other target files except the first type of files in the target file set as second type of files corresponding to the non-core function mirror image.
9. An image file compilation device, the device comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a target file set required by generating a complete mirror image, and the complete mirror image comprises a core function mirror image and a non-core function mirror image;
a rearrangement module, configured to rearrange the target files in the target file set to obtain a rearranged target file set, where the rearranged target file set includes a first file set and a second file set that are sequentially arranged, the first file set includes the target file corresponding to the core function mirror image, and the second file set includes the target file corresponding to the non-core function mirror image;
and the layout module is used for modifying the link script of the complete mirror image according to the rearranged target file set, laying the first file set to the front end of the complete mirror image to obtain a core function mirror image, and laying the second file set to the rear end of the complete mirror image to obtain a non-core function mirror image.
10. An electronic device, comprising:
a memory for storing a computer program;
a processor coupled to the memory for executing the computer program to implement the image file compilation method of any of claims 1-8.
CN202010374721.4A 2020-05-06 2020-05-06 Mirror image file compiling method and device and electronic equipment Pending CN111552479A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010374721.4A CN111552479A (en) 2020-05-06 2020-05-06 Mirror image file compiling method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010374721.4A CN111552479A (en) 2020-05-06 2020-05-06 Mirror image file compiling method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN111552479A true CN111552479A (en) 2020-08-18

Family

ID=72006065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010374721.4A Pending CN111552479A (en) 2020-05-06 2020-05-06 Mirror image file compiling method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111552479A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023213263A1 (en) * 2022-05-05 2023-11-09 阿里云计算有限公司 Program compiling method, program starting method, and device and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006277330A (en) * 2005-03-29 2006-10-12 Toshiba Corp Source code editing device and source code editing method
CN104298532A (en) * 2014-11-04 2015-01-21 上海斐讯数据通信技术有限公司 Upgrading method and upgrading system for software
CN104536797A (en) * 2015-01-14 2015-04-22 大唐微电子技术有限公司 Java program precompiling method and precompiler
CN105760201A (en) * 2016-02-29 2016-07-13 华为技术有限公司 Starting method and starting device of embedded type device
CN107329802A (en) * 2017-06-30 2017-11-07 联想(北京)有限公司 A kind of virtual machine creation method and electronic equipment
CN107678750A (en) * 2017-10-27 2018-02-09 北京腾云天下科技有限公司 A kind of SDK packaging methods, computing device and SDK packaging systems
CN109298891A (en) * 2018-09-06 2019-02-01 深圳市智美达科技股份有限公司 System start method and device, System build method and apparatus
CN109491662A (en) * 2018-10-31 2019-03-19 珠海市筑巢科技有限公司 Code packaging method, computer installation and computer readable storage medium, code packaging system
CN109814980A (en) * 2019-01-25 2019-05-28 新华三云计算技术有限公司 Image file acquisition methods and device
CN110888650A (en) * 2019-10-12 2020-03-17 苏州浪潮智能科技有限公司 Method and system for customizing operating system mirror image

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006277330A (en) * 2005-03-29 2006-10-12 Toshiba Corp Source code editing device and source code editing method
CN104298532A (en) * 2014-11-04 2015-01-21 上海斐讯数据通信技术有限公司 Upgrading method and upgrading system for software
CN104536797A (en) * 2015-01-14 2015-04-22 大唐微电子技术有限公司 Java program precompiling method and precompiler
CN105760201A (en) * 2016-02-29 2016-07-13 华为技术有限公司 Starting method and starting device of embedded type device
CN107329802A (en) * 2017-06-30 2017-11-07 联想(北京)有限公司 A kind of virtual machine creation method and electronic equipment
CN107678750A (en) * 2017-10-27 2018-02-09 北京腾云天下科技有限公司 A kind of SDK packaging methods, computing device and SDK packaging systems
CN109298891A (en) * 2018-09-06 2019-02-01 深圳市智美达科技股份有限公司 System start method and device, System build method and apparatus
CN109491662A (en) * 2018-10-31 2019-03-19 珠海市筑巢科技有限公司 Code packaging method, computer installation and computer readable storage medium, code packaging system
CN109814980A (en) * 2019-01-25 2019-05-28 新华三云计算技术有限公司 Image file acquisition methods and device
CN110888650A (en) * 2019-10-12 2020-03-17 苏州浪潮智能科技有限公司 Method and system for customizing operating system mirror image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
关丽霞;单红丽;: "Android系统核心管理工具设计与实现" *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023213263A1 (en) * 2022-05-05 2023-11-09 阿里云计算有限公司 Program compiling method, program starting method, and device and storage medium

Similar Documents

Publication Publication Date Title
CN108536745B (en) Shell-based data table extraction method, terminal, equipment and storage medium
CN110149518B (en) Method, system, device, equipment and storage medium for processing media data
CN106557307B (en) Service data processing method and system
CN111680253A (en) Page application data packet generation method and device, computer equipment and storage medium
CN108763572A (en) A kind of method and apparatus for realizing Apache Solr read and write abruptions
CN111679860B (en) Distributed information processing method and device
CN111198777A (en) Data processing method, device, terminal and storage medium
CN113138757A (en) Method, device, server, system and medium for automatically generating front-end code
CN113489593A (en) JSON message checking method and JSON message checking device
CN111552479A (en) Mirror image file compiling method and device and electronic equipment
CN110888972A (en) Sensitive content identification method and device based on Spark Streaming
CN113127735A (en) Vehicle and goods matching method and device, computer equipment and medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN113110851A (en) Resource loading method and device, electronic equipment and medium
CN115080114B (en) Application program transplanting processing method, device and medium
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN116302054A (en) Development method and device of software project, storage medium and electronic equipment
CN112506526B (en) Data presentation software deployment method and device and electronic equipment
CN113098961B (en) Component uploading method, device and system, computer equipment and readable storage medium
CN113419957A (en) Rule-based big data offline batch processing performance capacity scanning method and device
CN113934405A (en) Plug-in processing method, device, equipment, storage medium and computer program product
CN111651531A (en) Data import method, device, equipment and computer storage medium
CN106777288B (en) A kind of system and method for quick fractionation virtualization disk mirroring
CN111625505A (en) File splitting method and device
CN115543227B (en) Cross-system data migration method, system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination