CN114201320B - System block upgrading method and device, readable storage medium and electronic equipment - Google Patents

System block upgrading method and device, readable storage medium and electronic equipment Download PDF

Info

Publication number
CN114201320B
CN114201320B CN202210148569.7A CN202210148569A CN114201320B CN 114201320 B CN114201320 B CN 114201320B CN 202210148569 A CN202210148569 A CN 202210148569A CN 114201320 B CN114201320 B CN 114201320B
Authority
CN
China
Prior art keywords
system block
upgraded
data
block
space
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
CN202210148569.7A
Other languages
Chinese (zh)
Other versions
CN114201320A (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.)
Chengdu Baiwei Storage Technology Co ltd
Biwin Storage Technology Co Ltd
Original Assignee
Chengdu Baiwei Storage Technology Co ltd
Biwin Storage Technology 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 Chengdu Baiwei Storage Technology Co ltd, Biwin Storage Technology Co Ltd filed Critical Chengdu Baiwei Storage Technology Co ltd
Priority to CN202210148569.7A priority Critical patent/CN114201320B/en
Publication of CN114201320A publication Critical patent/CN114201320A/en
Application granted granted Critical
Publication of CN114201320B publication Critical patent/CN114201320B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/004Error avoidance

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a system block upgrading method, a device, a readable storage medium and electronic equipment.A first system block corresponding to the size of a storage space is obtained from a system space and is used for temporarily storing system data to be upgraded after the size of the system data to be upgraded is obtained, so that the system data to be upgraded are prevented from being stored by adopting a memory, and the problem of inconsistent data caused by insufficient memory or the memory with stored data is effectively avoided; meanwhile, after the second system block receives the system data from the first system block, the data is verified, and the data in the old system block and the data in the first system block are released only after verification, so that various exceptions occurring in the system block data upgrading process can be effectively dealt with, the correctness of the system block data is ensured, and the exception condition occurring in the storage equipment upgrading process is reduced.

Description

System block upgrading method and device, readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of memories, and in particular, to a method and an apparatus for upgrading a system block, a readable storage medium, and an electronic device.
Background
Currently, the mainstream flash memory products have a special physical block (block) for storing system data, such as firmware codes and system configuration information. These physical blocks are commonly referred to collectively as system blocks. During the operation of the product, the firmware code is read from the system block at Random and is placed in a Static Random-Access Memory (SRAM) for operation. And when the product function needs to be upgraded or a patch needs to be added, upgrading the data of the system block to realize the product function upgrade and the patch.
However, the existing upgrading method generally comprises: the equipment receives the data of the upgrade package firstly, then temporarily stores the data in the memory, and when the equipment receives the complete upgrade package, the data is printed on a new system block once. However, the upgrading method has many hidden defects, for example, the device cannot temporarily store all data due to insufficient memory space, and if the temporarily stored upgraded data is tampered by other services in the data receiving process, and power failure occurs in the refreshing process, these abnormalities may cause the device to be unable to start normally.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: a method and a device for upgrading a system block, a readable storage medium and an electronic device are provided, so that the abnormal condition in the upgrading process of a storage device is reduced.
In order to solve the technical problems, the invention adopts the technical scheme that:
a system block upgrading method comprises the following steps:
acquiring the size of system data volume to be upgraded;
acquiring a first system block corresponding to the size of a storage space from a system space according to the data volume of the system to be upgraded;
storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
and judging whether the upgrade system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage spaces of the first system block and the old system block.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a system block upgrade apparatus, comprising:
the first acquisition module is used for acquiring the data size of the system to be upgraded;
the second acquisition module is used for acquiring a first system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the first storage module is used for storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
the first judging module is used for judging whether the system data to be upgraded in the first system block is abnormal or not, and if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the second storage module is used for transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
and the second judging module is used for judging whether the upgraded system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage spaces of the first system block and the old system block.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of a system block upgrade method as described above.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of a system block upgrade method as described above when executing the computer program.
The invention has the beneficial effects that: after the size of the system data volume to be upgraded is obtained, the first system block corresponding to the size of the storage space is obtained from the system space and is used for temporarily storing the system data to be upgraded, so that the system data to be upgraded are prevented from being stored by adopting a memory, and the problem of data inconsistency caused by insufficient memory or the memory adopting stored data is effectively avoided; meanwhile, after the second system block receives the system data from the first system block, the data is verified, and the data in the old system block and the data in the first system block are released only after verification, so that various exceptions occurring in the system block data upgrading process can be effectively dealt with, the correctness of the system block data is ensured, and the exception condition occurring in the storage equipment upgrading process is reduced.
Drawings
FIG. 1 is a flowchart illustrating steps of a system block upgrade method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a system block upgrading apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 4 is a schematic flow chart illustrating another step of the system block upgrading method in this embodiment;
fig. 5 is a schematic diagram of a system version management structure of a system block upgrading method in this embodiment;
fig. 6 is a schematic diagram of system version management structure upgrade of a system block upgrade method in this embodiment;
fig. 7 is a schematic flow chart illustrating a step of judging validity of a system block in the system block upgrading method in this embodiment.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, a method for upgrading a system block includes the steps of:
acquiring the size of system data volume to be upgraded;
acquiring a first system block corresponding to the size of a storage space from a system space according to the data volume of the system to be upgraded;
storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
and judging whether the upgrade system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage spaces of the first system block and the old system block.
As can be seen from the above description, the beneficial effects of the present invention are: after the size of the system data volume to be upgraded is obtained, the first system block corresponding to the size of the storage space is obtained from the system space and is used for temporarily storing the system data to be upgraded, so that the system data to be upgraded are prevented from being stored by adopting a memory, and the problem of data inconsistency caused by insufficient memory or the memory adopting stored data is effectively avoided; meanwhile, after the second system block receives the system data from the first system block, the data is verified, and the data in the old system block and the data in the first system block are released only after verification, so that various exceptions occurring in the system block data upgrading process can be effectively dealt with, the correctness of the system block data is ensured, and the exception condition occurring in the storage equipment upgrading process is reduced.
Further, determining whether the system data to be upgraded in the first system block is abnormal, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the amount of the system data to be upgraded includes:
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, judging whether the storage format of the system data to be upgraded is consistent with the storage format required by the system block or not, and if not, acquiring a third system block with the corresponding storage space size from the system space according to the data volume of the system data to be upgraded; transmitting the system data to be upgraded in the first system block to the third system block for format conversion and then transmitting the system data to be upgraded in the second system block;
and if so, executing the step of acquiring a second system block corresponding to the size of the storage space from the system space according to the system data volume to be upgraded.
According to the description, whether the storage format of the system data to be upgraded is consistent with the storage format required by the system block or not is judged, and if not, the third system block is acquired to be specially used for temporarily storing and sorting the data, so that after the third system block finishes sorting the system data to be upgraded, the storage format of the system data to be upgraded is consistent with the storage format of the data on the system block, and then the system data to be upgraded is written into the second system block, thereby avoiding the problems of upgrading failure and the like caused by different formats, and also avoiding the problems that the format conversion is directly carried out on the original old system block, and the data is lost caused by the conversion failure.
Further, before obtaining the size of the system data volume to be upgraded, the method further includes:
updating the group number of the system block;
when the system block is obtained from the system space, the method further comprises the following steps:
and carrying out incremental numbering on the system blocks obtained from the system space to obtain a serial number, and adding the group number into the serial number.
It can be known from the above description that the group number of the system block acquired from the system space is updated every time the system block needs to be updated and before the size of the system data to be updated is acquired, so that when the data to be updated is acquired, the updated system data and the system data stored in the old system block are set to different group numbers, which can be used for distinguishing new data from old data, and the number of the system block is updated every time a batch of system data to be updated is written, so that the number of each used system block can be recorded, and the security of the data transmission process can be ensured.
Further, still include:
after receiving a power-on signal, judging whether an abnormal power-down signal exists or not, if so, acquiring the group numbers and serial numbers of all the system blocks in the system space;
grouping the system blocks according to the group numbers, and counting the number of the system blocks in each group;
marking the group with the larger number of the system blocks as a valid system block;
and if the number of the system blocks in each group is the same, marking the group with the large number corresponding to the system block as an effective system block.
It can be known from the above description that, after receiving the power-on signal, it is determined whether there is an abnormal power-down condition, if there is an abnormal power-down condition, the group number and the serial number of all system blocks in the system space are obtained, and the system blocks are divided into two different groups of data, i.e. new system data and old system data, and then it is determined which group number system block is used as valid data by determining the number of the two groups of data and the corresponding serial number size, so that it is not necessary to determine which group is new system data or old system data, the determination rule is simplified, the determination accuracy is improved, and the system can be successfully started no matter whether the update is successful, and the normal use of the system is ensured.
Further, the second system block and the old system block both comprise a backup system block;
the transmitting the system data to be upgraded in the first system block to the second system block, after obtaining the upgraded system data, includes:
and transmitting the system data to be upgraded to a backup system block of the second system block.
As can be seen from the above description, by setting the backup system blocks corresponding to the second system block and the old system block, the main system block and the standby system block can be backed up with each other in the system operation process, thereby improving the system stability.
Further, the determining whether the upgraded system data in the second system block is abnormal includes:
and judging whether the system data in the backup system block of the second system block is abnormal or not, and if not, marking the backup system block of the second system block and the backup system block of the second system block as valid system blocks.
As can be seen from the above description, only when the system data in the second system block and the backup system block of the second system block are not abnormal, the second system block is marked as an effective system block, so that it is avoided that only one new system data exists in the system space and cannot be backed up, thereby further improving the stability of the system.
Referring to fig. 2, another embodiment of the present invention provides a data writing apparatus, including:
a system block upgrade apparatus, comprising:
the first acquisition module is used for acquiring the data size of the system to be upgraded;
the second acquisition module is used for acquiring a first system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the first storage module is used for storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
the first judging module is used for judging whether the system data to be upgraded in the first system block is abnormal or not, and if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the second storage module is used for transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
and the second judging module is used for judging whether the upgraded system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage spaces of the first system block and the old system block.
Another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of a system block upgrade method as described above.
Referring to fig. 3, another embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a system block upgrade method as described above.
The system block upgrading method, device, readable storage medium and electronic device of the present invention can be applied to various flash memory storage products, such as eMMC, UFS, SSD, etc., and are described in the following through specific embodiments:
example one
Referring to fig. 1, a method for upgrading a system block includes the steps of:
s1, acquiring the size of the system data volume to be upgraded;
s2, acquiring a first system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded; the first system is a temporary storage system block and is used for temporarily storing the current system data to be upgraded and temporarily storing the system block to release the memory after the upgrade is finished;
in an alternative embodiment, the system space includes all free system blocks;
s3, storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
s4, determining whether the system data to be upgraded in the first system block is abnormal, if not, obtaining a second system block corresponding to the size of the storage space from the system space according to the amount of the system data to be upgraded, specifically:
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, judging whether the storage format of the system data to be upgraded is consistent with the storage format required by the system block or not, and if not, acquiring a third system block with the corresponding storage space size from the system space according to the data volume of the system data to be upgraded; transmitting the system data to be upgraded in the first system block to the third system block for format conversion and then transmitting the system data to be upgraded in the second system block;
if the system data size is consistent with the system data size to be upgraded, the step of acquiring a second system block corresponding to the storage space size from the system space according to the system data size to be upgraded is executed;
s5, transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
s6, judging whether the upgrade system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage space of the first system block and the old system block;
in an optional embodiment, the second system block and the old system block both include a backup system block;
step S5 is followed by:
and S5a, transmitting the system data to be upgraded to the backup system block of the second system block.
Step S6 is followed by:
s7, judging whether the system data in the backup system block of the second system block is abnormal, if not, marking the second system block and the backup system block of the second system block as valid system blocks;
the embodiment provides a specific system block upgrade scenario, which is described with the size of system data (fw. bin) to be upgraded being 512 kbytes:
referring to fig. 4, S1, obtaining the size of the system data size to be upgraded as 512 kbytes;
s2, acquiring a first system block with the size of 512 Kbytes from a system space (system space) according to the quantity and the size of 512 Kbytes, and setting the first system block as tmpblk 0;
s3, receiving the data to be upgraded issued from the host computer with a preset data receiving amount such as granularity of 512B bytes, counting, when a page size (such as 16K) is received, printing the received 16K data down into tmpblk0, and repeating the steps until the 512K byte data amount of the system data to be upgraded is completely received;
s4, judging whether the system data to be upgraded in the tmpblk0 is abnormal or not, if not, judging whether the storage format of the system data to be upgraded is consistent with the data storage format required by the system block or not, if so, respectively acquiring the second system block and the standby system block with the size of 512 Kbytes from the system space, and setting the second system block and the standby system block as newblk 0/1;
if the system block is inconsistent with the system block, acquiring a third system block with the size of 512 Kbytes from the system space, and setting the third system block as tmpblk 1; transmitting the system data to be upgraded in the tmpblk0 into the tmpblk1 for format conversion;
s5, if the formats are consistent, transmitting the system data to be upgraded in the tmpblk0 to newblk0 and newblk1 to obtain upgraded system data;
if the formats are not consistent, transmitting the system data to be upgraded after format conversion in the tmpblk1 to newblk0 and newblk1 to obtain upgraded system data;
s6, judging whether the upgrade system data in newblk0/1 is abnormal or not, if not, marking newblk0 and newblk1 as valid system blocks, and releasing the storage space of tmpblk0, tmpblk1 and the old system blocks.
Example two
The difference between the present embodiment and the first embodiment is that the effective system block in the system after power-on is judged;
the judgment of the effective system block in the system comprises the following steps:
a1, after receiving a power-on signal, judging whether an abnormal power-down signal exists, if so, acquiring the group number and the serial number of all the system blocks in the system space;
a2, grouping the system blocks according to the group numbers, and counting the number of the system blocks in each group;
a3, marking the group with larger number of the system blocks as an effective system block, and if the number of the system blocks in each group is the same, marking the group with larger number corresponding to the system block as an effective system block;
wherein, step S1 is preceded by: updating the group number of the system block;
when the system block is obtained from the system space, the method further comprises the following steps: incrementally numbering the system blocks obtained from the system space to obtain serial numbers, and adding the group number into the serial numbers, specifically:
referring to fig. 5, the present embodiment provides a system version management data structure;
designing a data structure SN with the size of 16 bits; wherein bit [15] SN1 represents the group number of the system block (sysblk) in the same batch, and the group number is updated (from 0 to 1 or from 1 to 0) every time the system block is upgraded; bit [14:0] SN0 is the version number of each system block, and the version number is incremented each time sysblk is brushed down from the system space; meanwhile, the whole SN is stored in raw data of nand page of the sysblk, and validity judgment can be carried out according to the SN number when the sysblk is read; please refer to fig. 6, which is a diagram illustrating SN updating; the system blocks in the system in the initial state are old-sysblk0 and old-sysblk1, and the corresponding group numbers and codes are respectively: SN 0X 0001 and SN 0X 0002; when updated, new-sysblk0, SN0 x 8003 and new-sysblk1 and SN0 x 8004 are obtained, and when updated, new-sysblk0, SN0 x 0005 and new-sysblk1, SN0 x 0006 and so on are obtained;
referring to fig. 7, the present embodiment provides a specific scenario for determining valid system blocks in the system:
a1, if abnormal power failure exists after receiving the power-on signal, carrying out a validity judgment step through a validity judgment entry, and reading and recording SN of all system blocks; meanwhile, whether tmpblk0/1 exists in the system block or not is judged, and if yes, the tmpblk0/1 is released;
a2, grouping the system blocks according to the group numbers in the SNs of the system blocks to obtain group0/1, and counting the number of the system blocks in group0 and group 1;
a3, marking the group with the larger number of the system blocks as an effective system block, if the number of the system blocks in the group0 and the group1 is the same (for example, 2: 2), marking the group with the larger number corresponding to the system block as an effective system block (namely, comparing bit [14:0] of SN), exiting the effectiveness judgment, and entering the system;
referring to fig. 4, after the system upgrade method is adopted, normal startup can be performed in various problem scenarios:
scene 1: in the process of issuing fw.bin (i.e., in the process of executing step S3), if data jump occurs, the device identifies the data jump when checking tmpblk0 (i.e., determining whether the data is abnormal in S4), so that device abnormality is not caused;
scene 2: the device loses power under the condition of brushing a certain 16K (namely in the process of executing the step S3), in this case, the upgrade process will be exited, but because the original system block is still valid, after the valid data block is judged after being electrified, the original system block can be marked as the valid data block, so that the device will not be abnormal;
scene 3: the equipment is powered off when the tmpblk1 data is sorted, in this case, the upgrading process is exited, but after the validity judgment is passed, the original system block is still set as the valid system block of the current system, so that the equipment abnormality cannot be caused;
scene 4: when the device fails to update the new fw bin successfully before or during the new blk0 is refreshed, the old system block is erased and released only when both the new blks are successfully refreshed and verified, and therefore the original system block is still set as the effective system block of the current system after the validity judgment is passed, and the device is not abnormal;
scene 5: when the power failure occurs before or during the device is refreshed in newblk1, 3 system blocks including 2 old system blocks and 1 new system block are generated after the device is powered on again, after validity judgment is performed, the 1 new system block is erased, and the original 2 system blocks are still valid, so that the device is not abnormal;
scene 6: when the device is powered down after the newblk1 is refreshed, before the old system blocks are released, 4 system blocks including 2 old system blocks and 2 new system blocks are available after the device is powered up again, and after the validity judgment is performed, the 2 old system blocks are erased, the 2 new system blocks are valid, and the device is not abnormal.
EXAMPLE III
Referring to fig. 2, a system block upgrading apparatus includes:
the first acquisition module is used for acquiring the data size of the system to be upgraded;
the second acquisition module is used for acquiring a first system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the first storage module is used for storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
the first judging module is used for judging whether the system data to be upgraded in the first system block is abnormal or not, and if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the second storage module is used for transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
and the second judging module is used for judging whether the upgraded system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage spaces of the first system block and the old system block.
Example four
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of a method for upgrading a system block according to one or both of the embodiments.
EXAMPLE five
Referring to fig. 3, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of a system block upgrade method according to one or two embodiments.
In summary, according to the method and apparatus for upgrading a system block, the readable storage medium and the electronic device provided by the present invention, by constructing a system version management data structure, when a system is updated, the system block is obtained from a system space and data is written in, and then the corresponding group number and version number of the system block are updated, so that when a system power failure occurs in a subsequent updating process, a currently valid system block in the system can be judged and marked according to the system version management data structure, thereby ensuring the stability of the system; meanwhile, after the size of the system data to be upgraded is obtained, the first system block corresponding to the size of the storage space is obtained from the system space and is used for temporarily storing the system data to be upgraded, so that the problem that the system data to be upgraded is stored by adopting a memory, and the problem that the memory is insufficient or the data is inconsistent due to the adoption of the memory with the stored data is effectively avoided; meanwhile, after the second system block receives the system data from the first system block, the data is verified, and the data in the old system block and the data in the first system block are released only after verification, so that various exceptions occurring in the system block data upgrading process can be effectively dealt with, the correctness of the system block data is ensured, and the exception condition occurring in the storage equipment upgrading process is reduced.
In the above embodiments provided in the present application, it should be understood that the disclosed method, apparatus, computer-readable storage medium, and electronic device may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple components or modules may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or components or modules, and may be in an electrical, mechanical or other form.
The components described as separate parts may or may not be physically separate, and parts displayed as components may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the components can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each component may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (6)

1. A method for upgrading a system block, comprising the steps of:
acquiring the size of system data volume to be upgraded;
acquiring a first system block corresponding to the size of a storage space from a system space according to the data volume of the system to be upgraded;
storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
judging whether the upgrade system data in the second system block is abnormal or not, if not, marking the second system block as a valid system block, and releasing the storage space of the first system block and the old system block;
the method for obtaining the size of the system data volume to be upgraded further comprises the following steps:
updating the group number of the system block;
when obtaining the system block from the system space, the method further comprises:
carrying out incremental numbering on the system blocks obtained from the system space to obtain a serial number, and adding the group number into the serial number;
after receiving a power-on signal, judging whether an abnormal power-down signal exists or not, if so, acquiring the group numbers and serial numbers of all the system blocks in the system space;
grouping the system blocks according to the group numbers, and counting the number of the system blocks in each group;
marking the group with the larger number of the system blocks as a valid system block;
if the number of the system blocks in each group is the same, marking the group with the large number corresponding to the system block as an effective system block;
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded comprises the following steps:
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, judging whether the storage format of the system data to be upgraded is consistent with the storage format required by the system block or not, and if not, acquiring a third system block with the size corresponding to the storage space from the system space according to the quantity of the system data to be upgraded; transmitting the system data to be upgraded in the first system block to the third system block for format conversion and then transmitting the system data to be upgraded in the second system block;
and if so, executing the step of acquiring a second system block corresponding to the size of the storage space from the system space according to the system data volume to be upgraded.
2. The method of claim 1, wherein the second system block and the old system block both comprise a backup system block;
the transmitting the system data to be upgraded in the first system block to the second system block, after obtaining the upgraded system data, includes:
and transmitting the system data to be upgraded to a backup system block of the second system block.
3. The method according to claim 1, wherein said determining whether the upgraded system data in the second system block is abnormal comprises:
and judging whether the system data in the backup system block of the second system block is abnormal or not, and if not, marking the backup system block of the second system block and the backup system block of the second system block as valid system blocks.
4. A system block upgrade apparatus, comprising:
the first acquisition module is used for acquiring the data size of the system to be upgraded;
the second acquisition module is used for acquiring a first system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the first storage module is used for storing the system data to be upgraded into the first system block in batches according to a preset data receiving amount until the system data to be upgraded are received;
the first judging module is used for judging whether the system data to be upgraded in the first system block is abnormal or not, and if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded;
the second storage module is used for transmitting the system data to be upgraded in the first system block to the second system block to obtain upgraded system data;
the second judging module is used for judging whether the upgraded system data in the second system block is abnormal or not, if not, the second system block is marked as a valid system block, and the storage spaces of the first system block and the old system block are released;
the method for obtaining the size of the system data volume to be upgraded further comprises the following steps:
updating the group number of the system block;
when the system block is obtained from the system space, the method further comprises the following steps:
carrying out incremental numbering on the system blocks obtained from the system space to obtain a serial number, and adding the group number into the serial number;
after receiving a power-on signal, judging whether an abnormal power-down signal exists or not, if so, acquiring the group numbers and serial numbers of all the system blocks in the system space;
grouping the system blocks according to the group numbers, and counting the number of the system blocks in each group;
marking the group with the larger number of the system blocks as a valid system block;
if the number of the system blocks in each group is the same, marking the group with the large number corresponding to the system block as an effective system block;
judging whether the system data to be upgraded in the first system block is abnormal, if not, acquiring a second system block corresponding to the size of the storage space from the system space according to the data volume of the system to be upgraded comprises the following steps:
judging whether the system data to be upgraded in the first system block is abnormal or not, if not, judging whether the storage format of the system data to be upgraded is consistent with the storage format required by the system block or not, and if not, acquiring a third system block with the corresponding storage space size from the system space according to the data volume of the system data to be upgraded; transmitting the system data to be upgraded in the first system block to the third system block for format conversion and then transmitting the system data to be upgraded in the second system block;
and if so, executing the step of acquiring a second system block corresponding to the size of the storage space from the system space according to the system data volume to be upgraded.
5. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of a method for system block upgrade as claimed in any one of claims 1 to 3.
6. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of a method of system block upgrade as claimed in any one of claims 1 to 3 when executing the computer program.
CN202210148569.7A 2022-02-18 2022-02-18 System block upgrading method and device, readable storage medium and electronic equipment Active CN114201320B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210148569.7A CN114201320B (en) 2022-02-18 2022-02-18 System block upgrading method and device, readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210148569.7A CN114201320B (en) 2022-02-18 2022-02-18 System block upgrading method and device, readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN114201320A CN114201320A (en) 2022-03-18
CN114201320B true CN114201320B (en) 2022-05-27

Family

ID=80645701

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210148569.7A Active CN114201320B (en) 2022-02-18 2022-02-18 System block upgrading method and device, readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114201320B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102163155A (en) * 2011-03-09 2011-08-24 深圳创维数字技术股份有限公司 Upgrade controlling device and method for upgrading memory device
CN105487903A (en) * 2015-12-04 2016-04-13 小米科技有限责任公司 System upgrading method and device
CN108595113A (en) * 2018-03-22 2018-09-28 维沃移动通信有限公司 A kind of method and terminal of subregion adjustment
CN111290773A (en) * 2020-03-12 2020-06-16 深圳Tcl新技术有限公司 System upgrading method, device and readable storage medium
CN112199238A (en) * 2020-10-16 2021-01-08 深圳佰维存储科技股份有限公司 Memory firmware updating method and device, storage medium and electronic equipment
CN113900699A (en) * 2021-05-26 2022-01-07 荣耀终端有限公司 System upgrading method and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677375A (en) * 2014-11-18 2016-06-15 中兴通讯股份有限公司 Update control device, terminal, terminal update method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102163155A (en) * 2011-03-09 2011-08-24 深圳创维数字技术股份有限公司 Upgrade controlling device and method for upgrading memory device
CN105487903A (en) * 2015-12-04 2016-04-13 小米科技有限责任公司 System upgrading method and device
CN108595113A (en) * 2018-03-22 2018-09-28 维沃移动通信有限公司 A kind of method and terminal of subregion adjustment
CN111290773A (en) * 2020-03-12 2020-06-16 深圳Tcl新技术有限公司 System upgrading method, device and readable storage medium
CN112199238A (en) * 2020-10-16 2021-01-08 深圳佰维存储科技股份有限公司 Memory firmware updating method and device, storage medium and electronic equipment
CN113900699A (en) * 2021-05-26 2022-01-07 荣耀终端有限公司 System upgrading method and electronic equipment

Also Published As

Publication number Publication date
CN114201320A (en) 2022-03-18

Similar Documents

Publication Publication Date Title
JP4596715B2 (en) An array for storing various versions of a data set in separate memory areas and a method for updating a data set in memory
CN108646982B (en) Automatic data restoration method and device based on UBIFS
US20090037646A1 (en) Method of using a flash memory for a circular buffer
CN111176885A (en) Data verification method and related device for distributed storage system
CN109685190B (en) Power-down protection method and device for IC card
CN102654839A (en) Method and device for realizing reliable upgrading of FPGA (field programmable gate array)
CN102163155A (en) Upgrade controlling device and method for upgrading memory device
CN107329966B (en) Machine data storage method and system
CN112558868A (en) Method, device and equipment for storing configuration data
CN112000513A (en) Computer and VPD data operation method, device and storage medium thereof
US20230376226A1 (en) Storage block management information synchronous recording method and system, and terminal and storage medium
CN114201320B (en) System block upgrading method and device, readable storage medium and electronic equipment
CN110990207B (en) BPS memory test method, system, terminal and storage medium based on Whitley platform
CN110209349B (en) Data processing method and terminal equipment
CN115509466B (en) Data management method and device, electronic equipment and storage medium
CN115630100A (en) Mixed processing method and device for unit and multivariate time sequence data and computer equipment
CN114300026A (en) Monotonic counter, counting method, electronic device and storage medium
CN114203252A (en) Bad block detection method, device, equipment and storage medium of nonvolatile memory
CN109960611B (en) Data recovery method and device, electronic equipment and machine-readable storage medium
CN103824101B (en) Logic card reading/writing method and system
CN112506786A (en) Regression testing method and regression testing device
CN111857586A (en) SSD Trim optimization method, system, terminal and storage medium
US20060117213A1 (en) Efficient maintenance of memory list
CN110321073B (en) Data storage method, device and equipment of flash memory
CN114637626B (en) Method, device and equipment for reducing read-write errors of EEPROM (electrically erasable programmable read-only memory) data and readable storage medium

Legal Events

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