CN106909398B - Compression method and device for executable file - Google Patents

Compression method and device for executable file Download PDF

Info

Publication number
CN106909398B
CN106909398B CN201710142482.8A CN201710142482A CN106909398B CN 106909398 B CN106909398 B CN 106909398B CN 201710142482 A CN201710142482 A CN 201710142482A CN 106909398 B CN106909398 B CN 106909398B
Authority
CN
China
Prior art keywords
target data
storage format
compression
attribute
executable file
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.)
Active
Application number
CN201710142482.8A
Other languages
Chinese (zh)
Other versions
CN106909398A (en
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.)
Shenzhen Skyworth RGB Electronics Co Ltd
Original Assignee
Shenzhen Skyworth RGB Electronics 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 Shenzhen Skyworth RGB Electronics Co Ltd filed Critical Shenzhen Skyworth RGB Electronics Co Ltd
Priority to CN201710142482.8A priority Critical patent/CN106909398B/en
Publication of CN106909398A publication Critical patent/CN106909398A/en
Priority to PCT/CN2018/076624 priority patent/WO2018161791A1/en
Application granted granted Critical
Publication of CN106909398B publication Critical patent/CN106909398B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/02Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word
    • H03M7/04Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word the radix thereof being two

Landscapes

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

Abstract

The embodiment of the invention discloses a method and a device for compressing an executable file. The method comprises the following steps: analyzing the functional attribute and the storage format attribute of data of each part of the executable file; identifying compressible target data in the data of each part according to the functional attributes; obtaining a compression strategy of the target data according to the storage format attribute of the target data; and compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file. By adopting the technical scheme, the compressed executable file can occupy less storage space, the effect of saving hardware cost is achieved, and the market competitiveness is improved.

Description

Compression method and device for executable file
Technical Field
The embodiment of the invention relates to the technical field of embedding, in particular to a compression method and device of an executable file.
Background
With the continuous development of science and technology, the competition of industries such as televisions and the like is more and more intense. Among them, cost competition is an important aspect, and how to reduce the cost is also a problem to be considered by most companies.
Taking the television manufacturing industry as an example, the cost competition is mainly focused on the hardware aspect. In software, the material cost of the storage hardware of the television is generally reduced by reducing the size of the executable file, thereby reducing the size of the storage chip space.
In the prior art, different compression algorithms are generally determined according to different executable files to compress the executable files. However, when there are many executable files and the executable files are compressed separately, there may be a case where the storage space cannot store all the compressed executable files. This is because, in the process of compressing and/or decompressing each executable file, an extra storage space needs to be opened up for executing the compression and/or decompression algorithm, and when there are many executable files, the extra storage space needed for executing the compression and/or decompression algorithm itself is also much, and when the storage space cannot meet the requirement for executing the compression and/or decompression algorithm, the effect of the compression and/or decompression algorithm is affected, which further causes the space of the storage device occupied by the file to increase, so that the cost of the storage chip for storing the executable file increases.
Therefore, the compression method and compression efficiency of the executable file in the prior art need to be improved.
Disclosure of Invention
In order to solve the above related technical problems, the present invention provides a method and an apparatus for compressing an executable file, so as to improve the compression rate of the executable file, save the storage space of a storage chip for storing the executable file, and indirectly achieve the technical effect of saving hardware cost.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a method for compressing an executable file, where the method includes:
analyzing the functional attribute and the storage format attribute of data of each part of the executable file;
identifying compressible target data in the data of each part according to the functional attributes;
obtaining a compression strategy of the target data according to the storage format attribute of the target data;
and compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file.
In a second aspect, an embodiment of the present invention provides an apparatus for executing a file, where the apparatus includes:
the attribute analysis module is used for analyzing the functional attribute and the storage format attribute of the data of each part of the executable file;
the target data identification module is used for identifying compressible target data in the data of each part according to the functional attributes;
the compression strategy determining module is used for obtaining a compression strategy of the target data according to the storage format attribute of the target data;
and the compression module is used for compressing the target data according to the compression strategy and updating the storage format attribute of the target data to obtain a compressed executable file.
The embodiment of the invention provides a method and a device for compressing an executable file, which comprises the steps of firstly analyzing the functional attributes and the storage format attributes of data of each part of the executable file, and identifying compressible target data in the data of each part according to the functional attributes of the data of each part; obtaining a compression strategy of the target data according to the storage format attribute of the target data; and compressing the compressible target data according to the compression strategy, and updating the storage format attribute of the target data to obtain the compressed executable file. By adopting the technical scheme, compared with the prior art, the compressed executable file can occupy less storage space, the technical effect of saving the hardware cost for storing the executable file is achieved, and the market competitiveness of the product is indirectly improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the contents of the embodiments of the present invention and the drawings without creative efforts.
Fig. 1 is a flowchart of a method for compressing an executable file according to an embodiment of the present invention;
FIG. 2a is a diagram of an executable binary file data generated after a write FLASH operation;
FIG. 2b is a diagram of another executable binary file data generated after a FLASH write operation;
fig. 3a is a data storage structure distribution diagram of a FLASH memory of a television before optimization according to an embodiment of the present invention;
fig. 3b is a data storage structure distribution diagram of the optimized television FLASH memory according to the first embodiment of the present invention;
FIG. 4 is a flowchart of a method for compressing an executable file according to a second embodiment of the present invention;
fig. 5 is a schematic diagram illustrating a comparison of storage spaces occupied by an executable file before and after compression according to a second embodiment of the present invention;
fig. 6 is a block diagram of an executable file compression apparatus according to a third embodiment of the present invention.
Detailed Description
In order to make the technical problems solved, technical solutions adopted and technical effects achieved by the present invention clearer, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. 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 invention.
Example one
Fig. 1 is a flowchart of a method for compressing an executable file according to an embodiment of the present invention. The method of the present embodiment may be performed by a compression device of an executable file such as a television and/or a television set-top box, wherein the method may be implemented by software and/or hardware deployed in, for example, a television and/or a television set-top box, which may generally be integrated in some embedded system. As shown in fig. 1, the method may include the steps of:
s110: and analyzing the functional attribute and the storage format attribute of the data of each part of the executable file.
The executable file refers to a file loaded and executed by an operating system, and the executable file mentioned in this embodiment is preferably an executable binary (bin) file. The executable binary file may be a compressed binary file or a non-compressed binary file. Wherein, a person skilled in the art can determine whether the binary file has been compressed according to the compression identifier carried in the executable binary file.
For example, the storage format attribute of each part of data of the executable file may be obtained from an identifier attached to a corresponding storage path of each part of data and identifying a corresponding storage format of the part of data, and generally includes the following three cases:
1. no compression mark is added in the corresponding storage path;
for the executable file without any compression identifier added in the storage path corresponding to each part of data, the compiler only needs to complete normal compilation processing when compiling the file, and does not need to do any compression and decompression processing.
2. A compression identifier with a lower compression rate is added in the corresponding storage path;
preferably, the preset storage format attribute in the embodiment of the present invention refers to a characteristic attribute of an executable file stored in a storage path according to a first preset storage format (e.g., an identifier "-g") or a second preset storage format (e.g., an identifier "-7"). The two storage formats have different compression ratios, the first preset storage format has a lower compression ratio, and the second preset storage format has a higher compression ratio. Specifically, when the marker of the first preset storage format is "-g". If the identifier of "-g" is detected in the corresponding storage path of some part of data of the executable binary file, it indicates that the compiler performs compression processing on the part of data in a manner of smaller compression rate in the process of compiling the part of data of the executable binary file, so as to save the storage space occupied by the binary file, and further save the material cost of hardware (such as a storage chip) for storing the binary file.
3. And adding a compression identifier with a higher compression rate into the corresponding storage path.
Preferably, when the identifier of the second preset storage format is "-7". If the identifier "-7" is detected in the corresponding storage path of some part of data of the executable binary file, it indicates that the compiler performs compression processing on the part of data in a manner of a larger compression rate in the process of compiling the part of data of the binary file, and compared with the first preset storage format with the identifier "-g", the compression manner can further save the storage space occupied by the executable binary file, so as to save the material cost of the hardware for storing the binary file.
It should be noted that, due to the numerous compression algorithms and techniques, the storage format of the data of each part of the executable binary file is not limited to the three forms listed above.
S120: and identifying compressible target data in each part of data according to the functional attributes.
Further, before each part of the executable binary file is compressed, it is necessary to determine whether each part of the executable binary file can be compressed according to the basic characteristic of the functional attribute of each part of the executable binary file. For example, the functional attributes of each portion of data in the executable binary file may include, but are not limited to, storage attributes, compression or decompression attributes, and the like. In the specific operation process, for the data of the executable binary file with the decompression attribute or the marking attribute, the data cannot be compressed against the data attribute; and for the data in the binary file with the storage attribute, the data can be compressed to save the storage space.
For example, the following description will be made by taking as an example the actual configuration of a system, which is preferably an NOS (No operating system) system:
00113:#define IMG_INFO_OFFSET 0x21000
00112:#difine MAGIC_BOOTLOADER 0x55AA1234
00113:#define MAGIC_APP 0x55AA5678
00114:#define MAGIC_IMAGE_END 0x55AAABCD
fig. 2a shows executable binary file data generated after a Flash Memory (generally abbreviated as Flash) operation. As shown in fig. 2a, by performing a FLASH write operation on this structure, 0x21000 is actually written data in the actual generated file. Since the address corresponds to the tag code portion, the generated file data cannot be compressed and must be stored in the size of the byte actually occupied.
Illustratively, the following executable binary file data:
00303:#difine BIN_PACKAGE_HEADER_ID0 0x54454C09
00304:#difine BIN_PACKAGE_HEADER_ID1 0x58336900
00289:PlaceU32_(BIN_PACKAGE_HEADER_ID0),
PlaceU32_(BIN_PACKAGE_HEADER_ID1)
specifically, fig. 2b shows another executable binary file data generated after the FLASH operation is written. As shown in fig. 2b, it can be understood by those skilled in the art that in the binary file, the data corresponding to the address 0002100h is consistent with the written data (54454C09 and 58336900), which indicates that the part of data in the binary file can be compressed.
By analyzing the functional attributes of the data of each part of the executable binary file, target data which can be compressed in the binary file can be quickly identified, so that a compressible object, namely a to-be-processed object, is quickly locked, and the processing range is reduced.
S130: and obtaining a compression strategy of the target data according to the storage format attribute of the target data.
Illustratively, the compression policies for different storage format attributes are different. For example:
and if the storage attribute of any compression identifier is not added in the storage path corresponding to the target data, the target data is completely not compressed. Therefore, the next compression strategy of the target data can be obtained, namely, the partial data can be compressed according to a certain compression mode, so that the storage space of the target data is reduced;
if the target data is stored in the corresponding path in the form of a first preset storage format (for example, the identifier is "-g"), it indicates that the target data is currently compressed in a compression mode with a lower compression rate. Therefore, the next compression strategy of the target data can be obtained, namely, the part of the target data can be compressed in a certain compression mode higher than the current compression rate;
if the target data is stored in the corresponding path in the form of a second preset storage format (e.g. identifier "-7"), it indicates that the target data can be currently compressed in a certain compression manner with a higher compression rate. Therefore, the next compression strategy of the target data can be obtained, that is, the compression rate of the part of target data can not be further improved by replacing the compression mode.
S140: and compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file.
And for the compressible target data, according to the determined compression strategy in the step, the target data can be compressed, and meanwhile, the storage format attribute in the storage path corresponding to the target data can be updated, so that the storage format attribute of the compressed target data corresponds to the current compression strategy. Thereby facilitating selection of a decompression policy corresponding to the current compression policy when the target data is executed. Therefore, by identifying the storage format attribute of the target data, it can be determined whether the target data is compressed or in what manner the target data is subjected to the compression processing.
Furthermore, after the compressed executable file is stored in the FLASH, the residual storage space of the FLASH can be fully utilized to store data, so that the utilization rate of the memory space of the FLASH can be maximized. Specifically, the optimization method comprises the following steps:
fig. 3a is a data storage structure distribution diagram of the optimized front television FLASH memory according to an embodiment of the present invention. As shown in fig. 3a, since the executable file of the software is mainly stored in the storage space of 0 to 57BANK (storage unit), the size of the executable file is 58 × 64K 3712K at the maximum. If the size of the executable file is larger than this space, there is a risk of covering the data area. And for data except the executable file, the storage space is distributed according to the size of the actual structure and the actual number of channels. After all data is stored, only 2K of available space remains, i.e. the storage space is not sufficient. Therefore, in order to optimize the storage space to meet the requirement of compaction, one BANK needs to be saved from the 7 BANKs in fig. 3a to store data. The specific optimization process is as follows:
through analysis, in the 63 rd BANK, the real data only have 304 BYTEs, but the storage space of the FLASH is divided by taking the BANK as a unit, so that the data of the 304 BYTEs in the 63 rd BANK occupies the whole 63 rd BANK, and the waste of FLASH storage space resources is caused. Fig. 3b is a data storage structure distribution diagram of the optimized television FLASH memory according to an embodiment of the present invention. As shown in fig. 3b, by upgrading HDCP, data of a High-bandwidth Digital Content Protection (HDCP) portion can be directly written into a specified memory (e.g., 58 th BANK). Thus, one more BANK can be saved to store other program code. In addition, the data storage mode can be changed into a non-storage mode, the whole table is initialized when the system is initialized, and then the data can be directly loaded from the table when different time sequences are switched, so that one BANK can be saved. Therefore, by adopting the mode of optimizing the memory allocation, the technical effect of further saving the storage space can be achieved.
Optionally, as for the method for saving the storage space, a person skilled in the art may understand that, for a picture that is not needed in the subsequent program execution, the size of the executable file for generating the picture may be reduced by deleting the picture in the program data, or modifying the compression rate of the picture when compiling the picture, so as to further save the storage space needed by the program.
Optionally, the mode of shielding the code that does not need to be executed in the program may be modified to a mode of directly deleting the part of the code that is shielded and is not executed, so as to achieve the technical effect of further saving the storage space of the executable file. Because the technical means of masking the code is just not to execute the part of code, but in the original executable binary file, the part of masked code that is not to be executed still exists in the original executable binary file physically, so that the part of masked code still occupies a certain physical storage space. If the code masked to be intentionally not executed is in the form of direct deleting code, the code is physically deleted, so that the storage space of the executable binary file is further saved by deleting the code compared with the technical means of masking not to be executed.
The embodiment provides a compression method of an executable file, which can identify target data which can be compressed in data of each part of the executable file according to the functional attributes of storage, compression or decompression and the like of the data of each part of the executable file after analyzing the functional attributes and the storage format attributes of the data of each part of the executable file. And obtaining the compression strategy of the target data according to the storage format attribute of the target data. The compression strategy may include the situations of performing no compression, performing compression in a new compression mode with a compression ratio larger than the original compression ratio, performing compression in a new compression mode with a compression ratio smaller than the original compression ratio, and the like. And compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file. By adopting the technical scheme, the compressed executable file can occupy less storage space, the technical effect of saving the cost of the storage hardware material required by the executable file is achieved, and the market competitiveness of corresponding products is indirectly improved.
Example two
Fig. 4 is a flowchart of a method for compressing an executable file according to a second embodiment of the present invention. In this embodiment two, based on the first embodiment, the step S130 "obtaining the compression policy of the target data according to the storage format attribute of the target data" in the first embodiment is further optimized, and referring to fig. 4, the second embodiment of the present invention specifically includes the following steps:
s210: and analyzing the functional attribute and the storage format attribute of the data of each part of the executable file.
S220: and identifying compressible target data in each part of data according to the functional attributes.
S230: judging whether the current storage format is matched with a preset storage format, if so, executing the step S240; otherwise, step S260 is executed.
For example, the compressible target data identified in step S220 may be data that has been subjected to compression processing, or may be data that has not been subjected to any compression processing. Therefore, by comparing the current storage format of the target data with the preset storage format, if the current storage format and the preset storage format do not match, it is possible to indicate that the target data is data that has not been subjected to the compression processing. If the current storage format is matched with any preset storage format, it can be shown that the current target data is data after being compressed according to the compression rate corresponding to the preset storage format. Therefore, step 230 may be used as a basis for determining a compression policy of the current target data, and after the compression policy is determined, a suitable compression method may be selected to further compress the current target data, so as to save a storage space occupied by the target data.
S240: judging whether the current storage format is matched with a first preset storage format corresponding to the first compression strategy, if so, executing the step S250; otherwise, step S260 is executed.
For example, on the premise that the current storage format of the target data matches the preset storage format, if it is further determined that the current storage format matches a first preset storage format (for example, an identifier is "-g") corresponding to the first compression policy, it may be indicated that the target data has been compressed according to the first compression policy. At this time, the compression strategy of the target data can be changed according to actual requirements, and simultaneously the original first preset storage format (such as the identifier is "-g") of the target data is correspondingly modified, so as to improve the compression rate of the target data, and achieve the technical effects of saving the storage space of the executable file and saving the cost of the storage material.
For example, it may further be determined whether the current storage format matches a second preset storage format (for example, the identifier is "-7") corresponding to the second compression policy, and if so, it may be stated that the target data has been compressed according to the second compression policy. At this time, the compression policy of the target data may also be changed according to actual requirements, and the original second preset storage format (e.g. identifier "-7") of the target data is modified correspondingly at the same time.
S250: and compressing the target data according to a second compression strategy corresponding to the second preset storage format, wherein the compression ratio corresponding to the second compression strategy is greater than the compression ratio corresponding to the first compression strategy, and continuing to execute the step S270.
For example, if a first preset storage format (e.g. identifier "-g") in the target data is modified into a second preset storage format (e.g. identifier "-7), the compression rate of the target data may be increased, and the storage space may be saved. Specifically, fig. 5 is a schematic diagram illustrating a comparison of storage spaces occupied by an executable file before and after compression according to a second embodiment of the present invention. As shown in fig. 5, uncompressed files (vdppayer. bin) need to occupy the size of the file itself in storage space to save storage space (1270 KB); for compressed files (vddplayer. bin), a smaller portion of storage space (380KB) is occupied.
For example, in some specific cases, for some target data, if it is not necessary or desirable to perform compression in a manner of a larger compression ratio according to actual needs, the second preset storage format (e.g. identifier "-7") may be modified into the first preset storage format (e.g. identifier "-g") to save the storage space occupied by the target data according to the characteristics of the target data itself.
S260: and determining a compression strategy of the target data according to the preset storage format, and continuing to execute the step S270.
For example, if the current storage format of the target data does not match the preset storage format, it may indicate that the target data has not been subjected to the compression process. At this time, a preset storage format (for example, the preset storage format may be the first preset storage format or the second preset storage format) may be added to a path where the target data is correspondingly stored, and when the target data is compressed, the editor may compress the target data according to compression methods corresponding to different storage formats, and obtain target data with different compression ratios, so as to save a storage space of the target data in the executable file and reduce a hardware cost required for storing the executable file.
S270: and compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file.
On the basis of the second embodiment, the current storage format of the target data is matched with the preset storage format, different compression strategies are adopted according to the matching result, and the original storage format attribute of the current target data is correspondingly added or changed to the new storage format attribute according to the selected compression strategy, so that the compression mode of the target data can be correspondingly added or changed according to actual needs, the compression ratio of the target data of the executable file can be improved, the storage space occupied by the target data is saved, and the technical effect of saving the cost of the storage material is indirectly achieved.
The following is an embodiment of the compression apparatus for an executable file according to an embodiment of the present invention, and the compression apparatus for an executable file and the compression method for an executable file according to the above embodiments belong to the same inventive concept.
EXAMPLE III
Fig. 6 is a block diagram of an executable file compression apparatus according to a third embodiment of the present invention. The apparatus may be implemented by software and/or hardware deployed in a hardware entity such as a television and/or television set-top box, wherein the apparatus may generally be integrated in an embedded system of the hardware entity such as a television and/or television set-top box.
As shown in fig. 6, the apparatus includes: an attribute analysis module 310, a target data identification module 320, a compression policy determination module 330, and a compression module 340. Wherein the content of the first and second substances,
the attribute analysis module 310 is used for analyzing the functional attributes and the storage format attributes of the data of each part of the executable file;
the target data identification module 320 is used for identifying compressible target data in each part of data according to the functional attributes;
a compression policy determining module 330, configured to obtain a compression policy of the target data according to the storage format attribute of the target data;
and the compression module 340 is configured to compress the target data according to the compression policy, and update the storage format attribute of the target data to obtain a compressed executable file.
The embodiment provides a compression device of an executable file, which analyzes the functional attribute and the storage format attribute of each part of data of the executable file, and identifies compressible target data in each part of data of the executable file according to the functional attributes of storage, compression or decompression and the like of each part of data of the executable file. And obtaining the compression strategy of the target data according to the storage format attribute of the target data. The compression strategy may include the situations of performing no compression, performing compression in a new compression mode with a compression ratio larger than the original compression ratio, performing compression in a new compression mode with a compression ratio smaller than the original compression ratio, and the like. And compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file. By adopting the technical scheme, the compressed executable file can occupy less storage space, the technical effect of saving the cost of the storage hardware material required by the executable file is achieved, and the market competitiveness of the corresponding product is indirectly improved.
On the basis of the above embodiment, the compression policy determining module 330 may further include:
and the compression strategy determining unit is used for determining the compression strategy of the target data according to the current storage format if the current storage format of the target data is matched with the preset storage format.
On the basis of the foregoing embodiment, the compression policy determining unit is specifically configured to:
if the current storage format is matched with a first preset storage format corresponding to a first compression strategy, the compression strategy of the target data is as follows:
and compressing the target data according to a second compression strategy corresponding to a second preset storage format, wherein the compression rate corresponding to the second compression strategy is greater than the compression rate corresponding to the first compression strategy.
On the basis of the foregoing embodiment, the compression policy determining module 330 may be further specifically configured to:
and if the current storage format of the target data is not matched with the preset storage format, determining a compression strategy of the target data according to the preset storage format.
On the basis of the above embodiment, the first preset storage format is "-g", and the second preset storage format is "-7".
The compression device of the executable file provided by the embodiment of the invention can execute the compression method of the executable file provided by any embodiment of the invention, and has corresponding functional modules and corresponding beneficial effects of the execution method. For technical details that are not described in detail in the above embodiments, reference may be made to a method for compressing an executable file according to any embodiment of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method of compressing an executable file, the method comprising:
analyzing the functional attribute and the storage format attribute of data of each part of the executable file;
identifying compressible target data in the data of each part according to the functional attributes;
obtaining a compression strategy of the target data according to the storage format attribute of the target data;
compressing the target data according to the compression strategy, and updating the storage format attribute of the target data to obtain a compressed executable file;
wherein the executable file is a binary bin file;
analyzing the functional attribute and the storage format attribute of the data of each part of the executable file, wherein the analyzing comprises the following steps:
determining the storage format attribute of each part of data according to the identifier attached to the storage path corresponding to each part of data; and determining the functional attribute of each part of data according to the actually written data in the flash memory writing operation of the structure.
2. The method according to claim 1, wherein the step of obtaining the compression policy of the target data according to the storage format attribute of the target data comprises:
and if the current storage format of the target data is matched with a preset storage format, determining a compression strategy of the target data according to the current storage format.
3. The method of claim 2, wherein the step of determining a compression policy for the target data according to the current storage format comprises:
if the current storage format is matched with a first preset storage format corresponding to a first compression strategy, the compression strategy of the target data is as follows:
and compressing the target data according to a second compression strategy corresponding to a second preset storage format, wherein the compression rate corresponding to the second compression strategy is greater than the compression rate corresponding to the first compression strategy.
4. The method according to claim 1, wherein the step of obtaining the compression policy of the target data according to the storage format attribute of the target data further comprises:
and if the current storage format of the target data is not matched with the preset storage format, determining a compression strategy of the target data according to the preset storage format.
5. The method of claim 3,
the first preset storage format is-g, and the second preset storage format is-7.
6. An apparatus for compressing an executable file, the apparatus comprising:
the attribute analysis module is used for analyzing the functional attribute and the storage format attribute of the data of each part of the executable file;
the target data identification module is used for identifying compressible target data in the data of each part according to the functional attributes;
the compression strategy determining module is used for obtaining a compression strategy of the target data according to the storage format attribute of the target data;
the compression module is used for compressing the target data according to the compression strategy and updating the storage format attribute of the target data to obtain a compressed executable file;
wherein the executable file is a binary bin file;
the attribute analysis module is used for determining the storage format attribute of each part of data according to the identifier attached to the storage path corresponding to each part of data; and determining the functional attribute of each part of data according to the actually written data in the flash memory writing operation of the structure.
7. The apparatus of claim 6, wherein the compression policy determination module comprises:
and the compression strategy determining unit is used for determining the compression strategy of the target data according to the current storage format if the current storage format of the target data is matched with the preset storage format.
8. The apparatus according to claim 7, wherein the compression policy determining unit is specifically configured to:
if the current storage format is matched with a first preset storage format corresponding to a first compression strategy, the compression strategy of the target data is as follows:
and compressing the target data according to a second compression strategy corresponding to a second preset storage format, wherein the compression rate corresponding to the second compression strategy is greater than the compression rate corresponding to the first compression strategy.
9. The apparatus of claim 6, wherein the compression policy determination module is specifically configured to:
and if the current storage format of the target data is not matched with the preset storage format, determining a compression strategy of the target data according to the preset storage format.
10. The apparatus of claim 8,
the first preset storage format is-g, and the second preset storage format is-7.
CN201710142482.8A 2017-03-10 2017-03-10 Compression method and device for executable file Active CN106909398B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710142482.8A CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file
PCT/CN2018/076624 WO2018161791A1 (en) 2017-03-10 2018-02-13 Method and device for compressing executable file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710142482.8A CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file

Publications (2)

Publication Number Publication Date
CN106909398A CN106909398A (en) 2017-06-30
CN106909398B true CN106909398B (en) 2020-10-16

Family

ID=59187689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710142482.8A Active CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file

Country Status (2)

Country Link
CN (1) CN106909398B (en)
WO (1) WO2018161791A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106909398B (en) * 2017-03-10 2020-10-16 深圳创维-Rgb电子有限公司 Compression method and device for executable file
CN111078647B (en) * 2019-11-22 2023-09-22 北京安兔兔科技有限公司 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment
CN113850055A (en) * 2021-09-29 2021-12-28 北京有竹居网络技术有限公司 Data processing method, device, storage medium and product
CN116909937B (en) * 2023-05-11 2024-02-23 深圳三地一芯电子股份有限公司 Flash memory capacity optimization method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556472A (en) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 Compression of executable document in embedded type system and its loading method
CN103218224A (en) * 2013-03-29 2013-07-24 东莞宇龙通信科技有限公司 Method and terminal for improving utilization ratio of memory space
CN103563255A (en) * 2011-04-11 2014-02-05 马维尔国际贸易有限公司 Method for compression and real-time decompression of executable code
CN105677348A (en) * 2016-01-04 2016-06-15 青岛海信信芯科技有限公司 BOOT program storing method and device and BOOT program starting method and device
CN106202213A (en) * 2016-06-28 2016-12-07 深圳市恒扬数据股份有限公司 A kind of FPGA binary file compression, decompressing method and compression, decompression device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977061B (en) * 2010-10-19 2012-12-26 广西师范大学 Lossless compression and decompression method for general information
CN202134001U (en) * 2011-03-07 2012-02-01 浪潮(北京)电子信息产业有限公司 Executable file backup device
CN102957633A (en) * 2011-08-19 2013-03-06 北京大学 Data packing and transmitting method and data packing and transmitting system for message-oriented middleware
CN103186597A (en) * 2011-12-29 2013-07-03 盛大计算机(上海)有限公司 Method and system for expanding hard disk capacity
CN102609360B (en) * 2012-01-12 2015-03-25 华为技术有限公司 Data processing method, data processing device and data processing system
CN104954497B (en) * 2015-07-03 2018-09-14 浪潮(北京)电子信息产业有限公司 Data transmission method and system in a kind of cloud storage system
CN106909398B (en) * 2017-03-10 2020-10-16 深圳创维-Rgb电子有限公司 Compression method and device for executable file

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556472A (en) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 Compression of executable document in embedded type system and its loading method
CN103563255A (en) * 2011-04-11 2014-02-05 马维尔国际贸易有限公司 Method for compression and real-time decompression of executable code
CN103218224A (en) * 2013-03-29 2013-07-24 东莞宇龙通信科技有限公司 Method and terminal for improving utilization ratio of memory space
CN105677348A (en) * 2016-01-04 2016-06-15 青岛海信信芯科技有限公司 BOOT program storing method and device and BOOT program starting method and device
CN106202213A (en) * 2016-06-28 2016-12-07 深圳市恒扬数据股份有限公司 A kind of FPGA binary file compression, decompressing method and compression, decompression device

Also Published As

Publication number Publication date
CN106909398A (en) 2017-06-30
WO2018161791A1 (en) 2018-09-13

Similar Documents

Publication Publication Date Title
CN106909398B (en) Compression method and device for executable file
US10140113B2 (en) Data processing method and device of preset application after upgrading
US5734822A (en) Apparatus and method for preprocessing computer programs prior to transmission across a network
CN111352861B (en) Memory compression method and device and electronic equipment
CN110377226B (en) Compression method and device based on storage engine bluestore and storage medium
CN111124464B (en) Method, system and computer readable storage medium for differential upgrade of embedded system
CN110022558B (en) Method for encrypting and decrypting upgrade package, electronic device and storage medium
CN105763602A (en) Data request processing method, server and cloud interactive system
KR20080023191A (en) Device and method for accessing binary data in fusion memory
CN111475195A (en) Firmware upgrading method, device and system
CN104778222A (en) Media library establishing and updating method on basis of USB (Universal Serial Bus) storage equipment
CN112181471A (en) Differential upgrading method and device, storage medium and computer equipment
CN109542495A (en) A kind of method for upgrading software and device
CN108874406A (en) A kind of upgrade package production method and device
CN112732321A (en) Firmware modification method and device, computer readable storage medium and equipment
CN111562929A (en) Method, device and equipment for generating patch file and storage medium
WO2017219872A1 (en) Set top box upgrading and channel changing methods and systems
CN107577474B (en) Processing method and device for upgrading file and electronic equipment
CN111414339A (en) File processing method, system, device, equipment and medium
CN112199042A (en) Storage space management method, device, chip, equipment and storage medium
CN108093258B (en) Code stream data decoding method, computer device and computer readable storage medium
CN111562983B (en) Memory optimization method and device, electronic equipment and storage medium
CN115495020A (en) File processing method and device, electronic equipment and readable storage medium
CN114356386A (en) Block differential upgrading method, terminal equipment and computer readable storage medium
CN113641643A (en) File writing method and device

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
GR01 Patent grant
GR01 Patent grant