Embedded system updating method, device, electronic device and storage medium
By backing up and deleting data in the reserved storage partition in an embedded system, the file system parsing errors caused by data updates are solved, ensuring that the system can run normally after updates.
Patent Information
- Application Number
- CN202210730811.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-06-24
AI Technical Summary
In embedded systems, due to data updates, the data obtained before and after the kernel is different, resulting in file system parsing errors, which in turn causes the program to fail to run normally.
When an update operation occurs in a preset data stored in a specified area, it is backed up to the reserved storage partition to ensure data consistency. After the update operation is completed, restart the system and delete the backup data in the reserved storage partition.
By backing up and deleting data in the reserved storage partition, ensure that the system can run normally after updates and prevent file system parsing errors.
Smart Images

Figure CN115017116B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to an embedded system updating method, device, electronic device and storage medium. Background Art
[0002] In embedded systems, most systems, executable programs, and configurations are stored in Flash memory. Except for the partition storing configurations, which can be written, most other partitions can only be read. When a program accesses the file system in the flash memory, the kernel uses page cache to temporarily store the data read from the flash memory. When the memory is insufficient, the page cache will be recycled by the kernel. If the program accesses the page cache data again, the kernel will read the data from the flash memory again. At this time, if the data in the flash memory is updated, the page cache read by the kernel is different from the previous page cache data, resulting in a file system parsing error, which causes the program to fail to run normally. Summary of the invention
[0003] The present application provides an embedded system update method, device, electronic device and storage medium to solve the problem in the prior art that due to data update, the data obtained by the kernel before and after are different, resulting in file system parsing errors, and further causing the program to fail to run normally.
[0004] In a first aspect, the present application provides an embedded system update method, comprising: when an update operation occurs to preset data stored in a specified area, backing up the preset data to a reserved storage partition; reading the preset data in the specified area to determine the update status of the preset data in the specified area; and restarting the system after the preset data in the specified area completes the update operation.
[0005] In an embodiment of the present application, when an update operation occurs to the preset data stored in the specified area, the preset data stored in the specified area is backed up to the reserved storage partition. During the update process of the preset data stored in the specified area, the preset data backed up in the reserved storage partition remains unchanged, thereby ensuring that the data obtained by the kernel is always consistent. There will be no problem of file system parsing errors due to differences in the data obtained by the kernel before and after, which will cause the program to fail to run normally.
[0006] In combination with the technical solution provided in the first aspect above, in some possible implementations, when an update operation occurs on the preset data, after backing up the preset data to a reserved storage partition, the method further includes: during the update process of the preset data stored in the designated area, receiving a data access request; if the data access request is a data access request to read the preset data in the reserved storage partition, reading the preset data in the reserved storage partition.
[0007] In an embodiment of the present application, when a data access request for reading preset data in a reserved storage partition is received, the preset data in the reserved storage partition is read, thereby ensuring that the preset data obtained before and after is always consistent, preventing file system parsing errors, and ensuring the normal operation of the program.
[0008] In combination with the technical solution provided in the first aspect above, in some possible implementations, after the system is restarted after the preset data in the designated area is updated, the method further includes: deleting the preset data in the reserved storage partition.
[0009] In an embodiment of the present application, the preset data in the reserved storage partition is deleted so that when the updated system is enabled, the updated preset data is used to ensure the normal operation of the updated system and free up more storage space.
[0010] In combination with the technical solution provided in the first aspect above, in some possible implementations, before backing up the preset data to the reserved storage partition, the method also includes: based on the preset data, obtaining the storage space size required for the reserved storage partition; based on the storage space size required for the reserved storage partition, applying for memory space, wherein the memory space applied for is the reserved storage partition.
[0011] In the embodiment of the present application, the storage space size required for the reserved storage partition is determined according to the preset data to ensure that the memory space applied for can store all the preset data, thereby preventing the reserved storage space from being insufficient. At the same time, it can also prevent the reserved storage space from being too large and occupying too much memory resources.
[0012] In combination with the technical solution provided in the first aspect above, in some possible implementations, applying for memory space based on the storage space size required by the reserved storage partition includes: applying for memory space multiple times based on the storage space size required by the reserved storage partition until the total amount of memory space applied for is greater than or equal to the storage space size required by the reserved storage partition.
[0013] In an embodiment of the present application, since it may be impossible to apply for a larger memory space at one time, the memory space may be applied for multiple times until the total memory space applied for is greater than or equal to the storage space required by the reserved storage partition. All the memory space applied for multiple times will be used as the reserved storage partition to realize the application of a larger memory space.
[0014] In combination with the technical solution provided in the first aspect above, in some possible implementations, the size of the memory space applied for each time is an integer multiple of 128K.
[0015] In the embodiment of the present application, since flash data access is usually performed according to 64K / 128K, setting the size of the memory space applied for each time to an integer multiple of 128K is beneficial for subsequent access to data stored in the reserved storage partition.
[0016] In combination with the technical solution provided in the first aspect above, in some possible implementations, the preset data is read-only data.
[0017] In a second aspect, the present application provides an embedded system update device, including a backup unit, a determination unit, and a processing unit. The backup unit is used to back up the preset data stored in a specified area to a reserved storage partition when an update operation occurs to the preset data stored in the specified area; the determination unit is used to read the preset data in the specified area and determine the update status of the preset data in the specified area; the processing unit is used to restart the system after the preset data in the specified area completes the update operation.
[0018] In a third aspect, the present application provides an electronic device, comprising: a memory and a processor, the memory and the processor being connected; the memory comprising a designated area and a reserved storage partition, the designated area being used to store preset data, and the reserved storage partition being used to back up the preset data stored in the designated area when an update operation occurs to the preset data stored in the designated area; the processor being used to execute a method provided in the above-mentioned first aspect embodiment and / or any possible implementation method in combination with the above-mentioned first aspect embodiment.
[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the method provided in the embodiment of the first aspect above and / or in any possible implementation manner in combination with the embodiment of the first aspect above is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A schematic diagram of a flow chart of an embedded system upgrade method shown in an embodiment of the present application;
[0022] Figure 2 A flowchart of another embedded system upgrade method shown in an embodiment of the present application;
[0023] Figure 3 This is a structural block diagram of an embedded system upgrade device shown in an embodiment of the present application;
[0024] Figure 4 A structural block diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0026] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it is not necessary to further define and explain it in the subsequent drawings. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements.
[0027] Furthermore, the term "and / or" in this application is merely a term used to describe the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone.
[0028] The technical solution of the present application will be described in detail below with reference to the accompanying drawings.
[0029] See also Figure 1 , Figure 1 A flowchart of an embedded system update method provided in an embodiment of the present application is shown below in combination with Figure 1 Describe the steps involved in it in detail.
[0030] S100: When an update operation occurs to the preset data stored in the designated area, the preset data is backed up to a reserved storage partition.
[0031] The designated area and the reserved storage partition may be different partitions of the same memory, or the designated area and the reserved storage partition may be located in different memories, respectively. The specific types of memories to which the designated area and the reserved storage partition belong are not limited here.
[0032] Optionally, the designated area may be a partial storage area in a flash memory, and the reserved storage partition may be any storage area in the flash memory except the designated area. Alternatively, the designated area may be a partial storage area in a flash memory, and the reserved storage partition may be a partial storage area in a DDR (Double Data Rate SDRAM, double data rate synchronous dynamic random access memory) memory. It is to be understood that the examples given here are only for ease of understanding and should not be used as limitations on the present application.
[0033] In one implementation, before updating the preset data in the designated area, the partition in the memory may be marked, the marked area is the designated area, and the data in the designated area is the preset data.
[0034] Alternatively, before updating the preset data in the designated area, the data in the memory may be marked, the marked data is the preset data, and the area where the preset data is located is the designated area.
[0035] The preset data may be any type of data, such as root file system data, media service data, etc., and no limitation is imposed on the specific data type here.
[0036] Optionally, the preset data is read-only data, that is, the preset data is stored in a read-only memory.
[0037] The specific principle and process of backing up data are well known to those skilled in the art and will not be described in detail here for the sake of brevity.
[0038] When an update operation occurs to the preset data and the preset data has been backed up to the reserved storage partition, at this time, if there is a data access request, in order to ensure that the preset data obtained before and after are always consistent, prevent file system parsing errors, and ensure the normal operation of the program, in one implementation method, it can be that during the update process of the preset data stored in the designated area, a data access request is received; if the data access request is a data access request to read the preset data in the reserved storage partition, the preset data in the reserved storage partition is read.
[0039] Among them, since each data access request carries an address representing the storage location of the accessed data, it is possible to determine whether the data access request is a data access request for reading preset data in the reserved storage partition based on the address carried by the data access request. Among them, each storage space has a globally unique address, and its corresponding storage space can be found based on the address.
[0040] Before backing up the preset data to the reserved storage partition, the embedded system upgrade method further includes obtaining the reserved storage partition. In one implementation, the specific process of obtaining the reserved storage partition may be firstly obtaining the storage space size required by the reserved storage partition based on the preset data; then applying for memory space based on the storage space size required by the reserved storage partition, wherein the memory space obtained by the application is the reserved storage partition.
[0041] For example, when the total size of the preset data is NK, the storage space required by the reserved storage partition needs to be greater than or equal to NK. Therefore, a memory space with a space size of NK is applied for, where N is a positive number, K is the unit of measurement Kb, and 1Kb=1000B.
[0042] It is understandable that when the memory space applied for at one time is large, the application may fail. In this case, based on the storage space required by the reserved storage partition, you can apply for memory space multiple times until the total memory space applied for is greater than or equal to the storage space required by the reserved storage partition.
[0043] For example, when the total size of the preset data is NK, the storage space required by the reserved storage partition must be greater than or equal to NK. If it is impossible to apply for a memory space of NK in one go, you can apply for it in k times. The first application is for a memory space of N1K, the second application is for a memory space of N2K, and so on. i K's memory space... The size of the k-th application is N k K memory space, where i is a positive integer greater than or equal to 1, k is a positive integer greater than or equal to 2, i is less than or equal to k, N i K is less than NK, and
[0044] Among them, N1K, N2K, N3K...N i K……N k K can be partially equal, completely unequal, or completely equal, that is, the size of the memory space requested each time can be equal or unequal.
[0045] When the designated area is a partial area in the flash memory, since the flash data access is usually performed according to 64K / 128K, that is, in the kernel code, the content in the NOR (Not OR) flash memory is read by reading 64K content each time; the content in the NAND (Not AND) flash memory is read by reading 128K content each time. In order to facilitate the subsequent access to the data stored in the reserved storage partition, the size of the memory space applied each time can be an integer multiple of 128K. For example, 128K, 256K, 384K, 512K, 640K, 768K, 896K, 1024K, etc., there is no restriction on the specific value of the memory space size applied each time.
[0046] Alternatively, it can also be an integer multiple of 64K, for example, 64K, 128K, 192K, 256K, 320K, 384K, 448K, 512K, 576K, 640K, 704K, 768K, 832K, 896K, 960K, 1024K, etc.
[0047] In order to further improve the speed of system upgrade, before updating the preset data in the specified area, you can release non-essential memory and exit the resource access irrelevant to the upgrade, for example, you can exit the media memory service, so as to improve the speed of system upgrade. The examples here are only for ease of understanding and should not be used as a limitation of this application.
[0048] S200: Reading preset data in a designated area, and determining an update status of the preset data in the designated area.
[0049] During the process of updating the preset data of the specified area, the preset data in the specified area can be read, and the update completion status can be judged based on the preset data read. If it is judged that the update is not completed, no other operations are performed, and the preset data of the specified area continues to be updated; if it is judged that the update is completed, step S300 is executed.
[0050] The specific process of judging the update completion status of the preset data obtained by reading the preset data may be to compare the preset data obtained by reading the preset data with the update data to judge whether the two are consistent, if they are consistent, it is determined that the preset data in the specified area has been updated; if they are inconsistent, it is determined that the preset data in the specified area has not been updated. The update data is the same as the preset data after the update is completed.
[0051] S300: Restart the system after the preset data in the designated area is updated.
[0052] After the preset data in the specified area is updated, restart the system to complete the system update.
[0053] In order to prevent conflicts between the backed-up designated data in the reserved storage area and the updated designated data, and to enable the updated preset data normally, in one implementation mode, after the preset data in the designated area is updated and the system is restarted, the preset data in the reserved storage partition is deleted.
[0054] Alternatively, after the preset data in the specified area is updated, delete the preset data in the reserved storage partition, and then restart the system to complete the system update.
[0055] After restarting the system and completing the system update, the data or partitions in the memory can be marked again to obtain a new designated area and new preset data, which are used to be backed up to a new reserved storage partition when the embedded system is updated next time.
[0056] For a better understanding of the embedded system update method shown in this application, please refer to Figure 2 It should be noted that Figure 2 The principle shown is one of many embodiments of the embedded system update method of this application, so it cannot be used. Figure 2 The manner shown is to be understood as limiting the present application.
[0057] like Figure 2 As shown, first, based on the preset data, the storage space size required by the reserved storage partition is obtained; then, based on the storage space size required by the reserved storage partition, memory space is applied for, and the memory space applied for is the reserved storage space. Afterwards, when the preset data stored in the specified area is updated, the preset data is backed up to the reserved storage partition. The preset data in the specified area is read to determine the update status of the preset data in the specified area; after the preset data in the specified area is updated, the system is restarted, and finally the preset data in the reserved storage partition is deleted.
[0058] During the updating process of the preset data stored in the designated area, if a data access request is received, and the data access request is a data access request for reading the preset data in the reserved storage partition, the preset data in the reserved storage partition is read.
[0059] in, Figure 2 The specific implementation of each step of the embedded system upgrade method shown has been clearly described in the previous text, and will not be repeated here for the sake of brief description.
[0060] See also Figure 3 , Figure 3 An embedded system updating device provided in an embodiment of the present application includes a backup unit 110 , a determination unit 120 and a processing unit 130 .
[0061] The backup unit 110 is used to back up the preset data stored in the designated area to a reserved storage partition when an update operation occurs to the preset data stored in the designated area;
[0062] The determination unit 120 is used to read the preset data in the specified area and determine the update status of the preset data in the specified area;
[0063] The processing unit 130 is configured to restart the system after the preset data in the designated area is updated.
[0064] The processing unit 130 is further configured to receive a data access request during the updating process of the preset data stored in the designated area; if the data access request is a data access request for reading the preset data in the reserved storage partition, read the preset data in the reserved storage partition.
[0065] The processing unit 130 is further configured to delete the preset data in the reserved storage partition after the system is restarted after the preset data in the designated area is updated.
[0066] The processing unit 130 is also used to obtain the storage space size required by the reserved storage partition based on the preset data before backing up the preset data to the reserved storage partition; and apply for memory space based on the storage space size required by the reserved storage partition, wherein the memory space applied for is the reserved storage partition.
[0067] The processing unit 130 is specifically configured to apply for memory space multiple times based on the storage space size required by the reserved storage partition, until the total amount of memory space applied for is greater than or equal to the storage space size required by the reserved storage partition.
[0068] The embedded system update device 100 provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned embedded system update method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned embedded system update method embodiment.
[0069] See also Figure 4 , which is an electronic device 200 provided in an embodiment of the present application. The electronic device 200 includes: a transceiver 210, a memory 220, a communication bus 230, and a processor 240.
[0070] The transceiver 210, the memory 220, and the processor 240 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 230 or signal lines. The transceiver 210 is used to send and receive data. The memory 220 includes a designated area and a reserved storage partition. The designated area is used to store preset data. The reserved storage partition is used to back up the preset data stored in the designated area when an update operation occurs in the preset data stored in the designated area. It can also store Figure 3 The software function module shown in is the embedded system update device 100. Among them, the embedded system update device 100 includes at least one software function module that can be stored in the memory 220 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 200. The processor 240 is used to execute the executable module stored in the memory 220, such as the software function module or computer program included in the embedded system update device 100. At this time, the processor 240 is used to back up the preset data stored in the specified area to the reserved storage partition when an update operation occurs to the preset data stored in the specified area; read the preset data in the specified area to determine the update status of the preset data in the specified area; and restart the system after the preset data in the specified area completes the update operation.
[0071] Among them, the memory 220 can be, but is not limited to, flash memory, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0072] The processor 240 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor 240 may also be any conventional processor, etc.
[0073] The electronic device 200 mentioned above includes but is not limited to a personal computer, a server, etc.
[0074] The embodiment of the present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored, and when the computer program is run by a computer such as the above-mentioned electronic device 200, the above-mentioned embedded system update method is executed. The computer-readable storage medium includes: flash memory, U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program codes.
[0075] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An embedded system update method, characterized in that: include: When an update operation occurs to the preset data stored in the designated area, the preset data is backed up to the reserved storage partition; wherein the designated area and the reserved storage partition are respectively located in different memories; Reading the preset data in the designated area, and determining the update status of the preset data in the designated area; After the preset data in the designated area is updated, restart the system; Wherein, when an update operation occurs to the preset data stored in the designated area, after backing up the preset data to the reserved storage partition, the method further includes: receiving a data access request during an update process of preset data stored in the designated area; If the data access request is a data access request to read preset data in the reserved storage partition, the preset data in the reserved storage partition is read.
2. The method according to claim 1, characterized in that After the preset data in the designated area is updated and the system is restarted, the method further includes: Delete the preset data in the reserved storage partition.
3. The method according to claim 1, characterized in that Before backing up the preset data to the reserved storage partition, the method further includes: Based on the preset data, obtaining the storage space size required by the reserved storage partition; Based on the storage space size required by the reserved storage partition, apply for memory space, wherein the memory space applied for is the reserved storage partition.
4. The method according to claim 3, characterized in that The applying for memory space based on the storage space size required by the reserved storage partition includes: Based on the storage space size required by the reserved storage partition, apply for memory space multiple times until the total memory space applied for is greater than or equal to the storage space size required by the reserved storage partition.
5. The method according to claim 4, characterized in that The size of the memory space requested each time is an integer multiple of 128K.
6. The method according to claim 1, characterized in that The preset data is read-only data.
7. An embedded system update device, characterized in that: include: A backup unit, configured to back up the preset data stored in the designated area to a reserved storage partition when an update operation occurs to the preset data stored in the designated area; wherein the designated area and the reserved storage partition are located in different memories respectively; a determination unit, configured to read the preset data in the specified area and determine an update status of the preset data in the specified area; A processing unit, configured to restart the system after the preset data in the designated area completes the update operation; When an update operation occurs to the preset data stored in the designated area, after backing up the preset data to the reserved storage partition, the processing unit is further used to receive a data access request during the update process of the preset data stored in the designated area; if the data access request is a data access request to read the preset data in the reserved storage partition, read the preset data in the reserved storage partition.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are connected; The memory comprises a designated area and a reserved storage partition, wherein the designated area is used to store preset data, and the reserved storage partition is used to back up the preset data stored in the designated area when an update operation occurs to the preset data stored in the designated area; The processor is used to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a computer, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Virtual machine service fast recovery method, system, device and storage medium
CN109298977A
System upgrading method and device, electronic equipment and medium
CN110780890A