CN1556472A - Compression of executable document in embedded type system and its loading method - Google Patents

Compression of executable document in embedded type system and its loading method Download PDF

Info

Publication number
CN1556472A
CN1556472A CNA2003101176648A CN200310117664A CN1556472A CN 1556472 A CN1556472 A CN 1556472A CN A2003101176648 A CNA2003101176648 A CN A2003101176648A CN 200310117664 A CN200310117664 A CN 200310117664A CN 1556472 A CN1556472 A CN 1556472A
Authority
CN
China
Prior art keywords
executable file
file
compression
data
segment
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.)
Granted
Application number
CNA2003101176648A
Other languages
Chinese (zh)
Other versions
CN1269034C (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN 200310117664 priority Critical patent/CN1269034C/en
Publication of CN1556472A publication Critical patent/CN1556472A/en
Application granted granted Critical
Publication of CN1269034C publication Critical patent/CN1269034C/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a compressing and loading method of executable files in an embedded system, including the steps: using the executable file processing method to process an originally-structured executable file, modifying the file identification symbols in the file head of the executable file, keeping other data invariant to express the executable file as an executable file processed by compression, so as to generate the compressed executable file; identifying the file head of the compressed executable file: if it is the compressed executable file, completing the branches of data decompression to decompress all the data and code segments; placing the decompressed data segments in the accurate positions in a memory according to the rule that the system normally loads an executable file. It has wide application range, high reliability and low cost for embedded systems.

Description

The compression of executable file and loading method thereof in a kind of embedded system
Technical field
The inventive method relates to a kind of compression and loading method of executable file, particularly relates to a kind of compression of the executable file in the embedded OS and loading method of the executable file after the compression of being applicable to.
Background technology
In computer system, in order to reduce the shared storage space of file, can adopt the mode storage file of compression usually, can be divided into two kinds of transparent compression and opaque compressions to the compression of file.
So-called opaque compression is the compress mode of the most normal employing, and this mode is used specific tool of compression (program), adopts specific compression algorithm, source file is compressed processing after, the acquisition less file that is compressed that takes up room; When needs obtain source file, then adopt corresponding instrument and algorithm to carry out decompression and obtain source file to being compressed file.Because other program in operating system and the system can not directly be used the file after being compressed, therefore this compression method is opaque for operating system or user.
So-called transparent compression is meant by taking certain technological means, has both reached compressing data to reduce the effect that storage space takies, and operating system and user again can these data of impregnable access simultaneously.In order to realize transparent compression,, can adopt following three kinds of modes usually again according to the difference of compressed object:
The one, the transparent compression of data file.Generally speaking data file is meant the file except executable file in the system.In general, data file generally can be opened by the relative program in the system, reading and writing, operation such as be closed.Accordingly,, adopt usually and revise these associative operations in the system dynamics execution storehouse, in operating process, increase the processing of compression/de-compression, so just can finish transparent compression/decompression processes the data file for the transparent compression of data file.
The 2nd, the transparent compression of executable file.Because executable file is a system can load operating, and the loader of operating system needs the file header of executable file and the contents such as load information of carrying out section just can be finished loading, therefore can not adopt the transparent compress mode identical with data file.The structure of the executable file of prior art as shown in Figure 1, it comprises a top of file, a program segment description list, each program segment 1~N successively; The transparent compress mode of executable file of the most normal employing at present, be when compression is handled, the self-extracting code is inserted in front portion at executable file, make executable file after the compression become the file of a self-extracting, when executable file loads, the self-extracting code of elder generation execute file front portion, finish the decompression of target executable file, after the target executable file is by complete decompression, executable file loader by system carries out load operating again, thereby reaches the purpose of transparent compression.
The 3rd, the compression of file system.This method realizes the purpose of packed data by the compression to file system itself, adopts the level of a compressible drive of increase between the file system of operating system drives with memory device usually.Like this, when file system was carried out data access operation, this compression driver had been finished the compression/de-compression operation to data simultaneously, thereby had realized the transparency to operability and user.
Because the scale of embedded system is less, memory capacity is limited, and embedded system generally all can be compressed data, with the aggregate demand of minimizing embedded system to storage space, thus the cost of reduction total system.For embedded system, because system scale is smaller, operation interface is simple even do not have operation interface, and therefore, the compress mode that needs in the system should be the transparent compress mode that does not need interactive operation.
The loading method of the executable file of prior art after program begins, is at first judged the type of this executable file as shown in Figure 4; Then, set up corresponding internal storage structure data, the copy process resource; Produce new program process; At last, this application program finishes this flow process after being scheduled and carrying out.But this loading procedure can't be used for the executable file of compression is loaded.
The data compression mode that adopts in the embedded system mainly contains and uses the file system and direct compact executable file dual mode of supporting data compression at present.Adopt this dual mode to realize data compression, have following subject matter:
If one. in embedded system, use the transparent mode of aforesaid executable file, then owing to this executable file needed original executable file is decompressed in the storage medium temporarily before operation.This mode is for the embedded system of storage medium finite capacity, and not only not minimizing system moves the total minimum memory dielectric capacity that needs, and has increased on the contrary to deposit the needed storage space of compression back document storage.So in fact this mode is very uneconomic.
Two. therefore compressed file system unavoidably will exert an influence to the performance of system owing to need increase the processing of compressible drive layer in whole file system operation.In adopting the embedded system of compressed file system, all file data operations all can cause system to produce bigger overhead through the processing of compressible drive layer thus, and this influences especially obvious in the limited embedded system of system processing power.
Three. there is certain medium correlativity in existing compressed file system, and the building mode of actual embedded system varies, and not necessarily can all find the compressed file system that meets the demands under all embedded system stored configuration situations.
Four. the compressibility of compressed file system is not high.In order to reach higher data compression rate, must need more jumbo related data is compressed, can cause the time-delay of data manipulation to increase and compress more related data.For balance quality and efficient, the compression efficiency of general compressed file system is not very high.
Five. for most embedded system, in order to finish specific special function, the application program that only need finish this function in the system can be moved and get final product, does not therefore have much other data files in system.In such system, in fact have only executable file to have the demand of compression.
Thus, there is big defective in prior art, and awaits being improved.
Summary of the invention
The purpose of the inventive method is the defective at above-mentioned prior art, the compression and the loading method thereof of executable file in a kind of embedded system are proposed, being suitable for embedded system compresses the executable file of its use and realizes loading to the executable file after the compression, by the sign type of top of file to the executable file after the compression, reduce the capacity of the needed storage medium of embedded system, reach the purpose that reduces cost, simultaneously, File Compress and load mode by the executable file after improving, reach the operational efficiency that improves the embedded system that adopts compressed file, reduce system's extra resource expense; By the load mode of the compact executable file in the inventive method, the embedded board of various storage medium configuration modes all can be compressed executable file, usable range is wideer.
Technical scheme of the present invention is as follows:
The compression of executable file and loading method thereof in a kind of embedded system, it may further comprise the steps:
A) executable file to original structure uses the executable file disposal route to handle, revise the file identifier in the file header of this executable file, keep other data constant, in order to the executable file of expression this document for the employing compression, the executable file after the generation compression;
B) executable file after the described compression of the following executable file loading method load operating of use:
B1) discern the top of file of the executable file after the described compression;
B2) if identifying the executable file of current loading is executable file after the described compression, then enter the flow process that loads compression back executable file;
B3) each branch information of data decompression finished in record, and each data segment and the code segment after overcompression decompressed;
B4) according to the relevant information of each data segment and code segment, the rule of each segment data after decompressing according to system's normal load executable file is placed in the correct core position.Described compression and loading method thereof, wherein, described step a) is further comprising the steps of:
A1) for the data segment and the code segment of executable file, the information that keeps its reorientation increases the relevant information of this section packed data simultaneously in the program segment descriptive table entry in the program segment descriptive table entry;
A2) each program segment data is compressed according to compression algorithm separately;
A3) assembling of the program segment after will compressing becomes a complete file.
Described compression and loading method thereof, wherein, the loading method of described executable file can load common executable file.
The compression and the loading method thereof of executable file in a kind of embedded system provided by the present invention, employing is compressed executable file, and information such as compression method are recorded in the described program segment description list, then by top of file is labelled the record this executable file whether through overcompression, described embedded system is according to this executable file after overcompression of the corresponding loading of sign of this document head, and counterpart carried out decompress(ion) carry out; Therefore the inventive method has following beneficial effect:
One, adopt the executable file compression and upload method of the inventive method after because reduce in the needed storage medium of this embedded system space, the storage medium amount of the pre-installation of system hardware institute need not too high, can reduce the cost of embedded system;
Two, with the inventive method compression with load executable file owing to do not reload after not needing the executable file after the compression de-compressed into complete executable file, can really adapt to the compression requirements of embedded system;
Three, the inventive method is generally only compressed the executable file of volume maximum in the embedded system, rather than whole file system compressed, the inventive method is compared with the mode of existing compressed file system like this, when moving except file load, can not produce extra system overhead, can not influence the runnability of system;
Four, with regard to compression efficiency, the inventive method is compared with existing compressed file system, owing to need not to consider the influence of the raising of compressibility to system performance, can accomplish higher compression efficiency, particularly evident for the executable file of the static state compiling of often adopting in the embedded system;
Five, adopt the inventive method that the executable file in the embedded system is carried out data compression, its realization and concrete platform independence have the characteristics of wide accommodation.
In a word, described method of the present invention has characteristics applied widely, that reliability is high, cost is low.
Description of drawings
In the accompanying drawing,
Fig. 1 is the structural representation of the general executable file of operating system in the prior art;
Fig. 2 is the structural representation that adopts the executable file behind the compression method of the inventive method;
Fig. 3 is the schematic flow sheet of the compact executable file of the inventive method;
Fig. 4 is the schematic flow sheet that the executable file that adopts usually in the method for prior art loads;
Fig. 5 is the schematic flow sheet that adopts the loading compact executable file of the inventive method.
Embodiment
Be described in further detail below in conjunction with the enforcement of accompanying drawing technical scheme:
As shown in Figure 1 be the structural representation of the common executable file of prior art, it comprises a top of file successively, a program segment description list, several program segments 1~N, assembling forms an executable file.
In embedded system, owing to practicing every conceivable frugality, the request for utilization to the storage area just can reduce the cost of system hardware, therefore, the inventive method adopts a specific compression method, executable file is compressed, file structure after the compression has comprised new top of file as shown in Figure 2 successively, and this new top of file comprised compression execute file information; New procedures section description list has wherein comprised new section attributes such as compression method; According to the compression method of record, the condensing routine section 1~N after corresponding each compression is assembled into the executable file after the compression then.
As shown in Figure 3, the compression method of the executable file of the described suitable embedded system of the inventive method, its concrete steps are as follows:
A) use the executable file disposal route to handle the executable file (as shown in Figure 1) of original structure, produce the executable file (as shown in Figure 2) after compressing.
The executable file of original structure, need through handling, obtain adopting the executable file after the inventive method is compressed, top of file originally is owing to carrying the needed relevant information of this executable file load operating, so other data except the file type sign remain unchanged in the top of file; Its key step comprises:
1) revise the file identification of the top of file of this executable file, expression this document is for adopting the executable file after the inventive method compression;
2) for data segment and code segment, the information that keeps its reorientation increases simultaneously the relevant information of this section packed data in this program segment descriptive table entry in described program segment descriptive table entry, promptly as the compression method of each program segment etc.;
3) each program segment data is compressed according to corresponding compression algorithm separately, forms the condensing routine section after compressing;
4) above each several part assembling is become a complete file, i.e. executable file after the compression.
B) use executable file after the compression that obtains in the described step a) of loading method load operating of new executable file, the loading method of this executable file has the ability that loads common executable file operation, can load operating with the executable file of other normal format in the assurance system, the key step of the loading method of the executable file that this is new is as follows:
B1) at first this loading method is discerned the file header of the executable file after the compression that produces in the described step a);
B2), then enter the flow process that loads the executable file after the compression if identifying current executable file to be loaded is executable file after the compression in the inventive method;
B3) this loading method has the branch of the data decompression finished, and is used for each data segment and code segment after overcompression are decompressed;
B4) according to the relevant information of each data segment and code segment, the rule of each segment data after decompressing according to system's normal load executable file is placed in the correct core position;
After this enter the process of the generation process identical with the normal load method.
Described as shown in Figure 3 a common executable file as shown in Figure 1, be treated as the process of an executable file after the compression as shown in Figure 2.
Main processing procedure has the processing of top of file, the processing of program segment attribute list and three parts of compression of adjustment and program segment data.
For file header, mainly be the specific identifier that increases the identification compact executable file, when this is identified at this executable file and is loaded, read and discern by loader, to determine the concrete load mode of this executable file.Described loader is a funtion part of operating system, be responsible for the executable program file of static state is loaded into the memory headroom of operating system thereon from the storage medium that can not directly carry out such as disk, some FLASH etc., and give its executive capability and make it finally can be by task scheduling mechanism scheduled for executing.
For the modification of program segment attribute list, mainly be the indication information that increases each program segment compression method, this indication information is read and discerns when loading by the executable file loader equally, to determine the decompression mode of each condensing routine section.
Compression for program segment, only need by the determined program segment of each program segment attribute list item start offset hereof with finish data segment between the skew as the input of compressing, adopt certain compression method to carry out data compression, promptly obtain the condensing routine section of this program segment correspondence.
After above treatment step finishes, the condensing routine section after described file header, program attribute segment table and each compression is linked together the executable file after the compression that needing just to obtain.
As shown in Figure 3, the concrete steps of its processing are, after program begins, the top of file of executable file to be compressed are set at first, and it is designated executable file type after the compression; Then, described program segment description list is set, increases program segment compression method information; Revise owing to adding the top of file skew that data cause; Scanning sequence section description list is the interval with the skew start-stop of each program segment, and the data that this is interval are compressed each program segment as input according to the compression algorithm of correspondence; Revise the off-set value that changes each program segment in the program segment description list that causes owing to data; Connect described top of file, program segment description list, each condensing routine section and obtain the executable file after the complete compression.
The workflow that one of the inventive method can load the executable file after the described compression has been described as shown in Figure 5.This loading method has the ability of the executable file after loading common executable file and compressing simultaneously:
Executable file for after the compression according to the position of the program segment description list of indicating in its top of file, reads and analyzes each program segment descriptive table entry successively, obtains the file bias internal, load address skew, compression method of each program segment etc.
At first, this loading method is according to the file identification of the top of file of described executable file, judges the type that needs the executable file that loads, for common executable file, then loaded according to as shown in Figure 4 normal loading flow process by operating system.
Then, according to all properties data of each program segment, calculation procedure loads needed memory headroom.
Then load the needed contiguous memory of this program space to the operating system application again.
Each program segment data that decompress one by one then, and the data after will decompressing are placed in the memory headroom of being applied for according to the loading position of normal executable file.Because it is different that compilation time and actual motion memory mapping constantly has, need carry out necessary correction to the base address of the routine data after decompressing etc., can correct execution with the assurance code.
Enter the normal step of operating system loading application programs then, carry out the relevant required preliminary work of establishment process of operating system, comprising: needed other resource of application process operation, execution environment initialization etc.
Create executable process in the operating system (perhaps thread) at last, and add the scheduling queue wait operation of this operating system.
This program loads flow process and finishes.
Thus, the inventive method has realized the transparent compression of executable file in embedded system, and accommodation is wide, simultaneously applicable to unpressed common executable file, and littler to the space that takies described embedded system after the executable file compression, cost is lower.
Describedly load common executable file and mean the inventive method and can load common executable file in the compact executable file loading, program of the present invention herein can recognize whether the executable file that is loaded is compressed from top of file, as be not compressed, directly load and get final product, as being compressed, the loading procedure fibrous root carries out the decompress(ion) of corresponding data piece according to the top of file record, because possible different pieces of information piece has adopted different compression methods, be loaded into then on the position that the data that are not extracted should load and get final product.Also be that the inventive method mainly comprises compression and loads two processes.
Technical scheme of the present invention may carry out other according to technology contents of the present invention and be equal to change or replacement, and all these is equal to change or replace the protection domain that all should belong to claims of the present invention to those skilled in the art.

Claims (3)

1, the compression and the loading method thereof of executable file in a kind of embedded system, it may further comprise the steps:
A) executable file to original structure uses the executable file disposal route to handle, revise the file identifier in the file header of this executable file, keep other data constant, in order to the executable file of expression this document for the employing compression, the executable file after the generation compression;
B) executable file after the described compression of the following executable file loading method load operating of use:
B1) discern the top of file of the executable file after the described compression;
B2) if identifying the executable file of current loading is executable file after the described compression, then enter the flow process that loads compression back executable file;
B3) each branch information of data decompression finished in record, and each data segment and the code segment after overcompression decompressed;
B4) according to the relevant information of each data segment and code segment, the rule of each segment data after decompressing according to system's normal load executable file is placed in the correct core position.
2, compression according to claim 1 and loading method thereof is characterized in that, described step a) is further comprising the steps of:
A1) for the data segment and the code segment of executable file, the information that keeps its reorientation increases the relevant information of this section packed data simultaneously in the program segment descriptive table entry in the program segment descriptive table entry;
A2) each program segment data is compressed according to compression algorithm separately;
A3) assembling of the program segment after will compressing becomes a complete file.
3, compression according to claim 2 and loading method thereof is characterized in that, the loading method of described executable file can load common executable file.
CN 200310117664 2003-12-31 2003-12-31 Compression of executable document in embedded type system and its loading method Expired - Lifetime CN1269034C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200310117664 CN1269034C (en) 2003-12-31 2003-12-31 Compression of executable document in embedded type system and its loading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200310117664 CN1269034C (en) 2003-12-31 2003-12-31 Compression of executable document in embedded type system and its loading method

Publications (2)

Publication Number Publication Date
CN1556472A true CN1556472A (en) 2004-12-22
CN1269034C CN1269034C (en) 2006-08-09

Family

ID=34337910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200310117664 Expired - Lifetime CN1269034C (en) 2003-12-31 2003-12-31 Compression of executable document in embedded type system and its loading method

Country Status (1)

Country Link
CN (1) CN1269034C (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101056252B (en) * 2007-06-07 2010-04-21 中兴通讯股份有限公司 Transmission method of compression file
CN1916853B (en) * 2006-09-18 2010-05-19 华为技术有限公司 Method and device of protecting code segment in use for MIPS system
CN102375760A (en) * 2010-08-24 2012-03-14 中兴通讯股份有限公司 Embedded system and method for switching file systems in same
CN104216890A (en) * 2013-05-30 2014-12-17 北京赛科世纪数码科技有限公司 Method and system for compressing ELF file
CN106909398A (en) * 2017-03-10 2017-06-30 深圳创维-Rgb电子有限公司 The compression method and device of a kind of executable file
CN109558149A (en) * 2018-11-30 2019-04-02 厦门亿联网络技术股份有限公司 A kind of uboot decompression method and system based on ubl
CN112270010A (en) * 2020-11-17 2021-01-26 上海好连网络科技有限公司 Method for remotely and safely loading executable file

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1916853B (en) * 2006-09-18 2010-05-19 华为技术有限公司 Method and device of protecting code segment in use for MIPS system
CN101056252B (en) * 2007-06-07 2010-04-21 中兴通讯股份有限公司 Transmission method of compression file
CN102375760A (en) * 2010-08-24 2012-03-14 中兴通讯股份有限公司 Embedded system and method for switching file systems in same
CN102375760B (en) * 2010-08-24 2016-01-20 中兴通讯股份有限公司 The reverse method of embedded system and file system wherein
CN104216890A (en) * 2013-05-30 2014-12-17 北京赛科世纪数码科技有限公司 Method and system for compressing ELF file
CN106909398A (en) * 2017-03-10 2017-06-30 深圳创维-Rgb电子有限公司 The compression method and device of a kind of executable file
CN106909398B (en) * 2017-03-10 2020-10-16 深圳创维-Rgb电子有限公司 Compression method and device for executable file
CN109558149A (en) * 2018-11-30 2019-04-02 厦门亿联网络技术股份有限公司 A kind of uboot decompression method and system based on ubl
CN112270010A (en) * 2020-11-17 2021-01-26 上海好连网络科技有限公司 Method for remotely and safely loading executable file
CN112270010B (en) * 2020-11-17 2024-04-12 上海好连网络科技有限公司 Remote safe loading method for executable file

Also Published As

Publication number Publication date
CN1269034C (en) 2006-08-09

Similar Documents

Publication Publication Date Title
CN1230744C (en) realization of isertion type system soft ware patch and control method
CN1096636C (en) Computer system and method for executing threads of execution with reduced run-time memory space requirements
CN1799032A (en) Method and apparatus for morphing memory compressed machines
CN1178134C (en) Data compaction method for intermediate object code program executable in onboard system
CN1264083C (en) Method and apparatus for maintaining context while executing translated instructions
CN1238500A (en) Method and system for performing static initialization
CN1504881A (en) Java execution equipment and java execution method
CN1868127A (en) Data compression system and method
CN1269034C (en) Compression of executable document in embedded type system and its loading method
CN1829977A (en) Method and apparatus for improving the performance of garbage collection using stack trace cache
CN111240765B (en) LINUX compression application program loading method
CN1609850A (en) System and method for resizing a database
CN1687899A (en) Method, system and module for dynamic downloading of applied programe to user identification
CN1825306A (en) XML data storage and access method based on relational database
CN1896960A (en) Fast photographic system and method
CN1329309A (en) Multi-languages user interface for operating system
CN1139032C (en) Arrangement for executing program code with reduced memory requirements
CN1200354C (en) Automatic compressing/decompressing file system and its compressing algorithm
CN1254735C (en) Method and system for reducing fragmentation
CN1320456C (en) Automatic forming method for intelligent instrument interface
CN1967505A (en) Information processing device, image pickup device, information processing method and computer program
CN101059758A (en) Screen transition program generating method and device
CN101051501A (en) Medium recording method and device
CN1195811A (en) Language processing system which generates debugging source file corresponding to optimization image and method therefor
CN101042655A (en) A firmware executing apparatus and executing method, a firmware configuration device and configuration method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CX01 Expiry of patent term
CX01 Expiry of patent term

Granted publication date: 20060809