Configuration parameter sharing methods, devices, electronic equipment, storage media and products
By loading the configuration parameter image of the shared storage area into the embedded device and transferring management control between the startup and runtime phases, the problem of inconsistent parameter versions is solved, improving the stability and consistency of device operation.
Patent Information
- Application Number
- CN202611593955.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-14
- Publication Date
- 2026-11-17
AI Technical Summary
In the prior art, embedded devices maintain separate copies of their configuration parameters during the startup and operation phases, which can lead to inconsistent parameter versions, state drift, or write-back errors, affecting the stability of device operation.
By loading the configuration parameter image into the shared storage area during the startup phase, a runtime shared parameter image is formed, and management rights are transferred when conditions are met. This enables unified management of configuration parameters across startup phases, ensuring that all execution entities and operating systems share the same parameter image at different stages, thus reducing version inconsistency issues.
This ensures the continuity and consistency of configuration parameters at different stages, improves device operational stability, and reduces the risk of write conflicts and management fragmentation.
Smart Images

Figure CN123114584A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software engineering technology, and in particular to a method, apparatus, electronic device, storage medium and product for sharing configuration parameters. Background Technology
[0002] In complex embedded devices such as vehicle cockpits, domain controllers, and industrial control systems, the startup and operation phases of embedded devices typically require loading and accessing configuration parameters. For example, for intelligent driving domain control platforms, hardware configuration parameters need to be loaded in the early startup phase, and sensor calibration parameters are shared by multiple system domains during the operation phase.
[0003] In existing technologies, embedded devices mainly maintain their own copies of configuration parameters according to the startup phase. In the early startup phase, parameters are read from persistent media and used for startup decisions. After the system enters the running phase, the operating system kernel or user-space components reread the parameters or establish their own caches. Each phase maintains its own copy of parameters.
[0004] However, the existing method of maintaining separate copies of configuration parameters is prone to inconsistent parameter versions, state drift, or write-back errors, which can lead to a decrease in the overall stability of the embedded device. Summary of the Invention
[0005] The configuration parameter sharing method, apparatus, electronic device, storage medium, and product provided in this application embodiment can enable the same configuration parameters to be continuously shared between the early startup phase and the running phase, avoiding problems such as maintaining separate copies of configuration parameters at different stages, which can easily lead to inconsistent parameter versions, and improving the stability of device operation.
[0006] In a first aspect, embodiments of this application provide a method for sharing configuration parameters, including:
[0007] During the startup phase of the electronic device, the configuration parameter image is loaded from the persistent storage area to the shared storage area by the first execution phase management unit to form a runtime shared parameter image. The configuration parameter image includes the configuration parameters required for the operation of each execution entity and / or operating system in the electronic device and the metadata of the configuration parameters. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device.
[0008] When the parameter takeover conditions are met, the management rights of the first execution phase management unit over the running shared parameter image are transferred to the second execution phase management unit, so that the second execution phase management unit can update the execution parameters of the running shared parameter image.
[0009] In one possible implementation, loading the configuration parameter image from the persistent storage area to the shared storage area includes:
[0010] In the first execution phase, read the first parameter copy and / or the second parameter copy from the persistent storage area;
[0011] Perform a preset basic check operation on the first parameter copy and / or the second parameter copy. The preset basic check operation includes at least one of version check, length check, status flag check and verification check.
[0012] If the first parameter copy and / or the second parameter copy pass the preset basic check operation, then the configuration parameter image is determined from the first parameter copy and / or the second parameter copy and loaded into the shared storage area;
[0013] If neither the first parameter copy nor the second parameter copy passes the preset basic check operation, the configuration parameter image is read from the backup parameter partition in the persistent storage area and loaded into the shared storage area.
[0014] In one possible implementation, determining the configuration parameter mirror from the first parameter copy and / or the second parameter copy includes:
[0015] Read the first metadata and the second metadata; the first metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the first parameter copy; the second metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the second parameter copy.
[0016] Based on the first metadata and the second metadata, select either the first parameter copy or the second parameter copy to determine the configuration parameter mirror.
[0017] In one possible implementation, it also includes:
[0018] Before the parameter takeover conditions are met, the first execution phase management unit performs parameter updates and persistent writes on the running shared parameter image.
[0019] The process of updating and persistently writing the runtime shared parameter image execution parameters through the first execution phase management unit includes:
[0020] Set a dirty flag or a pre-write flag for the running shared parameter image;
[0021] Update the runtime shared parameter image and its metadata;
[0022] Clear the dirty marker or the pre-write marker;
[0023] The updated content of the running shared parameter image is flushed to the persistent storage area.
[0024] In one possible implementation, it also includes:
[0025] Configure the current slot identifier, target slot identifier, and default value area version identifier in the metadata; wherein, the current slot identifier is used to identify the currently running slot; the target slot identifier is used to identify the target slot for update and upgrade; and the default value area version identifier is used to identify the default value baseline on which the electronic device is restored to factory settings.
[0026] In one possible implementation, it also includes:
[0027] After the management rights of the running-state shared parameter image are transferred to the second execution stage management unit, if the first execution stage management unit detects a parameter update requirement for the running-state shared parameter image, an update request is sent to the second execution stage management unit so that the second execution stage management unit can update the parameters of the running-state shared parameter image.
[0028] In one possible implementation, it also includes:
[0029] Establish the lifecycle of the running shared parameter image, which includes the image initialization state, image loading state, state before management takeover, state after management takeover, state after management takeover, state of flashing and synchronous update, and state of abnormal recovery.
[0030] Based on the lifecycle of the running shared parameter image, the parameter takeover conditions, and the transfer status of management rights, determine the read / write constraints and access constraints of the running shared parameter image;
[0031] Based on the read / write constraints and access constraints, determine whether to update the running-state shared parameter mirror execution parameters through the first execution phase management unit or the second execution phase management unit.
[0032] In one possible implementation, it also includes:
[0033] After the management rights of the runtime shared parameter image are transferred to the second execution phase management unit, if it is detected that each operating system accesses the runtime shared parameter image through the second execution phase management unit, the updated content of the runtime shared parameter image is obtained.
[0034] The updated content of the running shared parameter image is written to the persistent storage area by the second execution phase management unit.
[0035] Secondly, embodiments of this application provide a configuration parameter sharing device, including:
[0036] The loading module is used to load a configuration parameter image from the persistent storage area to the shared storage area through the first execution phase management unit during the startup phase of the electronic device, forming a runtime shared parameter image. The configuration parameter image includes the configuration parameters required for the operation of each execution entity and / or operating system in the electronic device and the metadata of the configuration parameters. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device.
[0037] The transfer module is used to transfer the management rights of the first execution phase management unit over the running shared parameter image to the second execution phase management unit when the parameter takeover conditions are met, so that the second execution phase management unit can perform parameter updates on the running shared parameter image.
[0038] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0039] The memory stores computer-executed instructions;
[0040] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0041] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0042] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0043] The configuration parameter sharing method, apparatus, electronic device, storage medium, and product provided in this application embodiment achieve unified management of configuration parameters across startup phases by loading the configuration parameter image into the shared storage area and forming a runtime shared parameter image during the startup phase. This enables various execution entities and / or operating systems in the electronic device to share access based on the same runtime shared parameter image at different stages, thereby reducing the problem of inconsistent parameter versions caused by maintaining multiple parameter copies, ensuring the continuity and consistency of configuration parameters at different stages, and improving the stability of device operation. Attached Figure Description
[0044] 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.
[0045] Figure 1 A flowchart illustrating the configuration parameter sharing method provided in this application;
[0046] Figure 2 The overall architecture diagram of the multi-operating system configuration parameter sharing storage and relay management system across the boot phase provided in the embodiments of this application;
[0047] Figure 3 The flowchart for parameter startup loading and pre-takeover management provided in the embodiments of this application;
[0048] Figure 4 This is a schematic diagram of the parameter mirror data layout structure provided in the embodiments of this application;
[0049] Figure 5 This is a schematic diagram of the two-parameter copy consistency determination and recovery decision-making process provided in an embodiment of this application;
[0050] Figure 6 The flowchart of the state machine for writing data is provided for this application;
[0051] Figure 7 The relay management state machine and ownership transfer timing diagram provided for embodiments of this application;
[0052] Figure 8 A schematic diagram of the configuration parameter sharing device provided in this application;
[0053] Figure 9 A schematic diagram of the structure of the electronic device provided in this application.
[0054] 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
[0055] 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.
[0056] This application relates to a method and system for shared storage and relay management of configuration parameters, primarily targeting electronic devices requiring multi-stage startup chains and multi-system collaborative operation. For example, taking an electronic device as an in-vehicle cockpit platform, the system needs to go through multiple stages such as bootloader, operating system (OS) kernel loading, and user-mode service startup, while also involving the collaboration of multiple operating system domains, including the instrument cluster domain, central control domain, and Advanced Driver Assistance Systems (ADAS) domain. Another example is an electronic device as an intelligent driving domain control platform, where the system needs to complete hardware configuration parameter loading in the early startup phase, and sensor calibration parameters are shared by multiple operating system domains during operation. Yet another example is an electronic device as industrial control equipment, where the system needs to transfer device status parameters between the startup and operation phases, and ensure parameter consistency across multiple control operating system domains. These scenarios share common characteristics: complex system startup chains, involving multiple execution stages (such as Bootloader, kernel loading, and user-mode service startup) and multiple operating system domains (such as security domain, application domain, and communication domain) during startup. They also require continuous sharing of critical configuration parameters across different stages and operating system domains, and face complex operational and maintenance needs such as A / B remote online upgrades (Over-the-Air, OTA), factory resets, and anomaly recovery. In traditional embedded and automotive platforms, configuration parameter management typically employs the following methods:
[0057] (1) Maintain parameter copies separately for each startup phase. In the early startup phase (i.e., the startup phase), configuration parameters are read from the persistent medium and used for startup decisions. After entering the running phase, the operating system kernel or user-space service reads the parameters again or establishes their own caches. Each phase maintains its own parameter copy. (2) Parameters are exclusively managed by a single startup phase. For example, the BootLoader is responsible for reading, modifying and saving parameters. If subsequent phases need to use related parameters, they are obtained indirectly by reading the persistent medium again, copying the cache, or through a dedicated interface. (3) Pass a small amount of control information through shared memory. A shared memory area is reserved between different startup phases to pass configuration parameters such as startup flags, control commands or short-lifetime status information. However, this shared memory only undertakes temporary message passing functions and does not undertake the unified carrying, persistent flushing and abnormal recovery responsibilities of long-term configuration parameters. (4) Improve reliability through dual copies or redundant partitions. Some traditional solutions improve the reliability of configuration parameters such as boot images or parameter files by using dual-parameter copies, check codes, and redundant partitions. However, these solutions only solve the problem of parameter copy validity judgment and recovery, and do not solve the problem of continuous sharing and unified management of the same runtime parameters across multiple boot stages. (5) Handle parameter inheritance separately in A / B OTA upgrades. In the A / B OTA upgrade scenario, traditional solutions design parameter inheritance logic separately for upgrade slot switching to ensure that some configurations can still be continued after the upgrade. However, these solutions are only for upgrade scenarios and are not designed in a unified manner with factory reset, daily parameter updates, and abnormal recovery mechanisms. (6) Synchronize parameters through inter-domain communication during the runtime of multiple operating systems. In multi-OS domain platforms, traditional solutions usually synchronize parameters between different OS domains through shared memory, message bus, remote procedure call (RPC), or inter-process communication (IPC) mechanisms. However, these solutions mostly occur during runtime, and each system domain may still maintain its own copy, lacking a mechanism for continuously reusing the same parameter image from the early boot stage to the runtime stage.
[0058] The above technologies have at least the following problems in practical applications: (1) Configuration parameter management is fragmented by stage, which is prone to inconsistency. Since different copies of configuration parameters are maintained in the early startup stage, kernel loading stage and user space service startup stage, the same configuration parameter may have different versions in different stages. Once it is modified in a certain stage, if other stages are not synchronized in time, it is easy to cause inconsistency of configuration parameters, state drift or write-back error. (2) Lack of a unified management responsibility handover mechanism. Even if the previous stage and the next stage need to access the configuration parameters, there is no clear management responsibility handover mechanism, which can easily lead to multiple execution entities having the ability to write at the same time, thereby causing concurrent write conflicts, repeated disk writes or persistent state chaos. (3) Shared memory scheme only solves "transmission" and not "management". Traditional shared memory scheme is mainly used to transmit short-lifetime control information and is not responsible for the long-term carrying, unified update, persistent flushing and abnormal recovery of configuration parameter image. Therefore, traditional shared memory scheme cannot directly meet the need for long-term configuration parameter continuous sharing across stages. (4) Redundant parameter copy scheme lacks unified semantics across stages. Traditional dual-parameter replica or redundant parameter partitioning schemes only focus on the validity judgment and recovery of parameter replicas, without involving the unique configuration parameter mirroring in runtime, relay management, unified disk persistence subject, and unified access of multiple systems. Therefore, even if parameter replicas are introduced, the problem of inconsistent configuration parameters across boot phases cannot be naturally solved. (5) Upgrade, recovery, and daily management mechanisms are fragmented. In practical applications, A / B OTA parameter inheritance, factory reset, and daily configuration parameter updates are designed separately, resulting in inconsistent configuration parameter organization, scattered recovery links, high maintenance complexity, and increased risks such as missing configuration parameters after upgrade and abnormal status after recovery. (6) Lack of unified disk persistence constraints in multi-system collaborative scenarios. In multi-operating system platforms, if multiple OS domains can directly modify and persist parameters to disk, it is easy to cause persistence competition, uncertain write order, and inconsistent parameter replica status. Traditional technologies lack a constraint mechanism of "multi-OS shared access but single subject unified disk persistence".
[0059] To address the aforementioned technical issues, embodiments of this application provide a configuration parameter sharing method, apparatus, electronic device, storage medium, and product that enables the continuous sharing of the same configuration parameters between the early startup phase and the operational phase, and facilitates clear management responsibility relay among multiple execution entities, while also taking into account the needs for reliable recovery, A / B OTA upgrades, factory reset, and unified access across multiple systems.
[0060] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0061] Figure 1 A flowchart illustrating the configuration parameter sharing method provided in this application is shown below. Figure 1 As shown, the method includes:
[0062] Step 110: During the startup phase of the electronic device, the configuration parameter image is loaded from the persistent storage area to the shared storage area through the first execution phase management unit to form a runtime shared parameter image.
[0063] The configuration parameter image includes the configuration parameters and metadata required for the operation of each execution entity and / or operating system in the electronic device. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device.
[0064] Step 120: When the parameter takeover conditions are met, the management rights of the first execution phase management unit over the running shared parameter image are transferred to the second execution phase management unit, so that the second execution phase management unit can perform parameter updates on the running shared parameter image.
[0065] The configuration parameter sharing method provided in this embodiment loads the configuration parameter image into the shared storage area during the startup phase to form a runtime shared parameter image. This enables various execution entities and / or operating systems in the electronic device to share access based on the same set of parameter data, thereby reducing the problem of inconsistent parameter versions caused by maintaining multiple parameter copies. When the parameter takeover conditions are met, the management rights of the runtime shared parameter image are transferred from the first execution phase management unit to the second execution phase management unit, which enables the orderly succession of parameter management responsibilities between the startup phase and the runtime phase, thereby reducing write conflicts and management fragmentation caused by the dispersed parameter update chain. In addition, by including the configuration parameters and their metadata in the shared parameter image, a consistency and recovery control mechanism can be built to provide identifiers for parameter updates, identification, and recovery, thereby improving the reliability of configuration parameters and the stability of system operation in complex embedded devices.
[0066] The configuration parameter sharing method provided in this embodiment can be applied to electronic devices with multi-stage startup links and multi-system collaborative operation requirements, including but not limited to vehicle cockpit platforms, intelligent driving domain control platforms, industrial control platforms and other embedded devices that operate multiple operating systems collaboratively.
[0067] In step 110 above, the electronic device can be divided into a startup phase and an operation phase. The first execution phase management unit can be an execution entity that can directly access the persistent medium and the reserved shared storage area in the early startup phase (i.e., the startup phase above), playing one of the logical execution roles in the parameter management relay process.
[0068] For example, an electronic device can be an in-vehicle platform that has a boot loading phase, an early execution phase, an operating system kernel phase, and multiple system domains operating in coordination.
[0069] The first execution phase management unit is used to complete the loading, verification, recovery, and early management of configuration parameter images (such as parameter updates and persistent writing) in the early stages of startup. Specifically, the first execution phase management unit can be responsible for the following operations: (1) reading the first parameter copy, the second parameter copy, and the configuration parameter copy in the backup parameter partition in the persistent storage area; (2) selecting the valid parameter copy image according to the validity rules; (3) loading the valid parameter copy image into the reserved shared storage area to form a unique running shared parameter image; (4) being responsible for reading, modifying, and managing the early persistence of configuration parameters before the second execution phase management unit meets the parameter takeover conditions; and (5) maintaining the version, serial number, generation, dirty flag, relay status identifier, and verification information in the metadata of the running shared parameter image.
[0070] For example, the first execution phase management unit can refer to the BootLoader mentioned above. The metadata of the runtime shared parameter image can be determined by the metadata of the configuration parameter image.
[0071] Additionally, the persistent storage area is used to store copies of configuration parameters. For example, the persistent storage area is internally divided into the first parameter copy, the second parameter copy, and the backup parameter partition, as described above. The shared memory area can be pre-reserved to hold a unique runtime shared parameter image.
[0072] Electronic devices may include multiple operating systems. For example, when an electronic device is an in-vehicle cockpit platform, it may include multiple operating systems such as the instrument cluster domain, the central control domain, and the ADAS domain. The various execution entities in an electronic device can refer to the Bootloader, kernel, and user-space services mentioned above. During the startup and runtime phases, these execution entities may need to access the runtime shared parameter image.
[0073] In this embodiment, a unique runtime shared parameter image is carried in a reserved shared memory area, so that each execution stage and each system domain no longer maintain independent parameter copies, but continuously share the same configuration parameter image.
[0074] The runtime shared parameter image in the reserved shared memory area is not a regular shared memory data block, but a runtime parameter carrier with a defined lifecycle. For example, the lifecycle includes at least the image initialization state, image loading state, state before management takeover, state of management handover, state after management takeover, state of flashing and synchronous update, and state of abnormal recovery.
[0075] Electronic devices access and manage a unique runtime shared parameter image around different stages (such as the startup and running stages) based on the different lifecycles of the runtime shared parameter image, instead of creating separate runtime parameter copies for different stages.
[0076] For example, in some implementations, a lifecycle of the runtime shared parameter image can be established; and based on the lifecycle of the runtime shared parameter image, parameter takeover conditions, and the transfer status of management rights, read / write constraints and access constraints of the runtime shared parameter image can be determined; then, based on the read / write constraints and access constraints, it can be determined whether to update the parameters of the runtime shared parameter image through the first execution phase management unit or the second execution phase management unit.
[0077] The lifecycle of the running shared parameter image can include the image initialization state, image loading state, state before management takeover, state of management handover, state after management takeover, state of flashing and synchronous update, and state of abnormal recovery.
[0078] In this embodiment, the lifecycle of the running shared parameter image is used to characterize the state evolution process from creation, loading, takeover, updating to recovery. Specifically, the image initialization state corresponds to the stage where the parameter image has just been created and is not yet publicly accessible; the image loading state corresponds to the stage where configuration parameters have been written to the shared storage area and can be read; the pre-takeover state indicates the stage where the first execution stage management unit is still in control; the management handover state indicates the transition stage where management rights are being transferred; the post-takeover state indicates the stage where the second execution stage management unit has acquired management rights; the synchronous update state indicates the stage where the parameter image content is synchronously written to the persistent storage area; and the abnormal recovery state indicates the stage where recovery processing begins after a power outage, partial write, or verification failure.
[0079] Both the first and second execution phase management units can read or modify the lifecycle of the runtime shared parameter image, but they can only perform read or modify operations when they have management authority. When the parameter takeover conditions are met and the management authority identifier switches from the first execution phase management unit to the second execution phase management unit, read / write constraints and access constraints can be generated based on the current lifecycle stage. Read / write constraints limit whether writing is allowed, whether only unidirectional flushing is allowed, and whether synchronization needs to be completed. Access constraints limit which execution entities or operating systems can directly access the image and which accesses require a proxy request.
[0080] For example, if the current state is before takeover, the update request is handled by the first execution phase management unit; if the state is in the relay switching state, the direct write is frozen and re-determined after the management rights are switched; if the state is after takeover, the parameter update is performed by the second execution phase management unit; if the state is in the abnormal recovery state, the system is restored to a valid image based on the serial number, generation, and verification information before normal access is restored.
[0081] In this embodiment, the runtime shared parameter image is unique. Its formation mechanism is as follows: when the device starts up, it first performs a validity check on the persistent copy, and then selects a valid parameter copy to load into the reserved shared memory area. After loading, subsequent execution entities and multiple operating system domains access the unique runtime shared parameter image in the reserved shared memory area. Before and after the relay, the image address, image identity and image version are continuously maintained, thereby ensuring that there is always only one runtime parameter image that is commonly referenced by all execution entities during runtime.
[0082] Through the unified layout and lifecycle management mechanism described above, this implementation method can carry different types of parameters in the same parameter image and provide a unified data foundation for parameter updates, anomaly recovery, A / B OTA upgrades and factory reset.
[0083] This implementation method enables the selection of the corresponding management unit to complete parameter updates when constraints are met, and synchronizes the update results to the shared parameter image and its metadata. This approach keeps the lifecycle state, management authority state, and update permissions consistent, reduces erroneous writes and state drift, and allows the system to return to an available image state in abnormal scenarios.
[0084] In step 120 above, the second execution phase management unit is used to take over the parameter management responsibilities after the relay is completed, and uniformly perform parameter updates and persistent writing; multiple operating system domains access the unique runtime shared parameter image after startup.
[0085] For example, Figure 2 This is an overall architecture diagram of the multi-operating system configuration parameter sharing storage and relay management system across boot stages provided in this application embodiment. This architecture covers key aspects such as persistent storage of configuration parameter images, early boot loading, runtime sharing, relay management, multi-operating system access, and unified disk persistence. Figure 2 As shown, the multi-system configuration parameter sharing and relay management system across startup phases mainly includes a persistent storage area, a reserved shared memory area (such as the shared storage area mentioned above), a first execution phase management unit, a second execution phase management unit, a parameter access interface unit, and a multi-system access coordination unit. Figure 2It can be divided into four layers: The top layer is the startup and operation chain of "first boot phase → first execution phase → second execution phase → user (such as the user-space service mentioned above)," which describes who manages the configuration parameters from the early startup phase to the operation phase. The middle layer is a shared parameter image with a reserved shared memory area as its core. The bottom layer is the parameter management unit partitioned persistent storage layer, which describes where the configuration parameters are finally stored and how to reliably save multiple parameter copies. The right side is the access and operation interface layer consisting of IPC, character devices, three OS domain access, A / B OTA upgrade, and factory reset, which describes how multiple OS domains, user space, OTA, and factory reset access and operate this parameter framework.
[0086] The first boot stage can be BootROM or early firmware for secure boot, etc., responsible for the most basic boot, possibly only reading the boot medium, selecting the boot path, loading the next stage, without having complete parameter management capabilities, and not directly undertaking long-term parameter writing to disk. The first execution stage management unit can be BootLoader, early firmware, and secure kernel boot program, etc., which can access persistent storage and reserved shared memory area. The second execution stage management unit can be kernel-mode parameter management unit or runtime parameter management subject with takeover conditions. When the parameter takeover conditions are met, it takes over from the first execution stage management unit and becomes the sole persistent management subject. Specifically, it can be responsible for: (1) uniformly modifying the shared parameter image; (2) uniformly executing disk writing and flashing synchronization; (3) uniformly handling exception recovery, copy selection, and conflict determination; (4) receiving proxy requests from the first execution stage management unit and the user, but not allowing them to directly write to the persistent medium, but rather performing unified persistent flashing by itself.
[0087] Through the above Figure 2 This can more intuitively demonstrate the overall structure of this application: "loading during the boot phase, takeover during the kernel phase, unified access across the three OSs, sharing the same parameter framework for upgrades and recovery, and unified kernel disk storage." This enables continuous sharing of configuration parameters from the early boot phase to the runtime phase, and achieves a smooth transfer of parameter management responsibilities through a relay management mechanism.
[0088] This embodiment uses the configuration parameter image as a unified parameter carrier and establishes a clear management transfer mechanism between the startup and operation phases. This ensures that the unique runtime shared parameter image maintains the same data source and the same management entity throughout the entire startup chain. The parameter loading, access, and update processes revolve around the unique runtime shared parameter image, thereby achieving continuous sharing and orderly succession of configuration parameters across stages.
[0089] Continue to refer to the above. Figure 2The persistent storage area includes a first parameter copy, a second parameter copy, and a parameter backup partition. In some embodiments, when loading the configuration parameter image from the persistent storage area to the shared storage area, parameter copy optimization needs to be performed, and specific steps may include:
[0090] Step S11: Read the first parameter copy and / or the second parameter copy from the persistent storage area during the first execution phase.
[0091] Step S12: Perform a preset basic check operation on the first parameter copy and / or the second parameter copy.
[0092] The preset basic check operations include at least one of version check, length check, status flag check, and verification check.
[0093] Step S13: If the first parameter copy and / or the second parameter copy pass the preset basic check operation, then determine the configuration parameter image from the first parameter copy and / or the second parameter copy and load it into the shared storage area.
[0094] Step S14: If both the first parameter copy and the second parameter copy fail the preset basic check operation, the configuration parameter image is read from the backup parameter partition in the persistent storage area and loaded into the shared storage area.
[0095] In this embodiment, the first parameter copy is a parameter copy stored in the persistent storage area used for startup recovery. After the first execution phase management unit reads it, it performs a basic check to determine whether it is a valid parameter mirror copy. The second parameter copy is a redundant parameter copy set up in conjunction with the first parameter copy, used to provide an alternative when the first parameter copy fails.
[0096] The default basic check operation is used to verify the validity of the parameter copy before loading. The check result is used to filter whether to load the first parameter copy or the second parameter copy as the configuration parameter image.
[0097] The version check is used to confirm whether the version of the parameter copy matches the version required for loading; the length check is used to confirm whether the data length of the parameter copy meets the preset range; the status flag check is used to determine whether the parameter copy is in a loadable state; and the verification check is used to verify the integrity of the parameter copy content.
[0098] The backup parameter partition is used to provide fallback recovery data when both parameter copies (i.e., the first parameter copy and the second parameter copy) are abnormal, so that the configuration parameter image can still be mounted to the shared storage area.
[0099] In this embodiment, by combining basic checks on dual-parameter replicas with a backup parameter partition as a fallback, a usable parameter image can still be identified even when parameter replicas differ or are partially damaged. This image is then stably loaded into the shared storage area, ensuring the continuous availability of the parameter source upon which various execution entities or operating systems rely for shared access. Furthermore, in scenarios where both replicas are faulty, the backup parameter partition provides a recovery source, preventing the configuration parameter image in the shared storage area from being interrupted due to replica failure.
[0100] The copy filtering method provided in this embodiment can effectively filter parameter copies in the early stages of startup and automatically switch to the backup parameter partition when a parameter copy is abnormal, thereby improving the determinism and recovery capability of configuration parameter image loading and ensuring the availability and continuity of parameter content in the shared storage area.
[0101] To illustrate the loading and management process of the configuration parameter image in the early stages of startup in this embodiment, Figure 3 The flowchart for parameter startup loading and pre-takeover management provided in the embodiments of this application is as follows: Figure 3 As shown, in the early stage of startup, the first execution phase management unit first reads the first parameter copy from the persistent storage, as well as the sequence number, generation and dirty flag of the first parameter copy, to determine whether the parameter copy is in a fully committed state and whether it belongs to the latest valid generation, and performs version check, length check, status flag check and verification check.
[0102] If the first parameter copy is valid (e.g., passes the preset basic check operation mentioned above), it is loaded into the reserved shared memory area to form a runtime shared parameter image; if the first parameter copy is invalid (e.g., fails the preset basic check operation), the second parameter copy is read. If both parameter copies are invalid, the complete image is restored from the backup parameter partition.
[0103] In addition, if both parameter copies are readable but have different versions, serial numbers, or dirty status, the priority copy is selected for loading according to the preset recovery decision rules, and the other copy is rebuilt at a later time.
[0104] This application embodiment combines a basic check of dual-parameter copies with a backup parameter partition as a fallback. This allows the first execution phase to identify a usable parameter image even when parameter copies differ or are partially damaged, and to stably load it into the shared storage area, thereby ensuring the continuous availability of configuration parameter sources for shared access. In scenarios where both dual-parameter copies are abnormal, the backup parameter partition provides a recovery source, ensuring that the configuration parameter image in the shared storage area is not interrupted due to the failure of the dual-parameter copies.
[0105] Furthermore, in order to explain the organization of the runtime shared parameter image in this application, Figure 4This is a schematic diagram of the parameter mirror data layout structure provided in the embodiments of this application, as shown below. Figure 4 As shown, the runtime shared parameter image includes a header area, a scalar parameter area, a binary parameter area, a reserved parameter area, and a check area.
[0106] The header area records the image version, length, status identifier, relay status identifier, current management entity identifier, serial number, generation, dirty flag, and verification summary. The scalar parameter area stores integer, enumerated, and flag parameters. The binary parameter area stores strings, certificates, or other binary configuration data. The reserved parameter area is for future expansion. The verification area stores the verification results for each parameter area.
[0107] In some embodiments, the header area of the runtime shared parameter image includes at least the following fields: (1) magic number, used to identify the image type; (2) format version number, used to identify the image layout version; (3) total image length, used to define the image boundary; (4) header length, used to support header expansion; (5) current management entity identifier, used to identify whether the management ownership is currently held by the first execution phase or the second execution phase; (6) relay status identifier, used to identify the status of not taken over, takeover preparation, ownership transfer, taken over, or abnormal rollback; (7) sequence number, used to identify the order in which the images were submitted; (8) generation, used to identify the image. (9) Dirty flag, used to identify whether the current image has an incomplete commit; (10) Write flag and write flag, used to identify whether a persistent commit is complete; (11) Current slot flag, used to identify the current running slot; (12) Target slot flag, used to identify the OTA target slot; (13) Default value area version flag, used to identify the default value baseline on which the factory reset is based; (14) Verification summary of each parameter area, used to verify the scalar parameter area, binary parameter area and reserved parameter area respectively; (15) Header verification field, used to verify the integrity of the header area itself.
[0108] Optionally, each parameter item, in addition to the parameter value itself, can also be associated with parameter identifier, parameter type, current value, slot-related value, default value, validity flag and update time information, so that the same parameter organization can simultaneously support daily parameter updates, A / B OTA slot inheritance and factory reset.
[0109] In some implementations, the fields contained in the header area of the running shared parameter image can be regarded as metadata. The aforementioned current slot identifier, target slot identifier, and default value area version identifier can be configured in this metadata. The current slot identifier is used to identify the currently running slot; the target slot identifier is used to identify the target slot for update and upgrade; and the default value area version identifier is used to identify the default value baseline on which the electronic device is restored to factory settings.
[0110] In the A / B OTA mentioned above, A represents slot A and B represents slot B. The current slot identifier is used to identify the slot in which the device is currently running (e.g., running in slot A or slot B). In the early stages of startup, the BootLoader needs to determine which slot's configuration parameter image to load based on the current slot identifier. Furthermore, startup success flags, rollback counts, health checks, etc., are all associated with the current slot. If the new slot fails to start, the rollback logic must revert to the old slot based on the current slot identifier.
[0111] In this embodiment, the current slot identifier indicates the slot status in which the electronic device is currently loaded and running, so as to distinguish the operating environment corresponding to the currently effective image in a dual-slot or multi-slot architecture. The target slot identifier records the slot information to be entered after the upgrade switch, enabling the parameter management unit to complete parameter inheritance, verification, and switching control around the target operating environment. The default value area version identifier indicates the default value baseline on which the factory reset is based.
[0112] Specifically, the target slot identifier is used to identify the slot to which the system wants to switch after an OTA upgrade, also known as the "next boot slot." The OTA client can write the new firmware to an inactive slot and then set the target slot identifier to that inactive slot. Upon the next boot, the BootLoader reads the target slot identifier and decides to boot from that slot. If boot is successful, the target slot identifier may be cleared. Conversely, if boot fails, the rollback logic will clear the target slot identifier and continue booting from the old slot.
[0113] When performing a factory reset, different system versions may have different default baselines. For example, the default baseline for system V1.0 is v1; system V2.0 may have added parameters, modified default values, or deleted old parameters. If system V2.0 uses the default values from v1 during a factory reset, it may lead to parameter incompatibility, missing values, or errors. Therefore, a version identifier in the default value area is needed to identify which default baseline corresponds to the current system version. During a factory reset, the correct default baseline can be found based on the version identifier in the default value area, ensuring that the parameters used after the factory reset match the current system version.
[0114] In this embodiment, routine parameter management, A / B OTA upgrades, and factory resets are all integrated into the same parameter organization (i.e., metadata) and the same recovery process. In other words, runtime parameter updates, slot switching parameter inheritance, default value rollback, anomaly recovery, and replica reconstruction are all executed around a single runtime shared parameter image, the same set of parameter item structures, the same set of sequence numbers and generational control logic, and the same persistent commit order, rather than maintaining separate data structures and separate recovery processes.
[0115] By configuring the three identifiers mentioned above simultaneously in the metadata, the runtime shared parameter image can provide a unified description of the current running state, the upgrade target state, and the restored default state. When performing loading, switching, rollback, and recovery operations, the system can complete judgment and control based on the same metadata source, thus ensuring consistency in slot identification, upgrade orientation, and default baseline positioning. Therefore, the system can accurately read the corresponding version information during multi-slot switching and factory reset, and synchronize the parameter status with the operating environment.
[0116] For example, in an A / B OTA upgrade scenario, the system determines the target slot based on the target slot identifier and binds the configuration parameters to be migrated to the target slot. Then, based on the current slot identifier, it determines whether the current operating environment allows the switch, thus completing parameter consistency processing before and after the A / B OTA upgrade. In a factory reset scenario, the system retrieves the corresponding default value baseline based on the default value version identifier, reconstructs the initial configuration using the retrieved baseline parameters, and then combines this with the current slot identifier to fill in the parameters of the currently running slot, ensuring that the restored configuration is consistent with the preset factory state.
[0117] By incorporating the current slot identifier, target slot identifier, and default value version identifier into a unified parameter framework, electronic devices can directly update the current value and advance the serial number when performing routine parameter updates; during A / B OTA upgrades, target slot inheritance or migration can be completed based on slot-related values in the same parameter item and the current generation; and during factory resets, rollback can be completed based on the default values in the same parameter item, using the same dirty marking, verification update, and copy recovery chain. Therefore, OTA, factory reset, and routine parameter management are no longer separate additional functions, but rather different operating modes under the same shared parameter mirroring mechanism.
[0118] After introducing the configuration parameter mirror, in some embodiments, replica selection can be achieved as follows: read the first metadata and the second metadata; then, based on the first metadata and the second metadata, select the first parameter replica or the second parameter replica to determine the configuration parameter mirror.
[0119] The first metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the first parameter copy; the second metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the second parameter copy.
[0120] In this embodiment, assuming the first parameter copy in the persistent storage area is selected as the configuration parameter image, then the first metadata corresponds to the metadata of that configuration parameter image. Similarly, assuming the second parameter copy in the persistent storage area is selected as the configuration parameter image, then the second metadata corresponds to the metadata of that configuration parameter image. Furthermore, assuming the parameter copy within the backup parameter partition is selected as the configuration parameter image, then the metadata of that parameter copy corresponds to the metadata of the configuration parameter image.
[0121] The version identifier can refer to the format version number in the header area mentioned above, used to identify the image layout version. The sequence identifier can refer to the sequence number in the header area mentioned above, used to identify the order in which the images were committed. The generation is used to identify the startup, recovery, or upgrade cycle to which the image belongs. The dirty flag is used to indicate whether there are any incomplete commits in the current image. The pre-write flag and post-write flag are used to indicate whether a persistent commit has been completely completed. Verification information is used to characterize the integrity of the replica content.
[0122] Figure 5 This is a schematic diagram of the two-parameter replica consistency determination and recovery decision-making process provided in the embodiments of this application, as follows: Figure 5 As shown, a multi-level recovery chain is preferably constructed using a first parameter copy, a second parameter copy, and a backup parameter partition. In the early stages of startup, not only is the validity of the verification of the first and second parameter copies determined, but also the sequence number, generation, dirty flag, pre-write flag, and post-write flag of each parameter copy are comprehensively compared to determine whether the parameter copy belongs to the most recent complete commit result.
[0123] Preferably, the algorithm for determining dual-copy recovery includes the following steps:
[0124] Step R1: Read the metadata (i.e., first metadata and second metadata) in the header area of the first parameter copy and the second parameter copy respectively, and verify the magic number, format version number, total image length and header verification field; the parameter copy with any abnormal basic field is directly determined as an invalid parameter copy (i.e. cannot be used as a configuration parameter image).
[0125] Step R2: Continue to verify the verification digest of each parameter area for the parameter copy that has passed the basic verification, and check the pre-write flag, post-write flag and dirty flag; if there is a pre-write flag that has been set but the post-write flag has not been completed, or a dirty flag that has not been cleared, then mark the parameter copy as a suspected half-written copy.
[0126] Step R3: Compare the generation of the two parameter copies; if the generation is different, prioritize the parameter copy with the higher generation, valid verification, and complete submission as the candidate valid copy.
[0127] Step R4: If the two replicas are of the same generation, compare their sequence numbers; prioritize the replica with the newer sequence number and complete commit as the candidate valid replica.
[0128] Step R5: If a parameter copy has a newer sequence number but is in a suspected half-written state, while another parameter copy has an older sequence number but is valid and has been fully committed, then the latter parameter copy is selected as the current valid parameter copy, and the former parameter copy is marked as the parameter copy to be rebuilt.
[0129] Step R6: If both parameter copies are valid and have the same serial number and generation, then either one can be loaded as the current valid parameter copy, and the two copies will be kept consistent during subsequent writes.
[0130] Step R7: If both copies are invalid, restore the complete image from the backup parameter partition, and rebuild the first parameter copy and the second parameter copy with the restored image.
[0131] The above-mentioned judgment algorithm can select the most trustworthy parameter copy as the configuration parameter image in scenarios such as different parameter copy versions, different submission times, abnormal power outages, and half-writes, instead of relying solely on a single verification result for recovery.
[0132] By using the above method, consistency and validity can be determined for the two parameter copies, and the most reliable parameter copy can be directly used as the configuration parameter image for subsequent loading and shared access. This provides a reliable foundation for the construction of runtime shared parameter images and reduces the probability of incorrect copies being selected.
[0133] In some embodiments, before the parameter takeover conditions are met, the first execution phase management unit can perform parameter updates and persistent writes on the runtime shared parameter image. The parameter updates and persistent writes performed on the runtime shared parameter image by the first execution phase management unit include the following steps:
[0134] Step S21: Set the dirty flag or pre-write flag for the runtime shared parameter mirror;
[0135] Step S22: Update the runtime shared parameter image and its metadata;
[0136] Step S23: Remove dirty markers or pre-write markers;
[0137] Step S24: Flush the updated content of the running shared parameter image to the persistent storage area.
[0138] In this embodiment, the runtime shared parameter image is a carrier of the configuration parameter image loaded in the shared storage area. Its content includes the parameters themselves and the corresponding metadata. The metadata of the runtime shared parameter image can be used to record version identifier, sequence identifier, generation, dirty flag, and verification information, etc.
[0139] The first execution phase management unit is the management entity for the runtime shared parameter image during the early startup phase or before the second execution phase management unit takes over. It can be used to perform unified modifications on the runtime shared parameter image. For example, when multiple execution entities need to modify the runtime shared parameter image, the first execution phase management unit will perform the modification in a unified manner to ensure that multiple execution entities do not concurrently write to the runtime shared parameter image. This avoids the situation in traditional technologies where multiple execution entities have the ability to write at the same time, which can lead to concurrent write conflicts, duplicate disk writes, or persistent state chaos.
[0140] In this embodiment, before the second execution phase management unit takes over management authority, the first execution phase management unit is responsible for reading, modifying, and managing the early persistence of the runtime shared parameter image. At this time, the first execution phase management unit is both the current management entity and the current disk persistence entity; its modifications to the runtime shared parameter image will synchronously update the sequence number or dirty flag status in the header area of the parameter image to indicate whether an uncommitted update has occurred.
[0141] This process allows for the creation of a unique runtime shared parameter image in the early stages of device startup, ensuring that subsequent execution entities and / or operating systems work around this unique runtime shared parameter image.
[0142] For example, during the runtime phase, when the current management entity (e.g., the second execution phase management unit) modifies the runtime shared parameter image, it first sets a dirty flag or a pre-write flag, then updates the image content, serial number, and verification information, and finally clears the dirty flag and sets the write-complete status. This commit sequence allows the device to determine whether the most recent update was fully committed based on the flag bits and sequence information after an abnormal power outage.
[0143] Through this consistency control and recovery decision-making process, this application can recover valid parameter images under abnormal scenarios such as power failure, partial write, copy corruption, and cross-stage switching interruption, thereby improving the reliability and recoverability of parameter management.
[0144] Furthermore, Figure 6 The flowchart of the state machine for writing provided in this application is as follows: Figure 6As shown, the persistent data flushing process can be implemented using a flushing state machine. This flushing state machine includes at least the following states: idle state, dirty data pending commit state, first replica flushing state, second replica flushing state, backup partition synchronization state, commit completed state, and exception recovery state.
[0145] When the runtime shared parameter image is modified, it first enters the dirty data pending commit state and sets a dirty flag or a pre-write flag; then it enters the first parameter copy flush state, writes the updated parameter image to the first parameter copy and updates the corresponding verification information; after the first parameter copy is successfully flushed, it enters the second parameter copy flush state, writes the same parameter image to the second parameter copy and updates the corresponding verification information; when preset conditions are met, it further enters the backup parameter partition synchronization state, performs delayed synchronization or periodic synchronization on the backup parameter partition; when the above steps are completed, the dirty flag is cleared, the post-write completion state is set, and it enters the commit completion state.
[0146] If an abnormal power outage, write failure, or verification failure occurs during the first parameter replica flushing, second parameter replica flushing, or backup parameter partition synchronization, the system can enter an abnormal recovery state. Upon the next startup, it will combine the sequence number, generation, dirty flag, pre-write flag, and post-write flag to execute a recovery decision. Thus, the flushing state machine forms a clear commit chain of "Dirty → First Replica → Second Replica → Backup → Complete".
[0147] Before the device enters a suspend state, a suspend protection flag is set on the master control side to prevent unsafe writes from continuing. If it is a non-master control system domain, a corresponding suspend flag is also set to prevent continued updates of shared parameters within the suspend window. Before the device is powered off or restarted, if dirty data exists, the current management entity will trigger a final synchronous write operation. Through this write state machine and suspend protection mechanism, the risk of a half-written state in the parameter area during suspend or power-down processes can be reduced.
[0148] In this embodiment, the first execution phase management unit modifies and updates the runtime shared parameter image before the transfer of management rights, and synchronously writes the update results to disk, so that the parameter image state, metadata state and persistent storage area content can be kept consistent, ensuring a more continuous connection of parameters before and after takeover, and in the event of abnormal interruption, it can identify uncommitted updates based on the marked state and perform recovery processing.
[0149] In some embodiments, after the management of the runtime shared parameter image is transferred to the second execution phase management unit, if the first execution phase management unit detects a parameter update requirement for the runtime shared parameter image, an update request is sent to the second execution phase management unit so that the second execution phase management unit can update the parameters of the runtime shared parameter image.
[0150] In this embodiment, the update request is used to characterize the parameter modification intentions of the first execution phase management unit that still exist after the transfer of management authority. The update request may carry the identifier of the parameter to be updated, the update content, and the corresponding target location. The target location is used to indicate the parameter segment, field, or record item in the runtime shared parameter image, so that the second execution phase management unit can locate and complete the update process accordingly.
[0151] In this process, after the transfer of management authority, the first execution phase management unit no longer has the authority to modify the runtime shared parameter image. Instead, it triggers the controlled update link by sending an update request, so that the second execution phase management unit can modify the runtime shared parameter image according to the unified image management rules.
[0152] For example, to illustrate the relay process of parameter management responsibilities between different management units in this application, Figure 7 The relay management state machine and ownership transfer timing diagram provided for the embodiments of this application are as follows: Figure 7 As shown, it illustrates the relay timing between the first execution phase management unit and the second execution phase management unit.
[0153] In the early startup phase, the device is under the exclusive management of the first execution phase management unit, which is responsible for the initialization, reading, modification, and early persistence management of the parameter image. At this time, the first execution phase management unit has both ownership of parameter image management and ownership of persistence disk storage, while the second execution phase management unit can only be in an unmanaged or read-only ready state.
[0154] When the second execution phase management unit completes initialization and meets the preset parameter takeover conditions, it enters the takeover preparation state. For example, the parameter takeover conditions preferably include one or more of the following:
[0155] (1) The second execution phase management unit has completed the shared memory mapping;
[0156] (2) The current running state shared parameter image has been successfully identified;
[0157] (3) The header area verification and version confirmation of the parameter mirror have been completed;
[0158] (4) It already has the ability to update parameters and persistently write data;
[0159] (5) There are currently no uncommitted transactions or dirty data that have been synchronized to a recoverable state in the first execution phase management unit.
[0160] After the above parameter takeover conditions are met, the ownership transfer state is entered. At this time, by updating the relay status identifier, the current management entity identifier, and the necessary confirmation flags, the ownership of the runtime shared parameter mirror management and the ownership of the persistent disk storage are transferred from the first execution stage management unit to the second execution stage management unit.
[0161] Optionally, the ownership transfer follows the following switching rules: first, freeze the direct disk write permissions of the first execution phase management unit; then, confirm that the second execution phase management unit has received the current parameter image context; then, switch the current management subject identifier; and finally, grant the unified write and disk write permissions to the second execution phase management unit.
[0162] Once ownership transfer is complete, the second execution phase management unit enters a state of exclusive management. At this point, the first execution phase management unit stops directly writing to persistent storage; if it still needs to modify parameters, it sends write requests to the second execution phase management unit via a proxy request method. The second execution phase management unit then uniformly modifies the shared parameter image and executes the write operation to disk. This ensures that only a single persistent management entity exists during runtime.
[0163] In addition, if an anomaly occurs during the takeover preparation or ownership transfer process, such as the second execution phase management unit initialization failure, takeover confirmation timeout, parameter mirror verification inconsistency, or the existence of uncommitted transactions, the system will enter an abnormal rollback state and will continue to be managed by the first execution phase management unit until the parameter takeover conditions are met again.
[0164] In the relay management process, state management can be achieved through a relay management state machine. This state machine includes at least the following states: initial non-takeover state, first execution phase exclusive management state, takeover preparation state, ownership transfer state, second execution phase exclusive management state, and abnormal rollback state. This relay management state machine ensures a clear handover of parameter management responsibilities and avoids concurrent disk writes by multiple execution entities.
[0165] In this embodiment, after the second execution phase management unit takes over management authority, parameter updates can still be completed in the controlled link. The responsibilities between the first execution phase management unit and the second execution phase management unit are clearly defined. The writing process of the running shared parameter image is under unified control. The parameter content and metadata are more likely to remain consistent, and it helps to reduce image state drift caused by management authority conflicts.
[0166] In other embodiments, after the management of the runtime shared parameter image is transferred to the second execution phase management unit, if it is detected that each operating system accesses the runtime shared parameter image through the second execution phase management unit, the updated content of the runtime shared parameter image is obtained; then the updated content of the runtime shared parameter image is written to the persistent storage area through the second execution phase management unit.
[0167] In this embodiment, each operating system refers to a running entity that can still access the runtime shared parameter image after the transfer of management rights. The running entity can be an operating system kernel, user-space service, or upper-layer software in different OS domains. The updated content can refer to the parameter data and its corresponding metadata that have been modified during the access process of the runtime shared parameter image.
[0168] In traditional technologies, multiple domains share a single memory block in shared memory or ordinary inter-domain communication frameworks. Shared memory solutions only address the issue of multiple domains being able to read and write to the same memory block, without taking responsibility for maintaining the consistency of the replicas between that memory block and the persistent partition. Traditional inter-domain sharing solutions generally lack parameter-level slot values, default values, and recovery semantics, and do not incorporate A / B OTA upgrades and factory resets into the same shared structure.
[0169] Unlike traditional technologies, in this embodiment, unified access across multiple OS domains is based on "unified access entry + unified disk write-by a single subject + parameter image-level recovery link". Unified access to the shared parameter image by multiple OS domains requires that multiple system domains access the same running shared parameter image. However, only the master execution subject that takes over is responsible for uniformly writing the first parameter copy, the second parameter copy, and the backup parameter partition, thereby avoiding persistence contention caused by multiple system domains writing to disk separately.
[0170] Continue to refer to the above. Figure 6 It demonstrates the end-to-end data flow from Boot to shared image, relay management, and unified disk storage, as well as the unified access mechanism for user space and multiple system domains. Specifically, it includes the interface link from unified access in user space to the underlying shared parameter image, and the shared access mechanism for multiple system domains to the same shared parameter image after the device has started up.
[0171] The second execution phase management unit exposes unified access capabilities to upper-layer applications through character device interfaces, system service interfaces, library encapsulation interfaces, Java Native Interface (JNI), or other equivalent interfaces. When user-space applications access the shared parameter image through the unified interface, they do not need to be aware of the underlying parameter image layout, dual-copy recovery logic, sequence number and generation control logic, or relay management details. If a user-space application initiates a write request, the second execution phase management unit will ultimately modify the shared parameter image and perform persistent disk write operations.
[0172] After the device boots up, multiple OS domains can access the same runtime shared parameter image. In some implementations, the master OS domain can be responsible for unified persistent disk write-in, and subordinate OS domains can read parameters through a unified access interface; if a subordinate system domain needs to modify parameters, it submits an update request through notification, proxy request, or equivalent mechanism, and the master system domain uniformly modifies the shared parameter image and writes it to disk.
[0173] Through the above-mentioned access path and unified parameter framework design, this application not only covers the sharing and recovery of the underlying parameter image, but also covers the unified access link from user space to the underlying parameter image and the multi-system collaborative access mechanism.
[0174] Continue to refer to the above. Figure 6 Based on the end-to-end data flow and timing sequence mechanism, from the perspective of end-to-end timing, this embodiment can run in the following order: "Boot startup → replica selection determination → shared parameter image loading → first execution phase management unit management → relay state machine switching → second execution phase management unit unified management → dual replica writing → backup partition synchronization → completion and submission".
[0175] Specifically, after booting, the device first reads the header area and verification information of the first and second parameter copies, and performs copy selection based on generation, serial number, dirty flag, and pre-write / post-write flag. Then, it loads the selected valid parameter copy into the reserved shared memory area to form a unique running shared parameter image. Before the second execution stage management unit takes over, the first execution stage management unit holds ownership of the shared parameter image management and persistent disk storage. When the second execution stage management unit meets the parameter takeover conditions, it completes the ownership transfer through the relay management state machine. After the relay is completed, all parameter updates converge to the second execution stage management unit, which uniformly modifies the shared parameter image and drives the write state machine to complete the synchronization of the first parameter copy, the second parameter copy, and the backup parameter partition.
[0176] Furthermore, in OTA upgrade scenarios, the inheritance of target slot parameters and the advancement of image generations also follow the aforementioned full-link timing; in factory reset scenarios, default value rollback, serial number advancement, and copy reconstruction also follow the aforementioned full-link timing. Thus, Boot, shared image, relay management, unified disk write, OTA, and factory reset are linked into a continuous processing link under the same mechanism framework, rather than independent local functions.
[0177] As described in the above embodiments, the overall idea of the configuration parameter sharing method provided in this application is to organize the configuration parameters into a persistent, recoverable, and reusable runtime shared parameter image. A relay management mechanism, a unique runtime image formation mechanism, a consistency and recovery control mechanism, and a unified management mechanism for OTA and factory reset are established around this shared parameter image. This enables multiple execution entities and multiple system domains to work collaboratively around the same runtime parameter image, with the single entity taking over the management uniformly performing the persistent disk write operation. Specifically, this includes:
[0178] (1) Set up a first parameter copy, a second parameter copy and a backup parameter partition in persistent storage, and maintain metadata such as version, serial number, generation, dirty mark, relay status identifier and verification information in the header area of the parameter image to establish the basis for consistency control and multi-level recovery of the parameter image.
[0179] Among them, establishing a parameter mirror-level recovery link through dual-parameter replicas, backup parameter partitions, and verification mechanisms can improve recovery capabilities in scenarios such as power outages, partial writes, and replica corruption.
[0180] (2) In the early stage of system startup, the first execution phase management unit selects a valid parameter copy according to the parameter copy validity judgment rule and loads it into the reserved shared memory area to form a unique running shared parameter image; the unique running shared parameter image serves as the unique running parameter carrier accessed by each execution entity before and after the handover of management rights.
[0181] By introducing a unique runtime shared parameter image that is continuously reused across startup phases, and storing the unique runtime shared parameter image in a reserved shared memory area, instead of maintaining parameter copies separately for each phase, the same configuration parameters can remain continuously available between the early startup phase and the runtime phase, reducing the risk of parameter inconsistency between different startup phases.
[0182] (3) Establish a shared parameter image lifecycle management mechanism so that the parameter image goes through the states of initialization, loading, pre-takeover management, handover switching, post-takeover unified management, write synchronization and abnormal recovery, and maintains consistent data organization and access constraints in each state. This can improve the uniformity, maintainability and scalability of the parameter management architecture.
[0183] (4) Establish a relay management state machine. Before the second execution phase management unit has the conditions to take over, the first execution phase management unit is responsible for reading, modifying and early persistence management of shared parameter images. When the conditions to take over are met, the parameter management responsibilities are transferred from the first execution phase management unit to the second execution phase management unit through relay status identifier, ownership transfer conditions and management subject switching rules.
[0184] In particular, by establishing a clear management responsibility handover link through a relay management state machine, takeover condition determination, and ownership transfer switching rules, the first execution phase and the second execution phase do not compete for write permissions in parallel, but complete the orderly handover according to the state machine rules. After the relay is completed, the previous phase can only submit updates through proxy requests, which can reduce the risk of conflict caused by multiple execution entities concurrently writing to disk.
[0185] (5) After the relay is completed, the management unit of the previous execution stage no longer writes to the persistent medium directly, but submits the parameter update request through the proxy request method. The management unit of the second execution stage uniformly modifies the shared parameter image and executes the disk write, thereby ensuring that only a single persistent management entity exists during the runtime.
[0186] (6) Establish a consistency and recovery mechanism based on serial number, generation, dirty mark, pre-write flag, post-write flag and verification result, which is used to perform replica selection, conflict determination and recovery decision in startup, power failure recovery, replica damage, half-write and abnormal interruption scenarios.
[0187] Among them, the sequence number, generation, dirty mark, pre-write / post-write flag and multi-level cyclic redundancy check (CRC) constitute the parameter mirror level consistency judgment and recovery decision link (first parameter copy, second parameter copy, backup parameter partition three-level recovery), rather than general file level or storage medium level fault tolerance.
[0188] (7) Integrate A / B OTA upgrades, factory resets and daily parameter management into the same parameter organization and the same recovery link, so that slot inheritance, default value rollback and daily updates share the same shared parameter image framework, instead of maintaining multiple independent mechanisms.
[0189] Integrating A / B OTA upgrades, factory resets, and routine parameter management into a single parameter framework can improve the stability of parameter inheritance during A / B OTA upgrades and enable factory resets to be completed within the same parameter framework.
[0190] (8) Supports multiple OS domains to access the same shared parameter image, but ultimately only a single entity is used to write it to disk, so as to take into account the shared access requirements of multiple systems and the requirements of persistence consistency, and reduce the parameter synchronization complexity in multi-system collaborative scenarios.
[0191] As can be seen from the above embodiments, since a unique runtime shared parameter image is maintained in the reserved shared memory area, the execution entities in the early startup stage and the runtime stage will work around this unique runtime parameter image, rather than maintaining separate independent caches. This reduces the risk of parameter inconsistency across stages. Furthermore, because the management entities before and after the handover are clearly distinguished by the handover status identifier, parameter management responsibilities have clear boundaries, preventing multiple execution entities from simultaneously writing to disk. Moreover, since persistent flushing is uniformly performed by a single second execution stage management unit after the handover is completed, while the previous first execution stage management unit submits updates via proxy requests, race conditions caused by concurrent writes from multiple entities are reduced.
[0192] Furthermore, because the first parameter copy, second parameter copy, backup parameter partition, and verification mechanism are integrated into a unified recovery path, a valid parameter image can still be recovered even in scenarios involving copy corruption, power loss, or partial write operations. Moreover, since runtime values, slot-related values, and default values are incorporated into the same parameter framework, A / B OTA upgrades, factory resets, and routine parameter updates can share the same organizational structure and flashing path, avoiding fragmentation from multiple mechanisms. Finally, because multiple system domains access the same runtime shared parameter image, and it is ultimately persisted to disk by a single entity, the complexity caused by cross-domain parameter synchronization, redundant maintenance, and persistence contention is reduced.
[0193] Figure 8 A schematic diagram of the configuration parameter sharing device provided in this application is shown below. Figure 8 As shown, the configuration parameter sharing device 80 provided in this embodiment includes:
[0194] The loading module 810 is used to load the configuration parameter image from the persistent storage area to the shared storage area through the first execution phase management unit during the startup phase of the electronic device, forming a runtime shared parameter image. The configuration parameter image includes the configuration parameters and metadata required for the operation of each execution entity and / or operating system in the electronic device. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device.
[0195] The transfer module 820 is used to transfer the management rights of the running shared parameter image from the first execution stage management unit to the second execution stage management unit when the parameter takeover conditions are met, so that the running shared parameter image can be updated by the second execution stage management unit.
[0196] In one possible implementation, loading modules can specifically be used for:
[0197] In the first execution phase, read the first and / or second parameter copies from the persistent storage area;
[0198] Perform preset basic checks on the first parameter copy and / or the second parameter copy. The preset basic checks include at least one of version check, length check, status flag check and verification check.
[0199] If the first parameter copy and / or the second parameter copy pass the preset basic check operation, the configuration parameter image is determined from the first parameter copy and / or the second parameter copy and loaded into the shared storage area;
[0200] If neither the first parameter copy nor the second parameter copy passes the preset basic check operation, the configuration parameter image is read from the backup parameter partition in the persistent storage area and loaded into the shared storage area.
[0201] In one possible implementation, loading modules can specifically be used for:
[0202] Read the first metadata and the second metadata; the first metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the first parameter copy; the second metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the second parameter copy.
[0203] Based on the first metadata and the second metadata, select either the first parameter copy or the second parameter copy to determine the configuration parameter image.
[0204] In one possible implementation, the configuration parameter sharing device further includes an update / flash module for:
[0205] Before the parameter takeover conditions are met, the first execution phase management unit performs parameter updates and persistent writes to the runtime shared parameter image. This parameter update and persistent write operation via the first execution phase management unit includes:
[0206] Set a dirty flag or a pre-write flag for the runtime shared parameter image;
[0207] Update the runtime shared parameter image and its metadata;
[0208] Remove dirty marks or write-before markers;
[0209] The updated content of the runtime shared parameter image is flushed to the persistent storage area.
[0210] In one possible implementation, the configuration parameter sharing device further includes a configuration module for: configuring a current slot identifier, a target slot identifier, and a default value area version identifier in the metadata; wherein, the current slot identifier is used to identify the currently running slot; the target slot identifier is used to identify the target slot for update and upgrade; and the default value area version identifier is used to identify the default value baseline on which the electronic device is restored to factory settings.
[0211] In one possible implementation, the configuration parameter sharing device further includes a request module, which is used to: after the management rights of the running-state shared parameter image are transferred to the second execution stage management unit, if the first execution stage management unit detects a parameter update requirement for the running-state shared parameter image, initiate an update request to the second execution stage management unit so that the second execution stage management unit can update the parameters of the running-state shared parameter image.
[0212] In one possible implementation, the configuration parameter sharing device further includes a constraint module for:
[0213] Establish the lifecycle of the runtime shared parameter image, which includes the image initialization state, image loading state, state before management takeover, state after management takeover, state of flashing and synchronous update, and state of abnormal recovery.
[0214] Based on the lifecycle of the runtime shared parameter image, the parameter takeover conditions, and the transfer status of management rights, determine the read / write constraints and access constraints of the runtime shared parameter image.
[0215] Based on read / write constraints and access constraints, determine whether to update the runtime shared parameter mirror execution parameters through the first execution phase management unit or the second execution phase management unit.
[0216] In one possible implementation, the configuration parameter sharing device further includes an access processing module for:
[0217] After the management of the runtime shared parameter image is transferred to the second execution phase management unit, if it is detected that each operating system accesses the runtime shared parameter image through the second execution phase management unit, the updated content of the runtime shared parameter image is obtained.
[0218] The second execution phase management unit flushes the updated content of the runtime shared parameter image to the persistent storage area.
[0219] The configuration parameter sharing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0220] Figure 9A schematic diagram of the structure of the electronic device provided in this application. Figure 9 As shown, the electronic device 900 provided in this embodiment includes at least one processor 901 and a memory 902. Optionally, the electronic device 900 further includes a communication component 903. The processor 901, memory 902, and communication component 903 are connected via a bus.
[0221] In a specific implementation, at least one processor 901 executes computer execution instructions stored in memory 902, causing at least one processor 901 to perform the above-described method.
[0222] The specific implementation process of processor 901 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0223] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0224] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0225] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0226] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0227] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0228] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0229] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0230] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0231] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0232] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0233] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0234] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0235] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A configuration parameter sharing method, characterized by, include: During the startup phase of the electronic device, the configuration parameter image is loaded from the persistent storage area to the shared storage area by the first execution phase management unit to form a runtime shared parameter image. The configuration parameter image includes the configuration parameters required for the operation of each execution entity and / or operating system in the electronic device and the metadata of the configuration parameters. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device. When the parameter takeover conditions are met, the management rights of the first execution phase management unit over the running shared parameter image are transferred to the second execution phase management unit, so that the second execution phase management unit can update the execution parameters of the running shared parameter image.
2. The method of claim 1, wherein, The process of loading the configuration parameter image from the persistent storage area to the shared storage area includes: In the first execution phase, read the first parameter copy and / or the second parameter copy from the persistent storage area; Perform a preset basic check operation on the first parameter copy and / or the second parameter copy. The preset basic check operation includes at least one of version check, length check, status flag check and verification check. If the first parameter copy and / or the second parameter copy pass the preset basic check operation, then the configuration parameter image is determined from the first parameter copy and / or the second parameter copy and loaded into the shared storage area; If neither the first parameter copy nor the second parameter copy passes the preset basic check operation, the configuration parameter image is read from the backup parameter partition in the persistent storage area and loaded into the shared storage area.
3. The method of claim 2, wherein, Determining the configuration parameter mirror from the first parameter copy and / or the second parameter copy includes: Read the first metadata and the second metadata; the first metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the first parameter copy; the second metadata includes at least one of the following: version identifier, sequence identifier, generation, dirty flag, pre-write flag, post-write flag, and verification information of the second parameter copy. Based on the first metadata and the second metadata, select either the first parameter copy or the second parameter copy to determine the configuration parameter mirror.
4. The method of claim 1, wherein, Also includes: Before the parameter takeover conditions are met, the first execution phase management unit performs parameter updates and persistent writes on the running shared parameter image. The process of updating and persistently writing the runtime shared parameter image execution parameters through the first execution phase management unit includes: Set a dirty flag or a pre-write flag for the running shared parameter image; Update the runtime shared parameter image and its metadata; Clear the dirty marker or the pre-write marker; The updated content of the running shared parameter image is written to the persistent storage area.
5. The method of claim 1, wherein, Also includes: Configure the current slot identifier, target slot identifier, and default value area version identifier in the metadata; wherein, the current slot identifier is used to identify the currently running slot; The target slot identifier is used to identify the target slot for the update and upgrade, and the default value area version identifier is used to identify the default value baseline on which the electronic device is restored to factory settings.
6. The method of claim 1, wherein, Also includes: After the management rights of the running-state shared parameter image are transferred to the second execution stage management unit, if the first execution stage management unit detects a parameter update requirement for the running-state shared parameter image, an update request is sent to the second execution stage management unit so that the second execution stage management unit can update the parameters of the running-state shared parameter image.
7. The method of claim 1, wherein, Also includes: Establish the lifecycle of the running shared parameter image, which includes the image initialization state, image loading state, state before management takeover, state after management takeover, state after management takeover, state of flashing and synchronous update, and state of abnormal recovery. Based on the lifecycle of the running shared parameter image, the parameter takeover conditions, and the transfer status of management rights, determine the read / write constraints and access constraints of the running shared parameter image; Based on the read / write constraints and access constraints, determine whether to update the running-state shared parameter mirror execution parameters through the first execution phase management unit or the second execution phase management unit.
8. The method of claim 1, wherein, Also includes: After the management rights of the runtime shared parameter image are transferred to the second execution phase management unit, if it is detected that each operating system accesses the runtime shared parameter image through the second execution phase management unit, the updated content of the runtime shared parameter image is obtained. The updated content of the running shared parameter image is written to the persistent storage area by the second execution phase management unit.
9. A configuration parameter sharing apparatus, characterized by, include: The loading module is used to load a configuration parameter image from the persistent storage area to the shared storage area through the first execution phase management unit during the startup phase of the electronic device, forming a runtime shared parameter image. The configuration parameter image includes the configuration parameters required for the operation of each execution entity and / or operating system in the electronic device and the metadata of the configuration parameters. The runtime shared parameter image is used for shared access by each execution entity and / or operating system in the electronic device. The transfer module is used to transfer the management rights of the first execution phase management unit over the running shared parameter image to the second execution phase management unit when the parameter takeover conditions are met, so that the second execution phase management unit can perform parameter updates on the running shared parameter image.
10. An electronic device / computer readable storage medium / computer program product, characterized in that, The electronic device includes: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of claims 1 to 8; 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 to 8; The computer program product includes computer execution instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 8.
