Summary of the invention
The object of the invention is to, a kind of method and apparatus across file system version online upgrading is provided, can complete the incompatible online upgrading across file system version and rollback.
Method across file system online upgrading of the present invention, comprising:
In current version system, download key plate presents to be moved;
Start system bootstrap routine, to obtain the current file system type in flash memory, the trade preceding document system initialization of going forward side by side;
Obtain main version information and key plate file system type originally;
Judge whether key plate originally can operate in current file system, and produce a result according to judgement, make current file system operation key plate originally.
The present invention also provides a kind of device across file system online upgrading, comprising:
This download module of key plate, for downloading key plate presents to be moved in current version system;
Current file system acquisition module, for starting system bootstrap routine, to obtain the current file system type in flash memory, the trade preceding document system initialization of going forward side by side;
This acquisition of information of key plate module, for obtaining main version information and key plate file system type originally;
Judge execution module, for producing a result according to judgement, make current file system operation key plate originally.
The invention has the beneficial effects as follows: according to the method for online upgrading of the present invention, can support to move the text on-line upgrading of different file, and in escalation process, support rollback operation.Advantage is as follows:
1. constant at hardware, flash and memory source be all in limited situation, realized that data are preserved automatically and version auto-update, Backward Function.
2. edition upgrading process is identification completely automatically, can not bring and anyly reduce manual operation because file system difference causes the difference of upgrading and rollback version operation steps to user, has improved the satisfaction of upgrading efficiency and user's use.
Embodiment
For making the technical problem to be solved in the present invention, technical scheme and advantage clearer, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
As shown in Figure 1, be the process flow diagram of the method across file system version online upgrading of an embodiment of the present invention, the method comprises the steps:
Step S101: download key plate presents to be moved in current version system;
Step S102: start system bootstrap routine, to obtain the current file system type in flash memory, the trade preceding document system initialization of going forward side by side;
Step S103: obtain main version information and key plate file system type originally;
Step S104: judge whether key plate originally can operate in current file system, and produce a result according to judgement, make current file system operation key plate originally.
The method of online upgrading of the present invention, can support to move the text on-line upgrading of different file, edition upgrading process is identification completely automatically, can not bring to user any because file system difference causes upgrading and the difference of rollback version operation steps, reduce manual operation, improved the satisfaction that upgrading efficiency and user use.The present invention can also realize the automatic rollback of version, and when key plate, this is early version, when current version is redaction, has realized the Backward Function of version.This method is suitable for the text on-line upgrading with standby usage system and line card simultaneously.
Wherein, step S101 downloads key plate presents to be moved in current version system, is downloaded new key plate presents and is saved in file system from remote online by current version system.This key plate originally can also be kept in file system; Or be kept at certain region of flash; Or version to be moved is kept at ftp, on tftp server.In order to make system bootstrap routine can support version to be moved, also need to upgrade new system starts guiding software version simultaneously, and this is version the to be moved starting system of laying equal stress on to activate new key plate.If system starts guiding, software can be supported version to be moved, and does not need to upgrade.
If active/standby backup version can be supported in flash space in system, new key plate presents saves as backup version file automatically, and after new key plate presents activates as version to be moved, old version file becomes backup version automatically.After new version file is upgraded unsuccessfully, old version file still exists like this, can reactivate old version file, thereby realizes version Backward Function.If not only comprise key plate presents and system guiding software version file in system, also have other software versions, such as firmware version etc., whether whether these versions upgrade itself has upgrading to determine according to them, is which kind of type and the key plate rollback of originally whether upgrading does not have association with this file system of current key plate.
Wherein, step S102 starts system bootstrap routine, to obtain the current file system type in flash memory, and the trade preceding document system initialization of going forward side by side; Identifying file system type in current flash can identify by the feature separately of file system.In system startup guiding software version, by reading the ad hoc structure of current file system region, automatically identify the file system type of original version operation, and carry out file system initialization operation.
Wherein, step S103 obtains main version information and key plate file system type originally.If version to be moved is kept in file system,, by first obtaining version name to be moved, then from file system, reads version to be moved, and read the file system type that can support version to be moved from version head to be moved; If version to be moved is kept in flash, obtains by flash parameter region version the to be moved region being kept in flash, thereby read version to be moved, and read the file system type that can support version to be moved from version head to be moved; If version to be moved is kept on ftp or tftp server, from server, directly obtains version to be moved, and read the file system type that can support version to be moved from version head to be moved; If version to be moved is placed in the file system of main control board, slave control board or line card can obtain version to be moved by communication between plate, and read the file system type that can support version to be moved from version head to be moved.
In this step, obtaining in the time moving version file, further comprise: if obtain version information failure to be moved, or treat operation version and carry out verification failure, when operation is described, there are abnormal conditions, now, can carry out verification from newly obtaining backup version file, after verification succeeds, Lookup protocol is version to be moved, thus operation early version.First obtain the filename of version to be moved by being kept at the act.txt of file system, from file system, read version head and the release content of version to be moved by filename, version to be moved in front face preserve data length and version exclusive or check and, can treat operation version by these information and carry out verification.If act.txt reads failure, or the version name to be moved that act.txt preserves the inside does not exist, or release content verification failure to be moved, from key plate presents catalogue the inside from new searching backup version file, backup version file verification success, backup version file is set for version file to be moved, and preserves backup version filename in act.txt file.
Wherein step S104, for judging whether key plate originally can operate in current file system, and produces a result according to judgement, makes current file system operation key plate originally.If YES, move key plate originally.
If NO, the file of the current file system in flash memory is saved in transfer storer, current file system in formatting flash memory, according to the type of main version file system, flash memory is carried out to file system initialization operation again, and the file in transfer storer is saved in flash memory, move key plate originally.The initialization operation of this step need to carry out initialization according to the type of main version file system, just makes key plate originally can move key plate originally.
As shown in Figure 2, for this process flow diagram of the operation key plate of an embodiment of the present invention, comprise the steps:
Step S1041: judge whether key plate originally can operate in current file system, if so, proceeds to step S1045, operation key plate originally; If NO, perform step S1042.
Step S1042: the file of the current file system in flash memory is saved in transfer storer to execution step S1043; The file of current file system is the file in flash memory, and transfer storer can be other parts in internal memory, hard disk or flash memory, for temporary transient storage current file system.If the transfer storeies such as Installed System Memory are not enough large, can not preserve All Files, adopt general lzma or gzip instrument, to being saved in transfer storer after whole file directory boil down to file map file, format flash file system, reinitialize file system according to version file system type to be moved, the file map file in centering unloading reservoir is saved in file system after decompressing.File directory image file can be saved in fixed address internal memory, also can be saved in Dram.By tools of compression such as lzma, to all boil down to image files of the whole catalogue of current file system (comprising version file to be moved), operation has versatility like this, and not needing to pay close attention to which vital document under which catalogue in file system needs to preserve.In one embodiment, original whole file directory 32M altogether that videos only takies the memory headroom of several M after the compression of lzma instrument, and Installed System Memory can meet the needs of preservation file directory image file completely like this.
Step S1043: after the current file system in formatting flash memory, flash memory is carried out to initialization operation; Execution step S1044.Reformatting file system, and initialization files system.File system formatization operation can adopt the mode of low-level formatting flash, and format is more thorough like this.
Step S1044: the file in transfer storer is saved in flash memory to execution step S1045.File in central unloading reservoir is compression, decompresses.This embodiment obtains file directory image file from the transfer storeies such as internal memory, is directly saved in new file system by after lzma decompression instrument decompress(ion), and version to be moved is also saved in file system.
Step S1045: operation key plate originally.If key plate originally can operate in current file system, can directly move key plate originally.If key plate originally can not operate in current file system, but when current file system is formatd, and carry out after initialization operation, current file system just can have been moved key plate originally.
As shown in Figure 3, be the structured flowchart of the device across file system version online upgrading of an embodiment of the present invention, this device comprises:
This download module of key plate 100, for download key plate presents to be moved in current version system, and preserves;
Current file system acquisition module 200, for starting system bootstrap routine, obtains the current file system type in flash memory, the trade preceding document system initialization of going forward side by side;
This acquisition of information of key plate module 300, for obtaining main version information and key plate file system type originally;
Judge execution module 400, for producing a result according to judgement, make current file system operation key plate originally.
The device of online upgrading of the present invention, can support to move the text on-line upgrading of different file, edition upgrading process is identification completely automatically, can not bring to user any because file system difference causes upgrading and the difference of rollback version operation steps, reduce manual operation, improved the satisfaction that upgrading efficiency and user use.This device is applicable to the text on-line upgrading of standby usage system and line card simultaneously.
Described judgement execution module 400 further comprises:
For moving key plate originally in the time being judged as YES, and
For in the time being judged as NO, the file of the current file system in flash memory is saved in transfer storer, current file system in formatting flash memory, according to the type of main version file system, flash memory is carried out to file system initialization operation again, and the file in transfer storer is saved in flash memory, move key plate originally.
Described judgement execution module 400 further comprises: in the time that described transfer memory span is less than the file of current file system, be saved in transfer storer after current file system compresses.
Described this acquisition module of key plate 300, further comprises in the time obtaining the file system type failure of main version information and key plate basis, moves current version.
In sum, according to the method across file system version online upgrading of the present invention, by automatic identification file system type, and situation about can not move in current file system for version to be moved, first All Files is temporarily saved in to transfer storer, then according to the needed file system type of version to be moved, from format initialization files system, the file data that simultaneously recovers to be temporarily stored in transfer storer arrives file system, thereby the in the situation that of internal memory and flash resource-constrained, realize the online upgrading across file system version, rollback, data are preserved automatically, updating operation does not limit, improve updating speed, reduce manual operation, improve user satisfaction.
Be more than in order to make those of ordinary skill in the art understand the present invention, and the detailed description that the present invention is carried out, but can expect, can also make other changes and modifications not departing from the scope that claim of the present invention contains.