Disclosure of Invention
The technical problem to be solved by the invention is to provide a simple system upgrading method, device and terminal for a multi-system mobile terminal, wherein unified partition table establishment, unified batch updating, independent partition updating, unified erasing partition and independent erasing partition are realized for a plurality of eMMCs through fastboot updating modes.
The technical solution for solving the above technical problems is to provide a system upgrade method for a multi-system mobile terminal, where the mobile terminal includes at least two embedded memories, the system is stored in the embedded memories, and the system upgrade method for the multi-system mobile terminal includes:
Creating a partition information table corresponding to each embedded memory, and correspondingly storing the partition information in the partition table in a structural information mode, wherein the partition information table comprises partition table names and partition full names uniquely corresponding to the partitions;
Reading the partition information table, identifying the corresponding embedded memory according to the partition table name, and uniformly partitioning a single or a plurality of embedded memories according to the partition information table;
And receiving a partition operation command, inquiring the partition information table according to the partition operation command so as to identify the embedded memories which are required to be operated and uniformly operating the partitions of the single or a plurality of embedded memories.
In the system upgrading method for the multi-system mobile terminal, the partition information table comprises struct oem _part_info structure information of all partitions of the embedded memory according to the sequence:
partition name, partition alias, partition system format and partition length, wherein the partition full name comprises partition name and partition alias.
In the system upgrading method for the multi-system mobile terminal of the present invention, the reading of the partition information table, the identifying of the embedded memory corresponding to the partition information table according to the partition table name, and the partitioning of the embedded memory includes:
Identifying a command of the mobile terminal, judging the embedded memory to be operated according to the command of the mobile terminal, and storing a judging result;
And directly partitioning the embedded memory according to the judging result.
In the system upgrading method for the multi-system mobile terminal of the present invention, the reading of the partition information table, the identifying of the embedded memory corresponding to the partition information table according to the partition table name, and the partitioning of the embedded memory includes:
Connecting to a USB host, and initializing fastboot communication protocol of the mobile terminal according to the command of the mobile terminal;
the peripheral equipment entering the interception data state acquires a partition operation command sent by a PC end;
and receiving and analyzing the partition operation command, if the partition name is acquired, identifying the embedded memory according to the partition name, partitioning the embedded memory and operating the partition, and if the partition name is not acquired, exiting the process.
In the system upgrading method for a multi-system mobile terminal of the present invention, the receiving a partition operation command, querying the partition information table according to the partition operation command, to identify the embedded memory that needs to be operated corresponding to the partition information table, and uniformly operating the partitions of the single or multiple embedded memories includes:
Receiving the partition name transmitted by the PC terminal bound with the mobile terminal, traversing the partition information table according to the partition name, and identifying a partition information table corresponding to the partition name;
determining and judging the embedded memory needing to be operated according to the partition information table;
and reading the partition table corresponding to the embedded memory, and operating the partition table.
The invention also provides a system upgrade apparatus for a multi-system mobile terminal, the mobile terminal comprising at least two embedded memories, the system being stored in the embedded memories, characterized in that the system upgrade apparatus for a multi-system mobile terminal comprises:
The partition information table unit is used for creating partition information tables corresponding to the embedded memories and correspondingly storing the partition information in the partition tables in a structure information mode, and the partition information tables comprise partition table names and partition full names uniquely corresponding to the partitions;
The partition unit is used for reading the partition information table, identifying the corresponding embedded memories according to the partition table names, and uniformly partitioning a single embedded memory or a plurality of embedded memories according to the partition information table;
and the operation partition unit is used for receiving a partition operation command, inquiring the partition information table according to the partition operation command so as to identify the embedded memories which are required to be operated and corresponding to the partition information table, and uniformly operating the partitions of the single or multiple embedded memories.
In the system upgrading device for the multi-system mobile terminal, the partition information table comprises struct oem _part_info structure information of all partitions of the embedded memory according to the sequence:
partition name, partition alias, partition system format and partition length, wherein the partition full name comprises partition name and partition alias.
In the system upgrading device for the multi-system mobile terminal, the partition establishing unit is further used for identifying the command of the mobile terminal, judging the embedded memory to be operated according to the command of the mobile terminal, storing the judging result, directly partitioning the embedded memory according to the judging result, initializing fastboot communication protocols of the mobile terminal according to the command of the mobile terminal, connecting to a USB host, acquiring a partition operation command sent by a PC end by the peripheral equipment in a data interception state, receiving and analyzing the partition operation command, identifying the embedded memory according to the partition name if the partition name is acquired, partitioning the embedded memory and operating the partition, and exiting the process if the partition name is not acquired;
the operation partition unit is further used for receiving the partition names transmitted by the PC end bound with the mobile terminal, traversing the partition information table according to the partition names, identifying partition information tables corresponding to the partition names, determining the embedded memory to be operated according to the partition information tables, reading the partition tables corresponding to the embedded memory, and operating the partition tables.
The invention also provides another system upgrading terminal for the multi-system mobile terminal, which comprises a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor executes the computer program to realize the steps of the system upgrading method for the multi-system mobile terminal.
The invention also provides a computer readable storage medium, the storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the system upgrading method for the multi-system mobile terminal according to any one of the above.
In the system upgrading method, the device and the terminal for the multi-system mobile terminal, in a boot loader (u-boot) of an embedded system, the embedded memory is identified for partitioning according to the full name of the partition by establishing the partition information table, and partition operation instructions input by external equipment are received to uniformly operate the partitions of a single or a plurality of embedded memories, so that the multi-system boot upgrade is realized through a fastboot boot mode, and the operation process is simple and efficient. Meanwhile, the command parameters can be analyzed fastboot, the partition of the embedded memory can be independently operated, namely, the single eMMC updating and multi-eMMC updating requirements of the novel operating system can be met by independently supporting a certain eMMC updating and upgrading mode.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, which is a flowchart of a first embodiment of a system upgrade method for a multi-system mobile terminal, the system upgrade method for a multi-system mobile terminal may be applied to an intelligent cockpit, the mobile terminal includes at least two embedded memories, the systems are stored in the embedded memories, and the system upgrade method for a multi-system mobile terminal includes:
And S11, creating a partition information table corresponding to each embedded memory, and correspondingly storing the partition information in the partition table in a mode of structural information, wherein the partition information table comprises partition table names and partition full names uniquely corresponding to the partitions.
Further, the partition information table comprises struct oem _part_info structure information of all partitions of the embedded memory in sequence, wherein the partition full name comprises a partition name and a partition alias, and the partition information table comprises all partitions of two eMMCs.
In the above step, taking as an example a mobile terminal that has been able to successfully drive two emmcs using u-boot, the two emmcs are numbered 0 (QNX system) and 1 (Android), respectively, and for example, an eMMC dev 0 or mmc dev 1 command is input to enable normal detection of the eMMC. According to the use requirements of QNX and Android systems on eMMC, partition tables are respectively built for eMMC 0 and eMMC 1, and are respectively stored in two tables of oem _part_table_0 and oem _part_table_1 in a manner of struct oem _part_info structure information. For example, oem _partition_table_0 and oem _partition_table_1 partition information table specific information is as follows:
Table-partition information table
It should be noted that when unifying the partitions to eMMC, it is necessary to ensure that all the partition full names are unique, where the partition full names represent character strings composed of partition names and partition aliases, such as system_a partition, and in the partition table, the partition names are "system", and the partition distinction names are "a", so the partition full names are "system_a".
And S12, reading the partition information table, identifying the corresponding embedded memory according to the partition table name, and uniformly partitioning a single embedded memory or a plurality of embedded memories according to the partition information table.
Accordingly, FIG. 2 is a flow chart of the partition of the embedded memory. The mobile terminal comprises two eMMC0 and eMMC 1, reads the partition information tables oem _partition_table_0 and oem _partition_table_1, automatically identifies which eMMC the partition is on according to the full name of the partition, writes the partition information table into the corresponding eMMC, partitions the eMMC, and after the partition is successful, the partition table structures of the eMMC0 and the eMMC 1 are shown in figure 3.
The method comprises the steps of judging the embedded memory to be operated according to the command of the mobile terminal, storing the judging result, and directly partitioning the embedded memory according to the judging result.
The method comprises the steps of connecting to a USB host, initializing fastboot communication protocols of the mobile terminal according to commands of the mobile terminal, enabling the peripheral device entering a data interception state to acquire partition operation commands sent by a PC end, receiving and analyzing the partition operation commands, identifying the embedded memory according to the partition names if the partition names are acquired, partitioning the embedded memory and operating the partition, and exiting the process if the partition names are not acquired.
Step S13, receiving a partition operation command, inquiring the partition information table according to the partition operation command so as to identify the embedded memories which are required to be operated and corresponding to the partition information table, and uniformly operating the partitions of the single or multiple embedded memories.
The method comprises the steps of receiving partition names transmitted by a PC (personal computer) terminal bound with a mobile terminal, traversing the partition information table according to the partition names, identifying partition information tables corresponding to the partition names, determining the embedded memory which needs to be operated according to the partition information tables, reading the partition tables corresponding to the embedded memory, and operating the partition tables.
Fig. 4 is a schematic diagram of a communication model between a u-boot terminal and a PC terminal. The software program of the invention can run in BootLoader meeting various requirements, but the implementation of the invention is mainly realized in u-boot, so muti _ fastboot exists as application software on u-boot in the example of the invention. The invention follows fastboot protocol, can manage multiple eMMCs in multiple dimensions to meet the running requirement of a novel operating system. And fastboot service at the PC end is fully compatible with conventional fastboot. The program designed by the invention realizes communication with fashboot service of the PC end by using the USB and is used as the USB device end. The muti _ fastboot communication realized by the u-boot end of the mobile terminal completely follows the standard fastboot protocol, and when the mobile terminal communicates with fastboot of the PC end, the PC end fastboot serves as a server end, and the muti _ fastboot of the u-boot end serves as a client end.
In the process of updating the flash, muti _ fastboot can support only one eMMC (for example, only eMMC 0 is operated, command: muti _ fastboot mmc 0), and can also support 2 emmcs at the same time, and in the process of specific flash, the number corresponding to the eMMC is automatically found according to the partition name, and then the corresponding eMMC is operated. Taking the u-boot end brush mode including eMMC 0 and eMMC 01 as an example, the command is exemplified as follows:
1. Single brushing machine eMMC 0
(1) U-boot end command:
muti_fastboot mmc 0
(2) PC side command:
Brushing machines according to the partition:
fastboot flash{partition}{image_file}
Examples of commands are as follows:
fastboot flash dos dos.img
fastboot flash qnxdisk qnxdata.img
erasure of partitions:
fastboot erase{partition}
Examples of commands are as follows:
fastboot erase dos
fastboot erase qnxdisk
Formatting:
Formatting a partition:
fastboot format{partition}
Examples of commands are as follows:
fastboot format dos
global formatting, reestablishing the partition table:
fastboot oem format
2. Single brushing machine eMMC 1
(1) U-boot end command:
muti_fastboot mmc 1
(2) PC side command:
Brushing machines according to the partition:
fastboot flash{partition}{image_file}
Examples of commands are as follows:
fastboot flash dtb dtb.img
fastboot flash dtbo dtbo.img
fastboot flash boot boot.img
fastboot flash metadata metadata.img
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash product product.img
erasure of partitions:
fastboot erase{partition}
Examples of commands are as follows:
fastboot erase misc
fastboot erase pst
fastboot erase vbmeta
fastboot erase dtb
fastboot erase dtbo
fastboot erase boot
fastboot erase metadata
fastboot erase system
fastboot erase vendor
fastboot erase qnxdisk
fastboot erase product
fastboot erase userdata
Formatting:
Formatting a partition:
fastboot format{partition}
fastboot format userdata
global formatting, reestablishing the partition table:
fastboot oem format
It should be noted that for a system employing a/B partitioning, muti _ fastboot is only flushed to one partition in a/B, as the a/B partitioning is mainly used for OTA upgrades, etc., and this option may be set in the implementation of muti _ fastboot. That is, assuming that the system boot is set to use the A partition, when the PC side executes the command "fastboot FLASH SYSTEM system. Img" to flush, only the system_a partition is flushed, and the system_b partition is disregarded.
3. Automatic brushing machine according to subareas
1) U-boot end command:
muti_fastboot mmc
(2) PC side command:
And the PC end command is completely the same as the commands in the commands 1 and 2, after the commands are executed, the u-boot end automatically installs and transmits the past partition name to search the number of the eMMC, and then the corresponding eMMC partition is operated.
PC end fastboot public instruction
Loading kernel operation according to u-boot parameters:
fastboot boot
Restarting:
fastboot reboot
fastboot reboot bootloader
Reading version information:
fastboot getver:version
as known from the above upgrade of the communication brush machine matched with muti _ fastboot of the PC end fastboot and the u-boot end, the embodiment completely follows fastboot protocol standard, mainly performs unified management of synchronous operation on eMMC 0 and eMMC 1, and reduces the differentiation of use to the greatest extent, so that the use of users is simpler and more convenient.
As shown in fig. 5, a second embodiment of a system upgrade method for a multi-system mobile terminal according to the present invention is provided, and the preconditions of the second embodiment include:
(1) The system used by the mobile terminal of the embodiment can normally operate multiple systems, and each system uses one eMMC exclusively;
(2) The u-boot used in this embodiment has successfully driven two pieces of eMMC (embedded memory), and the two pieces of eMMC are numbered 0 (QNX system) and 1 (Android), respectively, and commands such as input "mmc dev 0" or "mmc dev 1" are capable of normally detecting eMMC.
(3) The u-boot used in this embodiment already supports the USB OTG functionality.
(4) The u-boot used by the invention already supports updating the Android system for the eMMC 1.
The steps of the continuous operation flow after the eMMC partitioning are as follows:
(1) Acquiring a transferred partition name Temp-name from the peripheral device;
(2) Traversing partition information tables oem _partition_table_0 and oem _partition_table_1, judging partition information tables corresponding to partition names, and ending the traversal if the partition information tables corresponding to the partition names are not found;
(3) Identifying a partition information table, and automatically identifying which eMMC the partition is on according to the name of the partition table;
(4) And reading a partition information table in the corresponding eMMC, and then managing/operating the corresponding eMMC partition.
As shown in fig. 6, which is a third embodiment of the system upgrade method for a multi-system mobile terminal of the present invention, it should be noted that the preconditions of the third embodiment include:
(1) The system used by the mobile terminal can normally run a plurality of systems, and each system exclusively uses one eMMC;
(2) The u-boot used has successfully driven two pieces of eMMC (embedded memory), and the two pieces of eMMC are numbered 0 (QNX system) and 1 (Android), respectively, and commands such as input of "mmc dev 0" or "mmc dev 1" can normally detect eMMC.
(3) The u-boot used already supports the USB OTG functionality.
(4) The u-boot used already supports upgrading the Android system for the eMMC 1 brush engine.
The steps for carrying out eMMC brush machine upgrading based on muti _ fastboot are as follows:
(1) And identifying muti _ fastboot command parameters input at the u-boot end, judging whether the eMMC number needs to be operated or automatically searching the eMMC according to the partition name during operation, and storing the result in a flash_type variable.
(2) Select and bind the USB OTG peripheral device that is needed to be used and initialize fastboot protocols.
(3) The USB enters a state of listening to the data, and when the data is available, an interrupt is generated, and the data sent from the USB host is acquired.
(4) And analyzing command parameters of the PC end fastboot, such as flash/erase/getvar/boot/reboot/oem and the like.
(5) And selecting the eMMC to be operated according to the value of the flash_type. When flash_type=0, eMMC 0 is directly and independently operated, when flash_type=1, eMMC 1 is directly and independently operated, when flash_type=2 or other values, which eMMC is identified according to the partition name carried in the received PC side fastboot parameter, then the corresponding eMMC is operated, if the command parameter without the partition name is, for example oem, formatting operation is directly performed on both emmcs.
(6) And performing corresponding function operation on the eMMC according to the function of the PC end fastboot command parameter flash/erase/getvar/boot/reboot/oem, wherein for example, flash indicates that the mirror image is written into the eMMC, and erase indicates that a certain partition or all partitions of the eMMC are erased.
The invention provides a corresponding system upgrading device for a multi-system mobile terminal, which is applied to the mobile terminal, wherein the mobile terminal comprises at least two embedded memories, the operating systems are stored in the embedded memories, the upgrading device is a functional module of a u-boot, the design of muti _ fastboot programs is mainly finished on the u-boot, and the muti _ fastboot programs are also operated on the u-boot. As shown in fig. 7, the upgrade apparatus includes a create partition information table unit 71, a create partition unit 72, an operate partition unit 73:
A partition information table creating unit 71, configured to create a partition information table corresponding to each embedded memory, and store the partition information in the partition table in a corresponding manner in a structure information manner, where the partition information table includes a partition table name and a partition full name uniquely corresponding to the partition;
Establishing a partition unit 72, configured to read the partition information table, identify the corresponding embedded memories according to the partition table names, and partition a single or multiple embedded memories according to the partition information table;
and an operation partition unit 73, configured to receive a partition operation command, query the partition information table according to the partition operation command, identify the embedded memory that needs to be operated corresponding to the partition information table, and operate the partitions of the single or multiple embedded memories in a unified manner.
The partition establishing unit 72 is further configured to identify a command of the mobile terminal, determine the embedded memory to be operated according to the command of the mobile terminal, and store a determination result, directly partition the embedded memory according to the determination result, initialize fastboot communication protocols of the mobile terminal according to the command of the mobile terminal, acquire a partition operation command sent by a PC end from the peripheral device that enters a listening data state, receive and parse the partition operation command, identify the embedded memory according to the partition name if the partition name is acquired, partition the embedded memory and perform partition operation, and exit the process if the partition full name is not acquired;
Specifically, the operation partition unit 73 is further configured to receive the partition name transferred from the PC terminal bound to the mobile terminal, traverse the partition information table according to the partition name, identify a partition information table corresponding to the partition name, determine the embedded memory to be operated according to the partition information table, read the partition table corresponding to the embedded memory, and operate the partition table.
The invention provides a corresponding system upgrade terminal for a multi-system mobile terminal, as shown in fig. 8, comprising a memory 801 and a processor 802, wherein the memory 801 stores a computer program capable of running on the processor 802, and the processor 802 implements the steps of the first embodiment of the system upgrade method for the multi-system mobile terminal when executing the computer program.
The present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a first embodiment of a system upgrade method for a multi-system mobile terminal.
According to the mobile terminal, the embedded memory in the mobile terminal is partitioned and read-write operation is performed on the partition by identifying the partition operation instruction sent by the peripheral equipment (PC end), so that unified partition and machine brushing of multiple operating systems of the mobile terminal are realized, and the machine brushing process is simple and efficient. Meanwhile, the command parameters can be analyzed fastboot, the partitions of the embedded memory can be independently operated, namely, the updating mode of a certain embedded memory can be independently supported, and the single eMMC updating and multi-eMMC updating requirements of the operation of the novel operating system can be met.
The present invention is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present invention are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.