An FOTA upgrade erasure management method and device, electronic equipment and storage medium
By analyzing the powerwash flag in the upgrade package and checking the flag in Recovery mode, precise erasure of user data partitions during FOTA upgrades is achieved, solving the problem of blind erasure in existing technologies and improving the flexibility of the upgrade process and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JWIPC TECH CO LTD
- Filing Date
- 2026-04-01
- Publication Date
- 2026-06-19
AI Technical Summary
Existing FOTA upgrade technology cannot intelligently identify upgrade scenarios when switching between different system versions, resulting in blindly erasing user data or upgrade failures. It lacks an intelligent decision-making mechanism, which affects user experience.
By parsing the powerwash flag in the upgrade package, it determines whether a specific command has been written to the device's BCB. After entering Recovery mode, it checks the flag to enable or disable silent wipe mode, suppress or display UI output, and ensure that the user data partition is erased without the user's awareness, or to display the progress in the Recovery interface.
It enables precise erasure control of user data during FOTA upgrades, improves the flexibility and security of the upgrade process, ensures the security of user data and the stability of the system, and provides a personalized user experience.
Smart Images

Figure CN121957501B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded system firmware upgrade technology, and in particular to a FOTA upgrade erasure management method, apparatus, electronic device and storage medium. Background Technology
[0002] With the widespread adoption of smart devices and the rapid development of Internet of Things (IoT) technology, the demand for software maintenance and feature updates for embedded devices is increasing. FOTA (Firmware Over-The-Air) technology, as an efficient means of remotely updating device firmware, operating systems, or applications via wireless networks, has become a key technology for ensuring device security and improving user experience.
[0003] However, while the current mainstream A / B system partition upgrade method offers high reliability and a seamless upgrade experience, it still faces challenges when handling specific upgrade paths. For example, during the system development and testing phases, devices need to frequently switch between stable user versions (production versions) and feature-rich userdebug versions (debug versions), and the initialization requirements for user partitions (userdata) are drastically different between the two.
[0004] Furthermore, the traditional A / B FOTA mechanism lacks the ability to identify version types, which can easily lead to the blind erasure of user data or upgrade failures, seriously violating the original intention of improving user experience.
[0005] Therefore, there is an urgent need for a FOTA upgrade erasure management method that can intelligently identify upgrade scenarios and accurately control user partition erasure to ensure system switching reliability and user data security. Summary of the Invention
[0006] The present invention provides a method for erasure management during FOTA upgrades, addressing the problems of existing technologies failing to identify system version types, leading to indiscriminate erasure of user data or upgrade failures, and lacking an intelligent decision-making mechanism. The technical solution is as follows:
[0007] According to one aspect of the present invention, a method for erasure management in FOTA upgrades includes: downloading and parsing an upgrade package; if the upgrade package contains a powerwash flag with a value of 1, writing corresponding command data into the BCB of the device to be upgraded; otherwise, performing a regular FOTA upgrade; when the device to be upgraded enters Recovery mode, checking whether the BCB contains a powerwash=1 flag; if the powerwash=1 flag exists, clearing the flag in the misc partition and enabling silent erasure mode; if not, checking whether the BCB contains standard Recovery commands; if not, displaying the Recovery main interface; otherwise, checking whether the misc partition contains a flag; if the flag exists, disabling silent erasure mode; otherwise, enabling silent erasure mode; if the current erasure mode is silent erasure, suppressing relevant UI output, silently erasing relevant partitions, clearing the powerwash flag in the BCB, and restarting the system; otherwise, performing standard erasure; and after erasure, checking and writing the flag in the misc partition.
[0008] In one embodiment, the upgrade package is downloaded and parsed. If the upgrade package contains a powerwash flag with a value of 1, the corresponding command data is written into the BCB of the device to be upgraded; otherwise, a regular FOTA upgrade is performed. This is achieved through the following steps: After downloading the system upgrade package, the metadata attribute file in the upgrade package is parsed, and the presence of a powerwash flag is checked in the metadata attribute file. If a powerwash flag with a value of 1 is detected, command data containing powerwash=1 is written into the BCB of the device to be upgraded; otherwise, the regular FOTA upgrade process is directly executed, and user data is retained.
[0009] In one embodiment, when the device to be upgraded enters Recovery mode, it checks whether the powerwash=1 flag exists in the BCB. If the powerwash=1 flag exists, the flag bit in the misc partition is cleared, and silent erase mode is enabled. This is achieved through the following steps: After the device to be upgraded completes the system update write, the UpdateEngine triggers a reboot and enters Recovery mode, calling the check_powerwash_flag function to check whether the powerwash=1 flag exists in the BCB; if it exists, the 0xAA556677 flag bit in the misc partition is cleared, and silent erase mode is enabled; the 0xAA556677 flag bit is used to prevent standard Recovery commands from performing silent erase.
[0010] In one embodiment, if the standard Recovery command is not present, the presence of the standard Recovery command in the BCB is checked. If it is not present, the Recovery main interface is displayed. This is achieved through the following steps: if the powerwash=1 flag is not present in the BCB, the presence of the standard Recovery command in the BCB is checked; the standard Recovery command includes --wipe_data; if the standard Recovery command is not present in the BCB, the Recovery UI is started, the Recovery main interface is displayed, and the user is waited for processing requests.
[0011] In one embodiment, checking whether a flag bit exists in the misc partition is implemented by the following steps: if a standard Recovery command exists, the check_wipe_flag function is called to check whether the 0xAA556677 flag bit exists in the misc partition; if the 0xAA556677 flag bit exists, the silent erase mode is disabled and the normal erase process is entered; if the flag bit does not exist, the silent erase mode is enabled and the silent erase operation is prepared.
[0012] In one embodiment, if the current erasure mode is silent erasure, the relevant UI output is suppressed, the relevant partitions are silently erased, the powerwash flag in the BCB is cleared, and the system is restarted. This is achieved through the following steps: If the current erasure mode is silent erasure, all UI output related to erasure is suppressed, the user data partition and cache partition are silently erased, the powerwash flag in the BCB is cleared, and the system is directly restarted without displaying any UI.
[0013] In one embodiment, a standard erase is performed. After the erase is completed, the flag bit in the misc partition is checked and written through the following steps: If the current erase mode is not a silent erase, the standard erase process is executed, and the erase progress and prompt information are displayed normally in the Recovery interface, erasing the userdata partition and cache partition; after the erase is completed, it is checked whether the 0xAA556677 flag bit exists in the misc partition. If it does not exist, the flag bit is written to prevent subsequent standard Recovery commands from performing silent erase; if it already exists, the Recovery main interface is returned or the system is directly rebooted, depending on the situation.
[0014] According to one aspect of the present invention, an erase management device for FOTA upgrades, the device comprising: a powerwash flag verification module, configured to download and parse an upgrade package; if the upgrade package contains a powerwash flag with a value of 1, then write corresponding command data into the BCB of the device to be upgraded; otherwise, perform a regular FOTA upgrade; and a Recovery mode BCB verification module, configured to check whether a powerwash=1 flag exists in the BCB when the device to be upgraded enters Recovery mode; if a powerwash=1 flag exists, then clear the flag in the misc partition and enable... Silent erase mode; Recovery command check module, used to check if the standard Recovery command exists in the BCB if it does not exist. If it does not exist, the Recovery main interface is displayed. Otherwise, it checks if the flag bit exists in the misc partition. If the flag bit exists, the silent erase mode is disabled. Otherwise, the silent erase mode is enabled. Erase execution module, used to suppress relevant UI output, silently erase relevant partitions, clear the powerwash flag in the BCB and restart the system if the current erase mode is silent erase mode. Otherwise, it performs standard erase. After the erase is completed, it checks and writes the flag bit in the misc partition.
[0015] According to one aspect of the present invention, an electronic device includes at least one processor and at least one memory, wherein computer-readable instructions are stored on the memory; the computer-readable instructions are executed by one or more of the processors to cause the electronic device to implement the FOTA upgrade erasure management method as described above.
[0016] According to one aspect of the present invention, a storage medium has computer-readable instructions stored thereon, which are executed by one or more processors to implement the FOTA upgrade erasure management method as described above.
[0017] The beneficial effects of the technical solution provided by this invention are:
[0018] In the above technical solution, this invention downloads and parses the upgrade package, and determines whether to write specific commands into the BCB of the device to be upgraded based on the presence of a powerwash flag, thereby achieving a regular FOTA upgrade or preparing for silent wipe. When the device enters Recovery mode, it checks the flag in the BCB. If present, it clears the relevant flags in the misc partition and enables silent wipe mode, ensuring that the user data partition and cache partition are wiped without UI interference. If no specific flag is present in the BCB, it further checks for the presence of standard Recovery commands to determine whether to display the Recovery main interface or select the wipe mode based on the flag in the misc partition. In silent wipe mode, all relevant UI output is suppressed, the wipe operation is performed, the flag in the BCB is cleared, and the device is restarted. If standard wipe is used, the wipe progress is displayed in the Recovery interface. After wipe is complete, the misc partition flag is checked and written to prevent subsequent standard Recovery commands from performing silent wipe. This method effectively improves the flexibility and security of FOTA upgrades, ensuring the correct processing of user data in specific scenarios. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating an FOTA upgrade erasure management method according to an exemplary embodiment;
[0021] Figure 2 This is a schematic diagram of the FOTA upgrade stage in an application scenario's FOTA upgrade erasure management method;
[0022] Figure 3 yes Figure 2 A diagram illustrating the Recovery startup phase and erasure process in the corresponding application scenario;
[0023] Figure 4 yes Figure 2 A flowchart illustrating the system startup phase in the corresponding application scenario;
[0024] Figure 5 This is a block diagram illustrating an erase management device for FOTA upgrades according to an exemplary embodiment;
[0025] Figure 6 This is a hardware structure diagram of an electronic device according to an exemplary embodiment;
[0026] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0027] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0028] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this disclosure means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0029] This invention provides a method for erasure management in FOTA upgrades. Through flag identification and a multi-level command discrimination mechanism, it achieves precise erasure control of user data partitions during FOTA upgrades, solving the problem of blindly erasing user data or upgrade failures in traditional methods under specific upgrade paths. This improves the flexibility and security of the upgrade process. This FOTA upgrade erasure management method is applicable to FOTA upgrade erasure management devices, which can be electronic devices. The FOTA upgrade erasure management method in this invention can be applied to various scenarios, such as FOTA upgrade erasure management.
[0030] Please see Figure 1 This invention provides a method for erasure management during FOTA upgrades, applicable to electronic devices.
[0031] In the following method embodiments, for ease of description, the execution subject of each step of the method is an electronic device, but this does not constitute a specific limitation.
[0032] like Figure 1 As shown, the method may include the following steps:
[0033] Step 110: Download and parse the upgrade package. If the upgrade package contains a powerwash flag with a value of 1, write the corresponding command data into the BCB of the device to be upgraded; otherwise, perform a regular FOTA upgrade.
[0034] In one possible implementation, after downloading the system upgrade package, the metadata attribute file in the upgrade package is parsed, and the presence of the powerwash flag is checked in the metadata attribute file. If the powerwash flag is detected and its value is 1, command data containing powerwash=1 is written to the BCB of the device to be upgraded; otherwise, the regular FOTA upgrade process is executed directly, and user data is retained.
[0035] Specifically, the device downloads the system upgrade package via a wireless network (such as Wi-Fi, 4G / 5G). It parses the metadata attribute file in the upgrade package and checks for the presence of the powerwash flag. If powerwash=1 is detected, command data containing powerwash=1 is written to the device's Bootloader Control Block (BCB), marking that user data needs to be erased after this upgrade. If the powerwash flag is not detected or its value is 0, the regular FOTA upgrade process is executed directly, preserving user data.
[0036] By parsing the powerwash flag in the upgrade package, it can accurately determine whether an erase operation is needed, avoiding unnecessary user data loss. In upgrade scenarios where user data erasure is not required, user data is preserved, improving the user experience.
[0037] In the above process, the embodiments of the present invention parse the upgrade package metadata and determine the powerwash flag, so that the erasure operation can be accurately triggered in specific scenarios, providing a flexible data management method and realizing the security protection of user data.
[0038] Step 120: After the device to be upgraded enters Recovery mode, check if the powerwash=1 flag exists in BCB. If the powerwash=1 flag exists, clear the flag bit in the misc partition and enable silent wipe mode.
[0039] In one possible implementation, after the device to be upgraded completes the system update write, the UpdateEngine triggers a reboot and enters Recovery mode, calling the check_powerwash_flag function to check if the powerwash=1 flag exists in the BCB; if it exists, the 0xAA556677 flag bit in the misc partition is cleared, and silent erase mode is enabled.
[0040] The 0xAA556677 flag is used to disable silent erasure by standard Recovery commands.
[0041] Specifically, after the device to be upgraded completes the system update, the UpdateEngine triggers a reboot and enters Recovery mode. In Recovery mode, the check_powerwash_flag function is first called to check if the powerwash=1 flag exists in the BCB. If the powerwash=1 flag exists, it indicates that a silent wipe operation needs to be performed. At this time, the 0xAA556677 flag bit (which is used to disable the standard Recovery command from performing a silent wipe) in the misc partition is cleared, and the silent wipe mode is enabled.
[0042] If the powerwash=1 flag is not present in the BCB, the system further checks if a standard Recovery command (such as --wipe_data) exists in the BCB. If it exists, the system checks if the 0xAA556677 flag exists in the misc partition to determine whether to disable silent wipe mode; if it does not exist, the system directly displays the Recovery main interface and waits for the user to process the request.
[0043] In the above process, the embodiments of the present invention accurately determine the current erasure mode (silent erasure or standard erasure) through a multi-level command inspection and flag recognition mechanism, thereby avoiding the risk of misoperation and data loss and improving the security and reliability of the upgrade process.
[0044] Step 130: If it does not exist, check if the standard Recovery command exists in BCB. If it does not exist, display the Recovery main interface. Otherwise, check if the flag bit exists in the misc partition. If the flag bit exists, disable the silent erase mode. Otherwise, enable the silent erase mode.
[0045] In one possible implementation, if the powerwash=1 flag is not present in the BCB, the system checks if a standard Recovery command exists in the BCB. Standard Recovery commands include --wipe_data. If no standard Recovery command exists in the BCB, the Recovery UI is started, the main Recovery interface is displayed, and the system waits for the user to process the request.
[0046] In one possible implementation, if a standard Recovery command exists, the check_wipe_flag function is called to check if the 0xAA556677 flag exists in the misc partition. If the 0xAA556677 flag exists, the silent erase mode is disabled, and the normal erase process begins. If the flag does not exist, the silent erase mode is enabled, and the silent erase operation is prepared.
[0047] Standard Recovery commands include --wipe_data, etc., which are not specified here.
[0048] Specifically, if the current erase mode is silent erase, all erase-related UI output and log printing are suppressed, and the user data partition and cache partition are silently erased. During the silent erase process, the powerwash flag in BCB is cleared to ensure that the silent erase operation is not triggered again after the system restarts. If the current erase mode is non-silent erase (i.e., standard erase), the erase progress and prompts are displayed normally in the Recovery interface, and the userdata partition and cache partition are erased.
[0049] In the above process, the embodiments of the present invention distinguish between two modes, silent erasure and standard erasure, and adopt different execution strategies for each. This satisfies the need for seamless upgrades in specific scenarios while retaining the user-visible progress prompts in traditional upgrade methods, thereby improving the diversity and satisfaction of the user experience.
[0050] Step 140: If the current erasure mode is silent erasure, suppress the relevant UI output, silently erase the relevant partitions, clear the powerwash flag in BCB and restart the system; otherwise, perform standard erasure. After erasure, check and write the flag bits in the misc partition.
[0051] In one possible implementation, if the current erasure mode is silent erasure, then all UI output related to erasure is suppressed, the user data partition and cache partition are silently erased, the powerwash flag in BCB is cleared, and the system is directly restarted without displaying any UI.
[0052] In one possible implementation, if the current erase mode is not a silent erase, the standard erase process is executed, and the erase progress and prompts are displayed normally in the Recovery interface, erasing the userdata partition and cache partition. After the erase is completed, it is checked whether the 0xAA556677 flag bit exists in the misc partition. If it does not exist, the flag bit is written to prevent subsequent standard Recovery commands from performing silent erase. If it already exists, the system returns to the Recovery main interface or reboots directly, depending on the situation.
[0053] Specifically, after the erase operation is complete, regardless of the erase mode used, the flag bits in the misc partition need to be checked and processed. If the 0xAA556677 flag bit does not exist in the misc partition, it is written to prevent subsequent standard Recovery commands from performing a silent erase; if the flag bit already exists, a decision is made on whether to update or retain it based on the specific situation. Finally, depending on the erase mode and the flag bit processing result, the system is either directly rebooted or returned to the Recovery main interface to await further user operations.
[0054] In the above process, the embodiments of the present invention ensure the correctness and consistency of the system state through flag bit processing and system restart mechanism after erasure. Simultaneously, by persistently setting and managing the flag bits, a reliable reference is provided for subsequent upgrade operations, thereby further improving the stability and maintainability of the upgrade process.
[0055] Through the above process, this embodiment of the invention achieves precise erasure control of user data partitions during FOTA upgrades by parsing the upgrade package and setting commands, checking flags and selecting modes in Recovery mode, executing silent or standard erasure, and handling flag bits and restarting the system after erasure. This method not only improves the flexibility and security of the upgrade process but also significantly enhances the diversity and satisfaction of the user experience, providing strong technical support for software maintenance and feature updates of embedded devices.
[0056] In one application scenario, the FOTA upgrade erasure management method of the present invention is used to perform FOTA upgrade erasure management.
[0057] Figures 2 to 4 The flowcharts illustrate the FOTA upgrade phase, Recovery boot phase, wipe process, and system boot phase, and may include the following steps:
[0058] Step S1: FOTA upgrade phase (UpdateEngine).
[0059] Specifically, during a full FOTA (Firmware Over-The-Air) upgrade, the UpdateEngine begins processing the upgrade task. The UpdateEngine parses the metadata attribute file in the downloaded upgrade package, checking for the presence and value of the `powerwash` flag (1). If the `powerwash` flag is present in the full package, the UpdateEngine writes the corresponding command data to the Bootloader Control Block (BCB) of the device to be upgraded, setting `powerwash` to 1 and updating the full package to the inactive partition. Afterward, the device enters Recovery mode to perform the wipe process. If the `powerwash` flag is not present, the regular FOTA upgrade process is executed directly, preserving user data.
[0060] In the above process, the embodiments of the present invention parse the upgrade package metadata and determine the powerwash flag, so as to accurately trigger the corresponding erasure process according to the upgrade requirements, providing a flexible data management method and realizing the secure processing of user data in specific upgrade scenarios.
[0061] Step S2: Recovery startup phase.
[0062] Specifically, after the device enters Recovery mode, the boot process enters a refined flag check and processing stage. First, the system calls the check_powerwash_flag function to carefully check whether the powerwash=1 flag is explicitly set in the Bootloader Control Block (BCB). The presence of this flag is a key prerequisite for triggering the silent wipe process.
[0063] If the powerwash=1 flag exists in BCB, the flag in the misc partition is cleared and silent wipe mode is enabled. If the powerwash=1 flag does not exist in BCB, the system checks for the existence of standard Recovery commands (such as --wipe_data). These commands are usually triggered manually by the user to perform regular data wipe operations.
[0064] If the standard Recovery command exists, it checks if a flag exists in the misc partition. If the flag exists, the silent erase mode is disabled; if the flag does not exist, the silent erase mode is enabled.
[0065] If the standard Recovery command is not present, the Recovery main interface will be displayed.
[0066] In the above process, the embodiments of the present invention implement the following control logic: only the wipe operation triggered by the preset powerwash flag in the full OTA upgrade package (i.e., entering Recovery and powerwash=1 exists in BCB) is allowed to perform silent wipe, and the possible 0xAA556677 flag is cleared before the wipe to ensure that silent wipe can be performed.
[0067] Any wipe request initiated via standard Recovery commands (such as --wipe_data) will execute a normal wipe process with UI due to the presence of the 0xAA556677 flag (which is automatically written after each system boot), thus preventing silent wipe from being accidentally triggered.
[0068] The 0xAA556677 flag is automatically maintained every time the device starts up, ensuring that standard commands are always prohibited from silent erasure. OTA upgrades can temporarily clear this flag through powerwash, thereby gaining silent erasure permission once. After the erasure is completed, the system restarts and rewrites the flag, restoring the prohibited state.
[0069] Step S3: Data erasure process.
[0070] Specifically, after the data erasure process begins, branching is performed based on the value of the silent erasure mode (silent_wipe_mode). In silent erasure mode, all erasure-related UI output is suppressed, the userdata and cache partitions are silently erased, the powerwash flag in BCB is cleared, and then the system is directly restarted without displaying any UI. In the standard erasure branch, the erasure progress UI is displayed normally, the userdata and cache partitions are erased, and after erasure is complete, the "Datawipecomplete" result is displayed, then the system returns to the Recovery main interface or restarts.
[0071] In the above process, the embodiments of the present invention distinguish between silent and standard erasure modes, enabling users to select the appropriate erasure method according to their needs or system settings, providing a personalized data erasure experience, and achieving high efficiency and flexibility in the erasure process.
[0072] Step S4: System startup phase.
[0073] Specifically, upon first system boot after a silent erase, after the system completes boot (sys.boot_completed=1), the write_misc_flag service is started. It checks if the 0xAA556677 flag already exists in the misc partition. If it doesn't exist, it writes the persistent flag 0xAA556677 to the misc partition, marking that the device has completed its first silent erase; if the flag already exists, the writing is skipped.
[0074] In the above process, the embodiments of the present invention, by checking and writing the misc partition flag bit during the system startup phase, enable accurate recording of the device's silent erase state, providing a basis for subsequent erase process judgment, and realizing reliable persistence of device status information.
[0075] Through the above process, when a full package upgrade is required and the upgrade package contains the powerwash flag, this embodiment of the invention sequentially enters the FOTA upgrade stage, Recovery startup stage, data erasure process, and system startup stage according to a preset procedure. During the Recovery startup stage, through meticulous checking and intelligent judgment of multiple flags, the system can accurately identify the type of erasure request, ensuring appropriate handling regardless of whether it's an initial silent erasure, repeated silent erasures, or standard erasures. This precise and flexible processing method not only safeguards user data security but also ensures stable system operation, while providing a personalized data erasure experience, significantly improving user satisfaction and overall system performance.
[0076] In another application scenario, where an electronic device (such as a smart tablet) needs to undergo a full-package upgrade, the FOTA upgrade erasure management method provided by this invention is used for erasure management. Specifically, it may include the following steps:
[0077] Step S1, FOTA upgrade phase (UpdateEngine).
[0078] Specifically, when an electronic device (such as a smart tablet) needs a full upgrade, UpdateEngine begins processing the task. It parses the metadata attribute file in the downloaded upgrade package, checking for the presence of the `powerwash` flag with a value of 1. If the full package contains this flag, UpdateEngine writes command data to the BCB of the device to be upgraded, setting `powerwash` to 1 and updating the full package to the inactive partition. Then, it triggers the device to enter Recovery mode to perform the wipe process. If this flag does not exist, the regular FOTA upgrade process is executed directly, preserving user data.
[0079] Furthermore, this method allows for precise triggering of the erasure process based on upgrade requirements, flexible data management, and ensures user data security in specific scenarios. By parsing the upgrade package metadata and identifying the powerwash flag, precise data management is achieved.
[0080] Step S2, Recovery startup phase.
[0081] Specifically, after the device enters Recovery mode, the system calls the `check_powerwash_flag` function to check if the `powerwash = 1` flag is set in the BCB. If it exists, the misc partition flag is cleared and silent wipe mode is enabled; if it does not exist, it checks if a standard Recovery command (such as `--wipe_data`) exists. If it exists, the misc partition flag is checked; if present, silent wipe is disabled; otherwise, it is enabled; if absent, the Recovery main interface is displayed. This control logic ensures the accurate triggering of different wipe operations. Through multi-layer flag checks and intelligent judgment, the type of wipe request is accurately identified.
[0082] Step S3, data erasure process.
[0083] Specifically, the process branches based on the value of the silent wipe mode (silent_wipe_mode). If silent wipe is selected, UI output is suppressed, the userdata and cache partitions are wiped, the powerwash flag in BCB is cleared, and the system restarts directly without displaying a UI. If standard wipe is selected, the progress UI is displayed normally, the results are shown after partition wipe, and the system returns to the Recovery main interface or restarts. The appropriate wipe method is selected based on requirements, providing a personalized experience. By differentiating wipe modes, efficient and flexible data wiping is achieved.
[0084] Step S4, system startup phase.
[0085] Specifically, upon first system boot after a silent erase, once system startup is complete (sys.boot_completed = 1), the write_misc_flag service is started. It checks if the 0xAA556677 flag already exists in the misc partition. If it doesn't exist, it writes the flag, marking the device as having completed its first silent erase; if it exists, the write is skipped. This accurately records the device's silent erase status, providing a basis for subsequent judgments. Through flag checks and writing during the system boot phase, reliable persistence of device status information is achieved.
[0086] Through the above process, this embodiment of the invention employs the FOTA upgrade erasure management method of the present invention. During the FOTA upgrade phase, the UpdateEngine parses the upgrade package to determine whether to trigger the erasure process. Upon entering the Recovery startup phase, multi-layer flag checks accurately identify the erasure request type, deciding between silent or standard erasure. During the data erasure process, processing is based on mode branches, providing a personalized experience. During the system startup phase, device status is checked and recorded through flag bit checks. The entire process is precise and flexible, ensuring user data security, ensuring stable system operation, avoiding the problems of blind erasure or upgrade failures associated with traditional methods, improving the flexibility and security of the upgrade process, providing a better user experience, and offering strong support for device software maintenance and function updates.
[0087] The following are embodiments of the apparatus of the present invention, which can be used to execute the FOTA upgrade erasure management method involved in the present invention. For details not disclosed in the apparatus embodiments of the present invention, please refer to the method embodiments of the FOTA upgrade erasure management method involved in the present invention.
[0088] Please see Figure 5 This invention provides an FOTA upgrade erasure management device 800.
[0089] The FOTA upgrade erase management device 800 includes, but is not limited to: a powerwash flag verification module 810, a Recovery mode BCB verification module 830, a Recovery command checking module 850, and an erase execution module 870.
[0090] The powerwash flag verification module 810 is used to download and parse the upgrade package. If the upgrade package contains a powerwash flag with a value of 1, the corresponding command data is written into the BCB of the device to be upgraded; otherwise, a regular FOTA upgrade is performed.
[0091] The Recovery Mode BCB Verification Module 830 is used to check whether the powerwash=1 flag exists in the BCB when the device to be upgraded enters Recovery Mode. If the powerwash=1 flag exists, the flag bit in the misc partition is cleared and the silent erase mode is enabled.
[0092] Recovery command check module 850 is used to check if the standard Recovery command exists in BCB if it does not exist. If it does not exist, the Recovery main interface is displayed. Otherwise, it checks if the flag bit exists in the misc partition. If the flag bit exists, the silent erase mode is disabled. Otherwise, the silent erase mode is enabled.
[0093] The erase execution module 870 is used to suppress relevant UI output, silently erase relevant partitions, clear the powerwash flag in BCB and restart the system if the current erase mode is silent erase mode, otherwise it performs standard erase and checks and writes the flag bits in the misc partition after the erase is completed.
[0094] It should be noted that the FOTA upgrade erasure management provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the FOTA upgrade erasure management device will be divided into different functional modules to complete all or part of the functions described above.
[0095] Furthermore, the FOTA upgrade erasure management device and the FOTA upgrade erasure management method provided in the above embodiments belong to the same concept, and the specific way in which each module performs operations has been described in detail in the method embodiments, and will not be repeated here.
[0096] Figure 6 A schematic diagram of the structure of an electronic device according to an exemplary embodiment is shown.
[0097] It should be noted that this electronic device is merely an example adapted to the present invention and should not be construed as providing any limitation on the scope of use of the present invention. Furthermore, this electronic device should not be interpreted as requiring or depending on having... Figure 6 One or more components of the exemplary electronic device 2000 shown.
[0098] The hardware structure of electronic devices 2000 can vary significantly due to differences in configuration or performance, such as... Figure 6 As shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0099] Specifically, power supply 210 is used to provide operating voltage for various hardware devices on electronic device 2000.
[0100] Interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted to this invention, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 6 As shown, this does not constitute a specific limitation.
[0101] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0102] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the electronic device 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0103] Application 253 is a computer-readable instruction based on operating system 251 that performs at least one specific task, and may include at least one module ( Figure 6 (Not shown), each module may contain computer-readable instructions for the electronic device 2000. For example, the FOTA upgrade erase management device can be considered as application 253 deployed on the electronic device 2000.
[0104] Data 255 may be signal information, etc., and is stored in memory 250.
[0105] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby performing operations and processing on massive amounts of data 255 stored in the memory 250. For example, the FOTA upgrade erasure management method can be completed by the central processing unit 270 reading a series of computer-readable instructions stored in the memory 250.
[0106] Furthermore, the present invention can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of the present invention is not limited to any specific hardware circuit, software, or combination thereof.
[0107] Please see Figure 7 This invention provides an electronic device 4000, which may include: a desktop computer, a laptop computer, a server, etc., with sensor recognition capabilities.
[0108] exist Figure 7 In this context, the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0109] The data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0110] Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.
[0111] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), 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 invention. Processor 4001 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0112] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) 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 instructions or code in the form of instructions or data structures and accessible by the electronic device 4000, but not limited thereto.
[0113] The memory 4003 stores computer-readable instructions, and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002.
[0114] The computer-readable instructions are executed by one or more processors 4001 to implement the FOTA upgrade erasure management method in the above embodiments.
[0115] Furthermore, this embodiment of the invention provides a storage medium storing computer-readable instructions, which are executed by one or more processors to implement the FOTA upgrade erasure management method described above.
[0116] This invention provides a computer program product, which includes computer-readable instructions stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, thereby enabling the electronic device to implement the FOTA upgrade erasure management method as described above.
[0117] Compared with related technologies, the beneficial effects of the present invention are:
[0118] 1. This invention can accurately identify upgrade requirements and trigger corresponding erasure processes; by parsing the "powerwash" flag in the upgrade package metadata, it can clearly determine whether the user data partition needs to be erased after the upgrade, providing clear triggering conditions for subsequent erasure operations and ensuring that the upgrade process meets actual needs.
[0119] 2. This invention has the ability to avoid conflicts with standard functions; by combining standard command detection and custom flag checking, it can accurately identify different upgrade scenarios in Recovery mode, effectively distinguishing the erase requirement triggered by FOTA upgrade from the erase requirement triggered by standard functions such as factory reset, and avoiding user experience problems caused by misoperation.
[0120] 3. This invention enables seamless erasure processing, enhancing the user experience. By introducing the global variable silent_wipe_mode, all user interface output and log printing related to the erasure operation are suppressed in silent erasure mode, allowing users to complete data erasure without their knowledge. This achieves truly seamless processing and significantly improves the convenience and comfort of the user experience.
[0121] 4. This invention can prevent repeated erasure and ensure system stability. By setting a persistent flag bit 0xAA556677 in the misc partition, it records whether the device has undergone silent erasure triggered by FOTA upgrade, avoiding repeated erasure operations during subsequent startup, and ensuring the stability and reliability of system upgrades.
[0122] 5. This invention can flexibly respond to different upgrade scenarios; through multi-level command recognition logic and flag management mechanism, it can perform differentiated processing for various situations, such as retaining user data during regular upgrades, erasing user data under specific upgrade requirements, or handling repeated erasure requests, so as to meet the diverse needs of smart devices when frequently switching versions during system development and testing.
[0123] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by 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 flowcharts of the accompanying figures 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, and their execution order 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.
[0124] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for erasure management in FOTA upgrades, characterized in that, The method includes: Download and parse the upgrade package. If the upgrade package contains a powerwash flag with a value of 1, write the corresponding command data into the BCB of the device to be upgraded; otherwise, perform a regular FOTA upgrade. The BCB stands for Bootloader Control Block. When the device to be upgraded enters Recovery mode, check whether the powerwash=1 flag exists in the BCB. If the powerwash=1 flag exists, clear the flag bit in the misc partition and enable silent wipe mode. If it does not exist, check if the standard Recovery command exists in the BCB. If it does not exist, display the Recovery main interface. Otherwise, check if the flag bit exists in the misc partition. If the flag bit exists, disable the silent erase mode. Otherwise, enable the silent erase mode. If the current erasure mode is silent erasure mode, then suppress the relevant UI output, silently erase the relevant partitions, clear the powerwash flag in the BCB and restart the system; otherwise, perform standard erasure. After erasure, check and write the flag bits in the misc partition.
2. The FOTA upgrade erasure management method as described in claim 1, characterized in that, The downloaded upgrade package is parsed. If the upgrade package contains a powerwash flag with a value of 1, the corresponding command data is written into the BCB of the device to be upgraded; otherwise, a regular FOTA upgrade is performed, including: After downloading the system upgrade package, parse the metadata attribute file in the upgrade package and check whether the powerwash flag exists in the metadata attribute file; If the powerwash flag is detected to be 1, then command data containing powerwash=1 is written to the BCB of the device to be upgraded; otherwise, the normal FOTA upgrade process is executed directly, and user data is retained.
3. The FOTA upgrade erasure management method as described in claim 1, characterized in that, When the device to be upgraded enters Recovery mode, it checks whether the powerwash=1 flag exists in the BCB. If the powerwash=1 flag exists, it clears the flag bit in the misc partition and enables silent wipe mode, including: After the device to be upgraded completes the system update, the UpdateEngine triggers a reboot and enters Recovery mode, calling the check_powerwash_flag function to check whether the powerwash=1 flag exists in the BCB; If present, clear the 0xAA556677 flag in the misc partition and enable silent erase mode; the 0xAA556677 flag is used to prevent the standard Recovery command from performing silent erase.
4. The FOTA upgrade erasure management method as described in claim 1, characterized in that, If the above does not exist, then check if the standard Recovery command exists in the BCB. If it does not exist, display the Recovery main interface, including: If the powerwash=1 flag is not present in the BCB, then the presence of a standard Recovery command in the BCB is checked; the standard Recovery command includes --wipe_data; If the BCB does not contain standard Recovery commands, the Recovery UI will be launched, displaying the main Recovery interface and waiting for the user to process the request.
5. The FOTA upgrade erasure management method as described in claim 1, characterized in that, The process of checking whether a flag bit exists in the misc partition, disabling silent erase mode if the flag bit exists, and enabling silent erase mode otherwise, includes: If a standard Recovery command exists, the check_wipe_flag function is called to check if the 0xAA556677 flag exists in the misc partition; If the 0xAA556677 flag exists, the silent erase mode is disabled and the standard erase procedure is executed; if the flag does not exist, the silent erase mode is enabled and the silent erase operation is prepared.
6. The FOTA upgrade erasure management method as described in claim 1, characterized in that, If the current erasure mode is silent erasure mode, then suppress relevant UI output, silently erase the relevant partitions, clear the powerwash flag in the BCB, and restart the system, including: If the current erase mode is silent erase mode, then all UI output related to erasure is suppressed, the user data partition and cache partition are silently erased, the powerwash flag in the BCB is cleared, and the system is directly restarted without displaying any UI.
7. The FOTA upgrade erasure management method as described in claim 1, characterized in that, The standard erasure is performed, and after erasure, the flag bits in the misc partition are checked and written, including: If the current erase mode is not silent erase, the standard erase process will be executed, and the erase progress and prompts will be displayed normally in the Recovery interface, erasing the userdata partition and cache partition; After the erase is complete, check if the 0xAA556677 flag exists in the misc partition. If it does not exist, write the flag to prevent subsequent standard Recovery commands from performing a silent erase. If it already exists, return to the Recovery main interface or reboot directly, depending on the situation.
8. A FOTA (Firmware Over-The-Air) upgrade erasure management device, characterized in that, The device includes: The powerwash flag verification module is used to download and parse the upgrade package. If the upgrade package contains a powerwash flag and its value is 1, the corresponding command data is written into the BCB of the device to be upgraded; otherwise, a regular FOTA upgrade is performed. The BCB stands for Bootloader Control Block. The Recovery mode BCB verification module is used to check whether the powerwash=1 flag exists in the BCB when the device to be upgraded enters Recovery mode. If the powerwash=1 flag exists, the flag bit in the misc partition is cleared and the silent erase mode is enabled. The Recovery command check module is used to check whether a standard Recovery command exists in the BCB if it does not exist. If it does not exist, the Recovery main interface is displayed. Otherwise, it checks whether a flag bit exists in the misc partition. If the flag bit exists, the silent erase mode is disabled. Otherwise, the silent erase mode is enabled. The erase execution module is used to suppress relevant UI output, silently erase relevant partitions, clear the powerwash flag in the BCB and restart the system if the current erase mode is silent erase mode; otherwise, it performs standard erase and checks and writes the flag bits in the misc partition after the erase is completed.
9. An electronic device, characterized in that, include: At least one processor and at least one memory, wherein, The memory stores computer-readable instructions; The computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the erase management method for FOTA upgrades as described in any one of claims 1 to 7.
10. A storage medium having computer-readable instructions stored thereon, characterized in that, The computer-readable instructions are executed by one or more processors to implement the FOTA upgrade erasure management method as described in any one of claims 1 to 7.