WO2022262753A1 - Operating system starting method, device, storage medium, and computer program product - Google Patents
Operating system starting method, device, storage medium, and computer program product Download PDFInfo
- Publication number
- WO2022262753A1 WO2022262753A1 PCT/CN2022/098861 CN2022098861W WO2022262753A1 WO 2022262753 A1 WO2022262753 A1 WO 2022262753A1 CN 2022098861 W CN2022098861 W CN 2022098861W WO 2022262753 A1 WO2022262753 A1 WO 2022262753A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- partition
- data
- static
- sub
- dynamic
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 119
- 238000004590 computer program Methods 0.000 title claims abstract description 20
- 238000005192 partition Methods 0.000 claims abstract description 850
- 230000003068 static effect Effects 0.000 claims abstract description 417
- 238000012795 verification Methods 0.000 claims description 63
- 230000008569 process Effects 0.000 claims description 53
- 238000009434 installation Methods 0.000 claims description 33
- 230000008859 change Effects 0.000 description 12
- 230000001360 synchronised effect Effects 0.000 description 10
- 238000012937 correction Methods 0.000 description 9
- 238000013500 data storage Methods 0.000 description 9
- 230000006872 improvement Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 101150064138 MAP1 gene Proteins 0.000 description 4
- 101150009249 MAP2 gene Proteins 0.000 description 4
- 238000013508 migration Methods 0.000 description 4
- 230000005012 migration Effects 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 229920001296 polysiloxane Polymers 0.000 description 1
- 239000010979 ruby Substances 0.000 description 1
- 229910001750 ruby Inorganic materials 0.000 description 1
- 238000001308 synthesis method Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4406—Loading of operating system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1417—Boot up procedures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1433—Saving, restoring, recovering or retrying at system level during software upgrading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44536—Selecting among different versions
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present application relates to the field of computer technology, and in particular to an operating system startup method, device, storage medium and computer program product.
- a user terminal needs to be installed with an operating system before it can be used by the user.
- an operating system for example: IOS system, Android system
- a mobile phone operating system for example: IOS system, Android system
- the present application provides an operating system startup method, device, storage medium and computer program product, so as to help solve the problem in the prior art that the device cannot be started due to an error in operating system data.
- the embodiment of the present application provides a method for starting an operating system, which is applied to an electronic device, and the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partitions and user data partitions, the first static partition includes a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other,
- the methods include:
- Loading static partition data includes: performing a first verification operation on the data of the first sub-partition, and loading the data of the first sub-partition when the first verification operation is successful; When the verification operation fails, perform a second verification operation on the data of the second sub-partition, and when the second verification operation succeeds, load the data of the second sub-partition;
- the data of the dynamic partition is loaded to run the first operating system.
- the method further includes:
- the first static partition further includes a third sub-partition
- the second static partition further includes a fourth sub-partition
- the third sub-partition and the fourth sub-partition For sub-partitions corresponding to each other, the loading of static partition data also includes:
- the method further includes:
- the method further includes:
- the modifying the data of the second static partition includes:
- the method before loading the static partition data, the method further includes: synchronizing the data of the first static partition to the second static partition.
- the method before loading the data of the basic partition, the method further includes:
- the upgrade installation package includes a static partition upgrade file
- the upgrade installation package also includes a dynamic partition upgrade file, the restart of the electronic device confirms that the current startup sequence is before starting from the first static partition, and the method further includes creating a file in the user data partition.
- a virtual dynamic partition storing the dynamic partition upgrade file in the virtual dynamic partition;
- the loading of dynamic partition data includes loading the data of the dynamic partition and the dynamic partition upgrade file
- the method further includes: placing the dynamic partition upgrade file in the user data partition to the dynamic partition;
- the data synchronization of the first static partition to the second static partition is executed.
- the present application also provides an electronic device, the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partition and a user data partition, the The first static partition includes a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other, and the processor is configured to execute the A software code stored in the memory, so that the electronic device executes the method flow described in the first aspect.
- the present application also provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is run on a computer, the computer executes the method described in the first aspect. method.
- the present application further provides a computer program product, the computer program product includes a computer program, and when running on a computer, causes the computer to execute the method as described in the first aspect.
- the data of another static partition can be loaded, so as to ensure that the device starts up smoothly and runs the operating system; according to the method of the embodiment of the application, the device startup can be greatly improved. The success rate and improve the stability of equipment operation.
- Figure 1 shows a schematic diagram of the data storage structure of the Android system on the terminal device
- FIG. 2 is a flow chart of starting a device according to an embodiment of the present application.
- FIG. 3 is a schematic diagram of a device startup and loading process according to an embodiment of the present application.
- FIG. 4 is a flow chart showing an operating system upgrade according to an embodiment of the present application.
- FIG. 5 shows a flow chart of static partition synchronization according to an embodiment of the present application
- FIG. 6 shows a flow chart of static partition synchronization according to an embodiment of the present application
- FIG. 7 shows a flow chart of static partition synchronization according to an embodiment of the present application.
- FIG. 8 is a flowchart of an operating system upgrade according to an embodiment of the present application.
- FIG. 9 is a flowchart of an operating system upgrade according to an embodiment of the present application.
- FIG. 10 is a flow chart showing device startup and loading according to an embodiment of the present application.
- FIG. 11 is a schematic diagram of a device startup and loading process according to an embodiment of the present application.
- Fig. 12 shows a flow chart of device startup and loading according to an embodiment of the present application
- FIG. 13 is a flow chart showing data correction for a static partition (A) according to a solution of an embodiment of the present application
- Fig. 14 is a flow chart of device startup and loading according to an embodiment of the present application.
- a feasible solution is to build operating system backup data on the device.
- the backup operating system can be loaded data to ensure smooth startup of the device.
- backup data will occupy storage space, which will compress the data space that users can use freely, resulting in waste of storage space.
- the present application determines the mutually replaceable data in the operating system data by analyzing the storage file structure of the operating system. In the process of device startup, when the operating system data is loaded incorrectly, the data that can replace the wrong data is called to load, so as to ensure the smooth startup of the device.
- FIG. 1 shows a schematic diagram of a data storage structure of the Android system on a terminal device.
- the Android system data storage area includes a basic partition (Common), a static partition (A), a static partition (B), a dynamic partition (Super), and a user data partition (Userdata).
- Common basic partition
- A static partition
- B static partition
- Super dynamic partition
- Userdata user data partition
- the user data partition (Userdata) is used to store the user's personal data, for example, personal data such as apps installed by the user, pictures, documents, and videos saved by the user.
- the data saved in the basic part is system data that does not participate in the operating system upgrade.
- the structures of static partition (A) and static partition (B) correspond to each other, and sub-partition names are distinguished from each other by suffixes _a and _b.
- Static partition (A) includes bootloader_a, boot_a, vendor_boot_a, dtbo_a, vbmeta_a; static partition (B) includes bootloader_b, boot_b, vendor_boot_b, dtbo_b, vbmeta_b.
- a dynamic partition (Super) contains multiple subpartitions.
- the device When the device boots, it starts from a static partition. For example, if the device starts from the static partition (A): load the basic partition (Common), static partition (A) and dynamic partition (Super) in sequence; the device starts from the static partition (B): load the basic partition (Common), static partition in sequence (B) and dynamic partition (Super).
- A load the basic partition
- A static partition
- Super dynamic partition
- the static partition (A) and the static partition (B) have the same partition structure, when the data programmed in the static partition (A) and the static partition (B) are consistent ( For example, in some application scenarios, after the system is installed on the device before leaving the factory, the data burned in the static partition (A) and the static partition (B) are consistent), the data in the static partition (A) and the static partition (B) , the corresponding subdivisions can replace each other.
- the embodiment of this application proposes a method for starting an operating system.
- an Android system that adopts a virtual A/B upgrade method
- when a sub-partition fails to load the Try to load the subpartition corresponding to the subpartition in the static partition (B), so as to ensure that the device starts smoothly.
- the data of another static partition can be loaded, so as to ensure that the device starts up smoothly and runs the operating system; according to the method of the embodiment of the application, the device startup can be greatly improved. The success rate and improve the stability of equipment operation.
- Figure 2 is a flow chart of starting the device for the system data storage structure shown in Figure 1.
- the device starts from the static partition (A) (generally, after the operating system is installed on the device before leaving the factory, the default device starts from the static partition (A) ) start), the device starts according to the process shown in Figure 2.
- the device obtains a partition table from a file system (for example, UFS) of the device, and generates a device node of a partition to be loaded, where the device node is path information of the partition.
- a file system for example, UFS
- UFS Universal Flash Storage
- MBR Master Boot Record
- Dpt partition Table
- the device starts from the static partition (A).
- the subpartitions to be loaded in the static partition include bootloader_a, boot_a, vendor_boot_a, dtbo_a, and vbmeta_a.
- the device nodes to be loaded include:
- the partition is loaded.
- S202 loading a basic partition (Common).
- the bootloader sub-partition of the static partition is loaded.
- S212 modify the device node to be loaded, and modify the device node to be loaded from /dev/block/by-name/bootloader_a to /dev/block/by-name/bootloader_b (second sub-partition) ( Modify the suffix of the device node, change _a to _b).
- the boot sub-partition of the static partition is loaded.
- FIG. 3 is a schematic diagram of a device startup and loading process according to an embodiment of the present application.
- the operating system data loaded by the device from the static partition (A) is: basic partition (Common), bootloader_a subpartition, boot_a subpartition, vendor_boot_b subpartition, dtbo_a subpartition, vbmeta_b subpartition and dynamic partition (Super).
- FIG. 4 is a flow chart of upgrading the operating system for the system data storage structure shown in FIG. 1.
- the device When the device is currently started from the static partition (A), the device implements the operating system upgrade according to the process shown in FIG. 4.
- the device loads the basic partition (Common), static partition (A) and dynamic partition (Super) in sequence, and starts from the static partition (A);
- the device acquires an operating system upgrade installation package
- the device periodically initiates a packet search request to the packet search server, and the packet search request includes the version number (such as version 1.1) of the operating system currently running on the device; The version number of the operating system, and retrieve whether there is an operating system installation package with a newer version number (for example, version 1.2); Version 1.1 is upgraded to the download address of the operating system upgrade package) of version 1.2; the device downloads the operating system upgrade installation package according to the download address of the operating system upgrade installation package, and saves the operating system upgrade installation package to the user data partition (Userdata).
- version number such as version 1.1
- the version number of the operating system and retrieve whether there is an operating system installation package with a newer version number (for example, version 1.2); Version 1.1 is upgraded to the download address of the operating system upgrade package) of version 1.2; the device downloads the operating system upgrade installation package according to the download address of the operating system upgrade installation package, and saves the operating system upgrade installation package to the user data partition (Userdata).
- the device reads the operating system upgrade installation package stored in S410 from the user data partition (Userdata), and performs a data writing operation on the static partition (B) according to the operating system upgrade installation package to upgrade the static partition;
- the operating system upgrade installation package includes data of the static partition of version 1.2, and the device overwrites the data of the static partition of version 1.2 into the static partition (B).
- the device creates a virtual dynamic partition in the user data partition (Userdata) according to the operating system upgrade installation package, and writes upgrade data of the dynamic partition (Super) in the virtual dynamic partition.
- the operating system upgrade installation package contains the data of the dynamic partition of version 1.2, and the device writes the data of the dynamic partition (Super) of version 1.2 in the virtual dynamic partition.
- an incremental upgrade method is adopted for the dynamic partition (Super).
- the virtual dynamic partition of the user data partition (Userdata) does not save all the files of the new version of the dynamic partition (Super) after the upgrade, but the data that needs to be upgraded in the old version of the dynamic partition (Super).
- the result of the upgrade after the upgrade That is, what is stored in the virtual dynamic partition of the user data partition (Userdata) is the updated data of the dynamic partition.
- the data in the system subpartition can be divided into two parts: system1 and system2.
- the data system2 has not changed, and the data syetem1 has been upgraded to system3.
- the device creates a virtual dynamic partition in the user data partition (Userdata), and writes data system3 into the virtual dynamic partition.
- the system incremental upgrade installation package from version 1.1 to version 1.2 includes dynamic partition (Super) update data from version 1.1 to version 1.2
- the dynamic partition (Super) update data includes data system3.
- the incremental upgrade of the dynamic partition (Super) is realized based on the snapshot technology (snapshot).
- snapshot technology snapshot technology
- COW Copy-On-Write
- the upgrade data of the dynamic partition (Super) stored in the user data partition (Userdata) contains multiple COW files, and each COW file corresponds to a sub-partition of the dynamic partition (Super).
- Partition (Super) corresponds to sub-partition.
- each COW file is named according to the sub-partition of the dynamic partition (Super).
- the COW file for the system subpartition is named system-cow-img.img.0000.
- the device unpacks the operating system upgrade installation package to obtain all COW files, and attaches an A/B partition mark to each COW file.
- the dynamic partition (Super) loaded by the operating system currently running on the device is the dynamic partition (A).
- the virtual dynamic partition created in the user data partition (Userdata) is for the dynamic partition (B). Therefore, the name mark _b corresponding to the dynamic partition (B) is appended to the COW file. For example, append_b for system-cow-img.img.0000 generates system_b-cow-img.img.0000.
- an Update folder is created in the user data partition (Userdata), and the renamed COW file is saved in the Update folder.
- the Update folder of the user data partition (Userdata) contains the following files:
- the COW file includes a COW file map (snapshot map) and upgrade data of the COW file itself.
- the COW file map corresponds to the file map of the sub-partition of the dynamic partition (Super) targeted by the COW file.
- the file map of the sub-partition of the dynamic partition (Super) is used to describe all the files in the sub-partition of the dynamic partition (Super) and the storage address of each file in the current version of the operating system (the version before this upgrade, for example, version 1.1) .
- the upgrade data in the COW file is the updated file in the sub-partition data of the new version compared with the sub-partition data of the current version; the COW file map of the COW file itself is used to describe the updated file and the sub-partition of the current version The correspondence between the files in and the storage address of the updated files.
- the upgrade data in the COW file can be used to replace the corresponding file in the sub-partition of the dynamic partition (Super), thereby realizing the dynamic partition (Super) ) data upgrade.
- a snapshot operation may be performed on the data of the sub-partition of the dynamic partition (Super) based on the snapshot to generate the file map of the sub-partition of the dynamic partition (Super). It is also possible to pre-generate the file map of the sub-partition of the dynamic partition (Super) when making the operating system upgrade installation package, and add the file map to the COW file.
- the file map of the system subpartition can be:
- the value after the file name is the physical storage address (block address) of the file in the system sub-partition of the dynamic partition (Super).
- /system/app/A2.XXX and /system/user/C2.XXX are the system1 part of the system sub-partition data
- the COW file (system_b-cow-img.img.0000) for the system subpartition contains the latest versions of /system/app/A2.XXX and /system/user/C2.XXX.
- the COW file map of the COW file (system_b-cow-img.img.0000) itself can be:
- Map1 (the address of the data to be updated in the original super partition): start address address start: 024018 (the offset relative to the system start address); offset size: 2 (that is, the data in the address segment of 024018 ⁇ 024020)
- Map2 (the address of the updated data stored in the cow file): start address address start: 045033 (the offset relative to the start address stored in the cow file); offset size: 2 (that is, the address segment of 045033 to 045035 The data);
- Map1 (the address of the data to be updated in the original super partition): start address address start: 024036 (the offset relative to the system start address); offset size: 4 (that is, the data in the address segment 024036 ⁇ 024040)
- Map2 (the address of the update data stored in the cow file): start address address start: 045036 (offset relative to the start address stored in the cow file); offset size: 4 (that is, the address segment of 045036 ⁇ 045040 The data).
- the COW file map of the COW file (system_b-cow-img.img.0000) itself can be:
- Map1.1 (the address of the data to be updated in the original super partition): start address address start: 024018 (the offset relative to the system start address); data)
- Map2.1 stored in the cow file, the address of the updated data that needs to cover the address of Map1.1: start address address start: 045033 (offset relative to the start address stored in the cow file); offset size size: 2 (that is, the data in the address segment of 045033 ⁇ 045035);
- Map1.2 (the address to be written in the original super partition of the part of the cow file where the updated data exceeds the size of the data to be updated): start address address start: 025018 (offset relative to the start address of the system); offset Volume size size: 1 (that is, the data in the 025018 ⁇ 025020 address segment)
- Map2.2 (stored in the cow file, the address of the updated data that needs to cover the address of Map1.2): start address address start: 046033 (offset relative to the start address stored in the cow file); offset size size: 2 (that is, the data in the 046033 ⁇ 046035 address segment).
- the address segments (045033 ⁇ 045035 and 045036 ⁇ 045040) are the latest versions of /system/app/A2.XXX and /system/user/C2 in the COW file (system_b-cow-img.img.0000) respectively
- the dynamic partition (Super)+COW file is merged based on the snapshot.
- the merging of dynamic partitions (Super) and COW files is not a physical merging, but the overall file map of the sub-partitions in the COW file is merged with the COW file map of the COW file itself to generate a new A file map of versioned subpartition data.
- Map1 address start: 024018; size: 2 (that is, the data in the address segment from 024018 to 024020)
- Map2 address start: 045033; size: 2 (that is, the data in the address segment from 045033 to 045035);
- Map1 address start: 024036; size: 4 (that is, the data in the address segment from 024036 to 024040)
- Map2 address start: 045036; size: 4 (that is, the data in the address range from 045036 to 045040).
- the storage address of /system/app/A2.XXX does not point to /system/app/A2.XXX on the dynamic partition (Super) on the storage, but points to the user on the storage A2.XXX in system_b-cow-img.img.0000 in the data partition (Userdata); the storage address of /system/user/C2.XXX does not point to /system/user/C2 on the dynamic partition (Super) on the storage .XXX, but points to C2.XXX in system_b-cow-img.img.0000 in the user data partition (Userdata) on the storage.
- the new version of the file map of all sub-partitions of the dynamic partition (Super) is obtained (if the corresponding COW file of a certain sub-partition is not written in the user data partition (Userdata), directly Use the filemap of the subpartition as the new version's filemap). Combine the new version of the file map of all subpartitions to generate the new version of the file system of the dynamic partition (Super).
- the file system of the new version based on the dynamic partition (Super) reads data, reads all files contained in the file system of the new version of the dynamic partition (Super), and calculates a hash value.
- the COW file When the COW file is valid, change the merge status information in the metadata partition (/metadata) of the basic partition (Common) from "merged” to "wait for merge".
- the flush status information is used to indicate whether there are currently COW files that need to be flushed to the dynamic partition (Super).
- the disk placement status information includes an overall identifier for the dynamic partition (Super) and a sub-partition identifier for each sub-partition.
- the boot sequence identifier of the Master Boot Record For example, rewrite the boot sequence identifier of the Master Boot Record (MBR), and rewrite the boot sequence identifier from A to B.
- MLR Master Boot Record
- the device After the device is powered on, when the device reads the boot sequence ID as A, the device starts from the static partition (A), and loads the static partition (A) during startup; when the device reads the boot sequence ID as B, the device starts from the static partition (A). Partition (B) starts, and static partition (B) is loaded during startup.
- the device reads the boot flag in the basic partition (Common).
- the boot mark in the basic partition (Common) is (B), and the device loads the static partition (B) after loading the basic partition (Common), and starts from the static partition (B).
- the device loads the dynamic partition (Super) and the virtual dynamic partition of the user data partition (Userdata).
- the device reads the storage status information in the metadata (/metadata), determines whether to retrieve the COW file from the specified path of the user data partition (Userdata) based on the storage status information, and uses snapshot to merge and load the dynamic partition ( Super) and COW files.
- the device does not load all COW files in the dynamic partition (Super) and the user data partition (Userdata), but loads corresponding files according to operating requirements of the operating system. Specifically, in S441, the device determines the files to be loaded according to the operation requirements of the operating system, and extracts the corresponding files from the COW files in the dynamic partition (Super) or virtual dynamic partition based on the snapshot for loading.
- S441 when there is a corresponding COW file in the sub-partition of the dynamic partition (Super), first generate a new version of the file map of each sub-partition of the dynamic partition (Super) based on the snapshot. For the process of generating a file map of a new version, reference may be made to S430.
- the device determines the files to be loaded according to the operation requirements of the operating system, and loads the files based on the file map of the new version of the dynamic partition (Super) sub-partition.
- the operating system needs to load all the data in the directory user (/system/user) under the system subpartition.
- the device reads the migration status information in the metadata (/metadata), and the subpartition of the system subpartition in the migration status information is marked as "wait for merge". Therefore, the device is in the user data partition (Userdata) Search for COW files under Medium/Update. After searching for the COW file system_b-cow-img.img.0000 under Update, generate a system sub-partition based on the snapshot and according to the file map of the COW file in system_b-cow-img.img.0000 The new version of the file map. Load data according to the storage addresses of all files under /system/user in the new version of the file map of the system subpartition, for example, according to the new version of the file map of the system subpartition:
- the device when loading all the data in the directory user (/system/user) under the system subpartition, when the subpartition of the system subpartition in the storage status information is marked as "merged", the device will not Search for COW files under /Update in the user data partition (Userdata), but directly load all the data in the directory user (/system/user) under the system subpartition.
- the device before loading the file, the device needs to verify the loaded file.
- the dynamic partition (Super)+COW file is not verified as a whole, but only the files to be loaded are verified. For example, verify based on dmverity (dm-verity is a target of dm (device mapper), which is a virtual block device, specially used for file system verification). If the verification is successful, load the file; if the verification fails, restart the device, roll back the system or try to load the file again.
- dm-verity is a target of dm (device mapper), which is a virtual block device, specially used for file system verification.
- the device transfers the data of the virtual dynamic partition to the dynamic partition (Super) in the background.
- the disk operation refers to writing the dynamic partition (Super) upgrade file (COW file) stored in the virtual dynamic partition on the user data partition (Userdata) into the In the dynamic partition (Super), the files of the dynamic partition (Super) are upgraded, so that the device does not need to load the dynamic partition (Super) and the virtual dynamic partition at the next startup, and only needs to load the dynamic partition (Super) to complete the device. start up.
- COW file dynamic partition upgrade file
- the device After the device is successfully started, it performs a power-on broadcast, and starts an upgrade process after the power-on broadcast.
- the upgrade process reads the migration status information in the metadata (/metadata) of the basic partition (Common). If the migration status information is "merged", the device enters the normal operation mode.
- the upgrade process will put the COW files in the user data partition (Userdata) to the dynamic partition (Super).
- the upgrade process writes the upgrade data in the COW file in the user data partition (Userdata) to the corresponding address in the dynamic partition (Super), so that all the data in the dynamic partition (Super) are the new data after the upgrade. Version data.
- the data at addresses 045033-045035 Write to addresses 024014-024017; based on /system/user/C2.XXX: 024036-024040 in the file map of the system subpartition and /system/user/C2.XXX: 045036-045040 in the COW file map, the Data at addresses 045036 to 045040 are written to addresses 024036 to 024040.
- the upgrade process deletes the COW file in the user data partition (Userdata), returns the storage space to the user data partition (Userdata); Changed from "wait for merge” to "merged".
- the data operation of the static partition upgrade is aimed at the operating system data in the static partition (B), and it will not affect the operating system data of the currently started static partition (A); and, in S430, the dynamic The data operation of partition upgrade is completed on the virtual dynamic partition created in the user data partition (Userdata), which will not affect the currently mounted dynamic partition (Super). Therefore, during the whole process of upgrading the operating system, the user can use the device normally; and, after the completion of S431, the device does not need to be restarted immediately, and the user can choose the restarting time; in this way, the upgrading process of the operating system will not affect the The user's normal mobile phone operation is affected, thereby greatly improving the user experience. Further, for the dynamic partition (Super), a virtual dynamic partition will be created on the user data partition (Userdata) only when an upgrade is required, thus effectively improving the utilization rate of data storage space.
- the data of the operating system will not be changed as a whole, but only a certain part of the data will be changed. That is to say, when the operating system is upgraded from one version to another, the data in the static partition may not be modified, that is, the data in the static partition in the version 1.1 operating system is different from the data in the static partition in the version 1.2 operating system. data, may be the same. Or, when the operating system is upgraded from one version to another, only part of the data in the static partition may be modified, that is, part of the data in the static partition in the version 1.1 operating system is different from the Some data may be the same.
- the partition structures of the static partition (A) and the static partition (B) are consistent. Then, when the static partition (A) corresponds to the version 1.1 operating system, and the static partition (B) corresponds to the version 1.2 operating system, there may be one or more sub-partitions in the static partition (A), which are different from those in the static partition (B). The corresponding one or more sub-partitions have the same data. At this time, between the static partition (A) and the static partition (B), there is a situation that one or more sub-partitions can replace each other.
- the device initially starts from the static partition (A), and then the device upgrades the operating system based on the process shown in Figure 4, upgrades the data of the static partition (B) and starts from the static partition (B).
- the device initially starts from the static partition (A), and then the device upgrades the operating system based on the process shown in Figure 4, upgrades the data of the static partition (B) and starts from the static Partition (B), and then (after S451) the device will synchronize the data of the static partition (B) to the static partition (A), thus ensuring the data between the static partition (A) and the corresponding sub-partitions in the static partition (B) Consistent, so that sub-partitions corresponding to each other can replace each other.
- the data in the static partition (B) and the static partition (A) can support the smooth startup of the device.
- the device can be started smoothly by loading one or more sub-partitions in the static partition (A), thereby improving the success rate of device startup.
- the present application does not specifically limit the specific implementation manner of synchronizing the data of the static partition (B) to the static partition (A), and those skilled in the art may implement data synchronization in various feasible implementation manners.
- the specific implementation process of synchronizing the data of the static partition (B) to the static partition (A) is illustrated below through specific embodiments.
- the device writes the data of the static partition in the operating system upgrade installation package to the static partition (B). Therefore, if the same operating system is used to upgrade the installation package, and the data of the static partition in the operating system upgrade installation package is written into the static partition (A), the data in the static partition (A) will be different from the data in the static partition (B). ) are consistent with the data.
- synchronizing the data of the static partition (B) to the static partition (A) includes: obtaining and reading the operating system upgrade installation package stored in S410 from the user data partition (Userdata), and upgrading the operating system The data of the static partition in the installation package is written to the static partition (A).
- the static partition (A) and the static partition (B) are completely consistent in partition structure and partition size. Therefore, the data of the static partition (A) can be directly mirrored to the static partition (B), or the data of the static partition (B) can be mirrored to the static partition (A).
- FIG. 5 is a flowchart of an implementation manner of static partition synchronization.
- the terminal device executes the following process as shown in FIG. 4 to synchronize the data of the static partition (B) to the static partition (A).
- S500 reads out all the data in the static partition (B), packs and compresses it and makes it a mirror image file B;
- S510 recover the image file B to the static partition (A) after unpacking, so as to realize overwriting the data of the static partition (B) to the static partition (A).
- the static partition (A) and the static partition (B) are consistent in partition structure, and include the same sub-partitions. Therefore, by overwriting the files of each sub-partition in the static partition (B) to the corresponding sub-partition in the static partition (A), the data in the static partition (B) can be synchronized to the static partition (A).
- FIG. 6 is a flowchart of an implementation manner of static partition synchronization.
- the terminal device executes the following process as shown in FIG. 6 to synchronize the data of the static partition (B) to the static partition (A).
- UFS Universal Flash Storage
- MBR Master Boot Record
- Dpt partition Table
- S610 read all static subpartitions with the suffix name _b from the total partition table, and generate a list 1 for describing each subpartition of the static partition (B), and list 1 includes the names of each subpartition in the static partition (B) and address.
- list 1 includes the names of each subpartition in the static partition (B) and address.
- S620 read all static subpartitions with the suffix name _a from the total partition table, and generate a list 2 for describing each subpartition of the static partition (A), and list 2 includes the names of each subpartition in the static partition (A) and address.
- S630 select an unselected sub-partition (first sub-partition) in list 1, and acquire the name (first sub-partition name) and address (first file path) of the sub-partition.
- the sub-partitions may be sequentially selected according to the arrangement order (numbering order) of the sub-partitions in List 1, or may be randomly selected from all unselected sub-partitions.
- the sub-partition is marked so as to confirm whether the sub-partition has been selected subsequently. For example, as shown in Table 1, the selected state column is added in Table 1, and the initial value of the selected state is 0, and if the sub-partition is selected, the selected state is changed to 1.
- S640 performing desuffix matching on the sub-divisions selected in S630 and each sub-division in list 2; in determining list 2, after removing the suffix, the sub-division (the second sub-division) consistent with the sub-division name selected in S630 name) and in list 2, the sub-division address (second file path) corresponding to the second sub-division name;
- step S630 If it exists, return to step S630, and reselect the first sub-region;
- the device performs the following process:
- bootloader_b subpartition number 1 whose selected state is 0 in table 1, and modify the selected state of number 1 to 1;
- bootloader_b Use bootloader_b to perform suffix matching in all sub-partition names in Table 2.
- Bootloader_a and bootloader_b are consistent after removing _a and _b respectively. Therefore, bootloader_a is matched according to bootloader_b;
- boot_b Use boot_b to perform suffix matching in all sub-partition names in Table 2.
- Boot_a and boot_b are consistent after removing _a and _b respectively. Therefore, boot_a is matched according to boot_b;
- vendor_boot_b to perform suffix matching in all sub-partition names in Table 2. Vendor_boot_a and vendor_boot_b are consistent after removing _a and _b respectively. Therefore, vendor_boot_a is matched according to vendor_boot_b;
- dtbo_b Use dtbo_b to perform suffix matching in all sub-partition names in Table 2.
- dtbo_a and dtbo_b are consistent after removing _a and _b respectively. Therefore, dtbo_a is matched according to dtbo_b;
- vbmeta_b Use vbmeta_b to perform suffix matching in all sub-partition names in Table 2.
- vbmeta_a and vbmeta_b are consistent after removing _a and _b respectively. Therefore, vbmeta_a is matched according to vbmeta_b;
- Table 1 and Table 2 are transitional data, and Table 1 and Table 2 are deleted after the static partition synchronization is completed.
- the S420 when the S420 reads and writes the data of the static partition (B) according to the operating system upgrade installation package, it does not necessarily perform all sub-partitions in the static partition (B) to rewrite. That is, if the data in the static partition (A) and the static partition (B) are completely consistent before the operating system is upgraded, then, after the operating system is upgraded using the process shown in Figure 5, the data in the static partition (A) and the static partition (B) It is possible that data for some subpartitions may still be consistent.
- FIG. 7 is a flowchart of an implementation manner of static partition synchronization.
- the terminal device executes the following process as shown in FIG. 7 to synchronize the data of the static partition (B) to the static partition (A).
- S750 refer to S750
- step S730 If it exists, return to step S730, and reselect the first sub-region;
- the execution node for data synchronization between the static partition (A) and the static partition (B) is after any one of the static partition (A) and the static partition (B) is written with upgraded data.
- the upgrade data is written in the static partition (B), but since the operating system is running and loading the static partition (A), at this time, the data of the static partition (B) cannot be synchronized to the static partition ( A).
- the device loads the static partition (B) to run the operating system. The operation of the operating system does not need to load the static partition (A). At this time, the data of the static partition (B) can be synchronized to the static partition ( A). Therefore, in the embodiment of the present application, static partition synchronization can be performed at any time after S431. This application does not specifically limit the execution timing of data synchronization from the static partition (B) to the static partition (A).
- Fig. 8 is a flow chart showing an operating system upgrade according to an embodiment of the present application.
- the device When the device is currently started from the static partition (A), the device implements the upgrade of the operating system and the static partition according to the flow shown in Fig. 8 Synchronize.
- S800 ⁇ S832 refer to S400 ⁇ S432;
- the device puts the data of the virtual dynamic partition to the dynamic partition (Super); refer to S451.
- the device after the device is restarted and started from the upgraded static partition, the device will verify the files that need to be loaded for the current system operation in the dynamic partition + virtual dynamic partition, and only after the verification is successful Files that need to be loaded for the current system operation in the dynamic partition + virtual dynamic partition will be loaded. If the verification fails, the system will be restarted and rolled back, and the system upgrade will fail at this time.
- the files that need to be loaded in the dynamic partition + virtual dynamic partition are successfully verified, or the files that need to be loaded in the dynamic partition + virtual dynamic partition After being successfully loaded, the synchronization of the static partition is performed.
- Fig. 9 shows a flow chart of operating system upgrade according to an embodiment of the present application.
- the device When the device is currently started from the static partition (A), the device implements the upgrade of the operating system and the static partition according to the flow shown in Fig. 9 Synchronize.
- S900 ⁇ S952 refer to S800 ⁇ S852;
- the device initially starts from the static partition (B), if the static partition (B) is damaged, one or more sub-partitions in the static partition (B) have data errors.
- the device can refer to the embodiment shown in FIG. 2, in the process of starting the device from the static partition (B), the smooth startup of the device can be realized by loading one or more sub-partitions in the static partition (A).
- the error data in the static partition (B) is not repaired during the device startup process.
- the device starts from the static partition (B) again, it still needs to refer to the embodiment shown in FIG. 2, by loading the static partition (A) One or more subpartitions of the device to achieve smooth booting of the device.
- the data of the static partition whose data is upgraded is synchronized to another static partition, so as to ensure that the data of the two static partitions are consistent.
- FIG. 10 shows a flowchart for starting a device for the system data storage structure shown in FIG. 1 .
- the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is updated, and the device starts from the static partition (B) after restarting the device.
- the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
- S1000-S1070 refer to S200-S270, the difference is that in S1014, S1024, S1034, S1044, S1054, in addition to loading the sub-partition data, it is also necessary to mark the data error in the static partition (B).
- static partition state information is stored in the metadata of the basic partition (Common), and the static partition state information is used to describe the static partition (A) and whether there is a data error in the static partition (B).
- static partition status information can be as shown in the following table:
- Error_static partition_a corresponds to the static partition (A)
- Error_static partition_b corresponds to the static partition (B)
- the value 0 means no data error
- the value 1 means there is a data error.
- S1014, S1024, S1034, S1044, and S1054 in addition to loading sub-partition data, it is also necessary to set the value of Error_static partition_b to 1.
- the device After S1070, the device also needs to perform:
- FIG. 11 is a schematic diagram of a device startup and loading process according to an embodiment of the present application.
- vendor_boot_a in the static partition (A) and vbmeta_b in the static partition (B) have data errors.
- the device starts from the static partition (B), and the startup process is shown in Figure 11:
- the operating system data loaded by the device from the static partition (B) is: basic partition (Common), bootloader_b subpartition, boot_b subpartition, vendor_boot_b subpartition, dtbo_b subpartition, vbmeta_a subpartition and dynamic partition (Super).
- basic partition Common
- bootloader_b subpartition boot_b subpartition
- boot_b subpartition vendor_boot_b subpartition
- dtbo_b subpartition vbmeta_a subpartition
- vbmeta_a subpartition dynamic partition
- the device starts from the static partition (B), change the boot sequence to start from the static partition (A). Due to data errors in vendor_boot_a in the static partition (A), the device still needs to load the vendor_boot_b sub-partition of the static partition (B) in the process of booting from the static partition (A) to start smoothly. As a result, the device will never be able to boot smoothly based on only one static partition.
- the device is initially started from the static partition (A), and the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is upgraded, and the device is restarted from the static Partition (B) starts. Afterwards, the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
- the device keeps booting from the static partition (B). If there is a data error in the static partition (B), in the process of starting the device from the static partition (B), refer to the embodiment shown in Figure 2 to load the data in the static partition (A) to start the device smoothly. After the device starts up successfully, correct the data in the static partition (A), and change the boot sequence of the device from the static partition (B) to the static partition (A), so that the device can be started from The static partition (A) starts independently.
- FIG. 12 is a flow chart of starting a device for the system data storage structure shown in FIG. 1 .
- the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is upgraded, and after restarting the device, the device starts from the static partition (B) start up.
- the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
- the device After S1270, the device also needs to execute:
- the device modifies the current boot sequence from booting from the static partition (B) to booting from the static partition (A). In this way, when the device starts next time, it will start from the static partition (A), and data errors in the static partition (B) will not interfere with the execution of device startup. Moreover, assuming that before S1200, there is also a data error in the static partition (A), in S1272, by performing data correction on the static partition (A), there is no data error in the static partition (A). In this way, after S1273, during the process of booting the device from the static partition (A), there is no need to load the data of the static partition (B).
- the device initially boots from the static partition (A).
- the device completes the operating system upgrade based on the embodiment shown in FIG. 4 and synchronizes data from the static partition (B) to the static partition (A).
- the boot sequence of the device is to boot from the static partition (B).
- both the static partition (B) and the static partition (A) of the device have data errors.
- vendor_boot_a in the static partition (A) and vbmmeta_b in the static partition (B) exist data error.
- FIG. 13 is a flow chart of data correction for a static partition (A) according to an embodiment of the present application.
- the terminal device executes the following process as shown in FIG. 13 to implement S1272.
- FIG. 14 is a flow chart of starting a device for the system data storage structure shown in FIG. 1 .
- the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is updated, and the device starts from the static partition (B) after restarting the device.
- the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
- the device boots from the static partition (B) according to the flow shown in Figure 14.
- S1400-S1470 refer to S200-S270, the difference is that in S1414, S1424, S1434, S1444, S1454, in addition to loading the sub-partition data, it is also necessary to mark the sub-partition of the static partition (B) as having data errors.
- static partition state information is stored in the metadata of the basic partition (Common), and the static partition state information is used to describe the static partition (A) and whether there is a data error in the static partition (B).
- static partition status information can be as shown in the following table:
- a value of 0 means that there is no data error, and a value of 1 means that there is a data error.
- S1414, S1424, S1434, S1444, and S1454 in addition to loading sub-partition data, it is also necessary to set the value of the corresponding parameter to 1.
- the device After S1470, the device also needs to execute:
- improvements to a technology can be clearly distinguished as improvements in hardware (for example, improvements to circuit structures such as diodes, transistors, and switches) or improvements in software (improvements to method flow).
- improvements in hardware for example, improvements to circuit structures such as diodes, transistors, and switches
- improvements in software improvements to method flow.
- the improvement of many current method flows can be regarded as the direct improvement of the hardware circuit structure.
- Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be realized by hardware physical modules.
- a programmable logic device Programmable Logic Device, PLD
- PLD Programmable Logic Device
- FPGA Field Programmable Gate Array
- HDL Hardware Description Language
- ABEL Advanced Boolean Expression Language
- AHDL Altera Hardware Description Language
- HDCal JHDL
- Lava Lava
- Lola MyHDL
- PALASM RHDL
- VHDL Very-High-Speed Integrated Circuit Hardware Description Language
- Verilog Verilog
- the method flow proposed in the embodiment of the present application may be implemented in hardware, for example, using a controller, and the controller controls the touch screen to implement the method flow proposed in the embodiment of the present application.
- the controller may be implemented in any suitable way, for example the controller may take the form of a microprocessor or processor and a computer readable medium storing computer readable program code (such as software or firmware) executable by the (micro)processor , logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory.
- controller in addition to realizing the controller in a purely computer-readable program code mode, it is entirely possible to make the controller use logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded The same function can be realized in the form of a microcontroller or the like. Therefore, such a controller can be regarded as a hardware component, and the devices included in it for realizing various functions can also be regarded as structures within the hardware component. Or even, means for realizing various functions can be regarded as a structure within both a software module realizing a method and a hardware component.
- the present application further provides an electronic device.
- the electronic device includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps described in the embodiments of the present application.
- the present application also provides a computer program product, the computer program product includes a computer program, and when it is run on a computer, causes the computer to execute some or all of the steps provided in the embodiments of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
An operating system starting method, a device, a storage medium, and a computer program product provided in embodiments of the present application. The method is applied to an electronic device. The electronic device comprises a basic partition, a first static partition, a second static partition, a dynamic partition, and a user data partition; the first static partition comprises a first sub-partition; the second static partition comprises a second sub-partition; and the first sub-partition and the second sub-partition are sub-partitions corresponding to each other. The method comprises: loading data of the basic partition; loading data of the static partitions, comprising: performing a first check operation on data of the first sub-partition, and when the first check operation succeeds, loading the data of the first sub-partition, and when the first check operation fails, performing a second check operation on data of the second sub-partition, and when the second check operation succeeds, loading the data of the second sub-partition; and loading data of the dynamic partition to run a first operating system.
Description
本申请涉及计算机技术领域,具体地涉及一种操作系统启动方法、设备、存储介质及计算机程序产品。The present application relates to the field of computer technology, and in particular to an operating system startup method, device, storage medium and computer program product.
在现有技术的应用场景中,用户终端需要安装操作系统才可以被用户使用。例如,手机上需要安装手机操作系统(例如:IOS系统、安卓系统)才可以被用户使用。In an application scenario of the prior art, a user terminal needs to be installed with an operating system before it can be used by the user. For example, a mobile phone operating system (for example: IOS system, Android system) needs to be installed on the mobile phone before it can be used by the user.
在使用安装有操作系统的终端设备的过程中,存在由于操作系统数据错误而导致设备无法启动的情况,因此,需要一种针对操作系统数据错误的设备启动方法以确保设备可以顺利启动。In the process of using a terminal device installed with an operating system, there are cases where the device cannot be started due to incorrect operating system data. Therefore, a device starting method for operating system data errors is needed to ensure that the device can be started smoothly.
发明内容Contents of the invention
有鉴于此,本申请提供一种操作系统启动方法、设备、存储介质及计算机程序产品,以利于解决现有技术中操作系统数据错误导致设备无法启动的问题。In view of this, the present application provides an operating system startup method, device, storage medium and computer program product, so as to help solve the problem in the prior art that the device cannot be started due to an error in operating system data.
第一方面,本申请实施例提供了一种操作系统启动方法,应用于电子设备,所述电子设备包括处理器以及存储器,所述存储器包括基础分区、第一静态分区、第二静态分区、动态分区以及用户数据分区,所述第一静态分区包括第一子分区,所述第二静态分区包括第二子分区,所述第一子分区与所述第二子分区为相互对应的子分区,所述方法包括:In the first aspect, the embodiment of the present application provides a method for starting an operating system, which is applied to an electronic device, and the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partitions and user data partitions, the first static partition includes a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other, The methods include:
加载所述基础分区的数据;Load the data of the basic partition;
加载静态分区数据,包括:对所述第一子分区的数据进行第一校验操作,当所述第一校验操作成功时,加载所述第一子分区的数据;当所述第一校验操作失败时,对所述第二子分区的数据进行第二校验操作,当所述第二校验操作成功时,加载所述第二子分区的数据;Loading static partition data includes: performing a first verification operation on the data of the first sub-partition, and loading the data of the first sub-partition when the first verification operation is successful; When the verification operation fails, perform a second verification operation on the data of the second sub-partition, and when the second verification operation succeeds, load the data of the second sub-partition;
加载所述动态分区的数据以运行第一操作系统。The data of the dynamic partition is loaded to run the first operating system.
在第一方面的一种实现方式中,所述方法还包括:In an implementation manner of the first aspect, the method further includes:
当所述第二校验操作失败时,重启所述电子设备,或者,输出操作系统启动失败提示信息。When the second verification operation fails, restart the electronic device, or output a prompt message that the operating system fails to start.
在第一方面的一种实现方式中,所述第一静态分区还包括第三子分区,所述第二静态分区还包括第四子分区,所述第三子分区与所述第四子分区为相互对应的子分区,所述加载静态分区数据,还包括:In an implementation manner of the first aspect, the first static partition further includes a third sub-partition, the second static partition further includes a fourth sub-partition, and the third sub-partition and the fourth sub-partition For sub-partitions corresponding to each other, the loading of static partition data also includes:
对所述第三子分区的数据进行第三校验操作,当所述第三校验操作成功时,加载所述第三子分区的数据;当所述第三校验操作失败时,对所述第四子分区的数据进行第四校验操作,当所述第四校验操作成功时,加载所述第四子分区的数据。Performing a third verification operation on the data of the third sub-partition, when the third verification operation is successful, loading the data of the third sub-partition; when the third verification operation fails, performing a third verification operation on all Perform a fourth verification operation on the data of the fourth sub-partition, and load the data of the fourth sub-partition when the fourth verification operation is successful.
在第一方面的一种实现方式中,所述加载所述动态分区的数据之后,所述方法还包括:In an implementation manner of the first aspect, after the data of the dynamic partition is loaded, the method further includes:
当所述第一校验操作失败时,将所述电子设备的启动顺序由从所述第一静态分区启动修改为从所述第二静态分区启动。When the first verification operation fails, modify the boot order of the electronic device from booting from the first static partition to booting from the second static partition.
在第一方面的一种实现方式中,所述加载所述动态分区的数据之后,所述方法还包括:In an implementation manner of the first aspect, after the data of the dynamic partition is loaded, the method further includes:
修正所述第二静态分区的数据。Modify the data of the second static partition.
在第一方面的一种实现方式中,所述修正所述第二静态分区的数据,包括:In an implementation manner of the first aspect, the modifying the data of the second static partition includes:
将所述第一静态分区中,除所述第一子分区以外的其他子分区的数据,同步到所述第二静态分区中的对应子分区中。Synchronizing data of other sub-partitions in the first static partition except the first sub-partition to corresponding sub-partitions in the second static partition.
在第一方面的一种实现方式中,所述加载静态分区数据之前,所述方法还包括,将所述第一静态分区的数据同步到所述第二静态分区。In an implementation manner of the first aspect, before loading the static partition data, the method further includes: synchronizing the data of the first static partition to the second static partition.
在第一方面的一种实现方式中,所述加载所述基础分区的数据之前,所述方法还包括:In an implementation manner of the first aspect, before loading the data of the basic partition, the method further includes:
加载所述基础分区、所述第二静态分区以及所述动态分区的数据以运行第二操作系统;loading data of the basic partition, the second static partition and the dynamic partition to run a second operating system;
获取升级安装包,所述升级安装包包括静态分区升级文件;Obtain an upgrade installation package, the upgrade installation package includes a static partition upgrade file;
基于所述静态分区升级文件升级所述第一静态分区的数据;upgrading data of the first static partition based on the static partition upgrade file;
重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动;Restart the electronic device, and confirm that the current startup sequence is to start from the first static partition;
加载所述基础分区、所述第一静态分区以及所述动态分区的数据,以运行所述第一操作系统;loading data of the basic partition, the first static partition, and the dynamic partition to run the first operating system;
其中,在所述重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动之后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。Wherein, after restarting the electronic device and confirming that the current boot sequence is booting from the first static partition, performing the synchronizing the data of the first static partition to the second static partition.
在第一方面的一种实现方式中,在加载所述第一静态分区的数据的过程中,在静态分区数据校验成功后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。In an implementation manner of the first aspect, during the process of loading the data of the first static partition, after the data of the static partition is successfully verified, the synchronization of the data of the first static partition to the Second static partition.
在第一方面的一种实现方式中,在加载所述动态分区的数据的过程中,在待加载动态分区文件校验成功后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。In an implementation manner of the first aspect, during the process of loading the data of the dynamic partition, after the verification of the dynamic partition file to be loaded is successful, the synchronization of the data of the first static partition to the Second static partition.
在第一方面的一种实现方式中:In an implementation of the first aspect:
所述升级安装包还包括动态分区升级文件,所述重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动之前,所述方法还包括,在所述用户数据分区中创建虚拟动态分区,在所述虚拟动态分区中保存所述动态分区升级文件;The upgrade installation package also includes a dynamic partition upgrade file, the restart of the electronic device confirms that the current startup sequence is before starting from the first static partition, and the method further includes creating a file in the user data partition. A virtual dynamic partition, storing the dynamic partition upgrade file in the virtual dynamic partition;
所述加载动态分区数据,包括,加载所述动态分区的数据以及所述动态分区升级文件;The loading of dynamic partition data includes loading the data of the dynamic partition and the dynamic partition upgrade file;
所述加载动态分区数据之后,所述方法还包括:将所述用户数据分区中的所述动态分区升级文件落盘到所述动态分区;After the dynamic partition data is loaded, the method further includes: placing the dynamic partition upgrade file in the user data partition to the dynamic partition;
所述将所述用户数据分区中的所述动态分区升级文件落盘到所述动态分区 之后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。After the described dynamic partition upgrade file in the user data partition is placed on the disk to the dynamic partition, the data synchronization of the first static partition to the second static partition is executed.
第二方面,本申请还提供一种电子设备,所述电子设备包括处理器以及存储器,所述存储器包括包括基础分区、第一静态分区、第二静态分区、动态分区以及用户数据分区,所述第一静态分区包括第一子分区,所述第二静态分区包括第二子分区,所述第一子分区与所述第二子分区为相互对应的子分区,所述处理器用于执行所述存储器上存储的软件代码,以使得所述电子设备执行如第一方面所述的方法流程。In a second aspect, the present application also provides an electronic device, the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partition and a user data partition, the The first static partition includes a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other, and the processor is configured to execute the A software code stored in the memory, so that the electronic device executes the method flow described in the first aspect.
第三方面,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得计算机执行如第一方面所述的方法。In a third aspect, the present application also provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is run on a computer, the computer executes the method described in the first aspect. method.
第四方面,本申请还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,当其在计算机上运行时,使得计算机执行如第一方面所述的方法。In a fourth aspect, the present application further provides a computer program product, the computer program product includes a computer program, and when running on a computer, causes the computer to execute the method as described in the first aspect.
根据本申请实施例所提出的上述技术方案,至少可以实现下述技术效果:According to the above technical solutions proposed in the embodiments of the present application, at least the following technical effects can be achieved:
根据本申请实施例的方法,可以在当前加载的静态分区数据错误时,加载另一个静态分区的数据,从而确保设备顺利启动并运行操作系统;根据本申请实施例的方法,可以大大提高设备启动的成功率,提高设备运行稳定性。According to the method of the embodiment of the application, when the currently loaded static partition data is wrong, the data of another static partition can be loaded, so as to ensure that the device starts up smoothly and runs the operating system; according to the method of the embodiment of the application, the device startup can be greatly improved. The success rate and improve the stability of equipment operation.
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings that need to be used in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. Those of ordinary skill in the art can also obtain other drawings based on these drawings without paying creative labor.
图1所示为安卓系统在终端设备上的数据存储结构示意图;Figure 1 shows a schematic diagram of the data storage structure of the Android system on the terminal device;
图2所示为根据本申请一实施例启动设备的流程图;FIG. 2 is a flow chart of starting a device according to an embodiment of the present application;
图3所示为根据本申请一实施例的设备启动加载流程示意图;FIG. 3 is a schematic diagram of a device startup and loading process according to an embodiment of the present application;
图4所示为根据本申请一实施例的操作系统升级的流程图;FIG. 4 is a flow chart showing an operating system upgrade according to an embodiment of the present application;
图5所示为根据本申请一实施例的静态分区同步流程图;FIG. 5 shows a flow chart of static partition synchronization according to an embodiment of the present application;
图6所示为根据本申请一实施例的静态分区同步流程图;FIG. 6 shows a flow chart of static partition synchronization according to an embodiment of the present application;
图7所示为根据本申请一实施例的静态分区同步流程图;FIG. 7 shows a flow chart of static partition synchronization according to an embodiment of the present application;
图8所示为根据本申请一实施例的操作系统升级的流程图;FIG. 8 is a flowchart of an operating system upgrade according to an embodiment of the present application;
图9所示为根据本申请一实施例的操作系统升级的流程图;FIG. 9 is a flowchart of an operating system upgrade according to an embodiment of the present application;
图10所示为根据本申请一实施例的设备启动加载流程图;FIG. 10 is a flow chart showing device startup and loading according to an embodiment of the present application;
图11所示为根据本申请一实施例的设备启动加载流程示意图;FIG. 11 is a schematic diagram of a device startup and loading process according to an embodiment of the present application;
图12所示为根据本申请一实施例的设备启动加载流程图;Fig. 12 shows a flow chart of device startup and loading according to an embodiment of the present application;
图13所示为根据本申请一实施例的方案对静态分区(A)进行数据修正的流程图;FIG. 13 is a flow chart showing data correction for a static partition (A) according to a solution of an embodiment of the present application;
图14所示为根据本申请一实施例的设备启动加载流程图。Fig. 14 is a flow chart of device startup and loading according to an embodiment of the present application.
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solutions of the present application, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only some of the embodiments of the present application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。Terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of this application and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,甲和/或乙,可以表示:单独存在甲,同时存在甲和乙,单独存在乙这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" used herein is only an association relationship describing associated objects, which means that there may be three relationships, for example, A and/or B, which may mean that A exists alone, and A and B exist simultaneously. B, there are three situations of B alone. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.
针对操作系统数据错误而导致设备无法启动的问题,一种可行的解决方案是在设备上构建操作系统备份数据,在设备启动的过程中,当操作系统数据加载错误时,可以加载备份的操作系统数据以确保设备的顺利启动。但是,备份数据会占据存储空间,这就会压缩用户可以自由使用的数据空间,造成存储空间浪费。For the problem that the device cannot be started due to incorrect operating system data, a feasible solution is to build operating system backup data on the device. During the device startup process, when the operating system data is loaded incorrectly, the backup operating system can be loaded data to ensure smooth startup of the device. However, backup data will occupy storage space, which will compress the data space that users can use freely, resulting in waste of storage space.
为解决上述问题,本申请通过解析操作系统的存储文件结构,确定操作系统数据中可以实现相互替换的数据。在设备启动的过程中,当操作系统数据加载错误时,调用可以替换错误数据的数据进行加载,从而确保设备顺利启动。In order to solve the above problems, the present application determines the mutually replaceable data in the operating system data by analyzing the storage file structure of the operating system. In the process of device startup, when the operating system data is loaded incorrectly, the data that can replace the wrong data is called to load, so as to ensure the smooth startup of the device.
具体的,以采用虚拟A/B升级方式的安卓系统为例,图1所示为安卓系统在终端设备上的数据存储结构示意图。如图1所示,安卓系统数据存储区包含基础分区(Common)、静态分区(A)、静态分区(B)、动态分区(Super)、用户数据分区(Userdata)。Specifically, taking an Android system adopting a virtual A/B upgrade method as an example, FIG. 1 shows a schematic diagram of a data storage structure of the Android system on a terminal device. As shown in Figure 1, the Android system data storage area includes a basic partition (Common), a static partition (A), a static partition (B), a dynamic partition (Super), and a user data partition (Userdata).
用户数据分区(Userdata)用于保存用户的个人数据,例如,用户个人安装的APP、用户个人保存的图片、文档以及视频等个人数据。基础部分中保存的数据为不参与操作系统升级的系统数据。静态分区(A)与静态分区(B)的结构相互对应,子分区命名通过后缀_a以及_b相互区分。静态分区(A)包括bootloader_a、boot_a、vendor_boot_a、dtbo_a、vbmeta_a;静态分区(B)包括bootloader_b、boot_b、vendor_boot_b、dtbo_b、vbmeta_b。动态分区(Super)包含多个子分区。The user data partition (Userdata) is used to store the user's personal data, for example, personal data such as apps installed by the user, pictures, documents, and videos saved by the user. The data saved in the basic part is system data that does not participate in the operating system upgrade. The structures of static partition (A) and static partition (B) correspond to each other, and sub-partition names are distinguished from each other by suffixes _a and _b. Static partition (A) includes bootloader_a, boot_a, vendor_boot_a, dtbo_a, vbmeta_a; static partition (B) includes bootloader_b, boot_b, vendor_boot_b, dtbo_b, vbmeta_b. A dynamic partition (Super) contains multiple subpartitions.
在设备启动时,从一个静态分区启动。例如,设备从静态分区(A)启动:依次加载基础分区(Common)、静态分区(A)以及动态分区(Super);设备从静态分区(B)启动:依次加载基础分区(Common)、静态分区(B)以及动态分区(Super)。When the device boots, it starts from a static partition. For example, if the device starts from the static partition (A): load the basic partition (Common), static partition (A) and dynamic partition (Super) in sequence; the device starts from the static partition (B): load the basic partition (Common), static partition in sequence (B) and dynamic partition (Super).
在图1所示的系统存储结构中,静态分区(A)与静态分区(B)的分区结构是一致的,当静态分区(A)与静态分区(B)中烧录的数据一致的时候(例如,在某些应用场景中,设备进行出厂前系统安装后,静态分区(A)与静态分区(B)中烧录的数据是一致的),静态分区(A)与静态分区(B)中,相互对 应的子分区间可以相互替代。In the system storage structure shown in Figure 1, the static partition (A) and the static partition (B) have the same partition structure, when the data programmed in the static partition (A) and the static partition (B) are consistent ( For example, in some application scenarios, after the system is installed on the device before leaving the factory, the data burned in the static partition (A) and the static partition (B) are consistent), the data in the static partition (A) and the static partition (B) , the corresponding subdivisions can replace each other.
综上,本申请实施例提出了一种操作系统启动方法,针对采用虚拟A/B升级方式的安卓系统,在设备启动,加载静态分区(A)的过程中,当一个子分区加载失败,则尝试加载该子分区在静态分区(B)中对应的子分区,从而确保设备顺利启动。To sum up, the embodiment of this application proposes a method for starting an operating system. For an Android system that adopts a virtual A/B upgrade method, when the device starts and loads a static partition (A), when a sub-partition fails to load, the Try to load the subpartition corresponding to the subpartition in the static partition (B), so as to ensure that the device starts smoothly.
根据本申请实施例的方法,可以在当前加载的静态分区数据错误时,加载另一个静态分区的数据,从而确保设备顺利启动并运行操作系统;根据本申请实施例的方法,可以大大提高设备启动的成功率,提高设备运行稳定性。According to the method of the embodiment of the application, when the currently loaded static partition data is wrong, the data of another static partition can be loaded, so as to ensure that the device starts up smoothly and runs the operating system; according to the method of the embodiment of the application, the device startup can be greatly improved. The success rate and improve the stability of equipment operation.
图2所示为针对图1所示系统数据存储结构启动设备的流程图,当设备从静态分区(A)启动时(一般的,在设备出厂前安装操作系统后,默认设备从静态分区(A)启动),设备按照如图2所示的流程启动。Figure 2 is a flow chart of starting the device for the system data storage structure shown in Figure 1. When the device starts from the static partition (A) (generally, after the operating system is installed on the device before leaving the factory, the default device starts from the static partition (A) ) start), the device starts according to the process shown in Figure 2.
S200,设备从设备的文件系统(例如,UFS)中获取分区表,生成待加载分区的设备节点,设备节点为分区的路径信息。S200. The device obtains a partition table from a file system (for example, UFS) of the device, and generates a device node of a partition to be loaded, where the device node is path information of the partition.
例如,以采用主引导记录(Master Boot Record,MBR)格式的通用闪存(Universal Flash Storage,UFS)。从UFS的MBR(主引导扇区,UFS的第一个扇区,即C/H/S地址的0柱面0磁头1扇区)中读取UFS上各个分区的大小及位置信息,获取分区表(Dpt)。For example, take Universal Flash Storage (UFS) in Master Boot Record (MBR) format. Read the size and location information of each partition on UFS from the MBR of UFS (master boot sector, the first sector of UFS, that is, 0 cylinder 0 head 1 sector of C/H/S address), and obtain the partition Table (Dpt).
以静态分区为例,设备从静态分区(A)启动,静态分区的待加载子分区包括bootloader_a、boot_a、vendor_boot_a、dtbo_a、vbmeta_a,待加载的设备节点包括:Taking the static partition as an example, the device starts from the static partition (A). The subpartitions to be loaded in the static partition include bootloader_a, boot_a, vendor_boot_a, dtbo_a, and vbmeta_a. The device nodes to be loaded include:
/dev/block/by-name/bootloader_a;/dev/block/by-name/bootloader_a;
/dev/block/by-name/boot_a;/dev/block/by-name/boot_a;
/dev/block/by-name/vendor_boot_a;/dev/block/by-name/vendor_boot_a;
/dev/block/by-name/dtbo_a;/dev/block/by-name/dtbo_a;
/dev/block/by-name/vbmeta_a。/dev/block/by-name/vbmeta_a.
这里需要说明的是,上述设备节点描述仅为实际应用场景的举例描述。本申请方案对设备节点的具体形式以及具体内容并不做详细限制。It should be noted here that the above device node description is only an example description of an actual application scenario. The solution of this application does not limit the specific form and specific content of the device node in detail.
基于S200获取的待加载分区的设备节点,进行分区加载。S202,加载基础分区(Common)。Based on the device node of the partition to be loaded obtained by S200, the partition is loaded. S202, loading a basic partition (Common).
基于S200获取的待加载的设备节点/dev/block/by-name/bootloader_a(第一子分区),加载静态分区的bootloader子分区。Based on the device node /dev/block/by-name/bootloader_a (first sub-partition) to be loaded obtained by S200, the bootloader sub-partition of the static partition is loaded.
S210,校验设备节点/dev/block/by-name/bootloader_a下的数据(第一校验操作)。S210, verify the data under the device node /dev/block/by-name/bootloader_a (the first verification operation).
具体的,读取设备节点/dev/block/by-name/bootloader_a下的数据,对读取到的数据进行镜像完整性和合法性校验。Specifically, read the data under the device node /dev/block/by-name/bootloader_a, and perform image integrity and legality verification on the read data.
如果校验成功,执行S211,加载/dev/block/by-name/bootloader_a下的数据,并且,在数据加载完成后执行S220。If the verification is successful, execute S211 to load the data under /dev/block/by-name/bootloader_a, and execute S220 after the data loading is completed.
如果校验失败,S212,修改待加载的设备节点,将待加载的设备节点由/dev/block/by-name/bootloader_a修改为/dev/block/by-name/bootloader_b(第二子分区)(修改设备节点的后缀,将_a修改为_b)。If the verification fails, S212, modify the device node to be loaded, and modify the device node to be loaded from /dev/block/by-name/bootloader_a to /dev/block/by-name/bootloader_b (second sub-partition) ( Modify the suffix of the device node, change _a to _b).
S213,校验设备节点/dev/block/by-name/bootloader_b下的数据(第二校验操作)。S213, verify the data under the device node /dev/block/by-name/bootloader_b (second verification operation).
如果校验成功,执行S214,加载/dev/block/by-name/bootloader_b下的数据,并且,在数据加载完成后执行S220。If the verification is successful, execute S214 to load the data under /dev/block/by-name/bootloader_b, and execute S220 after the data loading is completed.
如校验失败,执行S201,重新启动设备,或者,输出设备无法启动的提示信息。If the verification fails, perform S201 to restart the device, or output a prompt message that the device cannot be started.
基于S200获取的待加载的设备节点/dev/block/by-name/boot_a(第三子分区),加载静态分区的boot子分区。Based on the device node /dev/block/by-name/boot_a (third sub-partition) to be loaded obtained by S200, the boot sub-partition of the static partition is loaded.
S220,校验设备节点/dev/block/by-name/boot_a下的数据。S220, verify the data under the device node /dev/block/by-name/boot_a.
具体的,读取设备节点/dev/block/by-name/boot_a下的数据,对读取到的数据进行镜像完整性和合法性校验。Specifically, read the data under the device node /dev/block/by-name/boot_a, and perform image integrity and legality verification on the read data.
如果校验成功,执行S221,加载/dev/block/by-name/boot_a下的数据,并且,在数据加载完成后执行S230。If the verification is successful, execute S221 to load the data under /dev/block/by-name/boot_a, and execute S230 after the data loading is completed.
如果校验失败,执行S222,修改待加载设备节点,将待加载的设备节点由/dev/block/by-name/boot_a修改为/dev/block/by-name/boot_b(第四子分区)(修改设备节点的后缀,将_a修改为_b)。If the verification fails, execute S222, modify the device node to be loaded, and modify the device node to be loaded from /dev/block/by-name/boot_a to /dev/block/by-name/boot_b (the fourth sub-partition) ( Modify the suffix of the device node, change _a to _b).
S223,校验设备节点/dev/block/by-name/boot_b下的数据。S223, verify the data under the device node /dev/block/by-name/boot_b.
如果校验成功,执行S224,加载/dev/block/by-name/boot_b下的数据,并且,在数据加载完成后执行S230。If the verification is successful, execute S224 to load the data under /dev/block/by-name/boot_b, and execute S230 after the data loading is completed.
如校验失败,执行S201,重新启动设备,或者,输出设备无法启动的提示信息。If the verification fails, perform S201 to restart the device, or output a prompt message that the device cannot be started.
基于S200获取的待加载的设备节点/dev/block/by-name/vendor_boot_a,加载静态分区的vendor_boot子分区。Load the vendor_boot subpartition of the static partition based on the device node /dev/block/by-name/vendor_boot_a obtained by the S200 to be loaded.
S230,校验设备节点/dev/block/by-name/vendor_boot_a下的数据。S230, verify the data under the device node /dev/block/by-name/vendor_boot_a.
具体的,读取设备节点/dev/block/by-name/vendor_boot_a下的数据,对读取到的数据进行镜像完整性和合法性校验。Specifically, read the data under the device node /dev/block/by-name/vendor_boot_a, and check the image integrity and validity of the read data.
如果校验成功,执行S231,加载/dev/block/by-name/vendor_boot_a下的数据,并且,在数据加载完成后执行S240。If the verification is successful, execute S231, load the data under /dev/block/by-name/vendor_boot_a, and execute S240 after the data loading is completed.
如果校验失败,执行S232,修改待加载设备节点,将待加载的设备节点由/dev/block/by-name/vendor_boot_a修改为/dev/block/by-name/vendor_boot_b(修改设备节点的后缀,将_a修改为_b)。If the verification fails, perform S232 to modify the device node to be loaded, and change the device node to be loaded from /dev/block/by-name/vendor_boot_a to /dev/block/by-name/vendor_boot_b (modify the suffix of the device node, Change _a to _b).
S233,校验设备节点/dev/block/by-name/vendor_boot_b下的数据。S233, verify the data under the device node /dev/block/by-name/vendor_boot_b.
如果校验成功,执行S234,加载/dev/block/by-name/vendor_boot_b下的数据, 并且,在数据加载完成后执行S240。If the verification is successful, execute S234 to load the data under /dev/block/by-name/vendor_boot_b, and execute S240 after the data loading is completed.
如校验失败,执行S201,重新启动设备,或者,输出设备无法启动的提示信息。If the verification fails, perform S201 to restart the device, or output a prompt message that the device cannot be started.
基于S200获取的待加载的设备节点/dev/block/by-name/dtbo_a,加载静态分区的dtbo子分区。Based on the device node /dev/block/by-name/dtbo_a to be loaded obtained by the S200, load the dtbo sub-partition of the static partition.
S240,校验设备节点/dev/block/by-name/dtbo_a下的数据。S240, verify the data under the device node /dev/block/by-name/dtbo_a.
具体的,读取设备节点/dev/block/by-name/dtbo_a下的数据,对读取到的数据进行镜像完整性和合法性校验。Specifically, read the data under the device node /dev/block/by-name/dtbo_a, and check the image integrity and validity of the read data.
如果校验成功,执行S241,加载/dev/block/by-name/dtbo_a下的数据,并且,在数据加载完成后执行S250。If the verification is successful, execute S241 to load the data under /dev/block/by-name/dtbo_a, and execute S250 after the data loading is completed.
如果校验失败,执行S242,修改待加载设备节点,将待加载的设备节点由/dev/block/by-name/dtbo_a修改为/dev/block/by-name/dtbo_b(修改设备节点的后缀,将_a修改为_b)。If the verification fails, execute S242, modify the device node to be loaded, and modify the device node to be loaded from /dev/block/by-name/dtbo_a to /dev/block/by-name/dtbo_b (modify the suffix of the device node, Change _a to _b).
S243,校验设备节点/dev/block/by-name/dtbo_b下的数据。S243, verify the data under the device node /dev/block/by-name/dtbo_b.
如果校验成功,执行S244,加载/dev/block/by-name/dtbo_b下的数据,并且,在数据加载完成后执行S250。If the verification is successful, execute S244 to load the data under /dev/block/by-name/dtbo_b, and execute S250 after the data loading is completed.
如校验失败,执行S201,重新启动设备,或者,输出设备无法启动的提示信息。If the verification fails, perform S201 to restart the device, or output a prompt message that the device cannot be started.
基于S200获取的待加载的设备节点/dev/block/by-name/vbmeta_a,加载静态分区的vbmeta子分区。Based on the device node /dev/block/by-name/vbmeta_a to be loaded obtained by S200, load the vbmeta sub-partition of the static partition.
S250,校验设备节点/dev/block/by-name/vbmeta_a下的数据。S250, verifying data under the device node /dev/block/by-name/vbmeta_a.
具体的,读取设备节点/dev/block/by-name/vbmeta_a下的数据,对读取到的数据进行镜像完整性和合法性校验。Specifically, read the data under the device node /dev/block/by-name/vbmeta_a, and perform image integrity and legality verification on the read data.
如果校验成功,执行S251,加载/dev/block/by-name/vbmeta_a下的数据,并且,在数据加载完成后执行S260。If the verification is successful, execute S251 to load the data under /dev/block/by-name/vbmeta_a, and execute S260 after the data loading is completed.
如果校验失败,执行S252,修改待加载设备节点,将待加载的设备节点由/dev/block/by-name/vbmeta_a修改为/dev/block/by-name/vbmeta_b(修改设备节点的后缀,将_a修改为_b)。If the verification fails, execute S252, modify the device node to be loaded, and modify the device node to be loaded from /dev/block/by-name/vbmeta_a to /dev/block/by-name/vbmeta_b (modify the suffix of the device node, Change _a to _b).
S253,校验设备节点/dev/block/by-name/vbmeta_a下的数据。S253. Verify the data under the device node /dev/block/by-name/vbmeta_a.
如果校验成功,执行S254,加载/dev/block/by-name/vbmeta_a下的数据,并且,在数据加载完成后执行S260。If the verification is successful, execute S254 to load the data under /dev/block/by-name/vbmeta_a, and execute S260 after the data loading is completed.
如校验失败,执行S201,重新启动设备,或者,输出设备无法启动的提示信息。S260,加载动态分区(Super);S270,设备启动成功。If the verification fails, perform S201 to restart the device, or output a prompt message that the device cannot be started. S260, load the dynamic partition (Super); S270, start the device successfully.
基于图2所示实施例的方法流程,可以在静态分区(A)中的子分区加载失败时,通过加载静态分区(B)中对应的子分区来确保设备顺利启动,从而大大 增加设备启动的成功率。Based on the method flow of the embodiment shown in Figure 2, when the sub-partition in the static partition (A) fails to be loaded, the device can be started smoothly by loading the corresponding sub-partition in the static partition (B), thereby greatly increasing the time for device startup. Success rate.
例如,图3所示为根据本申请一实施例的设备启动加载流程示意图。在一应用场景中,静态分区(A)中的vendor_boot_a以及vbmeta_a存在数据错误。基于图2所示实施例的方法流程启动设备,如图3所示:For example, FIG. 3 is a schematic diagram of a device startup and loading process according to an embodiment of the present application. In an application scenario, there are data errors in vendor_boot_a and vbmeta_a in the static partition (A). Start the device based on the method flow of the embodiment shown in Figure 2, as shown in Figure 3:
加载基础分区(Common);Load the basic partition (Common);
校验bootloader_a子分区(成功),加载bootloader_a子分区;Verify bootloader_a subpartition (success), load bootloader_a subpartition;
校验boot_a子分区(成功),加载boot_a子分区(成功);Verify boot_a subpartition (success), load boot_a subpartition (success);
校验vendor_boot_a子分区(失败);Verify vendor_boot_a subpartition (failure);
校验vendor_boot_b子分区(成功),加载vendor_boot_b子分区;Verify vendor_boot_b subpartition (successful), load vendor_boot_b subpartition;
校验dtbo_a子分区(成功),加载dtbo_a子分区;Verify dtbo_a subpartition (successful), load dtbo_a subpartition;
校验vbmeta_a子分区(失败);Verify vbmeta_a subpartition (failure);
校验vbmeta_b子分区(成功),加载vbmeta_b子分区;Verify vbmeta_b subpartition (successful), load vbmeta_b subpartition;
加载动态分区(Super)。Load dynamic partition (Super).
最终,设备从静态分区(A)启动所加载的操作系统数据为:基础分区(Common)、bootloader_a子分区、boot_a子分区、vendor_boot_b子分区、dtbo_a子分区、vbmeta_b子分区以及动态分区(Super)。Finally, the operating system data loaded by the device from the static partition (A) is: basic partition (Common), bootloader_a subpartition, boot_a subpartition, vendor_boot_b subpartition, dtbo_a subpartition, vbmeta_b subpartition and dynamic partition (Super).
进一步的,在设备出厂后,在实际应用场景中,设备还存在升级需求。图4所示为针对图1所示系统数据存储结构进行操作系统升级的流程图,当设备当前是从静态分区(A)启动时,设备按照如图4所示的流程实现操作系统的升级。Furthermore, after the equipment leaves the factory, in actual application scenarios, the equipment still needs to be upgraded. FIG. 4 is a flow chart of upgrading the operating system for the system data storage structure shown in FIG. 1. When the device is currently started from the static partition (A), the device implements the operating system upgrade according to the process shown in FIG. 4.
S400,设备依次加载基础分区(Common)、静态分区(A)以及动态分区(Super),从静态分区(A)启动;S400, the device loads the basic partition (Common), static partition (A) and dynamic partition (Super) in sequence, and starts from the static partition (A);
S410,设备获取操作系统升级安装包;S410, the device acquires an operating system upgrade installation package;
示例的,在一种可行的实现方案中,设备定期向搜包服务器发起搜包请求,搜包请求包含设备当前运行的操作系统的版本号(例如版本1.1);搜包服务器根据搜包请求中的操作系统版本号,检索当前是否存在更新版本号的操作系统安装包(例如版本1.2);当存在更新版本的操作系统安装包时,搜包服务器向设备反馈操作系统升级安装包(例如,由版本1.1升级到版本1.2的操作系统升级包)的下载地址;设备根据操作系统升级安装包的下载地址下载操作系统升级安装包,并将操作系统升级安装包保存到用户数据分区(Userdata)。For example, in a feasible implementation solution, the device periodically initiates a packet search request to the packet search server, and the packet search request includes the version number (such as version 1.1) of the operating system currently running on the device; The version number of the operating system, and retrieve whether there is an operating system installation package with a newer version number (for example, version 1.2); Version 1.1 is upgraded to the download address of the operating system upgrade package) of version 1.2; the device downloads the operating system upgrade installation package according to the download address of the operating system upgrade installation package, and saves the operating system upgrade installation package to the user data partition (Userdata).
S420,设备从用户数据分区(Userdata)读取S410中所保存的操作系统升级安装包,根据操作系统升级安装包针对静态分区(B)进行数据写入操作以升级静态分区;S420, the device reads the operating system upgrade installation package stored in S410 from the user data partition (Userdata), and performs a data writing operation on the static partition (B) according to the operating system upgrade installation package to upgrade the static partition;
例如,在操作系统升级安装包中包含版本1.2的静态分区的数据,设备将版本1.2的静态分区的数据覆写到静态分区(B)中。For example, the operating system upgrade installation package includes data of the static partition of version 1.2, and the device overwrites the data of the static partition of version 1.2 into the static partition (B).
S430,设备根据操作系统升级安装包在用户数据分区(Userdata)创建虚拟动态分区,在虚拟动态分区写入动态分区(Super)的升级数据。例如,在操作系统升级安装包中包含版本1.2的动态分区的数据,设备在虚拟动态分区中写入 版本1.2的动态分区(Super)的数据。S430. The device creates a virtual dynamic partition in the user data partition (Userdata) according to the operating system upgrade installation package, and writes upgrade data of the dynamic partition (Super) in the virtual dynamic partition. For example, the operating system upgrade installation package contains the data of the dynamic partition of version 1.2, and the device writes the data of the dynamic partition (Super) of version 1.2 in the virtual dynamic partition.
进一步的,在虚拟A/B升级方案中,针对动态分区(Super),采用增量升级方式。在升级过程中,用户数据分区(Userdata)的虚拟动态分区中保存的并不是升级后新版本的动态分区(Super)的全部文件,而是旧版本的动态分区(Super)中需要升级的数据在升级后的升级结果。即,用户数据分区(Userdata)的虚拟动态分区中保存的是动态分区的更新数据。Further, in the virtual A/B upgrade solution, an incremental upgrade method is adopted for the dynamic partition (Super). During the upgrade process, the virtual dynamic partition of the user data partition (Userdata) does not save all the files of the new version of the dynamic partition (Super) after the upgrade, but the data that needs to be upgraded in the old version of the dynamic partition (Super). The result of the upgrade after the upgrade. That is, what is stored in the virtual dynamic partition of the user data partition (Userdata) is the updated data of the dynamic partition.
以system子分区为例,假设在版本1.1中,system子分区中的数据可以分为system1、system2两部分。从版本1.1升级到版本1.2,数据system2没有发生变化,数据syetem1被升级为system3。那么,在S430中,设备在用户数据分区(Userdata)创建虚拟动态分区,在虚拟动态分区中写入数据system3。Taking the system subpartition as an example, assume that in version 1.1, the data in the system subpartition can be divided into two parts: system1 and system2. From version 1.1 to version 1.2, the data system2 has not changed, and the data syetem1 has been upgraded to system3. Then, in S430, the device creates a virtual dynamic partition in the user data partition (Userdata), and writes data system3 into the virtual dynamic partition.
例如,版本1.1升级到版本1.2的系统增量升级安装包包含版本1.1升级到版本1.2的动态分区(Super)更新数据,该动态分区(Super)更新数据包含数据system3。For example, the system incremental upgrade installation package from version 1.1 to version 1.2 includes dynamic partition (Super) update data from version 1.1 to version 1.2, and the dynamic partition (Super) update data includes data system3.
进一步的,在虚拟A/B升级方案中,基于快照技术(snapshot)实现动态分区(Super)的增量升级。具体的,用户数据分区(Userdata)的虚拟动态分区中,采用写时拷贝(Copy-On-Write,COW)文件保存动态分区(Super)的升级数据。Further, in the virtual A/B upgrade scheme, the incremental upgrade of the dynamic partition (Super) is realized based on the snapshot technology (snapshot). Specifically, in the virtual dynamic partition of the user data partition (Userdata), a copy-on-write (Copy-On-Write, COW) file is used to save the upgrade data of the dynamic partition (Super).
具体的,用户数据分区(Userdata)中保存的动态分区(Super)的升级数据包含多个COW文件,每个COW文件对应一个动态分区(Super)的子分区,COW文件的命名与其所针对的动态分区(Super)子分区相对应。Specifically, the upgrade data of the dynamic partition (Super) stored in the user data partition (Userdata) contains multiple COW files, and each COW file corresponds to a sub-partition of the dynamic partition (Super). Partition (Super) corresponds to sub-partition.
在S410所获取的操作系统升级安装包中,动态分区(Super)的升级数据的COW文件以二进制代码形式压缩保存。在操作系统升级安装包中,每个COW文件根据其所针对的动态分区(Super)子分区所命名。例如,针对system子分区的COW文件被命名为system-cow-img.img.0000。In the operating system upgrade installation package acquired by S410, the COW file of the upgrade data of the dynamic partition (Super) is compressed and saved in the form of binary code. In the operating system upgrade installation package, each COW file is named according to the sub-partition of the dynamic partition (Super). For example, the COW file for the system subpartition is named system-cow-img.img.0000.
在S430中,设备解包操作系统升级安装包以获取所有的COW文件,为每个COW文件附加A/B分区标记。具体的,当设备当前从静态分区(A)启动时,可以理解为设备当前运行操作系统所加载的动态分区(Super)为动态分区(A)。在升级操作系统时,用户数据分区(Userdata)中创建的虚拟动态分区是针对动态分区(B)。因此,为COW文件附加对应动态分区(B)的名称标记_b。例如,为system-cow-img.img.0000附加_b生成system_b-cow-img.img.0000。In S430, the device unpacks the operating system upgrade installation package to obtain all COW files, and attaches an A/B partition mark to each COW file. Specifically, when the device is currently started from the static partition (A), it can be understood that the dynamic partition (Super) loaded by the operating system currently running on the device is the dynamic partition (A). When upgrading the operating system, the virtual dynamic partition created in the user data partition (Userdata) is for the dynamic partition (B). Therefore, the name mark _b corresponding to the dynamic partition (B) is appended to the COW file. For example, append_b for system-cow-img.img.0000 generates system_b-cow-img.img.0000.
进一步的,在S430中,在用户数据分区(Userdata)中创建Update文件夹,将重命名的COW文件保存到Update文件夹下。例如,在一应用场景中,在向用户数据分区(Userdata)写入COW文件后,用户数据分区(Userdata)的Update文件夹中包含下述文件:Further, in S430, an Update folder is created in the user data partition (Userdata), and the renamed COW file is saved in the Update folder. For example, in an application scenario, after writing a COW file to the user data partition (Userdata), the Update folder of the user data partition (Userdata) contains the following files:
system_b-cow-img.img.0000;system_b-cow-img.img.0000;
system_ext_b-cow-img.img.0000;system_ext_b-cow-img.img.0000;
vendor_b-cow-img.img.0000;vendor_b-cow-img.img.0000;
product_b-cow-img.img.0000;product_b-cow-img.img.0000;
cust_b-cow-img.img.0000;cust_b-cow-img.img.0000;
odm_b-cow-img.img.0000。odm_b-cow-img.img.0000.
具体的,COW文件中包含COW文件自身的COW文件地图(快照map)以及升级数据。Specifically, the COW file includes a COW file map (snapshot map) and upgrade data of the COW file itself.
COW文件地图(快照)与COW文件所针对的动态分区(Super)的子分区的文件地图相对应。动态分区(Super)的子分区的文件地图用于描述当前版本的操作系统(本次升级之前的版本,例如,版本1.1)动态分区(Super)的子分区中的所有文件以及各个文件的保存地址。The COW file map (snapshot) corresponds to the file map of the sub-partition of the dynamic partition (Super) targeted by the COW file. The file map of the sub-partition of the dynamic partition (Super) is used to describe all the files in the sub-partition of the dynamic partition (Super) and the storage address of each file in the current version of the operating system (the version before this upgrade, for example, version 1.1) .
COW文件中的升级数据为相较于当前版本的子分区数据,新版本的子分区数据中被更新的文件;COW文件自身的COW文件地图则用于描述被更新的文件与当前版本的子分区中的文件间的对应关系以及被更新的文件的保存地址。The upgrade data in the COW file is the updated file in the sub-partition data of the new version compared with the sub-partition data of the current version; the COW file map of the COW file itself is used to describe the updated file and the sub-partition of the current version The correspondence between the files in and the storage address of the updated files.
基于动态分区(Super)的子分区的文件地图以及COW文件中的COW文件地图,就可以使用COW文件中的升级数据替换动态分区(Super)的子分区中的对应文件,从而实现动态分区(Super)数据的升级。具体的,在需要获取动态分区(Super)的子分区的文件地图时,可以基于snapshot对动态分区(Super)的子分区的数据进行快照操作以生成动态分区(Super)的子分区的文件地图。也可以在制作操作系统升级安装包时,预先生成动态分区(Super)的子分区的文件地图,将该文件地图加入到COW文件中。Based on the file map of the sub-partition of the dynamic partition (Super) and the COW file map in the COW file, the upgrade data in the COW file can be used to replace the corresponding file in the sub-partition of the dynamic partition (Super), thereby realizing the dynamic partition (Super) ) data upgrade. Specifically, when the file map of the sub-partition of the dynamic partition (Super) needs to be obtained, a snapshot operation may be performed on the data of the sub-partition of the dynamic partition (Super) based on the snapshot to generate the file map of the sub-partition of the dynamic partition (Super). It is also possible to pre-generate the file map of the sub-partition of the dynamic partition (Super) when making the operating system upgrade installation package, and add the file map to the COW file.
以system子分区为例,假设system子分区中按照以下路径保存数据:Taking the system subpartition as an example, assume that data is saved in the system subpartition according to the following path:
/system/app/A0.XXX;/system/app/A0.XXX;
/system/app/A1.XXX;/system/app/A1.XXX;
/system/app/A2.XXX;/system/app/A2.XXX;
/system/B0.XXX;/system/B0.XXX;
/system/B1.XXX;/system/B1.XXX;
/system/user/C0.XXX;/system/user/C0.XXX;
/system/user/C1.XXX;/system/user/C1.XXX;
/system/user/C2.XXX;/system/user/C2.XXX;
/system/user/C3.XXX。/system/user/C3.XXX.
system子分区的文件地图可以是:The file map of the system subpartition can be:
/system/app/A0.XXX:024010~024013;/system/app/A0.XXX: 024010~024013;
/system/app/A1.XXX:024014~024017;/system/app/A1.XXX: 024014~024017;
/system/app/A2.XXX:024018~024020;/system/app/A2.XXX: 024018~024020;
/system/B0.XXX:024021~024026;/system/B0.XXX: 024021~024026;
/system/B1.XXX:024027~024028;/system/B1.XXX: 024027~024028;
/system/user/C0.XXX:024029~024032;/system/user/C0.XXX: 024029~024032;
/system/user/C1.XXX:024033~024035;/system/user/C1.XXX: 024033~024035;
/system/user/C2.XXX:024036~024040;/system/user/C2.XXX: 024036~024040;
/system/user/C3.XXX:024041~024044。/system/user/C3.XXX: 024041~024044.
文件名后的数值(例如,/system/app/A0.XXX:024010~024013中的 024010~024013)为该文件在动态分区(Super)的system子分区的物理保存地址(块地址)。The value after the file name (for example, 024010-024013 in /system/app/A0.XXX: 024010-024013) is the physical storage address (block address) of the file in the system sub-partition of the dynamic partition (Super).
假设当前操作系统升级需要更新数据/system/app/A2.XXX以及/system/user/C2.XXX。Assume that the current operating system upgrade needs to update the data /system/app/A2.XXX and /system/user/C2.XXX.
可以视为:Can be viewed as:
/system/app/A2.XXX以及/system/user/C2.XXX为system子分区数据的system1部分;/system/app/A2.XXX and /system/user/C2.XXX are the system1 part of the system sub-partition data;
/system/app/A0.XXX、/system/app/A1.XXX、/system/B0.XXX、/system/B1.XXX、/system/user/C0.XXX、/system/user/C1.XXX以及/system/user/C3.XXX为system子分区数据的system2部分。/system/app/A0.XXX, /system/app/A1.XXX, /system/B0.XXX, /system/B1.XXX, /system/user/C0.XXX, /system/user/C1.XXX, and /system/user/C3.XXX is the system2 part of the system sub-partition data.
那么,针对system子分区的COW文件(system_b-cow-img.img.0000)就包含最新版的/system/app/A2.XXX以及/system/user/C2.XXX。Then, the COW file (system_b-cow-img.img.0000) for the system subpartition contains the latest versions of /system/app/A2.XXX and /system/user/C2.XXX.
可以视为,最新版的/system/app/A2.XXX以及/system/user/C2.XXX为system3。升级目标是使用system3更新掉system1。It can be considered that the latest versions of /system/app/A2.XXX and /system/user/C2.XXX are system3. The upgrade goal is to use system3 to update system1.
当COW文件中的更新数据的大小与其所要更新的原始数据的大小一致,并且,COW文件中的更新数据在数据更新后在子分区中的保存位置与其所要更新的原始数据在子分区中的保存位置一致时,COW文件(system_b-cow-img.img.0000)自身的COW文件地图可以为:When the size of the updated data in the COW file is the same as the size of the original data to be updated, and the storage position of the updated data in the COW file in the sub-partition after the data update is the same as the storage position of the original data to be updated in the sub-partition When the location is consistent, the COW file map of the COW file (system_b-cow-img.img.0000) itself can be:
/system/app/A2.XXX:/system/app/A2.XXX:
Map1(原super分区中待更新数据的地址):起始地址address start:024018(相对于system起始地址的偏移量);偏移量大小size:2(即024018~024020地址段的数据)Map1 (the address of the data to be updated in the original super partition): start address address start: 024018 (the offset relative to the system start address); offset size: 2 (that is, the data in the address segment of 024018 ~ 024020)
Map2(cow文件中存储的更新数据的地址):起始地址address start:045033(相对于cow文件存储的起始地址的偏移量);偏移量大小size:2(即045033~045035地址段的数据);Map2 (the address of the updated data stored in the cow file): start address address start: 045033 (the offset relative to the start address stored in the cow file); offset size: 2 (that is, the address segment of 045033 to 045035 The data);
/system/user/C2.XXX:/system/user/C2.XXX:
Map1(原super分区中待更新数据的地址):起始地址address start:024036(相对于system起始地址的偏移量);偏移量大小size:4(即024036~024040地址段的数据)Map1 (the address of the data to be updated in the original super partition): start address address start: 024036 (the offset relative to the system start address); offset size: 4 (that is, the data in the address segment 024036~024040)
Map2(cow文件中存储的更新数据的地址):起始地址address start:045036(相对于cow文件存储的起始地址的偏移量);偏移量大小size:4(即045036~045040地址段的数据)。Map2 (the address of the update data stored in the cow file): start address address start: 045036 (offset relative to the start address stored in the cow file); offset size: 4 (that is, the address segment of 045036 ~ 045040 The data).
当COW文件中的更新数据的大小与其所要更新的原始数据的大小不一致时,COW文件(system_b-cow-img.img.0000)自身的COW文件地图可以为:When the size of the updated data in the COW file is inconsistent with the size of the original data to be updated, the COW file map of the COW file (system_b-cow-img.img.0000) itself can be:
/system/app/A2.XXX:/system/app/A2.XXX:
Map1.1(原super分区中待更新数据的地址):起始地址address start:024018(相对于system起始地址的偏移量);偏移量大小size:2(即024018~024020地址段的数据)Map1.1 (the address of the data to be updated in the original super partition): start address address start: 024018 (the offset relative to the system start address); data)
Map2.1(cow文件中存储的,需要覆盖Map1.1地址的更新数据的地址):起始地址address start:045033(相对于cow文件存储的起始地址的偏移量);偏移量大小size:2(即045033~045035地址段的数据);Map2.1 (stored in the cow file, the address of the updated data that needs to cover the address of Map1.1): start address address start: 045033 (offset relative to the start address stored in the cow file); offset size size: 2 (that is, the data in the address segment of 045033~045035);
Map1.2(cow文件中更新数据超出待更新数据大小的那一部分在原super分区中的待写入地址):起始地址address start:025018(相对于system起始地址的偏移量);偏移量大小size:1(即025018~025020地址段的数据)Map1.2 (the address to be written in the original super partition of the part of the cow file where the updated data exceeds the size of the data to be updated): start address address start: 025018 (offset relative to the start address of the system); offset Volume size size: 1 (that is, the data in the 025018~025020 address segment)
Map2.2(cow文件中存储的,需要覆盖Map1.2地址的更新数据的地址):起始地址address start:046033(相对于cow文件存储的起始地址的偏移量);偏移量大小size:2(即046033~046035地址段的数据)。Map2.2 (stored in the cow file, the address of the updated data that needs to cover the address of Map1.2): start address address start: 046033 (offset relative to the start address stored in the cow file); offset size size: 2 (that is, the data in the 046033~046035 address segment).
在接下来的说明书描述中,为便于描述,仅以当COW文件中的更新数据的大小与其所要更新的原始数据的大小一致,并且,COW文件中的更新数据在数据更新后在子分区中的保存位置与其所要更新的原始数据在子分区中的保存位置一致的应用场景进行举例说明。In the following specification description, for the convenience of description, only when the size of the updated data in the COW file is consistent with the size of the original data to be updated, and the updated data in the COW file is stored in the sub-partition after the data is updated An example is given for an application scenario where the storage location is consistent with the storage location of the original data to be updated in the sub-partition.
在上述例子中,地址段(045033~045035以及045036~045040)分别为COW文件(system_b-cow-img.img.0000)中最新版的/system/app/A2.XXX以及/system/user/C2.XXX在用户数据分区(Userdata)的物理保存地址(块地址)。In the above example, the address segments (045033~045035 and 045036~045040) are the latest versions of /system/app/A2.XXX and /system/user/C2 in the COW file (system_b-cow-img.img.0000) respectively The physical storage address (block address) of .XXX in the user data partition (Userdata).
这样,如果使用地址045033~045035上的A2.XXX替换掉地址024018~024020上的A2.XXX,并且,使用地址045036~045040上的C2.XXX替换掉地址024036~024040上的C2.XXX,就可以完成动态分区(Super)的system子分区的数据升级。In this way, if A2.XXX at addresses 045033-045035 is used to replace A2.XXX at addresses 024018-024020, and C2.XXX at addresses 045036-045040 is used to replace C2.XXX at addresses 024036-024040, then The data upgrade of the system sub-partition of the dynamic partition (Super) can be completed.
进一步的,在S430中,在将COW文件写入用户数据分区(Userdata)后,还需要对动态分区(Super)+COW文件进行整体校验,校验动态分区(Super)+COW文件的有效性,验证当前版本的动态分区(Super)数据+COW文件的合成结果是否为新版本的动态分区(Super)数据。Further, in S430, after the COW file is written into the user data partition (Userdata), it is also necessary to perform an overall check on the dynamic partition (Super)+COW file to verify the validity of the dynamic partition (Super)+COW file , to verify whether the synthesis result of the current version of the dynamic partition (Super) data + the COW file is the new version of the dynamic partition (Super) data.
具体的,以从1.1版本升级到1.3版本为例,计算动态分区(Super)中不需要升级的数据(从版本1.1到版本1.2未发生变化的数据)与COW文件中升级数据(从版本1.1到版本1.2需要升级的数据)的合成结果的哈希值,判断该哈希值与1.3版本中动态分区(Super)的完整数据的哈希值是否一致,如果一致,则说明COW文件有效;如果不一致,则说明COW文件无效,升级失败,中断升级进程并报错;其中,1.3版本中动态分区(Super)的完整数据的哈希值被保存在操作系统升级安装包中。Specifically, taking the upgrade from version 1.1 to version 1.3 as an example, calculate the data that does not need to be upgraded in the dynamic partition (Super) (the data that has not changed from version 1.1 to version 1.2) and the upgraded data in the COW file (from version 1.1 to Version 1.2 The hash value of the synthetic result of the data that needs to be upgraded), and judge whether the hash value is consistent with the hash value of the complete data of the dynamic partition (Super) in version 1.3. If they are consistent, it means that the COW file is valid; if they are inconsistent , it means that the COW file is invalid, the upgrade fails, the upgrade process is interrupted and an error is reported; among them, the hash value of the complete data of the dynamic partition (Super) in version 1.3 is saved in the operating system upgrade installation package.
具体的,在校验过程中,基于snapshot合并动态分区(Super)+COW文件。在snapshot的实现过程中,动态分区(Super)与COW文件的合并并不是物理意义上的合并,而是将COW文件中子分区的整体文件地图与COW文件自身的COW文件地图进行合并,生成新版本的子分区数据的文件地图。Specifically, during the verification process, the dynamic partition (Super)+COW file is merged based on the snapshot. In the process of snapshot implementation, the merging of dynamic partitions (Super) and COW files is not a physical merging, but the overall file map of the sub-partitions in the COW file is merged with the COW file map of the COW file itself to generate a new A file map of versioned subpartition data.
例如,将system子分区的文件地图:For example, the file map of the system subpartition:
/system/app/A0.XXX:024010~024013;/system/app/A0.XXX: 024010~024013;
/system/app/A1.XXX:024014~024017;/system/app/A1.XXX: 024014~024017;
/system/app/A2.XXX:024018~024020;/system/app/A2.XXX: 024018~024020;
/system/B0.XXX:024021~024026;/system/B0.XXX: 024021~024026;
/system/B1.XXX:024027~024028;/system/B1.XXX: 024027~024028;
/system/user/C0.XXX:024029~024032;/system/user/C0.XXX: 024029~024032;
/system/user/C1.XXX:024033~024035;/system/user/C1.XXX: 024033~024035;
/system/user/C2.XXX:024036~024040;/system/user/C2.XXX: 024036~024040;
/system/user/C3.XXX:024041~024044。/system/user/C3.XXX: 024041~024044.
与COW文件地图:Maps with COW files:
/system/app/A2.XXX:/system/app/A2.XXX:
Map1:address start:024018;size:2(即024018~024020地址段的数据)Map1: address start: 024018; size: 2 (that is, the data in the address segment from 024018 to 024020)
Map2:address start:045033;size:2(即045033~045035地址段的数据);Map2: address start: 045033; size: 2 (that is, the data in the address segment from 045033 to 045035);
/system/user/C2.XXX:/system/user/C2.XXX:
Map1:address start:024036;size:4(即024036~024040地址段的数据)Map1: address start: 024036; size: 4 (that is, the data in the address segment from 024036 to 024040)
Map2:address start:045036;size:4(即045036~045040地址段的数据)。Map2: address start: 045036; size: 4 (that is, the data in the address range from 045036 to 045040).
合并。则得到system子分区的新版本的文件地图:merge. Then get the file map of the new version of the system sub-partition:
/system/app/A0.XXX:024010~024013;/system/app/A0.XXX: 024010~024013;
(指向动态分区(Super)中/system/app下的A0.XXX)(Point to A0.XXX under /system/app in the dynamic partition (Super))
/system/app/A1.XXX:024014~024017;/system/app/A1.XXX: 024014~024017;
(指向动态分区(Super)中/system/app下的A1.XXX)(Point to A1.XXX under /system/app in the dynamic partition (Super))
/system/app/A2.XXX:045033~045035;/system/app/A2.XXX: 045033~045035;
(指向用户数据分区(Userdata)中/Update/system_b-cow-img.img.0000中的A2.XXX)(Point to A2.XXX in /Update/system_b-cow-img.img.0000 in the user data partition (Userdata))
/system/B0.XXX:024021~024026;/system/B0.XXX: 024021~024026;
(指向动态分区(Super)中/system下的B0.XXX)(Point to B0.XXX under /system in the dynamic partition (Super))
/system/B1.XXX:024027~024028;/system/B1.XXX: 024027~024028;
(指向动态分区(Super)中/system下的B1.XXX)(Point to B1.XXX under /system in the dynamic partition (Super))
/system/user/C0.XXX:024029~024032;/system/user/C0.XXX: 024029~024032;
(指向动态分区(Super)中/system/user下的C0.XXX)(pointing to C0.XXX under /system/user in the dynamic partition (Super))
/system/user/C1.XXX:024033~024035;/system/user/C1.XXX: 024033~024035;
(指向动态分区(Super)中/system/user下的C1.XXX)(Point to C1.XXX under /system/user in the dynamic partition (Super))
/system/user/C2.XXX:045036~045040;/system/user/C2.XXX: 045036~045040;
(指向用户数据分区(Userdata)中/Update/system_b-cow-img.img.0000中的C2.XXX)(Point to C2.XXX in /Update/system_b-cow-img.img.0000 in the user data partition (Userdata))
/system/user/C3.XXX:024041~024044。/system/user/C3.XXX: 024041~024044.
(指向动态分区(Super)中/system/user下的C3.XXX)(Point to C3.XXX under /system/user in the dynamic partition (Super))
在新版本的system子分区的文件地图中,/system/app/A2.XXX的保存地址并不是指向存储器上动态分区(Super)上的/system/app/A2.XXX,而是指向存储器上用户数据分区(Userdata)中system_b-cow-img.img.0000中的A2.XXX; /system/user/C2.XXX的保存地址并不是指向存储器上动态分区(Super)上的/system/user/C2.XXX,而是指向存储器上用户数据分区(Userdata)中system_b-cow-img.img.0000中的C2.XXX。In the file map of the new version of the system subpartition, the storage address of /system/app/A2.XXX does not point to /system/app/A2.XXX on the dynamic partition (Super) on the storage, but points to the user on the storage A2.XXX in system_b-cow-img.img.0000 in the data partition (Userdata); the storage address of /system/user/C2.XXX does not point to /system/user/C2 on the dynamic partition (Super) on the storage .XXX, but points to C2.XXX in system_b-cow-img.img.0000 in the user data partition (Userdata) on the storage.
在校验过程中,按照上述合成方式,获取动态分区(Super)的所有子分区的新版本的文件地图(如果用户数据分区(Userdata)中并未写入某个子分区的对应COW文件,则直接以该子分区的文件地图为新版本的文件地图)。将所有子分区的新版本的文件地图组合生成动态分区(Super)的新版本的文件系统。During the verification process, according to the above synthesis method, the new version of the file map of all sub-partitions of the dynamic partition (Super) is obtained (if the corresponding COW file of a certain sub-partition is not written in the user data partition (Userdata), directly Use the filemap of the subpartition as the new version's filemap). Combine the new version of the file map of all subpartitions to generate the new version of the file system of the dynamic partition (Super).
基于动态分区(Super)的新版本的文件系统读取数据,读取动态分区(Super)的新版本的文件系统所包含的所有文件并计算哈希值。The file system of the new version based on the dynamic partition (Super) reads data, reads all files contained in the file system of the new version of the dynamic partition (Super), and calculates a hash value.
当COW文件有效时,将基础分区(Common)的元数据分区(/metadata)中的落盘状态信息由“已落盘(merged)”改为“未落盘(wait for merge)”。落盘状态信息用于表示当前是否存在需要落盘到动态分区(Super)的COW文件。具体的,落盘状态信息包含针对动态分区(Super)的整体标识以及针对每个子分区的子分区标识。当整体标识为“已落盘(merged)”时,代表动态分区(Super)的所有子分区均不需要进行落盘操作;当整体标识为“未落盘(wait for merge)”时,代表动态分区(Super)的一个或多个子分区需要进行落盘操作;当子分区标识为“已落盘(merged)”时,代表该子分区不需要进行落盘操作;当子分区标识为“未落盘(wait for merge)”时,代表该子分区需要进行落盘操作。When the COW file is valid, change the merge status information in the metadata partition (/metadata) of the basic partition (Common) from "merged" to "wait for merge". The flush status information is used to indicate whether there are currently COW files that need to be flushed to the dynamic partition (Super). Specifically, the disk placement status information includes an overall identifier for the dynamic partition (Super) and a sub-partition identifier for each sub-partition. When the overall flag is "merged", it means that all sub-partitions of the dynamic partition (Super) do not need to be merged; when the overall flag is "not merged (wait for merge)", it means dynamic One or more sub-partitions of a partition (Super) need to be merged; when the sub-partition is marked as "merged", it means that the sub-partition does not need to be merged; when the sub-partition is marked as "merged Disk (wait for merge)" means that the sub-partition needs to be moved to disk.
S431,将设备的启动顺序由从静态分区(A)启动变更为从静态分区(B)启动。S431. Change the boot sequence of the device from booting from the static partition (A) to booting from the static partition (B).
例如,改写主引导记录(Master Boot Record,MBR)的启动顺序标识,将启动顺序标识由A改写为B。在设备上电后,当设备读取到启动顺序标识为A,设备从静态分区(A)启动,启动过程中加载静态分区(A);当设备读取到启动顺序标识为B,设备从静态分区(B)启动,启动过程中加载静态分区(B)。For example, rewrite the boot sequence identifier of the Master Boot Record (MBR), and rewrite the boot sequence identifier from A to B. After the device is powered on, when the device reads the boot sequence ID as A, the device starts from the static partition (A), and loads the static partition (A) during startup; when the device reads the boot sequence ID as B, the device starts from the static partition (A). Partition (B) starts, and static partition (B) is loaded during startup.
S432,设备重启。退出当前的操作系统,切断设备电源,再次开启设备电源。S432, restarting the device. Exit the current operating system, cut off the power of the device, and turn on the power of the device again.
S440,设备依次加载基础分区(Common)、静态分区(B)。S440, the device sequentially loads a basic partition (Common) and a static partition (B).
在S440中,设备读取基础分区(Common)中的启动标记。基础分区(Common)中的启动标记为(B),设备在加载基础分区(Common)之后加载静态分区(B),从静态分区(B)启动。In S440, the device reads the boot flag in the basic partition (Common). The boot mark in the basic partition (Common) is (B), and the device loads the static partition (B) after loading the basic partition (Common), and starts from the static partition (B).
S441,设备加载动态分区(Super)以及用户数据分区(Userdata)的虚拟动态分区。S441. The device loads the dynamic partition (Super) and the virtual dynamic partition of the user data partition (Userdata).
具体的,设备读取元数据(/metadata)中的落盘状态信息,基于落盘状态信息确定是否需要从用户数据分区(Userdata)的指定路径中检索COW文件,并采用snapshot合并加载动态分区(Super)以及COW文件。Specifically, the device reads the storage status information in the metadata (/metadata), determines whether to retrieve the COW file from the specified path of the user data partition (Userdata) based on the storage status information, and uses snapshot to merge and load the dynamic partition ( Super) and COW files.
进一步的,在S441中,设备并不加载动态分区(Super)以及用户数据分区(Userdata)中的全部COW文件,而是根据操作系统运行需求加载对应的文件。具体的,在S441中,设备根据操作系统运行需求确定需要加载的文件,基于snapshot从动态分区(Super)或虚拟动态分区中的COW文件中提取对应的文件 进行加载。Further, in S441, the device does not load all COW files in the dynamic partition (Super) and the user data partition (Userdata), but loads corresponding files according to operating requirements of the operating system. Specifically, in S441, the device determines the files to be loaded according to the operation requirements of the operating system, and extracts the corresponding files from the COW files in the dynamic partition (Super) or virtual dynamic partition based on the snapshot for loading.
具体的,在S441中,当动态分区(Super)的子分区首存在对应的COW文件时,先基于snapshot生成动态分区(Super)各个子分区的新版本的文件地图。生成新版本的文件地图的过程可以参照S430。设备根据操作系统运行需求确定需要加载的文件,基于动态分区(Super)子分区的新版本的文件地图进行文件加载。Specifically, in S441, when there is a corresponding COW file in the sub-partition of the dynamic partition (Super), first generate a new version of the file map of each sub-partition of the dynamic partition (Super) based on the snapshot. For the process of generating a file map of a new version, reference may be made to S430. The device determines the files to be loaded according to the operation requirements of the operating system, and loads the files based on the file map of the new version of the dynamic partition (Super) sub-partition.
例如,操作系统运行需求加载system子分区下目录user(/system/user)中的所有数据。设备读取元数据(/metadata)中的落盘状态信息,落盘状态信息中system子分区的子分区标识为“未落盘(wait for merge)”,因此,设备在用户数据分区(Userdata)中/Update下搜索COW文件,在Update下搜索到COW文件system_b-cow-img.img.0000后,基于snapshot,根据system_b-cow-img.img.0000中的COW文件的文件地图生成system子分区的新版本的文件地图。按照system子分区的新版本的文件地图中/system/user下所有文件的保存地址进行数据加载,例如,根据system子分区的新版本的文件地图中:For example, the operating system needs to load all the data in the directory user (/system/user) under the system subpartition. The device reads the migration status information in the metadata (/metadata), and the subpartition of the system subpartition in the migration status information is marked as "wait for merge". Therefore, the device is in the user data partition (Userdata) Search for COW files under Medium/Update. After searching for the COW file system_b-cow-img.img.0000 under Update, generate a system sub-partition based on the snapshot and according to the file map of the COW file in system_b-cow-img.img.0000 The new version of the file map. Load data according to the storage addresses of all files under /system/user in the new version of the file map of the system subpartition, for example, according to the new version of the file map of the system subpartition:
/system/user/C0.XXX:024029~024032;/system/user/C0.XXX: 024029~024032;
/system/user/C1.XXX:024033~024035;/system/user/C1.XXX: 024033~024035;
/system/user/C2.XXX:045036~045040;/system/user/C2.XXX: 045036~045040;
/system/user/C3.XXX:024041~024044。/system/user/C3.XXX: 024041~024044.
加载地址024029~024032处的C0.XXX、地址024033~024035处的C1.XXX、地址045036~045040处的C2.XXX以及地址024041~024044处的C3.XXX。Load C0.XXX at addresses 024029-024032, C1.XXX at addresses 024033-024035, C2.XXX at addresses 045036-045040, and C3.XXX at addresses 024041-024044.
进一步的,在加载system子分区下目录user(/system/user)中的所有数据时,当落盘状态信息中system子分区的子分区标识为“已落盘(merged)”时,设备就不会在用户数据分区(Userdata)中/Update下搜索COW文件,而是直接加载system子分区下目录user(/system/user)中的所有数据。Furthermore, when loading all the data in the directory user (/system/user) under the system subpartition, when the subpartition of the system subpartition in the storage status information is marked as "merged", the device will not Search for COW files under /Update in the user data partition (Userdata), but directly load all the data in the directory user (/system/user) under the system subpartition.
进一步的,在加载system子分区下目录user(/system/user)中的所有数据时,当落盘状态信息中system子分区的子分区标识为“未落盘(wait for merge)”时,如果设备在用户数据分区(Userdata)中/Update下未搜索到对应system子分区的COW文件时,则说明升级过程中数据写入错误(COW文件写入错误或者落盘状态信息写入错误),此时设备回滚系统并报错。Further, when loading all the data in the directory user (/system/user) under the system sub-partition, when the sub-partition of the system sub-partition in the storage status information is marked as "wait for merge", if the device If the COW file corresponding to the system sub-partition is not found under /Update in the user data partition (Userdata), it means that the data was written incorrectly during the upgrade process (the COW file was written incorrectly or the disk status information was written incorrectly). The device rolls back the system and reports an error.
进一步的,在S441中,在加载文件之前,设备还需要对加载文件进行校验。不同于S430,在S441中,不对动态分区(Super)+COW文件进行整体验证,而是仅对需要加载的文件进行验证。例如,基于dmverity进行校验(dm-verity是dm(device mapper)的一个目标(target),是一个虚拟块设备,专门用于文件系统的校验)。校验成功则加载文件,校验失败则重启设备,回滚系统或者尝试再次加载文件。Further, in S441, before loading the file, the device needs to verify the loaded file. Different from S430, in S441, the dynamic partition (Super)+COW file is not verified as a whole, but only the files to be loaded are verified. For example, verify based on dmverity (dm-verity is a target of dm (device mapper), which is a virtual block device, specially used for file system verification). If the verification is successful, load the file; if the verification fails, restart the device, roll back the system or try to load the file again.
S450,设备成功启动,进入用户交互界面。S450, the device is successfully started and enters the user interaction interface.
S451,设备在后台将虚拟动态分区的数据落盘到动态分区(Super)。S451. The device transfers the data of the virtual dynamic partition to the dynamic partition (Super) in the background.
在本申请说明书的描述中,落盘操作指的是,在操作系统升级过程中,将用 户数据分区(Userdata)上虚拟动态分区中保存的动态分区(Super)升级文件(COW文件)写入到动态分区(Super)中,使得动态分区(Super)的文件完成数据升级,以便设备在下次启动时不需要加载动态分区(Super)和虚拟动态分区,只需加载动态分区(Super)就可以完成设备启动。In the description of this specification, the disk operation refers to writing the dynamic partition (Super) upgrade file (COW file) stored in the virtual dynamic partition on the user data partition (Userdata) into the In the dynamic partition (Super), the files of the dynamic partition (Super) are upgraded, so that the device does not need to load the dynamic partition (Super) and the virtual dynamic partition at the next startup, and only needs to load the dynamic partition (Super) to complete the device. start up.
具体的,设备在启动成功后进行开机广播,开机广播后开启升级进程。升级进程读取基础分区(Common)的元数据(/metadata)中的落盘状态信息,如果落盘状态信息为“已落盘(merged)”,则设备进入正常运行模式。Specifically, after the device is successfully started, it performs a power-on broadcast, and starts an upgrade process after the power-on broadcast. The upgrade process reads the migration status information in the metadata (/metadata) of the basic partition (Common). If the migration status information is "merged", the device enters the normal operation mode.
如果落盘状态信息为“未落盘(wait for merge)”,升级进程将用户数据分区(Userdata)中的COW文件落盘到动态分区(Super)中。If the disk status information is "wait for merge", the upgrade process will put the COW files in the user data partition (Userdata) to the dynamic partition (Super).
具体的,升级进程将用户数据分区(Userdata)中的COW文件中的升级数据写入到动态分区(Super)中的对应地址上,使得动态分区(Super)中的全部数据均为升级后的新版本的数据。Specifically, the upgrade process writes the upgrade data in the COW file in the user data partition (Userdata) to the corresponding address in the dynamic partition (Super), so that all the data in the dynamic partition (Super) are the new data after the upgrade. Version data.
例如,基于system子分区的文件地图中的/system/app/A2.XXX:024018~024020以及COW文件地图中的/system/app/A2.XXX:045033~045035,将地址045033~045035上的数据写入到地址024014~024017上;基于system子分区的文件地图中的/system/user/C2.XXX:024036~024040以及COW文件地图中的/system/user/C2.XXX:045036~045040,将地址045036~045040上的数据写入到地址024036~024040上。For example, based on /system/app/A2.XXX: 024018-024020 in the file map of the system subpartition and /system/app/A2.XXX: 045033-045035 in the COW file map, the data at addresses 045033-045035 Write to addresses 024014-024017; based on /system/user/C2.XXX: 024036-024040 in the file map of the system subpartition and /system/user/C2.XXX: 045036-045040 in the COW file map, the Data at addresses 045036 to 045040 are written to addresses 024036 to 024040.
在此之后升级进程删除用户数据分区(Userdata)中的COW文件,将存储空间归还给用户数据分区(Userdata);并且,将基础分区(Common)的元数据(/metadata)中的落盘状态信息由“未落盘(wait for merge)”改为“已落盘(merged)”。After that, the upgrade process deletes the COW file in the user data partition (Userdata), returns the storage space to the user data partition (Userdata); Changed from "wait for merge" to "merged".
在S420中,静态分区升级的数据操作是针对静态分区(B)中的操作系统数据的,其并不会影响到当前启动的静态分区(A)的操作系统数据;并且,在S430中,动态分区升级的数据操作是在用户数据分区(Userdata)中所创建的虚拟动态分区上完成的,其并不会影响到当前挂载的动态分区(Super)。因此,在整个操作系统升级的过程中,用户可以正常使用设备;并且,在S431完成后,设备并不需要立即重启,可以由用户自行选择重启时机;这样,操作系统的升级过程并不会对用户的正常手机操作产生影响,从而大大提高了用户体验。进一步的,针对动态分区(Super),仅在需要进行升级时才会在用户数据分区(Userdata)上创建虚拟动态分区,因此有效提高了数据存储空间利用率。In S420, the data operation of the static partition upgrade is aimed at the operating system data in the static partition (B), and it will not affect the operating system data of the currently started static partition (A); and, in S430, the dynamic The data operation of partition upgrade is completed on the virtual dynamic partition created in the user data partition (Userdata), which will not affect the currently mounted dynamic partition (Super). Therefore, during the whole process of upgrading the operating system, the user can use the device normally; and, after the completion of S431, the device does not need to be restarted immediately, and the user can choose the restarting time; in this way, the upgrading process of the operating system will not affect the The user's normal mobile phone operation is affected, thereby greatly improving the user experience. Further, for the dynamic partition (Super), a virtual dynamic partition will be created on the user data partition (Userdata) only when an upgrade is required, thus effectively improving the utilization rate of data storage space.
基于图4所示的系统升级流程,系统版本升级后,静态分区(A)与静态分区(B)的数据间存在系统版本差异。例如,假设静态分区(A)对应版本1.1的操作系统,设备从静态分区(A)启动运行版本1.1的操作系统;当操作系统升级到1.2时,按照图2所示流程,是静态分区(B)升级到版本1.2的操作系统,设备重启后从静态分区(B)启动运行版本1.2的操作系统;此时,设备运行版本1.2的操作系统,静态分区(A)对应版本1.1的操作系统,静态分区(B) 对应版本1.2的操作系统。Based on the system upgrade process shown in Figure 4, after the system version is upgraded, there is a system version difference between the data in the static partition (A) and the static partition (B). For example, assume that the static partition (A) corresponds to version 1.1 of the operating system, and the device starts the operating system of version 1.1 from the static partition (A); ) is upgraded to version 1.2 operating system, and after the device is restarted, the operating system running version 1.2 is started from the static partition (B); at this time, the device is running version 1.2 operating system, and the static partition (A) corresponds to the version Partition (B) corresponds to version 1.2 of the operating system.
一般的,操作系统从一个版本升级到另一个版本,操作系统的数据并不会做整体改动,而是仅改动其中的某一部分数据。也就是说,操作系统从一个版本升级到另一个版本时,静态分区中的数据可能不做修改,即,版本1.1的操作系统中静态分区中的数据,与版本1.2的操作系统中静态分区中的数据,可能是相同的。或者,操作系统从一个版本升级到另一个版本时,静态分区中的数据可能只修改一部分,即,版本1.1的操作系统中静态分区中的部分数据,与版本1.2的操作系统中静态分区中的部分数据,可能是相同的。Generally, when the operating system is upgraded from one version to another, the data of the operating system will not be changed as a whole, but only a certain part of the data will be changed. That is to say, when the operating system is upgraded from one version to another, the data in the static partition may not be modified, that is, the data in the static partition in the version 1.1 operating system is different from the data in the static partition in the version 1.2 operating system. data, may be the same. Or, when the operating system is upgraded from one version to another, only part of the data in the static partition may be modified, that is, part of the data in the static partition in the version 1.1 operating system is different from the Some data may be the same.
在图1所示的系统存储结构中,静态分区(A)与静态分区(B)的分区结构是一致的。那么,当静态分区(A)对应版本1.1的操作系统,静态分区(B)对应版本1.2的操作系统时,可能存在静态分区(A)中的一个或多个子分区,与静态分区(B)中对应的一个或多个子分区数据相同的情况。此时,在静态分区(A)与静态分区(B)之间,就存在一个或多各子分区可以相互替代的情况。In the system storage structure shown in FIG. 1 , the partition structures of the static partition (A) and the static partition (B) are consistent. Then, when the static partition (A) corresponds to the version 1.1 operating system, and the static partition (B) corresponds to the version 1.2 operating system, there may be one or more sub-partitions in the static partition (A), which are different from those in the static partition (B). The corresponding one or more sub-partitions have the same data. At this time, between the static partition (A) and the static partition (B), there is a situation that one or more sub-partitions can replace each other.
进一步的,由于在图1所示的系统存储结构中,静态分区(A)与静态分区(B)的分区结构一致;静态分区(A)与静态分区(B)的相对应的子分区在设备启动过程中所实现的功能是一致的。因此,即使由于操作系统升级导致静态分区(A)与静态分区(B)的相对应的子分区间数据并不一致,但是,在数据改动并没有造成功能变化时,在加载子分区时所实现的功能是相似的,因此,子分区间可以近似地相互替代。Further, because in the system storage structure shown in Figure 1, the partition structure of static partition (A) and static partition (B) is consistent; the corresponding sub-partition of static partition (A) and static partition (B) is in the device The functions implemented during startup are the same. Therefore, even if the data between the corresponding subpartitions of the static partition (A) and the static partition (B) are not consistent due to the upgrade of the operating system, when the data change does not cause a change in function, the data achieved when loading the subpartition The functionality is similar, therefore, the sub-partitions can be approximately substituted for each other.
因此,在一应用场景中,设备初始从静态分区(A)启动,之后设备基于图4所示流程升级操作系统,升级静态分区(B)的数据并从静态分区(B)启动。Therefore, in an application scenario, the device initially starts from the static partition (A), and then the device upgrades the operating system based on the process shown in Figure 4, upgrades the data of the static partition (B) and starts from the static partition (B).
在这之后,在设备被使用一段时间后(在此期间,设备保持从静态分区(B)启动),如果静态分区(B)被损坏,静态分区(B)中的一个或多个子分区存在数据错误,此时,依然可以参照图2所示实施例,在从静态分区(B)启动设备的过程中,通过加载静态分区(A)中的一个或多个子分区来实现设备的顺利启动,从而提高设备启动成功率。After that, after the device has been used for a period of time (during which the device keeps booting from the static partition (B)), if the static partition (B) is damaged, one or more subpartitions in the static partition (B) have data Error, at this time, still refer to the embodiment shown in Figure 2, in the process of starting the device from the static partition (B), by loading one or more sub-partitions in the static partition (A) to achieve smooth startup of the device, thus Improve the success rate of device startup.
进一步的,为了进一步提高设备启动成功率,在一应用场景中,设备初始从静态分区(A)启动,之后设备基于图4所示流程升级操作系统,升级静态分区(B)的数据并从静态分区(B),接下来(在S451之后)设备将静态分区(B)的数据同步到静态分区(A),从而确保静态分区(A)与静态分区(B)中相互对应的子分区间数据一致,使得相互对应的子分区可以互相替代。此时,静态分区(B)与静态分区(A)中的数据均可支撑顺利启动设备。Furthermore, in order to further improve the success rate of device startup, in an application scenario, the device initially starts from the static partition (A), and then the device upgrades the operating system based on the process shown in Figure 4, upgrades the data of the static partition (B) and starts from the static Partition (B), and then (after S451) the device will synchronize the data of the static partition (B) to the static partition (A), thus ensuring the data between the static partition (A) and the corresponding sub-partitions in the static partition (B) Consistent, so that sub-partitions corresponding to each other can replace each other. At this time, the data in the static partition (B) and the static partition (A) can support the smooth startup of the device.
在这之后,在设备被使用一段时间后(在此期间,设备保持从静态分区(B)启动),如果静态分区(B)被损坏,静态分区(B)中的一个或多个子分区存在数据错误。在从静态分区(B)启动设备的过程中,可以参照图2所示实施例,通过加载静态分区(A)中的一个或多个子分区来实现设备的顺利启动,从而提高设备启动成功率。After that, after the device has been used for a period of time (during which the device keeps booting from the static partition (B)), if the static partition (B) is damaged, one or more subpartitions in the static partition (B) have data mistake. In the process of starting the device from the static partition (B), referring to the embodiment shown in FIG. 2, the device can be started smoothly by loading one or more sub-partitions in the static partition (A), thereby improving the success rate of device startup.
进一步的,本申请对静态分区(B)的数据同步到静态分区(A)的具体实现方式不做具体限制,本领域的技术人员可以采用多种可行的实现方式实现数据同步。以下通过具体实施例举例说明静态分区(B)的数据同步到静态分区(A)的具体实现流程。Further, the present application does not specifically limit the specific implementation manner of synchronizing the data of the static partition (B) to the static partition (A), and those skilled in the art may implement data synchronization in various feasible implementation manners. The specific implementation process of synchronizing the data of the static partition (B) to the static partition (A) is illustrated below through specific embodiments.
在S420中,设备将操作系统升级安装包中的静态分区的数据写入到静态分区(B)。因此,如果使用同样的操作系统升级安装包,将操作系统升级安装包中的静态分区的数据写入到静态分区(A)中,就会使得静态分区(A)中的数据与静态分区(B)中的数据一致。In S420, the device writes the data of the static partition in the operating system upgrade installation package to the static partition (B). Therefore, if the same operating system is used to upgrade the installation package, and the data of the static partition in the operating system upgrade installation package is written into the static partition (A), the data in the static partition (A) will be different from the data in the static partition (B). ) are consistent with the data.
因此,在一实施例中,静态分区(B)的数据同步到静态分区(A)包括:获取从用户数据分区(Userdata)中读取S410中所保存的操作系统升级安装包,将操作系统升级安装包中的静态分区的数据写入到静态分区(A)中。Therefore, in one embodiment, synchronizing the data of the static partition (B) to the static partition (A) includes: obtaining and reading the operating system upgrade installation package stored in S410 from the user data partition (Userdata), and upgrading the operating system The data of the static partition in the installation package is written to the static partition (A).
进一步的,静态分区(A)与静态分区(B)在分区结构以及分区大小上是完全一致的。因此,可以直接将静态分区(A)的数据镜像到静态分区(B),或者,将静态分区(B)的数据镜像到静态分区(A)。Further, the static partition (A) and the static partition (B) are completely consistent in partition structure and partition size. Therefore, the data of the static partition (A) can be directly mirrored to the static partition (B), or the data of the static partition (B) can be mirrored to the static partition (A).
图5所示为静态分区同步的一种实现方式的流程图。终端设备执行如图4所示的下述流程以实现静态分区(B)的数据同步到静态分区(A)。FIG. 5 is a flowchart of an implementation manner of static partition synchronization. The terminal device executes the following process as shown in FIG. 4 to synchronize the data of the static partition (B) to the static partition (A).
S500,将静态分区(B)中的所有数据读出,打包压缩后制作为镜像文件B;S500 reads out all the data in the static partition (B), packs and compresses it and makes it a mirror image file B;
S510,将镜像文件B解包后恢复到静态分区(A),从而实现将静态分区(B)的数据覆写到静态分区(A)。S510, recover the image file B to the static partition (A) after unpacking, so as to realize overwriting the data of the static partition (B) to the static partition (A).
进一步的,静态分区(A)与静态分区(B)在分区结构上是一致的,其包含相同的子分区。因此,将静态分区(B)中每个子分区的文件覆写到静态分区(A)中对应子分区中,就可以实现将静态分区(B)中的数据同步到静态分区(A)。Further, the static partition (A) and the static partition (B) are consistent in partition structure, and include the same sub-partitions. Therefore, by overwriting the files of each sub-partition in the static partition (B) to the corresponding sub-partition in the static partition (A), the data in the static partition (B) can be synchronized to the static partition (A).
图6所示为静态分区同步的一种实现方式的流程图。终端设备执行如图6所示的下述流程以实现静态分区(B)的数据同步到静态分区(A)。FIG. 6 is a flowchart of an implementation manner of static partition synchronization. The terminal device executes the following process as shown in FIG. 6 to synchronize the data of the static partition (B) to the static partition (A).
S600,读取设备存储器上与分区表相关的参数(该参数在设备出厂时预存在设备中),合成存储器的总分区表。S600. Read the parameters related to the partition table on the device memory (the parameters are pre-stored in the device when the device leaves the factory), and synthesize the total partition table of the memory.
例如,以采用主引导记录(Master Boot Record,MBR)格式的通用闪存(Universal Flash Storage,UFS)。从UFS的MBR(主引导扇区,UFS的第一个扇区,即C/H/S地址的0柱面0磁头1扇区)中读取UFS上各个分区的大小及位置信息,获取分区表(Dpt)。For example, take Universal Flash Storage (UFS) in Master Boot Record (MBR) format. Read the size and location information of each partition on UFS from the MBR of UFS (master boot sector, the first sector of UFS, that is, 0 cylinder 0 head 1 sector of C/H/S address), and obtain the partition Table (Dpt).
S610,从总分区表中读取后缀名为_b的所有静态子分区,生成用于描述静态分区(B)各个子分区的列表1,列表1包括静态分区(B)中各个子分区的名称以及地址。例如:S610, read all static subpartitions with the suffix name _b from the total partition table, and generate a list 1 for describing each subpartition of the static partition (B), and list 1 includes the names of each subpartition in the static partition (B) and address. E.g:
表1Table 1
S620,从总分区表中读取后缀名为_a的所有静态子分区,生成用于描述静态分区(A)各个子分区的列表2,列表2包括静态分区(A)中各个子分区的名称以及地址。例如:S620, read all static subpartitions with the suffix name _a from the total partition table, and generate a list 2 for describing each subpartition of the static partition (A), and list 2 includes the names of each subpartition in the static partition (A) and address. E.g:
表2Table 2
这里需要说明的是,在表1以及表2中,以文件路径的方式指代该子分区的地址,在实际应用场景中,本领域的技术人员可以使用多种不同的方式描述子分区的地址。例如,采用线性地址描述。What needs to be explained here is that in Table 1 and Table 2, the address of the sub-partition is referred to in the form of a file path. In actual application scenarios, those skilled in the art can describe the address of the sub-partition in a variety of different ways . For example, a linear address description is used.
S630,在列表1中选定一个未被选定过的子分区(第一子分区),获取该子分区的名称(第一子分区名称)以及地址(第一文件路径)。S630, select an unselected sub-partition (first sub-partition) in list 1, and acquire the name (first sub-partition name) and address (first file path) of the sub-partition.
具体的,在S630之前,列表1中的子分区均未被选定。在S630中,可以按照列表1中子分区的排列顺序(编号顺序)依次选定子分区,也可以从所有未被选定过的子分区中随机选定。Specifically, before S630, none of the sub-partitions in List 1 is selected. In S630, the sub-partitions may be sequentially selected according to the arrangement order (numbering order) of the sub-partitions in List 1, or may be randomly selected from all unselected sub-partitions.
进一步的,在选定一个子分区后,标记该子分区以便在后续确认该子分区是否被选定过。例如,如表1所示,在表1中增加被选定状态列,被选定状态的初始值为0,如子分区被选定,则被选定状态修改为1。Further, after a sub-partition is selected, the sub-partition is marked so as to confirm whether the sub-partition has been selected subsequently. For example, as shown in Table 1, the selected state column is added in Table 1, and the initial value of the selected state is 0, and if the sub-partition is selected, the selected state is changed to 1.
S640,将S630中选定的子分区与列表2中的各个子分区做去后缀匹配;确定列表2中,去掉后缀后,与S630中选定的子分区名称一致的子分区(第二子分区名称)以及在列表2中,该第二子分区名称对应的子分区地址(第二文件路 径);S640, performing desuffix matching on the sub-divisions selected in S630 and each sub-division in list 2; in determining list 2, after removing the suffix, the sub-division (the second sub-division) consistent with the sub-division name selected in S630 name) and in list 2, the sub-division address (second file path) corresponding to the second sub-division name;
S641,读取第一文件路径下的数据;S641, read the data under the first file path;
S642,将读取到的数据覆写到第二文件路径下。S642. Overwrite the read data to the second file path.
S650,判断列表1中是否还存在未被选定过的子分区;S650, judging whether there are unselected sub-partitions in the list 1;
如果存在,返回步骤S630,重新选定第一子分区;If it exists, return to step S630, and reselect the first sub-region;
如果不存在,静态分区同步结束。If it does not exist, the static partition synchronization ends.
以表1以及表2为例,在一应用场景中,设备执行下述流程:Taking Table 1 and Table 2 as examples, in an application scenario, the device performs the following process:
选定表1中被选定状态为0的第一个子分区(编号1的bootloader_b子分区),将编号1的被选定状态修改为1;Select the first subpartition (bootloader_b subpartition number 1) whose selected state is 0 in table 1, and modify the selected state of number 1 to 1;
使用bootloader_b在表2中的所有子分区名称中做去后缀匹配,bootloader_a与bootloader_b在分别去掉_a以及_b后一致,因此,根据bootloader_b匹配到bootloader_a;Use bootloader_b to perform suffix matching in all sub-partition names in Table 2. Bootloader_a and bootloader_b are consistent after removing _a and _b respectively. Therefore, bootloader_a is matched according to bootloader_b;
从表1中读取到bootloader_b对应的文件路径/dev/block/by-name/bootloader_b;Read the file path /dev/block/by-name/bootloader_b corresponding to bootloader_b from Table 1;
从表2中读取到bootloader_a对应的文件路径/dev/block/by-name/bootloader_a;Read the file path /dev/block/by-name/bootloader_a corresponding to bootloader_a from Table 2;
读取/dev/block/by-name/bootloader_b下的数据,将读取到的数据覆写到/dev/block/by-name/bootloader_a;Read the data under /dev/block/by-name/bootloader_b, and overwrite the read data to /dev/block/by-name/bootloader_a;
表1中仍存在被选定状态为0的子分区,选定表1中被选定状态为0的第一个子分区(编号2的boot_b子分区),将编号2的被选定状态修改为1;There is still a selected subpartition in table 1 whose state is 0, select the first subpartition in table 1 whose selected state is 0 (boot_b subpartition number 2), and modify the selected state of number 2 is 1;
使用boot_b在表2中的所有子分区名称中做去后缀匹配,boot_a与boot_b在分别去掉_a以及_b后一致,因此,根据boot_b匹配到boot_a;Use boot_b to perform suffix matching in all sub-partition names in Table 2. Boot_a and boot_b are consistent after removing _a and _b respectively. Therefore, boot_a is matched according to boot_b;
从表1中读取到boot_b对应的文件路径/dev/block/by-name/boot_b;Read the file path /dev/block/by-name/boot_b corresponding to boot_b from Table 1;
从表2中读取到boot_a对应的文件路径/dev/block/by-name/boot_a;Read the file path /dev/block/by-name/boot_a corresponding to boot_a from Table 2;
读取/dev/block/by-name/boot_b下的数据,将读取到的数据覆写到/dev/block/by-name/boot_a;Read the data under /dev/block/by-name/boot_b, and overwrite the read data to /dev/block/by-name/boot_a;
表1中仍存在被选定状态为0的子分区,选定表1中被选定状态为0的第一个子分区(编号3的vendor_boot_b子分区),将编号3的被选定状态修改为1;There are still subpartitions whose selected status is 0 in Table 1, select the first subpartition (vendor_boot_b subpartition number 3) in Table 1 whose selected status is 0, and modify the selected status of No. 3 is 1;
使用vendor_boot_b在表2中的所有子分区名称中做去后缀匹配,vendor_boot_a与vendor_boot_b在分别去掉_a以及_b后一致,因此,根据vendor_boot_b匹配到vendor_boot_a;Use vendor_boot_b to perform suffix matching in all sub-partition names in Table 2. Vendor_boot_a and vendor_boot_b are consistent after removing _a and _b respectively. Therefore, vendor_boot_a is matched according to vendor_boot_b;
从表1中读取到vendor_boot_b对应的文件路径/dev/block/by-name/vendor_boot_b;Read the file path /dev/block/by-name/vendor_boot_b corresponding to vendor_boot_b from Table 1;
从表2中读取到vendor_boot_a对应的文件路径/dev/block/by-name/vendor_boot_a;Read the file path /dev/block/by-name/vendor_boot_a corresponding to vendor_boot_a from Table 2;
读取/dev/block/by-name/vendor_boot_b下的数据,将读取到的数据覆写到/dev/block/by-name/vendor_boot_a;Read the data under /dev/block/by-name/vendor_boot_b, and overwrite the read data to /dev/block/by-name/vendor_boot_a;
表1中仍存在被选定状态为0的子分区,选定表1中被选定状态为0的第一 个子分区(编号4的dtbo_b子分区),将编号4的被选定状态修改为1;There are still subpartitions whose selected state is 0 in table 1, select the first subpartition (dtbo_b subpartition number 4) whose selected state is 0 in table 1, and modify the selected state of number 4 is 1;
使用dtbo_b在表2中的所有子分区名称中做去后缀匹配,dtbo_a与dtbo_b在分别去掉_a以及_b后一致,因此,根据dtbo_b匹配到dtbo_a;Use dtbo_b to perform suffix matching in all sub-partition names in Table 2. dtbo_a and dtbo_b are consistent after removing _a and _b respectively. Therefore, dtbo_a is matched according to dtbo_b;
从表1中读取到dtbo_b对应的文件路径/dev/block/by-name/dtbo_b;Read the file path /dev/block/by-name/dtbo_b corresponding to dtbo_b from Table 1;
从表2中读取到vendor_boot_a对应的文件路径/dev/block/by-name/dtbo_a;Read the file path /dev/block/by-name/dtbo_a corresponding to vendor_boot_a from Table 2;
读取/dev/block/by-name/dtbo_b下的数据,将读取到的数据覆写到/dev/block/by-name/dtbo_a;Read the data under /dev/block/by-name/dtbo_b, and overwrite the read data to /dev/block/by-name/dtbo_a;
表1中仍存在被选定状态为0的子分区,选定表1中被选定状态为0的第一个子分区(编号5的vbmeta_b子分区),将编号5的被选定状态修改为1;There are still subpartitions whose selected status is 0 in Table 1, select the first subpartition (vbmeta_b subpartition number 5) whose selected status is 0 in Table 1, and modify the selected status of No. 5 is 1;
使用vbmeta_b在表2中的所有子分区名称中做去后缀匹配,vbmeta_a与vbmeta_b在分别去掉_a以及_b后一致,因此,根据vbmeta_b匹配到vbmeta_a;Use vbmeta_b to perform suffix matching in all sub-partition names in Table 2. vbmeta_a and vbmeta_b are consistent after removing _a and _b respectively. Therefore, vbmeta_a is matched according to vbmeta_b;
从表1中读取到vbmeta_b对应的文件路径/dev/block/by-name/vbmeta_b;Read the file path /dev/block/by-name/vbmeta_b corresponding to vbmeta_b from Table 1;
从表2中读取到vendor_boot_a对应的文件路径/dev/block/by-name/vbmeta_a;Read the file path /dev/block/by-name/vbmeta_a corresponding to vendor_boot_a from Table 2;
读取/dev/block/by-name/vbmeta_b下的数据,将读取到的数据覆写到/dev/block/by-name/vbmeta_a;Read the data under /dev/block/by-name/vbmeta_b, and overwrite the read data to /dev/block/by-name/vbmeta_a;
表1中不存在被选定状态为0的子分区,静态分区同步完成。There is no selected sub-partition in Table 1 whose state is 0, and the synchronization of the static partition is completed.
进一步的,在上述方案中,表1以及表2为过渡数据,在静态分区同步完成后删除表1以及表2。Further, in the above solution, Table 1 and Table 2 are transitional data, and Table 1 and Table 2 are deleted after the static partition synchronization is completed.
进一步的,在操作系统升级的过程中,在S420,根据操作系统升级安装包针对静态分区(B)部分的数据进行读写操作时,并不一定会对静态分区(B)中所有的子分区进行改写。即,如果操作系统升级前静态分区(A)与静态分区(B)中的数据完全一致,那么,在采用图5所示流程升级操作系统后,静态分区(A)与静态分区(B)中某些子分区的数据有可能仍然保持一致。因此,在将静态分区(B)的数据同步到静态分区(A)的过程中,如果首先识别静态分区(B)与静态分区(A)数据不一致的子分区,仅同步数据不一致的子分区,就可以在实现数据一致的基础上,大大降低数据读写量。Further, in the process of upgrading the operating system, when the S420 reads and writes the data of the static partition (B) according to the operating system upgrade installation package, it does not necessarily perform all sub-partitions in the static partition (B) to rewrite. That is, if the data in the static partition (A) and the static partition (B) are completely consistent before the operating system is upgraded, then, after the operating system is upgraded using the process shown in Figure 5, the data in the static partition (A) and the static partition (B) It is possible that data for some subpartitions may still be consistent. Therefore, in the process of synchronizing the data of the static partition (B) to the static partition (A), if the sub-partitions with inconsistent data between the static partition (B) and the static partition (A) are identified first, only the sub-partitions with inconsistent data are synchronized, On the basis of achieving data consistency, the amount of data read and write can be greatly reduced.
图7所示为静态分区同步的一种实现方式的流程图。终端设备执行如图7所示的下述流程以实现静态分区(B)的数据同步到静态分区(A)。FIG. 7 is a flowchart of an implementation manner of static partition synchronization. The terminal device executes the following process as shown in FIG. 7 to synchronize the data of the static partition (B) to the static partition (A).
S710~S740,参照S610~S640。For S710-S740, refer to S610-S640.
S741,对第一路径下的数据做哈希计算,获得第一哈希值;S741. Perform hash calculation on the data under the first path to obtain a first hash value;
S742,对第二子路径下的数据做哈希计算,获得第二哈希值;S742. Perform hash calculation on the data under the second subpath to obtain a second hash value;
S743,验证第一哈希值与第二哈希值是否一致;S743. Verify whether the first hash value is consistent with the second hash value;
如果一致,跳转到S750;If consistent, jump to S750;
如果不一致,S745,读取第一路径下的数据;If inconsistent, S745, read the data under the first path;
S746,将读取到的数据覆写到第二路径下。S746. Overwrite the read data to the second path.
S750,参照S750;S750, refer to S750;
如果存在,返回步骤S730,重新选定第一子分区;If it exists, return to step S730, and reselect the first sub-region;
如果不存在,静态分区同步结束。If it does not exist, the static partition synchronization ends.
进一步的,在本申请的方案中,静态分区(A)与静态分区(B)间进行数据同步的执行节点为静态分区(A)与静态分区(B)中任意一个被写入升级数据后。Further, in the solution of the present application, the execution node for data synchronization between the static partition (A) and the static partition (B) is after any one of the static partition (A) and the static partition (B) is written with upgraded data.
具体的,在S420之后,静态分区(B)中被写入升级数据,但是,由于此时操作系统运行加载静态分区(A),此时,静态分区(B)的数据无法同步到静态分区(A)。而在S431后,在S440执行过程中,设备加载静态分区(B)以运行操作系统,操作系统的运行无需加载静态分区(A),此时静态分区(B)的数据可以同步到静态分区(A)。因此,在本申请的实施例中,可以在S431之后的任意时刻执行静态分区同步。本申请对静态分区(B)的数据同步到静态分区(A)的执行时序不做具体限制,本领域的技术人员可以根据实际需求设定静态分区的同步时刻或者触发静态分区同步的触发条件。以下通过具体实施例举例描述静态分区(B)的数据同步到静态分区(A)的执行时序。Specifically, after S420, the upgrade data is written in the static partition (B), but since the operating system is running and loading the static partition (A), at this time, the data of the static partition (B) cannot be synchronized to the static partition ( A). After S431, during the execution of S440, the device loads the static partition (B) to run the operating system. The operation of the operating system does not need to load the static partition (A). At this time, the data of the static partition (B) can be synchronized to the static partition ( A). Therefore, in the embodiment of the present application, static partition synchronization can be performed at any time after S431. This application does not specifically limit the execution timing of data synchronization from the static partition (B) to the static partition (A). Those skilled in the art can set the synchronization time of the static partition or the trigger condition for triggering the synchronization of the static partition according to actual needs. The execution timing of synchronizing the data of the static partition (B) to the static partition (A) is described below by way of specific embodiments.
图8所示为根据本申请一实施例的操作系统升级的流程图,当设备当前是从静态分区(A)启动时,设备按照如图8所示的流程实现操作系统的升级以及静态分区的同步。Fig. 8 is a flow chart showing an operating system upgrade according to an embodiment of the present application. When the device is currently started from the static partition (A), the device implements the upgrade of the operating system and the static partition according to the flow shown in Fig. 8 Synchronize.
S800~S832,参照S400~S432;S800~S832, refer to S400~S432;
S840,设备加载基础分区(Common);S840, the device loads the basic partition (Common);
S850,设备加载静态分区(B);S850, the device loads a static partition (B);
S851,判断静态分区(B)是否加载成功;S851, judging whether the static partition (B) is loaded successfully;
如静态分区(B)加载失败,S852,重启设备并从静态分区(A)启动;If the static partition (B) fails to load, S852, restart the device and start from the static partition (A);
如静态分区(B)加载成功,S853,将静态分区(B)的数据同步到静态分区(A)。If the static partition (B) is loaded successfully, S853, synchronize the data of the static partition (B) to the static partition (A).
S860,加载动态分区(Super)+虚拟动态分区;参照S441。S860, load dynamic partition (Super)+virtual dynamic partition; refer to S441.
S870,设备成功启动,进入用户交互界面;参照S450。S870, the device starts successfully, and enters the user interaction interface; refer to S450.
S871,设备将虚拟动态分区的数据落盘到动态分区(Super);参照S451。S871. The device puts the data of the virtual dynamic partition to the dynamic partition (Super); refer to S451.
进一步的,在虚拟A/B升级方案中,在设备重启并从升级后的静态分区启动后,设备会对动态分区+虚拟动态分区中当前系统运行所需要加载的文件进行验证,验证成功后才会加载动态分区+虚拟动态分区中当前系统运行所需要加载的文件。验证失败则会重启并回滚系统,此时系统升级失败。Further, in the virtual A/B upgrade solution, after the device is restarted and started from the upgraded static partition, the device will verify the files that need to be loaded for the current system operation in the dynamic partition + virtual dynamic partition, and only after the verification is successful Files that need to be loaded for the current system operation in the dynamic partition + virtual dynamic partition will be loaded. If the verification fails, the system will be restarted and rolled back, and the system upgrade will fail at this time.
因此,为避免在升级失败下进行静态分区同步,在本申请一实施例中,在动态分区+虚拟动态分区所需要加载的文件被成功验证,或者,动态分区+虚拟动态分区所需要加载的文件被成功加载后,才进行静态分区的同步。Therefore, in order to avoid synchronization of static partitions when the upgrade fails, in one embodiment of the present application, the files that need to be loaded in the dynamic partition + virtual dynamic partition are successfully verified, or the files that need to be loaded in the dynamic partition + virtual dynamic partition After being successfully loaded, the synchronization of the static partition is performed.
图9所示为根据本申请一实施例的操作系统升级的流程图,当设备当前是从静态分区(A)启动时,设备按照如图9所示的流程实现操作系统的升级以及静 态分区的同步。Fig. 9 shows a flow chart of operating system upgrade according to an embodiment of the present application. When the device is currently started from the static partition (A), the device implements the upgrade of the operating system and the static partition according to the flow shown in Fig. 9 Synchronize.
S900~S952,参照S800~S852;S900~S952, refer to S800~S852;
如果静态分区(B)加载成功,S953,对动态分区+虚拟动态分区中需要加载的文件进行校验;例如,使用dmverity。If the static partition (B) is loaded successfully, S953, verify the files to be loaded in the dynamic partition+virtual dynamic partition; for example, use dmverity.
S954,判断校验是否成功。S954, judging whether the verification is successful.
如校验失败,S960,重启设备并回滚系统,例如,从静态分区(A)启动。If the verification fails, S960, restart the device and roll back the system, for example, start from the static partition (A).
如校验成功,执行S955;If the verification is successful, execute S955;
S955,将静态分区(B)的数据同步到静态分区(A);S955, synchronizing the data of the static partition (B) to the static partition (A);
S956~S958,参照S860~S871。For S956-S958, refer to S860-S871.
进一步的,在一应用场景中,设备初始从静态分区(B)启动,如果静态分区(B)被损坏,静态分区(B)中的一个或多个子分区存在数据错误。此时,设备虽然可以参照图2所示实施例,在从静态分区(B)启动设备的过程中,通过加载静态分区(A)中的一个或多个子分区来实现设备的顺利启动。但是,在设备启动过程中并未对静态分区(B)中的错误数据进行修复,设备再次从静态分区(B)时,依然需要参照图2所示实施例,通过加载静态分区(A)中的一个或多个子分区来实现设备的顺利启动。Further, in an application scenario, the device initially starts from the static partition (B), if the static partition (B) is damaged, one or more sub-partitions in the static partition (B) have data errors. At this time, although the device can refer to the embodiment shown in FIG. 2, in the process of starting the device from the static partition (B), the smooth startup of the device can be realized by loading one or more sub-partitions in the static partition (A). However, the error data in the static partition (B) is not repaired during the device startup process. When the device starts from the static partition (B) again, it still needs to refer to the embodiment shown in FIG. 2, by loading the static partition (A) One or more subpartitions of the device to achieve smooth booting of the device.
因此,在本申请一实施例中,在静态分区被升级后,将数据升级的静态分区的数据同步到另一个静态分区,以确保两个静态分区的数据一致。Therefore, in an embodiment of the present application, after the static partition is upgraded, the data of the static partition whose data is upgraded is synchronized to another static partition, so as to ensure that the data of the two static partitions are consistent.
在此之后,如果用于启动设备的静态分区出现数据错误,在设备从该静态分区启动的过程中,参照图2所示实施例,加载另一静态分区中的数据以顺利启动设备。在设备顺利启动后,修改设备的启动顺序,以使得设备下次启动时从不存在数据错误的静态分区启动。After that, if there is a data error in the static partition used to start the device, during the process of starting the device from the static partition, referring to the embodiment shown in FIG. 2 , load the data in another static partition to start the device smoothly. After the device starts up successfully, modify the startup sequence of the device so that the next time the device starts up from the static partition that does not have data errors.
例如,图10所示为针对图1所示系统数据存储结构启动设备的流程图。假设设备初始从静态分区(A)启动,基于图4所示流程进行操作系统升级,静态分区(B)的数据被升级,重启设备后设备从静态分区(B)启动。之后,将静态分区(B)的数据同步到静态分区(A),以确保两个静态分区的数据一致。For example, FIG. 10 shows a flowchart for starting a device for the system data storage structure shown in FIG. 1 . Assuming that the device initially starts from the static partition (A), the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is updated, and the device starts from the static partition (B) after restarting the device. Afterwards, the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
在此之后,设备按照如图10所示的流程从静态分区(B)启动。After that, the device boots from the static partition (B) according to the flow shown in Figure 10.
S1000~S1070,参照S200~S270,区别在于,在S1014、S1024、S1034、S1044、S1054中除了加载子分区数据之外,还需要标记静态分区(B)存在数据错误。S1000-S1070, refer to S200-S270, the difference is that in S1014, S1024, S1034, S1044, S1054, in addition to loading the sub-partition data, it is also necessary to mark the data error in the static partition (B).
例如,在基础分区(Common)的元数据中保存有静态分区状态信息,静态分区状态信息用于描述静态分区(A)以及静态分区(B)是否存在数据错误。例如,静态分区状态信息可以为下表所示:For example, static partition state information is stored in the metadata of the basic partition (Common), and the static partition state information is used to describe the static partition (A) and whether there is a data error in the static partition (B). For example, static partition status information can be as shown in the following table:
在表3中,Error_static partition_a对应静态分区(A),Error_static partition_b对应静态分区(B),值0代表无数据错误,值1代表存在数据错误。在S1014、S1024、S1034、S1044、S1054中,除了加载子分区数据之外,还需要将Error_static partition_b的值置为1。In Table 3, Error_static partition_a corresponds to the static partition (A), Error_static partition_b corresponds to the static partition (B), the value 0 means no data error, and the value 1 means there is a data error. In S1014, S1024, S1034, S1044, and S1054, in addition to loading sub-partition data, it is also necessary to set the value of Error_static partition_b to 1.
在S1070之后,设备还需要执行:After S1070, the device also needs to perform:
S1071,读取静态分区状态信息,判断静态分区(B)是否存在数据错误。具体的,设备读取Error_static partition_b的值,判断是否为1。S1071. Read static partition status information, and determine whether there is a data error in the static partition (B). Specifically, the device reads the value of Error_static partition_b to determine whether it is 1.
如果静态分区(B)存在数据错误,执行S1072,设备将当前的启动顺序由从静态分区(B)启动修改为从静态分区(A)启动。这样,设备下次启动时就会从静态分区(A)启动,静态分区(B)中的数据错误就不会干扰到设备启动的执行。If there is a data error in the static partition (B), execute S1072, and the device modifies the current boot sequence from booting from the static partition (B) to booting from the static partition (A). In this way, when the device starts next time, it will start from the static partition (A), and data errors in the static partition (B) will not interfere with the execution of device startup.
进一步的,在实际应用场景中,存在静态分区(B)以及静态分区(A)均存在数据错误的情况。在这种情况下,如果静态分区(B)以及静态分区(A)中无法成功加载的子分区并不对应,那么,参照图2所示实施例,是可以顺利启动设备的。例如,图11所示为根据本申请一实施例的设备启动加载流程示意图。在一应用场景中,静态分区(A)中的vendor_boot_a以及静态分区(B)中的vbmeta_b存在数据错误。设备从静态分区(B)启动,启动流程如图11所示:Further, in an actual application scenario, there are situations where data errors exist in both the static partition (B) and the static partition (A). In this case, if the static partition (B) does not correspond to the sub-partition that cannot be successfully loaded in the static partition (A), then, referring to the embodiment shown in FIG. 2 , the device can be started smoothly. For example, FIG. 11 is a schematic diagram of a device startup and loading process according to an embodiment of the present application. In an application scenario, vendor_boot_a in the static partition (A) and vbmeta_b in the static partition (B) have data errors. The device starts from the static partition (B), and the startup process is shown in Figure 11:
加载基础分区(Common);Load the basic partition (Common);
校验bootloader_b子分区(成功),加载bootloader_b子分区;Verify bootloader_b subpartition (success), load bootloader_b subpartition;
校验boot_b子分区(成功),加载boot_b子分区;Verify the boot_b subpartition (successful), load the boot_b subpartition;
校验vendor_boot_b子分区(成功),加载vendor_boot_b子分区;Verify vendor_boot_b subpartition (successful), load vendor_boot_b subpartition;
校验dtbo_b子分区(成功),加载dtbo_b子分区;Verify dtbo_b subpartition (successful), load dtbo_b subpartition;
校验vbmeta_b子分区(失败);Verify vbmeta_b subpartition (failure);
校验vbmeta_a子分区(成功),加载vbmeta_a子分区;Verify vbmeta_a subpartition (successful), load vbmeta_a subpartition;
加载动态分区(Super)。Load dynamic partition (Super).
最终,设备从静态分区(B)启动所加载的操作系统数据为:基础分区(Common)、bootloader_b子分区、boot_b子分区、vendor_boot_b子分区、dtbo_b子分区、vbmeta_a子分区以及动态分区(Super)。设备在从静态分区(B)启动的过程中,需要加载vbmeta_a子分区。Finally, the operating system data loaded by the device from the static partition (B) is: basic partition (Common), bootloader_b subpartition, boot_b subpartition, vendor_boot_b subpartition, dtbo_b subpartition, vbmeta_a subpartition and dynamic partition (Super). When the device starts from the static partition (B), it needs to load the vbmeta_a subpartition.
如果设备从静态分区(B)启动后,将启动顺序修改为从静态分区(A)启动。由于静态分区(A)中的vendor_boot_a存在数据错误,设备在从静态分区(A)启动的过程中仍需要加载静态分区(B)的vendor_boot_b子分区才能顺利启动。这就导致设备会始终不能仅基于一个静态分区顺利启动。If the device starts from the static partition (B), change the boot sequence to start from the static partition (A). Due to data errors in vendor_boot_a in the static partition (A), the device still needs to load the vendor_boot_b sub-partition of the static partition (B) in the process of booting from the static partition (A) to start smoothly. As a result, the device will never be able to boot smoothly based on only one static partition.
针对上述问题,在本申请一实施例中,假设设备初始从静态分区(A)启动,基于图4所示流程进行操作系统升级,静态分区(B)的数据被升级,重启设备 后设备从静态分区(B)启动。之后,将静态分区(B)的数据同步到静态分区(A),以确保两个静态分区的数据一致。In view of the above problems, in one embodiment of the present application, it is assumed that the device is initially started from the static partition (A), and the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is upgraded, and the device is restarted from the static Partition (B) starts. Afterwards, the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
在此之后,设备保持从静态分区(B)启动。如果静态分区(B)出现数据错误,在设备从静态分区(B)启动的过程中,参照图2所示实施例,加载静态分区(A)中的数据以顺利启动设备。在设备顺利启动后,修正静态分区(A)中的数据,并且,将设备的启动顺序由从静态分区(B)启动修改为从静态分区(A)启动,以使得设备下次启动时可以从静态分区(A)独立启动。After this, the device keeps booting from the static partition (B). If there is a data error in the static partition (B), in the process of starting the device from the static partition (B), refer to the embodiment shown in Figure 2 to load the data in the static partition (A) to start the device smoothly. After the device starts up successfully, correct the data in the static partition (A), and change the boot sequence of the device from the static partition (B) to the static partition (A), so that the device can be started from The static partition (A) starts independently.
图12所示为针对图1所示系统数据存储结构启动设备的流程图。在本申请一实施例中,假设设备初始从静态分区(A)启动,基于图4所示流程进行操作系统升级,静态分区(B)的数据被升级,重启设备后设备从静态分区(B)启动。之后,将静态分区(B)的数据同步到静态分区(A),以确保两个静态分区的数据一致。FIG. 12 is a flow chart of starting a device for the system data storage structure shown in FIG. 1 . In an embodiment of the present application, assuming that the device is initially started from the static partition (A), the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is upgraded, and after restarting the device, the device starts from the static partition (B) start up. Afterwards, the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
在此之后,设备按照如图12所示的流程从静态分区(B)启动。After that, the device boots from the static partition (B) according to the flow shown in Figure 12.
S1200~S1270,参照S1000~S1070。For S1200-S1270, refer to S1000-S1070.
在S1270之后,设备还需要执行:After S1270, the device also needs to execute:
S1271,读取静态分区状态信息,判断静态分区(B)是否存在数据错误。具体的,设备读取Error_static partition_b的值,判断是否为1。S1271. Read the status information of the static partition, and determine whether there is a data error in the static partition (B). Specifically, the device reads the value of Error_static partition_b to determine whether it is 1.
如果静态分区(B)存在数据错误,执行:If there is a data error in the static partition (B), execute:
S1272,修正静态分区(A)中的数据;S1272, modifying the data in the static partition (A);
S1273,设备将当前的启动顺序由从静态分区(B)启动修改为从静态分区(A)启动。这样,设备下次启动时就会从静态分区(A)启动,静态分区(B)中的数据错误就不会干扰到设备启动的执行。并且,假设在S1200之前,静态分区(A)也存在数据错误,在S1272中,通过对静态分区(A)进行数据修正,静态分区(A)中不再存在数据错误。这样,在S1273之后,在设备从静态分区(A)启动的过程中,就不需要加载静态分区(B)的数据。S1273. The device modifies the current boot sequence from booting from the static partition (B) to booting from the static partition (A). In this way, when the device starts next time, it will start from the static partition (A), and data errors in the static partition (B) will not interfere with the execution of device startup. Moreover, assuming that before S1200, there is also a data error in the static partition (A), in S1272, by performing data correction on the static partition (A), there is no data error in the static partition (A). In this way, after S1273, during the process of booting the device from the static partition (A), there is no need to load the data of the static partition (B).
进一步的,本申请对S1272的具体实现方式不做具体限制,本领域的技术人员可以采用多种可行的实现S1272。以下通过具体实施例举例说明S1272的具体实现流程。Further, the present application does not specifically limit the specific implementation manner of S1272, and those skilled in the art may adopt multiple feasible implementations of S1272. The specific implementation process of S1272 is illustrated below through specific embodiments.
假设设备初始为从静态分区(A)启动。设备基于图4所示实施例完成操作系统升级并将静态分区(B)数据同步到静态分区(A)。此时设备的启动顺序为从静态分区(B)启动。在此之后,假设设备的静态分区(B)以及静态分区(A)均出现了数据错误,例如,如图11所示,静态分区(A)中的vendor_boot_a以及静态分区(B)中的vbmmeta_b存在数据错误。Assume that the device initially boots from the static partition (A). The device completes the operating system upgrade based on the embodiment shown in FIG. 4 and synchronizes data from the static partition (B) to the static partition (A). At this time, the boot sequence of the device is to boot from the static partition (B). After that, assume that both the static partition (B) and the static partition (A) of the device have data errors. For example, as shown in Figure 11, vendor_boot_a in the static partition (A) and vbmmeta_b in the static partition (B) exist data error.
图13所示为根据本申请一实施例的方案对静态分区(A)进行数据修正的流程图。终端设备执行如图13所示的下述流程以实现S1272。FIG. 13 is a flow chart of data correction for a static partition (A) according to an embodiment of the present application. The terminal device executes the following process as shown in FIG. 13 to implement S1272.
S1300,确定静态分区(B)对应的操作系统版本;S1300, determine the operating system version corresponding to the static partition (B);
S1310,获取静态分区(B)对应的操作系统版本的静态分区安装镜像;S1310, acquiring the static partition installation image of the operating system version corresponding to the static partition (B);
S1300以及S1310的执行可以参照S310。在获取到操作系统全量安装包后,从操作系统全量安装包中提取静态分区安装镜像。For the execution of S1300 and S1310, refer to S310. After obtaining the full operating system installation package, extract the static partition installation image from the full operating system installation package.
S1320,将静态分区安装镜像恢复到静态分区(A)。S1320, restore the installation image of the static partition to the static partition (A).
。.
图14所示为针对图1所示系统数据存储结构启动设备的流程图。假设设备初始从静态分区(A)启动,基于图4所示流程进行操作系统升级,静态分区(B)的数据被升级,重启设备后设备从静态分区(B)启动。之后,将静态分区(B)的数据同步到静态分区(A),以确保两个静态分区的数据一致。FIG. 14 is a flow chart of starting a device for the system data storage structure shown in FIG. 1 . Assuming that the device initially starts from the static partition (A), the operating system is upgraded based on the process shown in Figure 4, the data of the static partition (B) is updated, and the device starts from the static partition (B) after restarting the device. Afterwards, the data of the static partition (B) is synchronized to the static partition (A) to ensure that the data of the two static partitions are consistent.
在此之后,设备按照如图14所示的流程从静态分区(B)启动。After that, the device boots from the static partition (B) according to the flow shown in Figure 14.
S1400~S1470,参照S200~S270,区别在于,在S1414、S1424、S1434、S1444、S1454中除了加载子分区数据之外,还需要标记静态分区(B)的子分区存在数据错误。S1400-S1470, refer to S200-S270, the difference is that in S1414, S1424, S1434, S1444, S1454, in addition to loading the sub-partition data, it is also necessary to mark the sub-partition of the static partition (B) as having data errors.
例如,在基础分区(Common)的元数据中保存有静态分区状态信息,静态分区状态信息用于描述静态分区(A)以及静态分区(B)是否存在数据错误。例如,静态分区状态信息可以为下表所示:For example, static partition state information is stored in the metadata of the basic partition (Common), and the static partition state information is used to describe the static partition (A) and whether there is a data error in the static partition (B). For example, static partition status information can be as shown in the following table:
在表4中,Error_bootloader_a、Error_boot_a、Error_vendor_boot_a、Error_dtbo_a、Error_vbmeta_a分别对应静态分区(A)的bootloader_a子分区、 boot_a子分区、vendor_boot_a子分区、dtbo_a子分区、vbmeta_a子分区;Error_bootloader_b、Error_boot_b、Error_vendor_boot_b、Error_dtbo_b、Error_vbmeta_b分别对应静态分区(B)的bootloader_b子分区、boot_b子分区、vendor_boot_b子分区、dtbo_b子分区、vbmeta_b子分区,值0代表无数据错误,值1代表存在数据错误。在S1414、S1424、S1434、S1444、S1454中,除了加载子分区数据之外,还需要将对应参数的值置为1。在表4中,Error_bootloader_a、Error_boot_a、Error_vendor_boot_a、Error_dtbo_a、Error_vbmeta_a分别对应静态分区(A)的bootloader_a子分区、 boot_a子分区、vendor_boot_a子分区、dtbo_a子分区、vbmeta_a子分区;Error_bootloader_b、Error_boot_b、Error_vendor_boot_b、Error_dtbo_b、 Error_vbmeta_b corresponds to the bootloader_b sub-partition, boot_b sub-partition, vendor_boot_b sub-partition, dtbo_b sub-partition, and vbmeta_b sub-partition of the static partition (B). A value of 0 means that there is no data error, and a value of 1 means that there is a data error. In S1414, S1424, S1434, S1444, and S1454, in addition to loading sub-partition data, it is also necessary to set the value of the corresponding parameter to 1.
在S1470之后,设备还需要执行:After S1470, the device also needs to execute:
S1471,读取静态分区状态信息,判断静态分区(B)是否存在数据错误并确定存在数据错误的子分区。具体的,设备读取Error_bootloader_b、Error_boot_b、Error_vendor_boot_b、Error_dtbo_b、Error_vbmeta_b的值,判断各个值是否为1。S1471. Read the status information of the static partition, judge whether there is a data error in the static partition (B), and determine the sub-partition with the data error. Specifically, the device reads the values of Error_bootloader_b, Error_boot_b, Error_vendor_boot_b, Error_dtbo_b, and Error_vbmeta_b, and determines whether each value is 1.
如果静态分区(B)存在数据错误,执行S1473,设备根据静态分区状态信息进行静态分区数据同步,具体的,将Error_bootloader_b、Error_boot_b、Error_vendor_boot_b、Error_dtbo_b、Error_vbmeta_b中值不为1的项对应的子分区的数据同步到静态分区(A)的对应子分区中。If there is a data error in the static partition (B), execute S1473, and the device performs static partition data synchronization according to the status information of the static partition. The data is synchronized to the corresponding subpartition of the static partition (A).
例如,如图11所示,静态分区(A)中的vendor_boot_a以及静态分区(B)中的vbmeta_b存在数据错误。在S1470之后,静态分区状态信息如下表所示:For example, as shown in FIG. 11 , vendor_boot_a in the static partition (A) and vbmeta_b in the static partition (B) have data errors. After S1470, the static partition status information is shown in the following table:
表5table 5
在S1473中,将bootloader_b子分区、boot_b子分区、vendor_boot_b子分区、dtbo_b子分区的数据分别同步到bootloader_a子分区、boot_a子分区、vendor_boot_a子分区、dtbo_a子分区In S1473, synchronize the data of the bootloader_b subpartition, boot_b subpartition, vendor_boot_b subpartition, and dtbo_b subpartition to the bootloader_a subpartition, boot_a subpartition, vendor_boot_a subpartition, and dtbo_a subpartition respectively
S1474,将当前的启动顺序由从静态分区(B)启动修改为从静态分区(A)启动。S1474. Modify the current boot sequence from booting from the static partition (B) to booting from the static partition (A).
可以理解的是,上述实施例中的部分或全部步骤或操作仅是示例,本申请实施例还可以执行其它操作或者各种操作的变形。此外,各个步骤可以按照上述实施例呈现的不同的顺序来执行,并且有可能并非要执行上述实施例中的全部操作。It can be understood that some or all of the steps or operations in the foregoing embodiments are only examples, and other operations or modifications of various operations may also be performed in the embodiment of the present application. In addition, various steps may be performed in different orders presented in the above embodiments, and it may not be necessary to perform all operations in the above embodiments.
进一步的,一般的,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由访问方对器件编程来确定。由设计人员自行编程来把一个数字装置“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。Further, in general, improvements to a technology can be clearly distinguished as improvements in hardware (for example, improvements to circuit structures such as diodes, transistors, and switches) or improvements in software (improvements to method flow). However, with the development of technology, the improvement of many current method flows can be regarded as the direct improvement of the hardware circuit structure. Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be realized by hardware physical modules. For example, a programmable logic device (Programmable Logic Device, PLD) (such as a field programmable gate array (Field Programmable Gate Array, FPGA)) is such an integrated circuit, the logic function of which is determined by the programming of the device by the accessing party. It is programmed by the designer to "integrate" a digital device on a PLD, instead of asking a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of making integrated circuit chips by hand, this kind of programming is mostly realized by "logic compiler (logic compiler)" software, which is similar to the software compiler used when program development and writing, but before compiling The original code of the computer must also be written in a specific programming language, which is called a hardware description language (Hardware Description Language, HDL), and there is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language) , AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., are currently the most commonly used The most popular are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. It should also be clear to those skilled in the art that only a little logical programming of the method flow in the above-mentioned hardware description languages and programming into an integrated circuit can easily obtain a hardware circuit for realizing the logic method flow.
因此,本申请实施例所提出的方法流程可以以硬件方式实现,例如,使用控制器,控制器控制触摸屏以实现本申请实施例所提出的方法流程。Therefore, the method flow proposed in the embodiment of the present application may be implemented in hardware, for example, using a controller, and the controller controls the touch screen to implement the method flow proposed in the embodiment of the present application.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现 相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller may be implemented in any suitable way, for example the controller may take the form of a microprocessor or processor and a computer readable medium storing computer readable program code (such as software or firmware) executable by the (micro)processor , logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that, in addition to realizing the controller in a purely computer-readable program code mode, it is entirely possible to make the controller use logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded The same function can be realized in the form of a microcontroller or the like. Therefore, such a controller can be regarded as a hardware component, and the devices included in it for realizing various functions can also be regarded as structures within the hardware component. Or even, means for realizing various functions can be regarded as a structure within both a software module realizing a method and a hardware component.
与上述实施例对应,本申请还提供了一种电子设备。电子设备包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发电子设备执行如本申请实施例所述的方法步骤。Corresponding to the foregoing embodiments, the present application further provides an electronic device. The electronic device includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps described in the embodiments of the present application.
本申请还提供一种计算机程序产品,计算机程序产品包括计算机程序,当其在计算机上运行时,使得计算机执行本申请实施例提供的部分或全部步骤。The present application also provides a computer program product, the computer program product includes a computer program, and when it is run on a computer, causes the computer to execute some or all of the steps provided in the embodiments of the present application.
本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Those skilled in the art can clearly understand that the technologies in the embodiments of the present invention can be implemented by means of software plus a necessary general-purpose hardware platform. Based on this understanding, the essence of the technical solutions in the embodiments of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM , magnetic disk, optical disk, etc., including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present invention.
本说明书中各个实施例之间相同相似的部分互相参见即可。尤其,对于装置实施例和终端实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例中的说明即可。For the same and similar parts among the various embodiments in this specification, refer to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to the description in the method embodiment.
Claims (14)
- 一种操作系统启动方法,其特征在于,应用于电子设备,所述电子设备包括处理器以及存储器,所述存储器包括基础分区、第一静态分区、第二静态分区、动态分区以及用户数据分区,所述第一静态分区包括第一子分区,所述第二静态分区包括第二子分区,所述第一子分区与所述第二子分区为相互对应的子分区,所述方法包括:A method for starting an operating system, characterized in that it is applied to an electronic device, the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partition, and a user data partition, The first static partition includes a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other, and the method includes:加载所述基础分区的数据;Load the data of the basic partition;加载静态分区数据,包括:对所述第一子分区的数据进行第一校验操作,当所述第一校验操作成功时,加载所述第一子分区的数据;当所述第一校验操作失败时,对所述第二子分区的数据进行第二校验操作,当所述第二校验操作成功时,加载所述第二子分区的数据;Loading static partition data includes: performing a first verification operation on the data of the first sub-partition, and loading the data of the first sub-partition when the first verification operation is successful; When the verification operation fails, perform a second verification operation on the data of the second sub-partition, and when the second verification operation succeeds, load the data of the second sub-partition;加载所述动态分区的数据以运行第一操作系统。The data of the dynamic partition is loaded to run the first operating system.
- 根据权利要求1所述方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:当所述第二校验操作失败时,重启所述电子设备,或者,输出操作系统启动失败提示信息。When the second verification operation fails, restart the electronic device, or output a prompt message that the operating system fails to start.
- 根据权利要求1所述方法,其特征在于,所述第一静态分区还包括第三子分区,所述第二静态分区还包括第四子分区,所述第三子分区与所述第四子分区为相互对应的子分区,所述加载静态分区数据,还包括:The method according to claim 1, wherein the first static partition further comprises a third sub-partition, the second static partition further comprises a fourth sub-partition, and the third sub-partition and the fourth sub-partition The partitions are sub-partitions corresponding to each other, and the loading of static partition data also includes:对所述第三子分区的数据进行第三校验操作,当所述第三校验操作成功时,加载所述第三子分区的数据;当所述第三校验操作失败时,对所述第四子分区的数据进行第四校验操作,当所述第四校验操作成功时,加载所述第四子分区的数据。Performing a third verification operation on the data of the third sub-partition, when the third verification operation is successful, loading the data of the third sub-partition; when the third verification operation fails, performing a third verification operation on all Perform a fourth verification operation on the data of the fourth sub-partition, and load the data of the fourth sub-partition when the fourth verification operation is successful.
- 根据权利要求1所述方法,其特征在于,所述加载所述动态分区的数据之后,所述方法还包括:The method according to claim 1, wherein after loading the data of the dynamic partition, the method further comprises:当所述第一校验操作失败时,将所述电子设备的启动顺序由从所述第一静态分区启动修改为从所述第二静态分区启动。When the first verification operation fails, modify the boot order of the electronic device from booting from the first static partition to booting from the second static partition.
- 根据权利要求4所述方法,其特征在于,所述加载所述动态分区的数据之后,所述方法还包括:The method according to claim 4, wherein after the data of the dynamic partition is loaded, the method further comprises:修正所述第二静态分区的数据。Modify the data of the second static partition.
- 根据权利要求5所述方法,其特征在于,所述修正所述第二静态分区的数据,包括:The method according to claim 5, wherein the modifying the data of the second static partition comprises:将所述第一静态分区中,除所述第一子分区以外的其他子分区的数据,同步到所述第二静态分区中的对应子分区中。Synchronizing data of other sub-partitions in the first static partition except the first sub-partition to corresponding sub-partitions in the second static partition.
- 根据权利要求1~6中任一项所述方法,其特征在于,所述加载静态分区数据之前,所述方法还包括,将所述第一静态分区的数据同步到所述第二静态分区。The method according to any one of claims 1-6, characterized in that, before loading the data of the static partition, the method further comprises: synchronizing the data of the first static partition to the second static partition.
- 根据权利要求7所述的方法,其特征在于,所述加载所述基础分区的数据之前,所述方法还包括:The method according to claim 7, wherein before loading the data of the basic partition, the method further comprises:加载所述基础分区、所述第二静态分区以及所述动态分区的数据以运行第二 操作系统;loading data of the basic partition, the second static partition and the dynamic partition to run a second operating system;获取升级安装包,所述升级安装包包括静态分区升级文件;Obtain an upgrade installation package, the upgrade installation package includes a static partition upgrade file;基于所述静态分区升级文件升级所述第一静态分区的数据;upgrading data of the first static partition based on the static partition upgrade file;重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动;Restart the electronic device, and confirm that the current startup sequence is to start from the first static partition;加载所述基础分区、所述第一静态分区以及所述动态分区的数据,以运行所述第一操作系统;loading data of the basic partition, the first static partition, and the dynamic partition to run the first operating system;其中,在所述重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动之后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。Wherein, after restarting the electronic device and confirming that the current boot sequence is booting from the first static partition, performing the synchronizing the data of the first static partition to the second static partition.
- 根据权利要求8所述的方法,其特征在于,在加载所述第一静态分区的数据的过程中,在静态分区数据校验成功后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。The method according to claim 8, wherein during the process of loading the data of the first static partition, after the data of the static partition is verified successfully, performing the step of synchronizing the data of the first static partition to The second static partition.
- 根据权利要求8所述的方法,其特征在于,在加载所述动态分区的数据的过程中,在待加载动态分区文件校验成功后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。The method according to claim 8, characterized in that, in the process of loading the data of the dynamic partition, after the verification of the dynamic partition file to be loaded is successful, performing the synchronization of the data of the first static partition to The second static partition.
- 根据权利要求8所述的方法,其特征在于:The method according to claim 8, characterized in that:所述升级安装包还包括动态分区升级文件,所述重启所述电子设备,确认当前的启动顺序为从所述第一静态分区启动之前,所述方法还包括,在所述用户数据分区中创建虚拟动态分区,在所述虚拟动态分区中保存所述动态分区升级文件;The upgrade installation package also includes a dynamic partition upgrade file, the restart of the electronic device confirms that the current startup sequence is before starting from the first static partition, and the method further includes creating a file in the user data partition. A virtual dynamic partition, storing the dynamic partition upgrade file in the virtual dynamic partition;所述加载动态分区数据,包括,加载所述动态分区的数据以及所述动态分区升级文件;The loading of dynamic partition data includes loading the data of the dynamic partition and the dynamic partition upgrade file;所述加载动态分区数据之后,所述方法还包括:将所述用户数据分区中的所述动态分区升级文件落盘到所述动态分区;After the dynamic partition data is loaded, the method further includes: placing the dynamic partition upgrade file in the user data partition to the dynamic partition;所述将所述用户数据分区中的所述动态分区升级文件落盘到所述动态分区之后,执行所述将所述第一静态分区的数据同步到所述第二静态分区。After the uploading the dynamic partition upgrade file in the user data partition to the dynamic partition, performing the step of synchronizing the data of the first static partition to the second static partition.
- 一种电子设备,其特征在于,所述电子设备包括处理器以及存储器,所述存储器包括包括基础分区、第一静态分区、第二静态分区、动态分区以及用户数据分区,所述第一静态分区包括第一子分区,所述第二静态分区包括第二子分区,所述第一子分区与所述第二子分区为相互对应的子分区,所述处理器用于执行所述存储器上存储的软件代码,以使得所述电子设备执行如权利要求1~11中任一项所述的方法流程。An electronic device, characterized in that the electronic device includes a processor and a memory, and the memory includes a basic partition, a first static partition, a second static partition, a dynamic partition and a user data partition, and the first static partition Including a first sub-partition, the second static partition includes a second sub-partition, the first sub-partition and the second sub-partition are sub-partitions corresponding to each other, and the processor is configured to execute the A software code, so that the electronic device executes the method procedure according to any one of claims 1-11.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得计算机执行如权利要求1~11中任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and when the computer program is run on a computer, the computer is made to execute the computer program described in any one of claims 1-11. described method.
- 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序,当其在计算机上运行时,使得计算机执行如权利要求1~11中任一项所述的方法。A computer program product, characterized in that the computer program product includes a computer program, which when run on a computer causes the computer to execute the method according to any one of claims 1-11.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110662962.3A CN114116023B (en) | 2021-06-15 | 2021-06-15 | Operating system starting method, device, storage medium and computer program product |
CN202110662962.3 | 2021-06-15 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022262753A1 true WO2022262753A1 (en) | 2022-12-22 |
Family
ID=80359245
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/098861 WO2022262753A1 (en) | 2021-06-15 | 2022-06-15 | Operating system starting method, device, storage medium, and computer program product |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114116023B (en) |
WO (1) | WO2022262753A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116628670A (en) * | 2023-05-18 | 2023-08-22 | 荣耀终端有限公司 | Authority setting method and electronic equipment |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114116023B (en) * | 2021-06-15 | 2023-05-09 | 荣耀终端有限公司 | Operating system starting method, device, storage medium and computer program product |
CN115480798B (en) * | 2021-06-15 | 2023-06-16 | 荣耀终端有限公司 | Operating system upgrade method, device, storage medium and computer program product |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102693283A (en) * | 2012-05-07 | 2012-09-26 | 深圳市共进电子股份有限公司 | Data partition storage method and system boot method of embedded system |
CN102945176A (en) * | 2012-11-09 | 2013-02-27 | 青岛海信移动通信技术股份有限公司 | Terminal equipment booting and updating method and equipment |
CN103678030A (en) * | 2012-09-04 | 2014-03-26 | 杭州海康威视数字技术股份有限公司 | Multi-system equipment start system and method thereof |
CN109725945A (en) * | 2018-12-30 | 2019-05-07 | 龙尚科技(上海)有限公司 | A kind of mould group starting method, apparatus, equipment and storage medium |
US20190361710A1 (en) * | 2018-05-24 | 2019-11-28 | Visteon Global Technologies, Inc. | Method for starting an operating system |
CN110737481A (en) * | 2019-09-25 | 2020-01-31 | 浙江万胜智能科技股份有限公司 | Starting method of embedded LINUX operating system based on multiple backup bootstrap programs |
CN114116023A (en) * | 2021-06-15 | 2022-03-01 | 荣耀终端有限公司 | Operating system starting method, operating system starting device, storage medium and computer program product |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10146780B1 (en) * | 2016-03-23 | 2018-12-04 | EMC IP Holding Company LLC | Data storage system using paced deallocation of truncated file blocks |
CN105975864A (en) * | 2016-04-29 | 2016-09-28 | 北京小米移动软件有限公司 | Operation system starting method and device, and terminal |
US10528479B2 (en) * | 2017-06-02 | 2020-01-07 | Huawei Technologies Co., Ltd. | Global variable migration via virtual memory overlay technique for multi-version asynchronous dynamic software update |
CN108958814B (en) * | 2018-06-13 | 2020-09-01 | 北京航空航天大学 | Multimode redundant embedded operating system starting method |
CN109032846A (en) * | 2018-08-08 | 2018-12-18 | 京信通信系统(中国)有限公司 | Equipment remote backup upgrade method, device, computer storage medium and equipment |
CN109408153B (en) * | 2018-11-01 | 2022-03-01 | 百度在线网络技术(北京)有限公司 | Software starting method and software upgrading method |
CN110175039A (en) * | 2019-04-26 | 2019-08-27 | 潍坊歌尔电子有限公司 | Online upgrading method, equipment, readable storage medium storing program for executing and electronic equipment |
CN112804071B (en) * | 2019-11-13 | 2024-09-06 | 南京中兴新软件有限责任公司 | Online upgrade method, upgrade file providing method, device and storage medium |
-
2021
- 2021-06-15 CN CN202110662962.3A patent/CN114116023B/en active Active
-
2022
- 2022-06-15 WO PCT/CN2022/098861 patent/WO2022262753A1/en active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102693283A (en) * | 2012-05-07 | 2012-09-26 | 深圳市共进电子股份有限公司 | Data partition storage method and system boot method of embedded system |
CN103678030A (en) * | 2012-09-04 | 2014-03-26 | 杭州海康威视数字技术股份有限公司 | Multi-system equipment start system and method thereof |
CN102945176A (en) * | 2012-11-09 | 2013-02-27 | 青岛海信移动通信技术股份有限公司 | Terminal equipment booting and updating method and equipment |
US20190361710A1 (en) * | 2018-05-24 | 2019-11-28 | Visteon Global Technologies, Inc. | Method for starting an operating system |
CN109725945A (en) * | 2018-12-30 | 2019-05-07 | 龙尚科技(上海)有限公司 | A kind of mould group starting method, apparatus, equipment and storage medium |
CN110737481A (en) * | 2019-09-25 | 2020-01-31 | 浙江万胜智能科技股份有限公司 | Starting method of embedded LINUX operating system based on multiple backup bootstrap programs |
CN114116023A (en) * | 2021-06-15 | 2022-03-01 | 荣耀终端有限公司 | Operating system starting method, operating system starting device, storage medium and computer program product |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116628670A (en) * | 2023-05-18 | 2023-08-22 | 荣耀终端有限公司 | Authority setting method and electronic equipment |
CN116628670B (en) * | 2023-05-18 | 2024-03-22 | 荣耀终端有限公司 | Authority setting method and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN114116023A (en) | 2022-03-01 |
CN114116023B (en) | 2023-05-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022262753A1 (en) | Operating system starting method, device, storage medium, and computer program product | |
WO2022262751A1 (en) | Operating system upgrading method, and device, storage medium and computer program product | |
WO2022262754A1 (en) | Operating system data updating method and device, storage medium, and program product | |
WO2022262744A1 (en) | Upgrade method for operating system, and device, storage medium and computer program product | |
US20230229424A1 (en) | Operating System Upgrade Method and Device, Storage Medium, and Computer Program Product | |
CN113821221B (en) | Method, apparatus and storage medium for installing operating system | |
WO2022262748A1 (en) | Management method for operating system, device, storage medium, and computer program product | |
CN113805956B (en) | Configuration method and device of operating system and storage medium | |
CN114461257B (en) | Operating system data configuration method, operating system data configuration device, storage medium and program product | |
CN113900673B (en) | System installation package management method, device, storage medium and program product | |
CN113806139B (en) | Operating system recovery method, operating system recovery device, storage medium and computer program product | |
CN114489813B (en) | Method, equipment and storage medium for configuring operating system | |
CN113821234B (en) | Operating system upgrade method, apparatus, storage medium, and computer program product | |
US20240296035A1 (en) | Method for Configuring Operating System Vendor Country, Device, and Storage Medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22824230 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 22824230 Country of ref document: EP Kind code of ref document: A1 |