Flash Partition Upgrade via Virtual APP MTD Under Limited Memory
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for updating Flash partitions in resource-constrained embedded systems face challenges due to insufficient memory resources and the unpredictability of content being loaded into memory, leading to program crashes during partition upgrades.
Innovation Solution
A method and device that utilize available DDR memory information to create a target virtual APP MTD partition and modify the readsect function to ensure data reading from this partition, allowing upgrades with minimal system changes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the program content is loaded into memory for Flash partition upgrade, then the upgrade can be performed, but the memory resources are consumed and content may be reclaimed under memory pressure
Solution Approach 1:
The patent uses mlock system call to pre-lock the memory pages containing the program content before the upgrade process begins. This preliminary action ensures that the memory pages are not reclaimed during the upgrade operation, guaranteeing that the content remains in memory throughout the critical upgrade process while avoiding continuous memory pressure on the system.
Solution Approach 2:
The patent introduces a memory locking mechanism (mlock) as an intermediary between the program content and the memory management system. This intermediary prevents the memory pages from being swapped out or reclaimed by the Linux memory management system, thereby ensuring reliable access to the content during the Flash partition upgrade without permanently consuming additional memory resources.
2Ease of operation
If ping-pong partitions are used for Flash partition upgrade, then the upgrade process is simplified, but the system requires additional Flash resources that are not available in resource-constrained embedded systems
Solution Approach 1:
Instead of using ping-pong partitions which require duplicating the entire Flash partition structure, the patent copies only the necessary program content into locked memory pages. This selective copying approach allows the upgrade process to proceed with minimal Flash resource consumption while maintaining the simplicity of the upgrade operation. The copied content is then used directly from memory without requiring additional Flash partitions.
Solution Approach 2:
The patent extracts the essential program content from the Flash partition and places it into locked memory pages, separating the upgrade-critical data from the rest of the Flash storage system. This extraction eliminates the need for ping-pong partition structures while preserving the upgrade simplicity, as only the necessary content is copied and locked in memory for the upgrade process.
3Quantity of substance
If the Linux page fault mechanism is used to load content on demand, then memory usage is optimized, but it cannot be guaranteed that all required content is pre-loaded into memory for upgrade
Solution Approach 1:
The patent applies preliminary anti-action by using mlock to prevent the Linux page fault mechanism from swapping out or reclaiming the memory pages containing the program content before the upgrade process begins. This counteracts the default behavior of the page fault mechanism, ensuring that the required content remains in memory throughout the upgrade operation while still allowing efficient memory usage for non-critical content.
Data Source
AI summary
A Flash partition upgrade method and device, an apparatus, and a storage medium, applied to a SquashFS system are provided. The Flash partition upgrade method includes: obtaining available DDR memory information via a kernel command line and Linux; performing virtual partition creation and Flash memory copy based on the available DDR memory information and a preset virtual partition creation rule to obtain a target virtual APP MTD partition and a copy status record identifier corresponding to an APP partition in system Flash; by modifying implementation of a preset readsect function, performing data reading based on the copy status record identifier and the target virtual APP MTD partition to obtain target data; in response to a corresponding APP partition upgrade trigger condition being met, performing partition upgrade based on the target data. In this way, Flash partition upgrade under the condition of limited resources can be effectively achieved.


