CN113495746B - Program upgrading method, device, medium and electronic equipment - Google Patents

Program upgrading method, device, medium and electronic equipment Download PDF

Info

Publication number
CN113495746B
CN113495746B CN202110604261.4A CN202110604261A CN113495746B CN 113495746 B CN113495746 B CN 113495746B CN 202110604261 A CN202110604261 A CN 202110604261A CN 113495746 B CN113495746 B CN 113495746B
Authority
CN
China
Prior art keywords
user data
data area
backup
area
target user
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
CN202110604261.4A
Other languages
Chinese (zh)
Other versions
CN113495746A (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.)
Hangzhou Huacheng Software Technology Co Ltd
Original Assignee
Hangzhou Huacheng Software 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 Hangzhou Huacheng Software Technology Co Ltd filed Critical Hangzhou Huacheng Software Technology Co Ltd
Priority to CN202110604261.4A priority Critical patent/CN113495746B/en
Publication of CN113495746A publication Critical patent/CN113495746A/en
Application granted granted Critical
Publication of CN113495746B publication Critical patent/CN113495746B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a program upgrading method, a program upgrading device, a medium and electronic equipment, and relates to the field of data storage. The program upgrading method responds to a received program upgrading instruction input by a user, and updates a version file partition and a partition table contained in the flash memory according to an upgrading data packet; dividing a user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table; integrating the data of the target user data area and the data of each backup user data area into a spliced file; writing the spliced files into the target user data area and each backup user data area respectively; wherein the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal. When the method upgrades the program of the terminal equipment which is not provided with the backup area of the user data area, the original user data is reserved and further backed up, so that the terminal equipment which is not provided with the backup area can obtain the backup area.

Description

Program upgrading method, device, medium and electronic equipment
Technical Field
The embodiment of the application relates to the field of data storage, in particular to a program upgrading method, a device, a medium and electronic equipment.
Background
Terminal equipment using a Linux system, such as an Internet Protocol Camera (IPC), is widely applied in various scenes of industry at present, and as the cost requirement is higher and higher, a FLASH memory (FLASH) is generally used as a storage device, and a low-capacity NOR FLASH is used for storage in a mainstream low-cost scheme at present. Flash memory is often divided into a BOOT area, a partition table, a kernel area, a ROOTFS area, a user data area, all of which are writable only by the user data area and the partition table. In low capacity NOR FLASH, the JFFS2 file system is often employed for mounting.
In the existing program upgrading method, if the terminal equipment is provided with a backup area of user data, if power failure, abnormal restarting and other conditions occur during user data updating, the user data can be recovered when lost. However, this type of terminal device typically does not have a backup area for the user data area, for storage space or the like. Therefore, how to provide a program upgrading method for enabling terminal equipment without a backup area to obtain the backup area has important practical significance.
Disclosure of Invention
The embodiment of the application provides a program upgrading method, a program upgrading device, a program upgrading medium and electronic equipment, which can enable terminal equipment to obtain a backup area when the program of the terminal equipment which is not provided with the backup area of a user data area is upgraded.
In order to achieve the above purpose, the technical solution of the embodiments of the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a program upgrading method, including:
responding to a received program upgrading instruction input by a user, and updating version file partitions and partition tables contained in the flash memory according to an upgrading data packet;
dividing a user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table;
integrating the data of the target user data area and the data of each backup user data area into a spliced file;
writing the spliced files into the target user data area and each backup user data area respectively; and the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal.
According to the program upgrading method provided by the embodiment of the application, when a program is upgraded on a terminal device which is not provided with a backup area of a user data area, the user data area of the flash memory is divided into a target user data area and at least one backup user data area according to the updated partition table, the data of the target user data area and the data of each backup user data area are integrated into a spliced file, and original user data is reserved and further backed up according to the spliced file, so that the terminal device which is not provided with the backup area can obtain the backup area.
In an alternative embodiment, the dividing the user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table includes:
and adjusting the storage address of the user data area according to the user data area parameters in the updated partition table so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area.
According to the method, the storage address of the user data area is adjusted according to the user data area parameters in the updated partition table, so that the user data area of the flash memory is divided into the target user data area and at least one backup user data area, the user data area parameters in the partition table can be set according to specific requirements when a program is upgraded, flexible data backup is achieved, and therefore the running stability of a system is improved more efficiently.
In an alternative embodiment, the integrating the data of the target user data area and each backup user data area into a spliced file includes:
and reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence.
In the method of the embodiment, data is read from the target user data area and each backup user data area according to the sequence of the storage addresses, and the data are integrated into the spliced file based on the read sequence, so that the physical address storage sequence of the data in the spliced file is regular, splicing time consumption is reduced, and the subsequent reading of the spliced file is more convenient, thereby more effectively preventing the normal starting of a program from being influenced by data abnormality during upgrading and improving the running stability of a system.
In an alternative embodiment, the writing the spliced file into the target user data area and each of the backup user data areas includes:
and if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
According to the method, whether the data in the target user data area is different from the data in the backup user data area is determined, unnecessary writing of spliced files can be avoided, so that the efficiency of backing up the user data is improved, and the stability of system operation is improved more effectively.
In an alternative embodiment, before said determining that the data in the target user data area and the backup user data area are different, further comprising:
mounting the data of the target user data area into a preset first catalogue, and mounting the data of each backup user data area into a corresponding second catalogue respectively;
judging whether the data in the target user data area and the backup user data area are the same or not by the following modes:
for any one of the second directories, detecting whether the data of the first directory and the second directory are the same, and if so, determining that the data in the backup user data area corresponding to the target user data area and the second directory are the same;
the step of respectively erasing and writing the data of the target user data area and the backup user data area into the spliced file comprises the following steps:
and respectively erasing the data mounted in the first catalogue and each second catalogue, and writing the data mounted in a third catalogue, wherein the third catalogue is a catalogue mounted with the spliced file.
According to the method, the preset three directory files are adopted to efficiently read and compare the data, so that the original user data is reserved and further backed up, the overall efficiency of backing up the user data is improved, and the running stability of the system is improved more effectively.
In a second aspect, an embodiment of the present application further provides a program upgrading apparatus, including:
the program upgrading module is used for responding to a received program upgrading instruction input by a user and updating a version file partition and a partition table contained in the flash memory according to an upgrading data packet;
the data partitioning module is used for partitioning the user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partitioning table;
the data splicing module is used for integrating the data of the target user data area and the data of each backup user data area into a spliced file;
the data backup module is used for writing the spliced files into the target user data area and each backup user data area respectively; and the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal.
In an alternative embodiment, the data partitioning module is specifically configured to:
and adjusting the storage address of the user data area according to the user data area parameters in the updated partition table so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area.
In an alternative embodiment, the data stitching module is specifically configured to:
and reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence.
In an alternative embodiment, the data backup module is specifically configured to:
and if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
In an alternative embodiment, the apparatus further comprises a data mounting module for:
mounting the data of the target user data area into a preset first catalogue, and mounting the data of each backup user data area into a corresponding second catalogue respectively;
the data backup module is specifically configured to:
for any one of the second directories, detecting whether the data of the first directory and the second directory are the same, and if so, determining that the data in the backup user data area corresponding to the target user data area and the second directory are the same;
Respectively erasing the data mounted in the first catalogue and each second catalogue, and writing the data mounted in the third catalogue;
and the data mounting module is also used for mounting the third catalogue and the spliced file.
In a third aspect, embodiments of the present application further provide a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the program upgrading method of the first aspect.
In a fourth aspect, an embodiment of the present application further provides an electronic device, including a flash memory and a processor, where the flash memory stores a computer program that can be executed on the processor, and when the computer program is executed by the processor, the processor is caused to implement the program upgrading method of the first aspect.
The technical effects caused by any implementation manner of the second aspect to the fourth aspect may refer to the technical effects caused by the corresponding implementation manner of the first aspect, and are not described herein.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a flash memory partition according to an embodiment of the present disclosure;
FIG. 3 is a flowchart of a program upgrade method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a user data area divided into two during a program update according to an embodiment of the present application;
FIG. 5 is a flowchart of another program upgrade method according to an embodiment of the present application;
FIG. 6 is a flowchart of another program upgrade method according to an embodiment of the present application;
FIG. 7 is a flowchart of another program upgrade method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a program upgrading apparatus according to an embodiment of the present application;
FIG. 9 is a schematic structural diagram of another program upgrading apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail below with reference to the accompanying drawings, wherein it is apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
It should be noted that the terms "comprises" and "comprising," along with their variants, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Some words appearing hereinafter are explained:
(1) Linux: the universal GNU/Linux is a free-to-use and freely-spread UNIX-like operating system. It can run major Unix tools, applications, and networking protocols. It supports 32-bit and 64-bit hardware. Linux inherits the design idea of Unix with a network as a core, and is a multi-user network operation system with stable performance. There are hundreds of different releases for Linux, such as debian, archlinux based on community development, red Hat Enterprise Linux based on commercial development, SUSE, oracle Linux, etc. The Linux operating system regards all devices as files, which integrates the resources of the entire computer into one large file directory. To access a file in a storage device, a user must mount the partition in which the file resides to an existing directory and then access the storage device by accessing this directory.
(2) NOR Flash: the NOR Flash is a memory adopting nonvolatile Flash technology, and is characterized by an XIP (eXecute In plane) execution, so that an application program can directly run In the Flash without reading codes into a system RAM. The transfer efficiency of NOR Flash is high, with high cost effectiveness at small capacities of 1-4 MB.
(3) Mounting (mount): refers to a process by which computer files and directories on a storage device (such as a hard disk, CD-ROM, or shared resource) are made available to a user for access through the computer's file system by an operating system. Typically, when the computer is shut down, each mounted storage will undergo an uninstallation to ensure that all queued data is written to and to ensure the integrity of the on-media file system structure. In Linux operating systems, mounting is a very important function, which is used very frequently, in particular to mount a device (typically a storage device) to an existing directory.
(4) Flash Memory (Flash Memory): is a long-life non-volatile (still maintaining stored data information in the event of a power failure) memory, and data deletion is not in units of a single byte but in units of a fixed block (note: NOR Flash is a byte store.) the block size is typically 256KB to 20MB. Flash memory is a variation of electrically erasable read-only memory (EEPROM), which differs from EEPROM in that EEPROM can be erased and rewritten on a byte level rather than an entire chip, while most chips of flash memory require block erasure. Flash memory is commonly used to store setup information, such as data stored in the BIOS (basic program) of a computer, a PDA (personal digital assistant), a digital camera, etc., because it can still store data when it is powered off.
Terminal equipment using a Linux system, such as an Internet Protocol Camera (IPC), is widely applied in various scenes of industry at present, and as the cost requirement is higher and higher, a FLASH memory (FLASH) is generally used as a storage device, and a low-capacity NOR FLASH is used for storage in a mainstream low-cost scheme at present. FLASH (FLASH) memory is often divided into a BOOT area, a partition table, a kernel area, a ROOTFS area, and a user data area. All partitions are writable only with the user data area and partition table, often mounted using the JFFS2 file system in a low capacity NOR FLASH. For reasons of storage space, etc., this type of terminal equipment is generally not provided with a backup area for the user data area.
In the existing program upgrading method, if the terminal equipment is provided with a backup area of user data, if power failure, abnormal restarting and other conditions occur during user data updating, the user data can be recovered when lost. However, this type of terminal device typically does not have a backup area for the user data area, for storage space or the like. Therefore, how to provide a program upgrading method for enabling terminal equipment without a backup area to obtain the backup area has important practical significance.
In order to solve the existing technical problems, the embodiment of the application provides a program upgrading method, a device, a medium and electronic equipment, wherein version file partitions and partition tables contained in a flash memory are updated according to an upgrading data packet by responding to a received program upgrading instruction input by a user; dividing a user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table; integrating the data of the target user data area and the data of each backup user data area into a spliced file; writing the spliced files into the target user data area and each backup user data area respectively; and the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal. When the method is used for program upgrading of terminal equipment without a backup area of a user data area, the user data area of the flash memory is divided into a target user data area and at least one backup user data area according to the updated partition table, the data of the target user data area and the data of each backup user data area are integrated into a spliced file, and the original user data is reserved and further backed up according to the spliced file, so that the terminal equipment without the backup area can obtain the backup area.
For the purpose of promoting an understanding of the principles of the invention, reference will now be made in detail to the embodiments, some but not all of which are illustrated in the accompanying drawings. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
It should be noted that, the application scenario described in the embodiment of the present application is for more clearly describing the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application, and as a person of ordinary skill in the art can know, with the appearance of the new application scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
Fig. 1 shows an application scenario provided in an embodiment of the present application, and referring to fig. 1, the application scenario includes a terminal device 200 and a server 100. The server 100 and the terminal device 200 are in the same data network, which may be a wired network or a wireless network. When the server 100 and the terminal device 200 are in the same data network, the terminal device 200 can communicate with the server 100. The server 100 may be a cloud server that performs an upgrade service for the terminal device 200. The terminal device 200 comprises a flash memory 201. It can be understood that the server 100 and the terminal device 200 may also be respectively located in different data networks connected to each other, and the same data network of the application scenario described in fig. 1 does not constitute a limitation on the technical solution provided in the embodiments of the present application. Fig. 2 shows a schematic diagram of a flash memory partition according to an embodiment of the present application. As shown in fig. 2, the flash memory is mainly divided into a BOOT area, a partition table, a kernel area, a ROOTFS area, and a user data area. The BOOT area is generally used for storing a core file used when Linux is started; the partition table is a guide file for uniformly managing the division of the flash memory; the kernel area is used for storing kernel files; the ROOTFS area contains the directory and critical files necessary for system start-up, and files necessary for other file systems to mount; the user data area typically stores user data. Only the user data area and the partition table in the above-mentioned partition of the flash memory partition are writable. The other several partitions, except the user data area and the partition table area, obtained by partitioning the flash memory may be collectively referred to as version file partitions. When the program of the terminal device 200 is updated, the updated version program can be implemented by updating the BOOT area, the partition table, the kernel area, the ROOTFS area, and the user data area included in the flash memory 201 of the terminal device 200. In the following embodiments of the present application, the partition of the flash memory 201 of the terminal device 200 includes a version file partition, a user data area, and a partition table, where the version file partition includes a BOOT area, a kernel area, and a ROOTFS area, which are described as examples.
The server 100 periodically pushes a program upgrade reminder message to the terminal device 200, and the user can confirm the received program upgrade reminder message by clicking the terminal device 200, thereby inputting a program upgrade instruction to the terminal device 200. In response to a received program upgrading instruction input by a user, the terminal device 200 updates the version file partition and the partition table contained in the flash memory 201 according to an upgrading data packet; dividing a user data area of the flash memory 201 into a target user data area and at least one backup user data area according to the updated partition table; integrating the data of the target user data area and the data of each backup user data area into a spliced file; writing the spliced files into the target user data area and each backup user data area respectively; wherein the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal.
The embodiment of the application provides a program upgrading method, as shown in fig. 3, comprising the following steps:
step S301, in response to the received program upgrade instruction input by the user, updates the version file partition and the partition table contained in the flash memory according to the upgrade data packet.
The flash memory comprises a plurality of preset partitions for storing program data of a program; the plurality of preset partitions comprise a version file partition, a partition table and a user data area for storing user data; the partition table is used for determining the storage position of each preset partition.
Optionally, the version file partition includes a BOOT area, a kernel area, and a ROOTFS area.
Illustratively, the terminal device 200 downloads an upgrade data packet from the server 100 in response to a received program upgrade instruction input by a user, and updates a version file partition and a partition table included in the flash memory 201 according to the upgrade data packet, wherein the version file partition is other partition than the partition table and the user data area among a plurality of preset partitions included in the flash memory 201 for storing program data of the program: BOOT area, kernel area, ROOTFS area.
Step S302, the user data area of the flash memory is divided into a target user data area and at least one backup user data area according to the updated partition table.
In the embodiment of the present application, the process of dividing the user data area in the flash memory according to the updated partition table may be divided into the target user data area and one backup user data area, or may be divided into the target user data area and a plurality of backup user data areas. The number of backup user data areas obtained by dividing is not particularly limited in the present application.
In some alternative embodiments, the division of the user data area of the flash memory into the target user data area and the at least one backup user data area according to the updated partition table may be achieved by:
and adjusting the storage address of the user data area according to the user data area parameters in the updated partition table so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area.
The user data area parameters are acquired when the terminal device updates the partition table. The acquisition modes of the user data area parameters include, but are not limited to: user input data are collected, and preset default parameters are obtained.
When the terminal acquires the parameters of the user data area by acquiring the user input data, the number of divisions input by the user, the start address and the storage capacity corresponding to each divided new user data area may be acquired. The dividing number indicates that the whole storage area of the user data area before upgrading needs to be divided into a plurality of user data areas.
Illustratively, the user data area parameters include a start address and a storage capacity of the user data area. When updating the partition table, the terminal device acquires and stores the number of divisions of the user data area, the start address, and the storage capacity input by the user in response to the prompt information prompting the user to input the user data area parameters.
When the terminal obtains the parameters of the user data area by obtaining the preset default parameters, the number of divisions of the preset user data area, the starting address and the storage capacity of each divided new user data area can be directly obtained.
Illustratively, when updating the partition table, the terminal device 200 may directly obtain the number of divisions of the user data area, the start address and the storage capacity of each divided new user data area according to the preset data, to obtain the updated partition table.
Fig. 4 is a schematic diagram showing a user data area divided into two at the time of program update according to an embodiment of the present application. As shown in fig. 4, after upgrading the BOOT area, the kernel area, the ROOTFS area, and the partition table according to the program upgrade package, the terminal device 200 adjusts the partition positions according to the new partition table, so that the user data area before upgrading can be divided into two parts, thereby obtaining the user data area 1 and the user data area 2. It can be understood that, the division of the user data area before upgrading into two in fig. 4 is merely illustrative, and the program upgrading method provided in the embodiment of the present application may also divide the user data area before upgrading into more user data areas, and fig. 4 does not constitute a limitation on the technical solution provided in the embodiment of the present application.
It can be understood that the program upgrading method provided in this embodiment is also suitable for multiple upgrades of terminal devices in a backup area where no user data area is set. If the user data area of the flash memory is already divided into two or more partitions during the previous upgrade of the terminal device, the user data area of the flash memory is still divided into a target user data area and at least one backup user data area according to the updated partition table of the upgrade during the upgrade: if the user data area parameter of the updated partition table is unchanged compared with the user data area parameter of the previous upgrade, the target user data area and at least one backup user data area obtained by the upgrade are consistent with the upgrade of the previous time; if the user data area parameter of the updated partition table is changed compared with the previous upgrade, the target user data area and at least one backup user data area obtained by the upgrade are different from the last upgrade, that is, the user data area parameter is obtained according to the updated partition table of the upgrade, and the user data area of the terminal equipment is re-divided, so that a new target user data area and a new at least one backup user data area are obtained.
In some embodiments of the present application, when the user data area of the flash memory is divided into the target user data area and the at least one backup user data area according to the updated partition table, if it is determined that only one user data area exists in the updated partition table, alarm information is generated.
Illustratively, when the terminal device 200 divides the user data area of the flash memory into the target user data area and at least one backup user data area according to the updated partition table, it determines whether only one user data area exists in the updated partition table, and if it determines that only one user data area exists in the updated partition table, generates alert information to indicate a reminder. For example, a prompt message of "error, only in one user data area" is displayed.
Step S303, integrating the data of the target user data area and each backup user data area into a spliced file.
Illustratively, the terminal device 200 integrates the data of the target user data area and the respective backup user data areas into a splice file data.img. It is understood that the spliced files herein are merely examples, and other file types of spliced files are equally applicable to the embodiments of the present application. The following embodiments of the present application will all take the spliced file data.img as an example.
In some embodiments of the present application, the data of the target user data area and each backup user data area are integrated into a spliced file, specifically: and reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence.
Illustratively, the terminal device 200 continuously reads the partition data of the target user data area and each backup user data area according to the sequence of the storage addresses, and integrates the partition data into the spliced file data.
And step S304, writing the spliced files into the target user data area and each backup user data area respectively.
The backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal.
The terminal device writes the spliced file data.img into the target user data area and each backup user data area respectively, wherein the backup user data area enables normal starting of the program when the data of the target user data area is abnormal.
In some alternative embodiments, step S304, writing the spliced file into the target user data area and each backup user data area, respectively, as shown in fig. 5, may be implemented by the following steps:
In step S501, if the data in the target user data area and the backup user data area are different, the data in the target user data area and the backup user data area are erased respectively, and the spliced file is written into the target user data area and the backup user data area respectively.
The terminal device may mount the target user data area and each backup user data area to a preset target directory file and a plurality of backup directory files, so that the target directory file mounts the target user data area, and the plurality of backup directory files mount one backup user data area respectively, then select the backup directory files one by one according to the sequence of the storage addresses of the partitions corresponding to the directory files and compare the backup directory files with the data of the target directory files respectively, and if both the backup directory files are the same, determine that the data in the target user data area and the backup user data area are the same; and if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
When the program upgrading method provided by the embodiment of the application is used for upgrading the program of the terminal equipment which is not provided with the backup area of the user data area, the user data before upgrading is reserved through the target user data area, and the user data before upgrading is further backed up through each backup user data area. According to the program upgrading method, when the program is upgraded on the terminal equipment which is not provided with the backup area of the user data area, at least one backup user data area is arranged, so that the original user data is reserved and further backed up, the terminal equipment which is not provided with the backup area is enabled to obtain the backup area, and the data restorability of the terminal equipment is improved.
In an alternative embodiment, before determining that the data in the target user data area and the backup user data area are different in step S501, as shown in fig. 6, the method includes:
s601, mounting the data of the target user data area into a preset first catalog, and mounting the data of each backup user data area into a corresponding second catalog respectively.
Illustratively, the terminal device 200 mounts the data of the target user data area into a preset first directory a, and mounts the data of each backup user data area into a corresponding second directory B.
S602, judging whether the data in the target user data area and the backup user data area are the same or not by the following modes:
and detecting whether the data of the first catalogue and the second catalogue are identical or not according to any one of the second catalogues, and if so, determining that the data in the backup user data area corresponding to the target user data area and the second catalogue are identical.
Illustratively, the terminal device 200 determines whether the data in the target user data area and the backup user data area are the same by:
and detecting whether the data of the first catalog A and the second catalog B are identical for any one second catalog B, and if so, determining that the data in the backup user data area corresponding to the target user data area and the backup user data area corresponding to the second catalog B are identical.
In this embodiment, step S501, if the data in the target user data area and the backup user data area are different, respectively erasing and writing the data in the target user data area and the backup user data area into the spliced file, may be implemented by the following steps:
and S603, if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data mounted in the first catalogue and the second catalogues, and writing the data mounted in a third catalogue, wherein the third catalogue is a catalogue mounted with the spliced file.
For example, if the terminal device 200 determines that the data in the target user data area and the backup user data area are different, the data mounted in the first directory a and the second directory B are erased respectively, and the data mounted in the third directory C is written, where the third directory C is a directory mounted with the spliced file data.
In other embodiments, the terminal device 200 may record the number of times of mounting the backup user data area to the second directory B after the power-down restart and the kernel start of the current program upgrade by using a counter, and when determining that the data mounted to the target user data area is different from the data mounted to the backup user data area, if the number of times of mounting the backup user data area to the second directory B is greater than a preset threshold, for example, the preset threshold is 2, only erase the data mounted to the second directory, and write the data mounted to the third directory to the partition mounted to the second directory. The embodiment can control the number of times of erasing and writing data of the first catalog.
In another embodiment, the program upgrade process, as shown in FIG. 7, performs the following steps:
step S701, in response to a received program upgrade instruction input by a user, downloading an upgrade data packet.
Step S702, according to the upgrade data packet, updating the version file partition and partition table contained in the flash memory.
Wherein the version file partition comprises: BOOT area, kernel area, ROOTFS area.
Specifically, when the partition table is updated, the user data parameters are acquired.
In step S703, the flash memory is powered down in response to the power-down restart instruction.
Step S704, dividing the user data area of the flash memory into a target user data area and a backup user data area according to the updated partition table.
Specifically, according to the user data area parameters in the updated partition table, the storage address of the user data area is adjusted to divide the user data area of the flash memory into a target user data area and a backup user data area.
Optionally, the number of backup user data areas is a plurality.
In step S705, it is determined that only one user data area exists in the updated partition table. If yes, go to step S711; if not, go to step S706.
Step S706, the partition contents of the target user data area and the backup user data area are continuously read, and a spliced file is formed and stored in the memory.
In step S707, the target user data area is mounted in the first directory, the backup user data area is mounted in the second directory, and the spliced file is mounted in the third directory.
Step S708 checks whether the data in the first directory and the second directory exist and are the same. If yes, go to step S710; if not, step S709 is performed.
Step S709, copying the spliced file to the first directory and the second directory according to the third directory.
Step S710, deleting the spliced file corresponding to the third directory.
Illustratively, the terminal device 200 deletes the spliced file data.img corresponding to the third directory to save memory space.
Step S711, generating alarm information.
The specific process of each of steps S701 to S711 may be performed with reference to the method steps in the foregoing embodiments, and will not be described herein.
Based on the same inventive concept, the embodiment of the application also provides a program upgrading device. Because the device is a device corresponding to the program upgrading method provided by the embodiment of the application, and the principle of the device for solving the problem is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
Fig. 8 shows a schematic structural diagram of a program upgrading device provided in an embodiment of the present application, and as shown in fig. 8, the program upgrading device includes a program upgrading module 801, a data partitioning module 802, a data splicing module 803, and a data backup module 804.
The program upgrading module 801 is configured to respond to a received program upgrading instruction input by a user, and update a version file partition and a partition table contained in the flash memory according to an upgrading data packet;
a data partitioning module 802, configured to partition a user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table;
the data splicing module 803 is configured to integrate the data of the target user data area and each backup user data area into a spliced file;
the data backup module 804 is configured to write the spliced file into the target user data area and each backup user data area respectively; wherein the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal.
In an alternative embodiment, data partitioning module 802 is specifically configured to:
and adjusting the storage address of the user data area according to the user data area parameters in the updated partition table so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area.
In an alternative embodiment, the data stitching module 803 is specifically configured to:
And reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence.
In an alternative embodiment, data backup module 804 is specifically configured to:
and if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
In an alternative embodiment, as shown in fig. 9, the apparatus further includes a data mounting module 901, configured to:
mounting the data of the target user data area into a preset first catalogue, and mounting the data of each backup user data area into a corresponding second catalogue respectively;
the data backup module 804 is specifically configured to:
for any one second catalogue, detecting whether the data of the first catalogue and the second catalogue are the same, if so, determining that the data in the backup user data area corresponding to the target user data area and the second catalogue are the same;
respectively erasing the data mounted in the first catalogue and each second catalogue, and writing the data mounted in the third catalogue;
The data mounting module 901 is further configured to mount the third directory and the spliced file.
The embodiment of the application also provides electronic equipment based on the same inventive concept as the embodiment of the method. The electronic device may be used for program upgrades. In one embodiment, the electronic device is a terminal device, such as terminal device 200 in FIG. 1. In this embodiment, the electronic device may be configured as shown in fig. 10, including a memory 101, a communication module 103, and one or more processors 102. The memory 101 is a flash memory.
A memory 101 for storing a computer program for execution by the processor 102. The memory 101 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, a program required for running an instant messaging function, and the like; the storage data area can store various instant messaging information, operation instruction sets and the like.
The memory 101 may be a volatile memory (RAM) such as a random-access memory (RAM); the memory 101 may also be a non-volatile memory (non-volatile memory), such as a read-only memory, a flash memory (flash memory), a Hard Disk Drive (HDD) or a Solid State Drive (SSD), or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 101 may be a combination of the above memories.
The processor 102 may include one or more central processing units (central processing unit, CPU) or digital processing units, etc. A processor 102 for implementing the program upgrade method when calling the computer program stored in the memory 101.
The communication module 103 is used for communicating with the terminal device and other servers.
The specific connection medium between the memory 101, the communication module 103, and the processor 102 is not limited in the embodiments of the present application. In the embodiment of the present application, the memory 101 and the processor 102 are connected through the bus 104 in fig. 10, the bus 104 is shown with a thick line in fig. 10, and the connection manner between other components is only schematically illustrated, but not limited to. The bus 104 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one thick line is shown in fig. 10, but not only one bus or one type of bus.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device executes the program upgrading method in the above-described embodiment. The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application.

Claims (5)

1. A program upgrade method, comprising:
responding to a received program upgrading instruction input by a user, and updating version file partitions and partition tables contained in the flash memory according to an upgrading data packet;
dividing a user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table; the flash memory comprises a plurality of preset partitions for storing program data of a program; the plurality of preset partitions comprise the version file partition, the partition table and the user data area for storing user data; the partition table is used for determining the storage position of each preset partition;
integrating the data of the target user data area and the data of each backup user data area into a spliced file;
writing the spliced files into the target user data area and each backup user data area respectively; wherein the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal;
The dividing the user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partition table includes:
according to the user data area parameters in the updated partition table, the storage address of the user data area is adjusted so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area; the user data area parameters are obtained when the terminal equipment updates the partition table; the method for acquiring the user data area parameters comprises the steps of acquiring user input data; acquiring the user data area parameters through the acquired user input data, wherein the user data area parameters comprise the acquired user input dividing number, the starting address and the storage capacity corresponding to each divided new user data area;
integrating the data of the target user data area and the data of each backup user data area into a spliced file, wherein the method comprises the following steps:
reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence;
the writing the spliced file into the target user data area and each backup user data area respectively includes:
And if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
2. The method of claim 1, further comprising, prior to said determining that the data in the target user data area and the backup user data area are different:
mounting the data of the target user data area into a preset first catalogue, and mounting the data of each backup user data area into a corresponding second catalogue respectively;
judging whether the data in the target user data area and the backup user data area are the same or not by the following modes:
for any one of the second directories, detecting whether the data of the first directory and the second directory are the same, and if so, determining that the data in the backup user data area corresponding to the target user data area and the second directory are the same;
the step of respectively erasing and writing the data of the target user data area and the backup user data area into the spliced file comprises the following steps:
And respectively erasing the data mounted in the first catalogue and each second catalogue, and writing the data mounted in a third catalogue, wherein the third catalogue is a catalogue mounted with the spliced file.
3. A program upgrade apparatus, comprising:
the program upgrading module is used for responding to a received program upgrading instruction input by a user and updating a version file partition and a partition table contained in the flash memory according to an upgrading data packet;
the data partitioning module is used for partitioning the user data area of the flash memory into a target user data area and at least one backup user data area according to the updated partitioning table; the flash memory comprises a plurality of preset partitions for storing program data of a program; the plurality of preset partitions comprise the version file partition, the partition table and the user data area for storing user data; the partition table is used for determining the storage position of each preset partition;
the data splicing module is used for integrating the data of the target user data area and the data of each backup user data area into a spliced file;
the data backup module is used for writing the spliced files into the target user data area and each backup user data area respectively; wherein the backup user data area is used for enabling the program to be started normally when the data of the target user data area is abnormal;
The data partitioning module is specifically configured to:
according to the user data area parameters in the updated partition table, the storage address of the user data area is adjusted so as to divide the user data area of the flash memory into a target user data area and at least one backup user data area; the user data area parameters are obtained when the terminal equipment updates the partition table; the method for acquiring the user data area parameters comprises the steps of acquiring user input data; acquiring the user data area parameters through the acquired user input data, wherein the user data area parameters comprise the acquired user input dividing number, the starting address and the storage capacity corresponding to each divided new user data area;
the data splicing module is specifically configured to:
reading data from the target user data area and each backup user data area according to the sequence of the storage addresses, and integrating the data into a spliced file based on the read sequence;
the data backup module is specifically configured to:
and if the data in the target user data area and the data in the backup user data area are different, respectively erasing the data in the target user data area and the data in the backup user data area, and respectively writing the spliced file into the target user data area and the backup user data area.
4. A computer-readable storage medium having a computer program stored therein, characterized in that: the computer program, when executed by a processor, implements the method of any of claims 1-2.
5. An electronic device comprising a flash memory and a processor, the flash memory having stored thereon a computer program executable on the processor, the computer program, when executed by the processor, implementing the method of any of claims 1-2.
CN202110604261.4A 2021-05-31 2021-05-31 Program upgrading method, device, medium and electronic equipment Active CN113495746B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110604261.4A CN113495746B (en) 2021-05-31 2021-05-31 Program upgrading method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110604261.4A CN113495746B (en) 2021-05-31 2021-05-31 Program upgrading method, device, medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113495746A CN113495746A (en) 2021-10-12
CN113495746B true CN113495746B (en) 2024-02-02

Family

ID=77997251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110604261.4A Active CN113495746B (en) 2021-05-31 2021-05-31 Program upgrading method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113495746B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176824A (en) * 2013-03-15 2013-06-26 青岛海信移动通信技术股份有限公司 System upgrade method and system upgrade device
CN103500128A (en) * 2013-09-30 2014-01-08 上海斐讯数据通信技术有限公司 NVRAM data backup method
WO2014161339A1 (en) * 2013-08-12 2014-10-09 中兴通讯股份有限公司 Firmware upgrade method and device
EP3046026A1 (en) * 2013-09-13 2016-07-20 Huizhou TCL Mobile Communication Co., Ltd. Software upgrade method and system for mobile terminal
CN107656745A (en) * 2017-08-28 2018-02-02 深圳市金立通信设备有限公司 A kind of data processing method, terminal and computer-readable medium
CN109002317A (en) * 2018-06-27 2018-12-14 上海有个机器人有限公司 A kind of PCBA firmware upgrade method and system, PCBA
CN111142907A (en) * 2019-12-25 2020-05-12 声耕智能科技(西安)研究院有限公司 Partition upgrading method for off-line keyword recognition system
CN111913835A (en) * 2020-07-30 2020-11-10 深圳忆联信息系统有限公司 Data multi-backup storage method and device based on cross mapping, computer equipment and storage medium
CN112328287A (en) * 2020-11-24 2021-02-05 杭州海康威视数字技术股份有限公司 Embedded equipment system updating method, device, equipment and storage medium
CN112788118A (en) * 2020-12-30 2021-05-11 宁波奥克斯电气股份有限公司 Wi-Fi module, intelligent home equipment and intelligent home system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100608012B1 (en) * 2004-11-05 2006-08-02 삼성전자주식회사 Method and apparatus for data backup
US11210173B2 (en) * 2018-05-09 2021-12-28 Microsoft Technology Licensing, Llc Fault tolerant device upgrade

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176824A (en) * 2013-03-15 2013-06-26 青岛海信移动通信技术股份有限公司 System upgrade method and system upgrade device
CN106293848A (en) * 2013-03-15 2017-01-04 青岛海信移动通信技术股份有限公司 A kind of method and device of system upgrade
WO2014161339A1 (en) * 2013-08-12 2014-10-09 中兴通讯股份有限公司 Firmware upgrade method and device
EP3046026A1 (en) * 2013-09-13 2016-07-20 Huizhou TCL Mobile Communication Co., Ltd. Software upgrade method and system for mobile terminal
CN103500128A (en) * 2013-09-30 2014-01-08 上海斐讯数据通信技术有限公司 NVRAM data backup method
CN107656745A (en) * 2017-08-28 2018-02-02 深圳市金立通信设备有限公司 A kind of data processing method, terminal and computer-readable medium
CN109002317A (en) * 2018-06-27 2018-12-14 上海有个机器人有限公司 A kind of PCBA firmware upgrade method and system, PCBA
CN111142907A (en) * 2019-12-25 2020-05-12 声耕智能科技(西安)研究院有限公司 Partition upgrading method for off-line keyword recognition system
CN111913835A (en) * 2020-07-30 2020-11-10 深圳忆联信息系统有限公司 Data multi-backup storage method and device based on cross mapping, computer equipment and storage medium
CN112328287A (en) * 2020-11-24 2021-02-05 杭州海康威视数字技术股份有限公司 Embedded equipment system updating method, device, equipment and storage medium
CN112788118A (en) * 2020-12-30 2021-05-11 宁波奥克斯电气股份有限公司 Wi-Fi module, intelligent home equipment and intelligent home system

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Publisher: IEEE Cite This PDF;Kun-Ru Wu;《IEEE Journal on Selected Areas in Communications ( Volume: 36, Issue: 3, March 2018)》;411 - 421 *
分区隐藏与数据恢复技术;阳辉;《西部经济管理论坛 》;53-56 *
基于双备份的兆易创新GD32程序升级方案研究;曹玉保;《中国集成公路》;1-4 *
智能卡操作系统及其bootloader的研究与实现;周成冲;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;I135-242 *
网络电视差分升级系统的设计与实现;王丛华;《万方》;1-67 *

Also Published As

Publication number Publication date
CN113495746A (en) 2021-10-12

Similar Documents

Publication Publication Date Title
CN107870968B (en) Performing real-time updates to a file system volume
US9507604B2 (en) Boot method and boot system
JP5113700B2 (en) Firmware update apparatus and method
US20120096252A1 (en) Preparing and preserving a system configuration during a hot upgrade
JP5821393B2 (en) Information processing apparatus, activation method, program
KR20090060774A (en) Apparatus and method for mirroring firmware and data of the embedded system
WO2017185954A1 (en) Method, host, and system for implementing usb device management
CN108345477B (en) Design method and device for sharing conf partition file by double images
US20180095693A1 (en) Information processing apparatus, information processing system, and method for controlling information processing apparatus
CN105824678A (en) Method and device for installing operating system
US20140372560A1 (en) Maintaining system firmware images remotely using a distribute file system protocol
CN104866324A (en) Method for constructing portable operating system and portable memorizer
CN110297726B (en) Computer system with serial presence detection data and memory module control method
CN111796882A (en) Electronic equipment system processing method and device and electronic equipment
CN111399936A (en) BMC customization method, system, equipment and readable storage medium
CN114780019A (en) Electronic device management method and device, electronic device and storage medium
CN113495746B (en) Program upgrading method, device, medium and electronic equipment
US8407460B1 (en) System and method for a software application to determine if the storage device and the operating system is an internal drive or an external drive
US20170357657A1 (en) Systems and methods for implementing dynamic file systems
US9298602B2 (en) Nonvolatile random access memory use
US7234039B1 (en) Method, system, and apparatus for determining the physical memory address of an allocated and locked memory buffer
CN109697077B (en) Method, device and equipment for starting hard disk firmware
KR20170037017A (en) Memory Upgrade System And Method
US9971532B2 (en) GUID partition table based hidden data store system
CN114020308A (en) Camera equipment upgrading method, device, equipment and 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