Data migration methods, apparatus, equipment and media
By setting up an extended sub-area in the firmware storage, data can be directly migrated to the extended sub-area according to the migration method indicated by the target firmware. This solves the problems of low data migration efficiency, poor security, and high cost during firmware upgrades, and achieves efficient, secure, and low-cost data migration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GOLDCARD HIGH TECH
- Filing Date
- 2024-12-30
- Publication Date
- 2026-06-30
AI Technical Summary
Existing technologies suffer from low data migration efficiency, poor security, and high costs during firmware upgrades. This is especially true when there are many firmware versions, as the migration and conversion code becomes larger and hardware storage usage increases. Furthermore, data migration methods that rely on external tools suffer from poor security and high development costs.
An extended sub-area is set in the memory of each firmware. By obtaining the parameter information of the target firmware, a preset operation is performed according to the migration method indicated by the target firmware to directly migrate the data to the extended sub-area, avoiding the process of data migration out and back, and realizing efficient data migration and parameter attribute update.
It improves data migration efficiency, reduces the size of the target firmware, enhances security and convenience, reduces development costs, and ensures stable system operation after firmware updates.
Smart Images

Figure CN122308706A_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and more particularly to a data migration method, apparatus, device, and medium. Background Technology
[0002] Firmware-dependent systems often use multiple firmware versions. For each firmware version, multiple service partitions are set up in its memory to store data with consistent parameter attributes. These parameter attributes include service functions and storage frequency.
[0003] To cope with changes in the environment and requirements, firmware sometimes needs to be upgraded. Understandably, firmware upgrades change the attributes of some parameters, which may lead to data shifts in various business partitions. Therefore, data migration is necessary after a firmware upgrade to ensure the normal operation of firmware-dependent systems. Currently, known technologies propose copying stored data before firmware upgrades using cloud services or host computer software, and then writing it back to the corresponding storage after the upgrade. Specifically, when rewriting the stored data into the corresponding storage, it must conform to the data format and processing requirements of the new firmware version.
[0004] The above process involves reading, copying, and rewriting stored data, which results in inefficiency. Summary of the Invention
[0005] This application provides a data migration method, apparatus, device, and medium to efficiently complete data migration after firmware upgrade.
[0006] In a first aspect, this application provides a data migration method applied to a system that uses at least one firmware for any application, wherein the system has at least one extended sub-region in the memory corresponding to each firmware; the method includes:
[0007] After the system is powered on, if any firmware is updated to the corresponding target firmware, the target parameter information indicated by the target firmware is obtained; the target parameter information includes target parameter attributes of each of the extended sub-areas and each service sub-area, and the target parameter attributes include at least one of service function, storage frequency, and length;
[0008] When the target parameter information is inconsistent with the parameter information indicated by the firmware, at least one of the preset operations is performed according to the migration method indicated by the target firmware; the preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
[0009] In another possible implementation, the parameter information includes parameter attributes; the step of performing at least one of the preset operations according to the migration method indicated by the target firmware when the target parameter information is inconsistent with the parameter information indicated by the firmware includes:
[0010] When at least one target parameter attribute of any business sub-region is inconsistent with the corresponding parameter attribute, the operation of reading the partition data of the corresponding business sub-region and migrating it to the corresponding extended sub-region is performed according to the migration method.
[0011] In another possible implementation, the operation of reading the partition data of the corresponding business sub-region and migrating it to the corresponding extended sub-region according to the migration method includes:
[0012] The attribute change method is determined based on the migration method; the attribute change method is used to change the attributes of the partition data of the business sub-region.
[0013] The partition data is read from the business sub-area, and the partition data after being changed according to the attribute change method is migrated to the target extended sub-area. The parameter attributes of the target extended sub-area are consistent with the parameter attributes of the changed partition data.
[0014] In another possible implementation, the method further includes:
[0015] If there exists an extended sub-region with the same parameter attributes as the modified partition data and has free space, then the extended sub-region is determined to be the target extended sub-region.
[0016] Otherwise, the operation of updating the parameter attributes of the corresponding extended sub-region is performed, and the corresponding extended sub-region is determined as the target extended sub-region; the corresponding extended sub-region is an extended sub-region whose parameter attribute is the default initial value.
[0017] In another possible implementation, the target parameter information further includes the number of used target extended sub-regions, and the parameter information includes parameter attributes and the number of used extended sub-regions; when the target parameter information is inconsistent with the parameter information indicated by the firmware, performing at least one of the preset operations according to the migration method indicated by the target firmware includes:
[0018] When the number of used target extended sub-regions is greater than the number of used extended sub-regions, the operation of updating the parameter attributes of the corresponding extended sub-regions is performed according to the new parameter attributes indicated by the migration method;
[0019] When the number of used sub-regions in the target extended sub-region is less than the number of used extended sub-regions, the operation of restoring the sub-region data of the corresponding extended sub-region and updating the parameter attributes of the corresponding extended sub-region is performed according to the deletion parameter attribute indicated by the migration method; wherein, the corresponding extended sub-region in the operation of updating the parameter attributes of the corresponding extended sub-region is an extended sub-region whose parameter attributes are consistent with the deletion parameter attributes;
[0020] When the number of used sub-regions in the target extended sub-region is consistent with the number of used extended sub-regions, and the target parameter attribute is consistent with the parameter attribute, the operation of restoring the sub-region data of the corresponding extended sub-region is performed according to the migration method, where the corresponding extended sub-region is any extended sub-region.
[0021] In another possible implementation, the method further includes:
[0022] After performing the operation of reading the partition data of the corresponding business sub-area and migrating it to the corresponding extended sub-area, the target sub-area following the corresponding business sub-area is moved forward.
[0023] In another possible implementation, the method further includes:
[0024] After the system is powered on, for each firmware, if the parameter attributes of each service sub-area and each extended sub-area are not initialized, the parameter attributes of each service sub-area are initialized according to the parameter attributes indicated by the firmware, so that each service sub-area corresponds to a parameter attribute, and the parameter attributes of each extended sub-area are initialized according to the parameter attributes indicated by the firmware and / or the default initial value.
[0025] If the parameter attributes of each of the service sub-regions and each of the extended sub-regions have been initialized, then the partition data of each of the service sub-regions is restored, and when the firmware is updated to the target firmware, it is determined whether the target parameter information indicated by the target firmware is consistent with the parameter information indicated by the firmware.
[0026] Secondly, this application provides a data migration apparatus for use in a system that has at least one firmware for any application, wherein the system has at least one extended sub-region in the memory corresponding to each firmware; the apparatus includes:
[0027] The acquisition module is used to acquire target parameter information indicated by the target firmware when any firmware is updated to the corresponding target firmware; the target parameter information includes target parameter attributes of each of the extended sub-regions and each service sub-region, and the target parameter attributes include at least one of service function, storage frequency, and length;
[0028] The migration module is used to perform at least one of the preset operations according to the migration method indicated by the target firmware when the target parameter information is inconsistent with the parameter information indicated by the firmware; the preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
[0029] Thirdly, this application provides an electronic device, including: at least one processor and a memory;
[0030] The memory stores computer-executed instructions;
[0031] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any of the first aspects above.
[0032] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a central processing unit, are used to implement the method described in any of the first aspects above.
[0033] Fifthly, this application provides a computer program product, including a computer program that, when executed by a central processing unit, implements the method described in any of the first aspects.
[0034] This application provides a data migration method, apparatus, device, and medium. The method is applied to any system that uses at least one firmware, where each firmware's corresponding memory has at least one extended sub-region. Specifically, in the method, when any firmware is updated to a target firmware, target parameter attributes indicated by the target firmware are obtained. If the target parameter attributes are inconsistent with the parameter attributes indicated by the firmware before the update, at least one of preset operations is performed according to the migration method indicated by the target firmware. Through this method, after a firmware update, when data migration is required, the data to be migrated can be directly migrated to the corresponding extended sub-region. This process only involves data reading and does not involve data migration out and back, thereby effectively improving data migration efficiency and reducing the size of the target firmware. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0036] Figure 1 This is a schematic diagram illustrating an application scenario of a data migration method provided in an embodiment of this application;
[0037] Figure 2 A flowchart illustrating a data migration method provided in this application embodiment. Figure 1 ;
[0038] Figure 3 A flowchart illustrating a data migration method provided in this application embodiment. Figure 2 ;
[0039] Figure 4 A flowchart illustrating a data migration method provided in this application embodiment. Figure 3 ;
[0040] Figure 5 A process example diagram of a data migration method provided in an embodiment of this application;
[0041] Figure 6 This is a schematic diagram of the structure of a data migration device provided in an embodiment of this application;
[0042] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0043] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0044] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0045] In today's booming Internet of Things (IoT) era, all sorts of IoT devices are permeating people's lives and production scenarios, from smart locks and cameras in smart homes to smart sensors and automation controllers in the industrial field. Many of these are firmware-dependent systems. These systems often use multiple firmware components working together to support complex and ever-changing functional requirements.
[0046] Understandably, firmware-dependent systems often require the collection and storage of large amounts of data during application, which is crucial for the system's normal operation and data analysis. Specifically, firmware-dependent systems set up multiple service partitions in the memory of each firmware file to store data with consistent parameter attributes. These parameter attributes include service functions and storage frequency.
[0047] Understandably, firmware upgrades are sometimes necessary to address changes in the environment and requirements. However, firmware upgrades often present several challenges, one of the most prominent being data loss or data format incompatibility caused by changes in parameter attributes. This is because firmware upgrades involve updating the device's internal control software, and the upgraded firmware may differ from the previous one in terms of data processing logic and parameter settings. For example, if the upgraded firmware uses a new data storage format, data stored in the old format may not be correctly recognized and read, leading to data incompatibility issues. Alternatively, adjustments to certain critical storage parameters during the firmware upgrade process, if not handled properly, could result in data loss, affecting normal device operation and subsequent data utilization.
[0048] To address the aforementioned issues, known technologies have proposed data migration and conversion methods based on firmware version numbers. Specifically, after a firmware upgrade, upon its first run, the firmware version number is used as an identifier to perform data content migration and conversion operations. In other words, the device can identify which old version it upgraded from (by the firmware version number), and then, according to pre-defined rules for changes between different versions, process the stored data accordingly to ensure it conforms to the data format and processing requirements of the new firmware version. For example, if the old firmware version stores sensor-collected data in a simple text format, while the new firmware version requires structured database table format storage, then upon first run, the corresponding migration and conversion process will extract the text-formatted data, organize it, and store it in the new database table structure, ensuring the data remains intact and usable in the new firmware environment.
[0049] Known technologies also propose using cloud services or host computer software for data backup and write-back. Specifically, before performing a firmware upgrade, the data stored internally on the device is copied out using cloud services (if the device supports internet connectivity and interacts with a cloud platform, like many smart home appliances that can upload data to a corresponding cloud server for storage) or host computer software (for example, some industrial IoT devices can connect to specific computer management software) to create a backup. After the firmware upgrade is complete, the backed-up data is written back to the device using the same method (cloud service write-back or host computer software write-back). This can minimize the risk of data loss due to unexpected situations during the firmware upgrade process, ensuring data integrity and the device's subsequent normal use of the data.
[0050] In the first approach described above, since firmware version numbers are used as identifiers, conversion can be performed quickly when the number of versions is small. However, when the number of versions is large, it leads to increased migration and conversion code size, increased hardware storage usage, and longer conversion time. In the second approach, data migration and conversion rely on external tools, resulting in lower convenience. Furthermore, this approach requires the complete design and development of data exchange services (devices and host computers), increasing development costs. Additionally, since some critical data is migrated externally during operation, security is compromised, and there is a risk of modification.
[0051] Therefore, there is an urgent need for a data migration method that is efficient, secure, and cost-effective. This application provides a data migration method, apparatus, device, and medium. Specifically, in the method of this application, at least one extended sub-region is set in the memory corresponding to each firmware. Based on this, when any firmware is updated to the corresponding target firmware, and the target parameter information and parameter information indicated by the target firmware are inconsistent, at least one of the preset operations is executed according to the migration method indicated by the target firmware to complete the data migration when there is a data migration requirement.
[0052] The method described in this application enables the migration of partition data in extended sub-regions as needed after firmware updates, and / or the migration of partition data from corresponding service sub-regions to corresponding extended sub-regions, and / or the updating of parameter attributes in corresponding extended sub-regions. This allows for efficient data migration without involving the inflow or outflow of partition data. Furthermore, it enables the updating of parameter attributes in corresponding extended sub-regions as needed, allowing them to store data related to newly added parameters.
[0053] Furthermore, the method in this application does not involve migrating partitioned data to external storage space, thereby effectively improving security and convenience.
[0054] It is understood that the data migration method of this application can be performed by any electronic device and can be applied to any system that needs to be upgraded with firmware. Figure 1 This is a schematic diagram illustrating an application scenario of a data migration method provided in an embodiment of this application, such as... Figure 1 As shown, the method of this application can be applied to an Internet of Things (IoT) system. Specifically, the IoT system is connected to an electronic device, and the IoT system uses at least one firmware. Using the method of this application, when any firmware is updated to the corresponding target firmware, the electronic device obtains the target parameter information indicated by the target firmware. If the target parameter information is inconsistent with the parameter information indicated by the firmware, it performs at least one of the preset operations according to the migration method indicated by the target firmware, thereby achieving efficient data migration.
[0055] It is understood that electronic devices can be set up independently of an IoT system or integrated into an IoT system, and this application does not limit this. When electronic devices are set up independently, in addition to the aforementioned IoT system, they can also connect to other firmware-dependent systems to achieve efficient data migration when any of their firmware is updated, and this application does not limit this either.
[0056] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Where the embodiments do not conflict, the following embodiments and features thereof can be combined with each other.
[0057] It is worth emphasizing that the method of this application is applicable to any system that has applied at least one firmware, and the system has at least one extended sub-area in the memory corresponding to each firmware. In this application, the extended sub-area is used to store newly added parameters generated when the firmware version changes, or to take over the partition data in the service sub-area where the parameter attributes have changed.
[0058] Based on this, this application provides a data migration method. Figure 2 A flowchart illustrating a data migration method provided in this application embodiment. Figure 1 ,like Figure 2 As shown, the method provided in this embodiment includes:
[0059] S201: After the system is powered on, if any firmware is updated to the corresponding target firmware, the target parameter information indicated by the target firmware is obtained.
[0060] The target parameter information includes target parameter attributes for each extended sub-area and each service sub-area. The target parameter attributes include at least one of the following: service function, storage frequency, and length.
[0061] It is understandable that in practical applications, due to various needs, it is sometimes necessary to restore from the current firmware version to a historical firmware version. Therefore, in this embodiment, the target firmware is not limited to a single point; it can be a new firmware version pointed to by the firmware update process, used to upgrade and expand device functions and optimize performance; or it can be an older firmware version, meeting the user's need to roll back the system under specific circumstances.
[0062] In this embodiment, for each firmware corresponding to the memory, in addition to the extended sub-area, at least one service sub-area is also set, and each service sub-area is used to store partition data of a parameter attribute.
[0063] Understandably, the target firmware carries target parameter attributes to accurately transmit parameter settings for each service sub-area and extended sub-area to the system, ensuring that all parts of the system can coordinate and adapt to the target firmware for efficient operation. Specifically, in this embodiment, the target parameter attributes include service function, storage frequency, and length, meaning that each service sub-area or each extended sub-area is used to store service data with consistent service function, storage frequency, and length.
[0064] Furthermore, in this embodiment, after the system is powered on, each memory is first initialized to store a corresponding firmware. For each firmware, it is first determined whether the parameters of each sub-region have been initialized.
[0065] If the parameter attributes of each service sub-area and each extended sub-area are not initialized, the parameter attributes of each service sub-area are initialized according to the parameter attributes indicated by the firmware, so that each service sub-area corresponds to one parameter attribute, and the parameter attributes of each extended sub-area are initialized according to the parameter attributes indicated by the firmware and / or the default initial values.
[0066] It is understandable that when some extended sub-regions are enabled in the current firmware, those extended sub-regions have corresponding parameter attributes; for inactive extended sub-regions, their corresponding parameter attributes are empty. When no extended sub-regions are enabled in the current firmware, the parameter attributes of all extended sub-regions are empty. When all extended sub-regions are enabled in the current firmware, all extended sub-regions have corresponding non-empty parameter attributes. Therefore, in this embodiment, the parameter attributes of each extended sub-region are specifically initialized according to the parameter attributes indicated by the firmware and / or the default initial values.
[0067] If the parameter attributes of each service sub-area and each extended sub-area have been initialized and processed, then restore the partition data of each service sub-area, and when the firmware is updated to the target firmware, determine whether the target parameter information indicated by the target firmware is consistent with the parameter information indicated by the firmware.
[0068] In this embodiment, once the parameter attributes of each partition have been initialized, the electronic device retrieves the partition data of each service sub-region from the system's backup storage area. Further, the electronic device determines whether the target parameter attributes indicated by the target firmware are consistent with the parameter attributes indicated by the firmware, in order to determine whether a parameter migration operation is required.
[0069] During the above process, the electronic device initializes itself promptly when the system is powered on and restores the partition data of each service sub-area in a timely manner, so that when the firmware is upgraded to the target firmware, the data migration can be completed in a timely manner, thereby maintaining the normal operation of the system.
[0070] S202, when the target parameter information is inconsistent with the parameter information indicated by the firmware, perform at least one of the preset operations according to the migration method indicated by the target firmware; the preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
[0071] In this embodiment, when the electronic device obtains the target parameter information, it compares the target parameter information with the parameter information indicated by the current firmware. If the two are inconsistent, it indicates that the configuration after the firmware update differs from the original setting, and targeted processing is required to ensure stable system operation.
[0072] Specifically, as can be seen from the above, when at least one of the service functions, storage frequency, and length of any service sub-area or extended sub-area indicated by the target firmware in the electronic device is inconsistent with at least one of the service functions, storage frequency, and length of the corresponding service sub-area or extended sub-area indicated by the current firmware, it is determined that the target parameter information is inconsistent with the parameter information indicated by the firmware.
[0073] Based on this, in this embodiment, the target firmware, in addition to carrying target parameter attributes, also carries corresponding migration methods. These migration methods are used to instruct at least one of the preset operations based on the target parameter attributes. It is understood that different migration methods will correspond to different changes in the target parameter attributes compared to the parameter attributes; these are set by the user when writing the target firmware.
[0074] In this embodiment, multiple extended sub-regions are provided within the memory. As mentioned above, these extended sub-regions are only enabled when the firmware version changes. Therefore, it is understandable that the default initial value of each extended sub-region is empty.
[0075] Based on this, when the target parameter attribute is inconsistent with the parameter attribute, the electronic device performs at least one of the preset operations according to the corresponding migration method. Specifically, it can be described as follows: when at least one parameter attribute of any service sub-area is inconsistent with the corresponding parameter attribute, the electronic device performs the operation of reading the partition data of the service sub-area and migrating it to the corresponding extended sub-area according to the corresponding migration method.
[0076] Specifically, the corresponding extended sub-region is an extended sub-region whose target parameter attributes are consistent with those of the business sub-region. After migrating the partition data of the business sub-region to the corresponding extended sub-region, if the parameter attributes corresponding to the corresponding extended sub-region are at their default initial values, then the parameter attributes of the corresponding extended sub-region are updated to the target parameter attributes; that is, the operation of updating the parameter attributes of the corresponding extended sub-region is performed. If the parameter attributes corresponding to the corresponding extended sub-region are the target parameter attributes, then the operation of updating the parameter attributes of the corresponding extended sub-region does not need to be performed.
[0077] Understandably, when the system applies the current firmware, at least one extended sub-region may already be enabled. Therefore, when the electronic device performs data migration, it needs to restore the sub-region data of the corresponding extended sub-region to retrieve the partition data of each enabled extended sub-region from the backup storage area. Furthermore, upon system power-on, when the electronic device performs at least one of the preset operations according to the migration method indicated by the target firmware, it also needs to retrieve the sub-region data of each service sub-region from the backup storage area to ensure normal system operation.
[0078] In the method provided in this embodiment, when any firmware is updated to the target firmware, the electronic device obtains the target parameter attributes indicated by the target firmware, and when the target parameter attributes are inconsistent with the parameter attributes indicated by the firmware before the update, it performs at least one of the preset operations according to the migration method indicated by the target firmware, thereby completing the migration of the data that needs to be migrated.
[0079] The method in this embodiment enables direct migration of partition data to the corresponding extended sub-region when data migration is required. This process involves only data reading and does not involve data migration out and back, thereby effectively improving data migration efficiency and reducing the size of the target firmware.
[0080] This application also provides an embodiment of a data migration method. Figure 3 A flowchart illustrating a data migration method provided in this application embodiment. Figure 2 This embodiment, based on the foregoing embodiments, provides a detailed explanation of the data migration process described in the foregoing embodiments. For example... Figure 3 As shown, the method in this embodiment includes:
[0081] S301, when at least one target parameter attribute in any business sub-region is inconsistent with the corresponding parameter attribute, the attribute change method shall be determined according to the migration method.
[0082] Among them, the attribute change method is used to change the attributes of the partition data in the business sub-area.
[0083] Specifically, the migration method is written by the firmware developer into the target firmware according to the firmware change objectives, and is used to indicate how to change attributes for each change. When at least one target parameter attribute of an electronic device in any service sub-area is inconsistent with the corresponding parameter attribute, the attribute change method for that service sub-area is determined according to the migration method indicated by the target firmware.
[0084] In this embodiment, the target firmware provides an attribute change method for each service sub-area change. Specifically, a unique identifier is assigned to each service sub-area with a parameter attribute change. When the parameter attribute of a service sub-area changes, the electronic device identifies the corresponding identifier and determines the unique attribute change method from the migration methods based on the identifier.
[0085] More specifically, the attribute change method is used to indicate that at least one of the service function, storage frequency, and length parameters in the service sub-area should be changed to at least one of the target parameter attributes. For example, if the firmware indicates that the parameter attributes of a service sub-area are: service function A, storage frequency B, and length C, and the target firmware indicates that the target parameter attributes of the service sub-area are: service function A, storage frequency B, and length c, then the attribute change method corresponding to the service sub-area in the target firmware is used to indicate that the length is changed from C to c.
[0086] S302, read partition data from the business sub-area, and migrate the partition data after the attribute change method to the target extended sub-area.
[0087] The parameter attributes of the target extended sub-region are consistent with the parameter attributes of the modified partition data.
[0088] In this embodiment, after determining the attribute change method, the electronic device reads all the partition data contained in the service sub-area, changes the corresponding parameter attributes according to the attribute change method, and finally migrates the changed partition data to the target extended sub-area.
[0089] Specifically, in the aforementioned example, after determining the attribute change method, the electronic device reads all the partition data contained in the service sub-area, changes the length of this partition data from C to c, and then stores this data according to the changed parameter attributes. For example, if the storage frequency corresponding to the service sub-area indicated by the firmware is B, and the storage frequency corresponding to the service sub-area indicated by the target widget is b, then the electronic device, according to the attribute change method indicated by the target firmware, after reading the partition data of the service sub-area, changes the storage frequency of this partition data to b and migrates it to the target extended sub-area.
[0090] Understandably, if there exists an extended sub-region with the same parameter attributes as the changed partition data and is available, then the extended sub-region is determined as the target extended sub-region; otherwise, the operation of updating the parameter attributes of the corresponding extended sub-region is performed, and the corresponding extended sub-region is determined as the target extended sub-region; the corresponding extended sub-region is an extended sub-region with any parameter attribute having a default initial value.
[0091] In this embodiment, when determining the target extended sub-region, the electronic device first checks whether there is an extended sub-region among the various extended sub-regions whose parameter attributes are consistent with the target parameter attributes. If such an extended sub-region exists and is idle, it is taken as the target extended sub-region. If no extended sub-region exists that matches the target parameter attributes, or if an extended sub-region exists but is not idle, the extended sub-region with other parameter attributes set to default initial values is taken as the target extended sub-region.
[0092] In the method provided in this embodiment, on the one hand, the electronic device can efficiently and accurately adapt to the diverse change requirements of different service sub-areas by means of the identification code and the preset migration method; on the other hand, by reasonably selecting the target extended sub-area, a suitable storage location is provided for the changed data, thereby ensuring that the data can be stably stored and transferred before and after the firmware update, and thus maintaining the stable operation of the system.
[0093] Furthermore, based on the aforementioned embodiments, as a preferred example, after the electronic device performs the operation of reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area, it moves the target sub-area after the corresponding service sub-area forward.
[0094] It is understandable that after the partition data of the corresponding service sub-area is migrated to the extended sub-area, the storage space corresponding to that service sub-area is empty. At this time, to save storage space and increase the flexibility of data storage, the electronic device can move the target sub-area located after the service sub-area forward, so as to flexibly utilize the various storage spaces in the memory. Specifically, the target sub-area includes the extended sub-area, or includes other service sub-areas and the extended sub-area. More specifically, the electronic device can move the target sub-area using any forward movement method; this embodiment does not limit this.
[0095] This application also provides an embodiment of a data migration method. Figure 4 A flowchart illustrating a data migration method provided in this application embodiment. Figure 3 This embodiment provides a supplementary explanation of the data migration process described in the previous embodiments.
[0096] It is worth noting that in this embodiment, the target parameter information also includes the number of used target extended sub-regions, and the parameter information also includes the number of used extended sub-regions, which are used to indicate the number of extended sub-regions enabled by the target firmware and the number of extended sub-regions enabled by the firmware, respectively. It is understood that the number of used extended sub-regions will increase when new parameters are added, or when partition data of a service sub-region needs to be migrated to a new extended sub-region.
[0097] It should be understood that if the method of this embodiment is executed based on the foregoing embodiment, then the case where the number of used targets in the extended sub-region is greater than the number of used extended sub-regions only includes the case of newly added parameters, in order to avoid repeatedly updating the parameter attributes of the corresponding extended sub-regions. If the method of this embodiment is executed only based on the first method embodiment, then the case where the number of used targets in the extended sub-region is greater than the number of used extended sub-regions can include two cases: newly added parameters or the need to migrate the partition data of the business sub-region to the new extended sub-region.
[0098] Based on this, this embodiment takes the execution based on the first method embodiment as an example to provide a detailed description of the data migration method. For example... Figure 4 As shown, the method in this embodiment includes:
[0099] S401, when the number of used target extended sub-regions is greater than the number of used extended sub-regions, perform the operation of updating the parameter attributes of the corresponding extended sub-regions according to the new parameter attributes indicated by the migration method.
[0100] It is understandable that when new parameters are added or partition data in a business sub-region needs to be migrated, the number of used target extended sub-regions may exceed the number of used extended sub-regions. Specifically, when a new parameter is added, the system checks if a target extended sub-region with the same parameter attribute exists and is free. If it does, there is no need to update the parameter attribute of the target extended sub-region. Otherwise, the parameter attribute of any extended sub-region is updated from its default initial value to the parameter attribute of the new parameter. When partition data in a business sub-region needs to be migrated, the operation of updating the parameter attribute of the corresponding extended sub-region is performed in the same way, and the specific details can be found in the aforementioned embodiments, which will not be repeated here.
[0101] S402, when the number of used sub-regions in the target extended sub-region is less than the number of used extended sub-regions, perform the operation of restoring the sub-region data of the corresponding extended sub-region and updating the parameter attributes of the corresponding extended sub-region according to the deletion parameter attributes indicated by the migration method.
[0102] Specifically, the corresponding extended sub-region in the operation of updating the parameter attributes of the corresponding extended sub-region is the extended sub-region whose parameter attributes are consistent with those of the deleted parameter attributes.
[0103] Understandably, when the current firmware version is higher than the target firmware version, or under special requirements, the number of used extended sub-regions in the target firmware may be less than the number of used extended sub-regions. In this case, the target firmware will indicate unused parameter attributes, i.e., deleted parameter attributes. The electronic device restores the parameter attributes of the extended sub-regions corresponding to these deleted parameter attributes to their default initial values, or the target parameter attributes indicated by the target version. For parameter attributes indicated as used by the target firmware, the electronic device performs the operation of restoring the sub-region data of the corresponding extended sub-regions to restore the partition data of extended sub-regions that do not need to be deleted.
[0104] S403, when the number of used data in the target extended sub-region is the same as the number of used data in the extended sub-region, and the target parameter attributes are the same as the parameter attributes, perform the operation of restoring the sub-region data of the corresponding extended sub-region according to the migration method, and the corresponding extended sub-region is any extended sub-region.
[0105] It is understandable that, in practical applications, there may be situations where the target firmware has not changed in terms of storage parameter attributes or the number of used extended sub-regions compared to the original firmware. In such cases, the electronic device obtains the partition data of each extended sub-region from the backup storage area.
[0106] The method provided in this embodiment refines the processing of different scenarios by comparing the number of used target extended sub-regions and the number of used extended sub-regions, as well as the target parameter attributes and parameter attributes. On the one hand, it can accurately handle various complex data changes such as adding parameters, deleting parameters, and data migration, and reasonably update or restore extended sub-region parameters and data; on the other hand, it reduces unnecessary repetitive operations, improves the accuracy and efficiency of data migration, ensures stable operation of the system under different firmware version switching scenarios, and maintains the integrity and availability of stored data.
[0107] As an example, Figure 5 This is a process example diagram illustrating a data migration method provided in an embodiment of this application. For example... Figure 5 As shown, the method of this application can be applied to a multifunctional smart home system. This multifunctional smart home control system uses water metering firmware, and the memory corresponding to this water metering firmware has a service sub-area and an extension sub-area.
[0108] Specifically, the current version of the water metering firmware is used to instruct different business sub-areas to store kitchen water consumption according to a first preset length and a first preset storage frequency, and to store bathroom water consumption according to a second preset length and a second preset storage frequency.
[0109] Based on this, such as Figure 5As shown, after the multi-functional smart home system is powered on, the electronic device first initializes the memory to initialize the memory corresponding to the water metering firmware. Further, the electronic device determines whether the storage parameters have been initialized. If so, it restores the partition data of the first and second service sub-regions. If not, it initializes the parameter attributes of each service sub-region, as well as the parameter attributes of the extended sub-regions. Specifically, it initializes according to the parameter attributes indicated by the firmware, so that each partition stores data according to the corresponding parameter attributes.
[0110] In this example, the current version of the water metering firmware adds a "living room water consumption" storage parameter compared to its predecessor. Therefore, the current version of the water metering firmware instructs one extended sub-area to store the living room water consumption according to a third preset length and a third preset storage frequency, while the parameter attributes of the remaining extended sub-areas are set to default initial values. The electronic device initializes the parameter attributes of each extended sub-area accordingly.
[0111] It is understood that the first preset length, the second preset length, and the third preset length mentioned above can be exactly the same, completely different, or partially the same, as can the first preset storage frequency, the second preset storage frequency, and the third preset storage frequency. This embodiment does not limit these.
[0112] It is understandable that the first business sub-area is connected to the water meter in the kitchen, the second business sub-area is connected to the water meter in the bathroom, and the extended sub-area is connected to the water meter in the living room.
[0113] like Figure 5 As shown, after restoring the partition data of each service sub-zone, if the multi-functional smart home system receives an instruction to upgrade the current version of the water metering firmware and issues the target version of the water metering firmware, the electronic device determines whether the parameter attributes indicated by the current version of the water metering firmware and the updated target version of the water metering firmware have changed. If not, the electronic device further restores the partition data of the extended sub-zone. If so, the electronic device completes the data migration according to the changes in parameter attributes.
[0114] Specifically, if the parameter attributes of the first service sub-area are inconsistent, the electronic device will perform the following preset operations according to the migration method corresponding to the difference: read the partition data of the first service sub-area and migrate it to the extended sub-area with the parameter attributes set to the default initial values, and update the parameter attributes of the extended sub-area to meet the parameter attributes of the first service sub-area indicated by the target version of the water metering firmware. In addition, the following preset operation must also be performed: restore the partition data of the extended sub-area used to store living room water consumption.
[0115] Through the above process, after the system is powered on, the electronic device can promptly complete data recovery or even data migration for each firmware, thereby enabling the system to operate normally.
[0116] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0117] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0118] The above embodiments describe a data migration method from the perspective of process flow. The following embodiments describe a data migration device from the perspective of virtual module or virtual unit. For details, please refer to the following embodiments.
[0119] This application provides a data migration device. Figure 6 This is a schematic diagram of the structure of a data migration device provided in an embodiment of this application, as shown below. Figure 6 As shown, the device is applied to any system that uses at least one firmware, and the system has at least one extended sub-region in the memory corresponding to each firmware; the device includes:
[0120] The acquisition module 61 is used to acquire the target parameter information indicated by the target firmware when any firmware is updated to the corresponding target firmware; the target parameter information includes the target parameter attributes of each extended sub-area and each service sub-area, and the target parameter attributes include at least one of service function, storage frequency and length;
[0121] The migration module 62 is used to perform at least one of the preset operations according to the migration method indicated by the target firmware when the target parameter information is inconsistent with the parameter information indicated by the firmware. The preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
[0122] Another possible implementation of this application embodiment includes parameter information including parameter attributes; the migration module 62 is specifically used for:
[0123] If at least one target parameter attribute in any business sub-region is inconsistent with the corresponding parameter attribute, the operation of reading the partition data of the corresponding business sub-region and migrating it to the corresponding extended sub-region is performed according to the migration method.
[0124] In another possible implementation of this application embodiment, the migration module 62 is further used for:
[0125] The attribute change method is determined based on the migration method; the attribute change method is used to change the attributes of the partition data in the business sub-region.
[0126] Read partition data from the business sub-area, and migrate the partition data after it has been changed according to the attribute change method to the target extended sub-area. The parameter attributes of the target extended sub-area are consistent with the parameter attributes of the changed partition data.
[0127] In another possible implementation of this embodiment, the migration module 62 is further configured to:
[0128] If there exists an extended sub-region with the same parameter attributes as the changed partition data and has free space, then the extended sub-region is determined as the target extended sub-region.
[0129] Otherwise, perform the operation to update the parameter attributes of the corresponding extended sub-region, and determine the corresponding extended sub-region as the target extended sub-region; the corresponding extended sub-region is an extended sub-region where any parameter attribute has a default initial value.
[0130] In another possible implementation of this application embodiment, the target parameter information further includes the used quantity of the target extended sub-region, and the parameter information includes parameter attributes and the used quantity of the extended sub-region; the migration module 62 is specifically used for:
[0131] When the number of used target extended sub-regions exceeds the number of used extended sub-regions, the corresponding extended sub-region parameter attributes are updated according to the new parameter attributes indicated by the migration method.
[0132] When the number of used sub-regions in the target extended sub-region is less than the number of used extended sub-regions, the operation of restoring the sub-region data of the corresponding extended sub-region and updating the parameter attributes of the corresponding extended sub-region is performed according to the deletion parameter attributes indicated by the migration method; wherein, the corresponding extended sub-region in the operation of updating the parameter attributes of the corresponding extended sub-region is the extended sub-region whose parameter attributes are consistent with the deletion parameter attributes.
[0133] When the number of used data in the target extended sub-region is the same as the number of used data in the extended sub-region, and the target parameter attributes are the same as the parameter attributes, the operation of restoring the sub-region data of the corresponding extended sub-region is performed according to the migration method, and the corresponding extended sub-region is any extended sub-region.
[0134] In another possible implementation of this application embodiment, the migration module 62 is further used for:
[0135] After performing the operation of reading the partition data of the corresponding business sub-area and migrating it to the corresponding extended sub-area, the target sub-area following the corresponding business sub-area is moved forward.
[0136] In another possible implementation of this application embodiment, the migration module 62 is further used for:
[0137] After the system is powered on, for each firmware, if the parameter attributes of each service sub-area and each extended sub-area are not initialized, the parameter attributes of each service sub-area are initialized according to the parameter attributes indicated by the firmware, so that each service sub-area corresponds to one parameter attribute, and the parameter attributes of each extended sub-area are initialized according to the parameter attributes indicated by the firmware and / or the default initial values.
[0138] If the parameter attributes of each service sub-area and each extended sub-area have been initialized and processed, then restore the partition data of each service sub-area, and when the firmware is updated to the target firmware, determine whether the target parameter information indicated by the target firmware is consistent with the parameter information indicated by the firmware.
[0139] The data migration apparatus provided in this application is applicable to the above-described method embodiments, and will not be described again here.
[0140] This application provides an electronic device. Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 7 As shown, Figure 7 The illustrated electronic device includes a processor 71 and a memory 72. The processor 71 and the memory 72 are connected, for example, via a bus 73. Optionally, the electronic device may also include a transceiver 74. It should be noted that in practical applications, the transceiver 74 is not limited to one type, and the structure of this electronic device does not constitute a limitation on the embodiments of this application.
[0141] Processor 71 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 71 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0142] Bus 73 may include a pathway for transmitting information between the aforementioned components. Bus 73 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Bus 73 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The symbol is represented by a single thick line, but this does not mean that there is only one bus 73 or one type of bus 73.
[0143] The memory 72 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0144] The memory 72 is used to store application code that executes the solution of this application, and its execution is controlled by the processor 71. The processor 71 is used to execute the application code stored in the memory 72 to implement the content shown in the foregoing method embodiments.
[0145] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores program instructions, which are used to implement the methods in the above embodiments.
[0146] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the technical solution of the above method embodiments. Its implementation principle and technical effects are similar, and will not be repeated here.
[0147] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
[0148] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A data migration method, characterized in that, A system applied to at least one firmware for any application, wherein the system has at least one extended sub-region in the memory corresponding to each firmware; the method includes: After the system is powered on, if any firmware is updated to the corresponding target firmware, the target parameter information indicated by the target firmware is obtained; the target parameter information includes target parameter attributes of each of the extended sub-areas and each service sub-area, and the target parameter attributes include at least one of service function, storage frequency, and length; When the target parameter information is inconsistent with the parameter information indicated by the firmware, at least one of the preset operations is performed according to the migration method indicated by the target firmware; the preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
2. The method according to claim 1, characterized in that, The parameter information includes parameter attributes; when the target parameter information is inconsistent with the parameter information indicated by the firmware, performing at least one of the preset operations according to the migration method indicated by the target firmware includes: When at least one target parameter attribute of any business sub-region is inconsistent with the corresponding parameter attribute, the operation of reading the partition data of the corresponding business sub-region and migrating it to the corresponding extended sub-region is performed according to the migration method.
3. The method according to claim 2, characterized in that, The operation of reading the partition data of the corresponding business sub-region and migrating it to the corresponding extended sub-region according to the migration method includes: The attribute change method is determined based on the migration method; the attribute change method is used to change the attributes of the partition data of the business sub-region. The partition data is read from the business sub-area, and the partition data after being changed according to the attribute change method is migrated to the target extended sub-area. The parameter attributes of the target extended sub-area are consistent with the parameter attributes of the changed partition data.
4. The method according to claim 3, characterized in that, The method further includes: If there exists an extended sub-region with the same parameter attributes as the changed partition data and has free space, then the extended sub-region is determined to be the target extended sub-region; Otherwise, the operation of updating the parameter attributes of the corresponding extended sub-region is performed, and the corresponding extended sub-region is determined as the target extended sub-region; the corresponding extended sub-region is an extended sub-region where any parameter attribute has a default initial value.
5. The method according to any one of claims 1-4, characterized in that, The target parameter information also includes the number of used target extended sub-regions, and the parameter information includes parameter attributes and the number of used extended sub-regions; when the target parameter information is inconsistent with the parameter information indicated by the firmware, performing at least one of the preset operations according to the migration method indicated by the target firmware includes: When the number of used target extended sub-regions is greater than the number of used extended sub-regions, the operation of updating the parameter attributes of the corresponding extended sub-regions is performed according to the new parameter attributes indicated by the migration method; When the number of used sub-regions in the target extended sub-region is less than the number of used extended sub-regions, the operation of restoring the sub-region data of the corresponding extended sub-region and updating the parameter attributes of the corresponding extended sub-region is performed according to the deletion parameter attribute indicated by the migration method; wherein, the corresponding extended sub-region in the operation of updating the parameter attributes of the corresponding extended sub-region is an extended sub-region whose parameter attributes are consistent with the deletion parameter attributes; When the number of used sub-regions in the target extended sub-region is consistent with the number of used extended sub-regions, and the target parameter attribute is consistent with the parameter attribute, the operation of restoring the sub-region data of the corresponding extended sub-region is performed according to the migration method, where the corresponding extended sub-region is any extended sub-region.
6. The method according to any one of claims 1-4, characterized in that, The method further includes: After performing the operation of reading the partition data of the corresponding business sub-area and migrating it to the corresponding extended sub-area, the target sub-area following the corresponding business sub-area is moved forward.
7. The method according to any one of claims 1-4, characterized in that, The method further includes: After the system is powered on, for each firmware, if the parameter attributes of each service sub-area and each extended sub-area are not initialized, the parameter attributes of each service sub-area are initialized according to the parameter attributes indicated by the firmware, so that each service sub-area corresponds to a parameter attribute, and the parameter attributes of each extended sub-area are initialized according to the parameter attributes indicated by the firmware and / or the default initial value. If the parameter attributes of each of the service sub-regions and each of the extended sub-regions have been initialized, then the partition data of each of the service sub-regions is restored, and when the firmware is updated to the target firmware, it is determined whether the target parameter information indicated by the target firmware is consistent with the parameter information indicated by the firmware.
8. A data migration device, characterized in that, A system applicable to at least one firmware for any application, wherein the system has at least one extended sub-region in the memory corresponding to each firmware; the device includes: The acquisition module is used to acquire target parameter information indicated by the target firmware when any firmware is updated to the corresponding target firmware; the target parameter information includes target parameter attributes of each of the extended sub-regions and each service sub-region, and the target parameter attributes include at least one of service function, storage frequency, and length; The migration module is used to perform at least one of the preset operations according to the migration method indicated by the target firmware when the target parameter information is inconsistent with the parameter information indicated by the firmware; the preset operations include: restoring the sub-area data of the corresponding extended sub-area, updating the parameter attributes of the corresponding extended sub-area, reading the partition data of the corresponding service sub-area and migrating it to the corresponding extended sub-area.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.