Mirror image file programming method and device, electronic equipment and computer program product

By optimizing the image file burning process, determining the burning method based on whether the fill data is 0, and increasing the memory space size, the problem of long burning time for eMMC storage media image files has been solved, achieving more efficient burning.

CN121957618APending Publication Date: 2026-05-01CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-01-22
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

As software applications become more complex, the time required to burn image files for embedded multimedia card (eMMC) storage media becomes longer. Traditional methods are inefficient and unstable when the image files are large.

Method used

By obtaining the padding data in the sparse image file to be burned, the burning method is determined based on whether the padding data is 0. The erase or write method is adopted. Combined with increasing the memory space size to 0x3000, the data writing efficiency is improved and the burning process is optimized.

Benefits of technology

It effectively reduces the burning time of image files, improves burning efficiency, and basically reaches the maximum write rate of eMMC storage media, thus reducing burning time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121957618A_ABST
    Figure CN121957618A_ABST
Patent Text Reader

Abstract

The invention provides a mirror image file programming method and device, electronic equipment and a computer program product. The method comprises the steps of obtaining first data contained in a to-be-programmed first mirror image file; the first data is fill data; the first mirror image file is a sparse image; filling the first data with second data to obtain third data; determining a first programming mode corresponding to the third data according to the second data and a first value; the first programming mode at least comprises writing in a first storage medium or erasing a first offset address and size in the first storage medium; the first value is 0; the first storage medium is an emmc storage medium; and programming the third data to a first storage medium according to the first programming mode. The programming efficiency of the mirror image file can be improved, so that the programming time consumption of the mirror image file is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to computer technology, and in particular to a method, apparatus, electronic device, and computer program product for burning image files. Background Technology

[0002] As software applications become more complex, their image files also become larger and larger. For embedded devices with embedded Multi Media Card (eMMC) storage media, this also increases the time required to burn the image. Summary of the Invention

[0003] This application provides a method, apparatus, electronic device, and computer program product for burning image files, which can improve the burning efficiency of image files and reduce the burning time of image files.

[0004] The technical solution of this application embodiment is implemented as follows: This application provides a method for creating an image file, the method comprising: Obtain the first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image. Fill the first data with the second data to obtain the third data; Based on the second data and the first value, a first programming method corresponding to the third data is determined; the first programming method includes at least writing to the first storage medium or erasing the first offset address and size within the first storage medium; the first value is 0; the first storage medium is an eMMC storage medium; The third data is written to the first storage medium according to the first writing method.

[0005] This application provides an image file burning device, including: The acquisition unit is used to acquire the first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image. A filling unit is used to fill the first data with the second data to obtain the third data; The first determining unit is configured to determine a first programming method corresponding to the third data based on the second data and the first value; the first programming method includes at least writing to the first storage medium or erasing the first offset address and size in the first storage medium; the first value is 0; the first storage medium is an eMMC storage medium; The programming unit is used to program the third data to the first storage medium according to the first programming method.

[0006] This application provides an electronic device, the electronic device comprising: Memory is used to store executable instructions or computer programs. The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the image file burning method provided in the embodiments of this application.

[0007] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the image file burning method provided in this application.

[0008] The embodiments of this application have the following beneficial effects: By obtaining the fill data from the sparse image to be burned and filling the fill data, the first burning method is determined to be either write or erase based on whether the second data to be filled is 0. The erase method can improve the efficiency of writing data to the first storage medium. Then, the third data is burned to the first storage medium through the first burning method, thereby improving the burning efficiency of the image file and reducing the burning time of the image file. Attached Figure Description

[0009] Figure 1 This is a schematic diagram illustrating an exemplary process for burning an image file, provided as an embodiment of this application. Figure 2 A schematic flowchart illustrating a method for burning an image file, provided in an embodiment of this application; Figure 3 A schematic diagram illustrating an exemplary raw data burning process provided in this application embodiment; Figure 4 A schematic diagram illustrating an exemplary fill data burning process provided for embodiments of this application; Figure 5 A schematic diagram illustrating an exemplary optimized image file burning process provided in this application embodiment; Figure 6 A schematic diagram illustrating an exemplary programming time provided for an embodiment of this application; Figure 7 A schematic diagram illustrating another exemplary programming time provided for embodiments of this application; Figure 8 This is a schematic diagram of the structure of a mirror file burning device provided in an embodiment of this application; Figure 9This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0010] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0011] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0012] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first," "second," etc., used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first," "second," etc., may be interchanged in a specific order or sequence where permissible, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0013] As software applications become increasingly complex, their image file sizes are also growing larger. For embedded devices using eMMC storage media, this also increases the time required to burn the image.

[0014] To improve the speed of burning images, the following methods are generally used: increase the read and write speed of the eMMC storage medium; reduce the image file size.

[0015] Currently, the read and write speeds of eMMC storage media cannot be increased indefinitely, and the size of image files can only continue to grow. Therefore, the two current methods have certain limitations in improving the performance of burning images.

[0016] eMMC is an embedded memory standard specification established by the MMC Association, primarily for products such as mobile phones and tablets. Essentially, it can be seen as a highly integrated system of Nand Flash memory, a Nand Flash controller, and the eMMC standard interface. It can autonomously perform operations such as erase / write leveling, bad block management, and error verification, while possessing advantages such as high read / write speeds, large capacity, ease of development, and good compatibility. Therefore, it is widely used for image burning storage media in embedded devices. Traditional burning methods generally rely on scripts, Linux commands, or dedicated burning tools. Improving burning speed typically involves increasing the read / write speed of the eMMC storage media or compressing the image file size.

[0017] Traditional eMMC flashing methods are typically time-consuming, inefficient, and unstable when dealing with large image files. Therefore, this invention proposes a method to optimize and improve the flashing speed of eMMC storage media. While maintaining the same eMMC storage media read / write speed and image file size (8.25GB), the flashing process is made more efficient to reduce flashing time.

[0018] Figure 1 This application provides an exemplary flowchart of a process for burning an image file; as shown in the embodiments of this application. Figure 1 As shown, the specific steps are as follows: 1. Execute the fastboot flash command to start burning the image file.

[0019] 2. Is the image file larger than FASTBOOT_BUF_SIZE?

[0020] It should be noted that if the image file is larger than FASTBOOT_BUF_SIZE, proceed to step 3; if the image file is smaller than or equal to FASTBOOT_BUF_SIZE, proceed to step 14. Here, FASTBOOT_BUF_SIZE is used to limit the maximum size of a single file transferred via the fastboot protocol. Fastboot is a USB transfer protocol, typically used by computers to transfer and burn images to devices. Its specific implementation is the fastboot driver in the open-source code repository uboot.

[0021] 3. Split the image file into N sparse.img files.

[0022] 4. Start burning sparse.img.

[0023] 5. Is it fill data or raw data?

[0024] It should be noted that if the data is fill data, steps 6-7 are executed; if the data is raw data, steps 8-11 are executed.

[0025] 6. Fill in the data.

[0026] 7. Write the filled data to the eMMC storage medium.

[0027] 8. Request a memory space buf with a size of 100.

[0028] 9. Copy 100 bytes to the memory space buf.

[0029] 10. Write the data in the memory space buf to the eMMC storage medium.

[0030] 11. Has the writing of all data been completed?

[0031] It should be noted that if all data has been written, proceed to step 12; if not all data has been written, re-execute step 9.

[0032] 12. Has the burning of a single sparse.img file been completed?

[0033] It should be noted that if the burning of a single sparse.img is completed, proceed to step 13; if the burning of a single sparse.img is not completed, re-execute step 5.

[0034] 13. Has the burning of all sparse.img files been completed?

[0035] It should be noted that if all sparse.img files have been successfully burned, proceed to step 15; if not all sparse.img files have been successfully burned, re-execute step 4.

[0036] 14. Write raw data to eMMC storage medium.

[0037] 15. The image file burning process is complete.

[0038] To facilitate understanding, the above process is illustrated with an example: If the image file size exceeds the user-defined FASTBOOT_BUF_SIZE, the fastboot tool will convert the image file into multiple sparse format image files of size FASTBOOT_BUF_SIZE. The structure of a sparse.img file consists of several identical bytes replaced by markers, called fill data. During flashing, the device will fill the fill data completely before writing it to the eMMC storage medium. Data without modification is called raw data. Multiple fill data and raw data are alternately combined to form a sparse.img file. Flashing a sparse.img file alternately writes fill data and raw data to the eMMC storage medium; when the image file is smaller than the user-defined FASTBOOT_BUF_SIZE, the image is written directly to the eMMC storage medium.

[0039] Based on this, this application provides a method for burning image files. Figure 2 This is a flowchart illustrating a method for burning an image file, as provided in an embodiment of this application. Figure 2 As shown, the specific steps are as follows: S201. Obtain the first data contained in the first image file to be burned.

[0040] The first data is fill data; the first image file is sparse.image.

[0041] It should be noted that there can be one or more first image files to be programmed, and the specific number can be determined according to the actual situation, without limitation here. The first image file consists of multiple alternating fill data and raw data. When programming the first image file, fill data and raw data will be written to the eMMC storage medium alternately. The first image file can be understood as a sparse format image file; the first image file page can also be denoted as sparse.img. Obtaining the first data contained in the first image file to be programmed can be understood as programming the first image file and obtaining the fill data.

[0042] S202. Fill the first data with the second data to obtain the third data.

[0043] It should be noted that the specific value of the second data can be determined according to the actual situation and is not limited here; as an example, the second data must include at least 0 and non-zero data. The third data is the data obtained by filling the first data with the second data. Filling the first data with the second data to obtain the third data can be understood as filling the fill data completely with the second data, and the data after filling is the third data.

[0044] S203. Based on the second data and the first value, determine the first writing method corresponding to the third data; the first writing method includes at least writing to the first storage medium or erasing the first offset address and size in the first storage medium; the first value is 0; the first storage medium is an eMMC storage medium.

[0045] It should be noted that determining the first programming method corresponding to the third data based on the second data and the first value can be understood as determining the first programming method corresponding to the third data based on whether the second data is 0. The first offset address and size can be understood as the offset address and size corresponding to the second data.

[0046] S204. Write the third data to the first storage medium according to the first writing method.

[0047] It should be noted that writing the third data to the first storage medium according to the first writing method can be understood as writing the third data to the eMMC storage medium, or erasing the first offset address and size in the eMMC storage medium.

[0048] The solution in this application embodiment obtains fill data from the sparse image to be burned; fills the fill data; and determines whether the first burning method is a write or erase method based on whether the second data to be filled is 0. The erase method can improve the efficiency of writing data to the first storage medium. Then, the third data is burned to the first storage medium through the first burning method, thereby improving the burning efficiency of the image file and reducing the burning time of the image file.

[0049] In this embodiment of the application, the process of determining the first burning method corresponding to the third data based on the second data and the first value specifically includes: when the second data is the first value, the method of erasing the first offset address and size in the first storage medium is taken as the first burning method; when the second data is not the first value, the method of writing the third data into the first storage medium is taken as the first burning method.

[0050] It should be noted that when the second data is the first value, erasing the first offset address and size in the first storage medium is used as the first writing method; when the second data is not the first value, writing the third data into the first storage medium is used as the first writing method. This can be understood as follows: when the second data (fill data) is 0, the offset address and size corresponding to the second data in the eMMC storage medium will be erased; when the second data (fill data) is not 0, the third data will be directly written into the eMMC storage medium.

[0051] The solution in this application embodiment can effectively improve the efficiency of data writing by using the erase zero method when the filling data is 0.

[0052] In this embodiment of the application, the method further includes: obtaining fourth data contained in the first image file; the fourth data being raw data; determining a second burning method corresponding to the fourth data; and burning the fourth data to the first storage medium based on the second burning method.

[0053] It should be noted that the fourth data is the raw data in the first image file.

[0054] In this embodiment of the application, the process of determining the second burning method corresponding to the fourth data specifically includes: obtaining a first memory space of a first size and copying the fourth data to the first memory space; the first size is 0×3000; and writing the fourth data in the first memory space into the first storage medium as the second burning method.

[0055] It should be noted that the first memory space of the first size can be understood as a memory space of 0x3000, or it can be written as a memory space buf of 0x3000.

[0056] In this embodiment of the application, the process of copying the fourth data to the first memory space specifically includes: obtaining a first quantity of target data from the fourth data; copying the target data to the first memory space; and matching the first quantity with the first size.

[0057] It should be noted that the first quantity matches the first size. This can be understood as follows: when the first size is 0×3000, the first quantity is 0×3000. The target data can be understood as byte data. Obtaining the first quantity of target data from the fourth data and copying the target data to the first memory space can be understood as obtaining 0×3000 bytes from the raw data and copying them to the first memory space.

[0058] It should be noted that writing the fourth data to the first storage medium based on the second writing method can be understood as writing the data in the first memory space to the first storage medium.

[0059] It should be noted that after copying 0x3000 bytes to the first memory space and writing the data in the first memory space to the first storage medium, it is necessary to determine whether all the fourth data has been written. If not, copy 0x3000 bytes to the first memory space again and write it to the first storage medium until all the fourth data has been written.

[0060] The solution in this application embodiment increases the memory space size to 0×3000, which can effectively improve the efficiency of writing data to the first storage medium.

[0061] In this embodiment of the application, before obtaining the first data contained in the first image file to be burned, the method further includes: obtaining the second image file to be burned; and if the second image file is larger than the fast boot cache size (FASTBOOT_BUF_SIZE), splitting the second image file into one or more first image files.

[0062] It should be noted that the second image file can be understood as the complete image file to be flashed. `FASTBOOT_BUF_SIZE` is used to limit the maximum size of a single file transfer via the fastboot protocol; the specific value of `FASTBOOT_BUF_SIZE` can be determined based on actual circumstances and is not limited here. Splitting the second image file into one or more first image files can be understood as splitting the second image file into one or more sparse.image files.

[0063] In this embodiment of the application, the method further includes: if the second image file is less than or equal to FASTBOOT_BUF_SIZE, writing the original data included in the second image file into the first storage medium.

[0064] It should be noted that the raw data included in the second image file can be understood as the raw data included in the second image file. Writing the raw data included in the second image file to the first storage medium can be understood as writing the raw data in the second image file to the eMMC storage medium.

[0065] For ease of understanding, the above method is illustrated with examples. Table 1 is a table showing the write speed of an eMMC for writing data of different lengths, provided in the embodiments of this application. Table 1 is shown below: Table 1

[0066] As shown in Table 1, the shorter the length of the written data, the lower the relative speed; when the written data reaches a certain length, the writing speed remains basically unchanged.

[0067] After erasing data in an eMMC, the data on the eMMC will be erased to 0. Table 2 shows the efficiency of erasing and writing 0 in an eMMC; Table 2 is shown below: Table 2

[0068] As shown in Table 2, for writing 0 data, erasing is significantly more efficient than writing.

[0069] The native flashing process allocates a 100-byte memory space (buf) for writing raw data, then copies the data to this memory space (buf) before writing it to the eMMC storage medium. Given the write speed of the eMMC storage medium, increasing the size of the memory space (buf) to 6MB can effectively improve the write speed.

[0070] Figure 3 This application provides an exemplary flowchart of raw data programming. Figure 3 As shown in the figure, the steps are as follows: 1. Is it fill data or raw data?

[0071] It should be noted that if the data is raw, proceed to step 2.

[0072] 2. Request a memory space buf with a size of 0x3000.

[0073] 3. Copy 0x3000 bytes to the memory space buf.

[0074] 4. Write the data in the memory space buf to the eMMC storage medium.

[0075] 5. Has the writing of all data been completed?

[0076] It should be noted that if not all data has been written, step 2 should be executed again.

[0077] As can be seen from the above comparison of eMMC erase rates, for writing zero data, using the erase method instead can effectively improve the efficiency of data writing. Figure 4 This application provides an exemplary schematic diagram of a fill data burning process; as shown in the embodiments of this application. Figure 4 As shown, the specific steps are as follows: 1. Is it fill data or raw data?

[0078] It should be noted that if the data is fill, then proceed to step 2.

[0079] 2. Fill in the data.

[0080] 3. Check if the fill data is 0.

[0081] It should be noted that if the fill data is 0, proceed to step 4; if the fill data is not 0, proceed to step 5.

[0082] 4. Erase the specified offset address and size of the eMMC storage medium.

[0083] 5. Write the filled data to the eMMC storage medium.

[0084] 6. Has the burning of a single sparse.img file been completed?

[0085] For ease of understanding, Figure 5 A schematic diagram illustrating an exemplary optimized image file burning process provided in this application embodiment; as shown Figure 5 As shown, the specific steps are as follows: 1. Fastboot begins burning the image file.

[0086] 2. Is the image file larger than FASTBOOT_BUF_SIZE?

[0087] It should be noted that if the image file is larger than FASTBOOT_BUF_SIZE, proceed to step 3; if the image file is smaller than or equal to FASTBOOT_BUF_SIZE, proceed to step 16.

[0088] 3. Split the image file into N sparse.img files.

[0089] 4. Start burning sparse.img.

[0090] 5. Is it fill data or raw data?

[0091] It should be noted that if the data is fill data, steps 6-9 are executed; if the data is raw data, steps 10-13 are executed.

[0092] 6. Fill in the data.

[0093] 7. Check if the fill data is 0.

[0094] It should be noted that if the fill data is 0, proceed to step 8; if the fill data is not 0, proceed to step 9.

[0095] 8. Erase the specified offset address and size of the eMMC storage medium.

[0096] 9. Write the filled data to the eMMC storage medium.

[0097] 10. Request a memory space buf with a size of 0x3000.

[0098] 11. Copy 0x3000 bytes to memory space buf.

[0099] 12. Write the data in the memory space buf to the eMMC storage medium.

[0100] 13. Has the writing of all data been completed?

[0101] It should be noted that if all data has been written, proceed to step 14; if not all data has been written, re-execute step 11.

[0102] 14. Has the burning of a single sparse.img file been completed?

[0103] It should be noted that if the burning of a single sparse.img file is completed, proceed to step 15; if the burning of a single sparse.img file is not completed, re-execute step 5.

[0104] 15. Has the burning of all sparse.img files been completed?

[0105] It should be noted that if all sparse.img files have been successfully burned, proceed to step 17; if not all sparse.img files have been successfully burned, re-execute step 4.

[0106] 16. Write raw data to eMMC storage medium.

[0107] 17. The image file burning process is complete.

[0108] For ease of understanding, this application provides a comparative example of flashing time, with the eMMC speed kept constant, the flashed image size kept constant at 8.25GB, and the same flashing tool used for image flashing, such as Spacemit flashing tool, Fastboot tool, etc. The following data uses Spacemit flashing tool as an example. Figure 6 A schematic diagram illustrating an exemplary programming time provided for embodiments of this application; as shown Figure 6 As shown, Figure 6 The burning time in the above-mentioned Figure 1 The programming scheme is obtained from the middle, from Figure 6 As can be seen from this, the writing time is 844 seconds (s). Figure 7 A schematic diagram illustrating another exemplary programming time provided for embodiments of this application; as shown below. Figure 7 As shown, Figure 7 The programming time is obtained using the programming scheme in the embodiments of this application, which can also be understood as using the above-mentioned programming scheme. Figure 5 The programming scheme is obtained from the middle, from Figure 7 As can be seen, the programming time is 515 seconds. For easier understanding, Table 3 compares the programming time before and after optimization, as shown below: Table 3

[0109] As shown in Table 3, the performance improvement is (844-515) / 844=38.98%. Furthermore, the optimization changes are essentially the same for the flashing process, preserving the logic of the original code and avoiding the introduction of unknown defects.

[0110] The solution in this application embodiment, based on the same eMMC storage medium's write rate and image size, ensures that the overall image burning rate is essentially consistent with the maximum write rate of the eMMC storage medium. Previously, the single write data volume in the burning process was 100, preventing the write rate from reaching its maximum. However, after applying the solution in this application embodiment, the write rate essentially reaches its maximum. Image files typically contain a significant amount of zero data, which the eMMC storage medium's erase function will erase to zero. For writing zero data, the erase method effectively improves the data write rate.

[0111] This application provides an image file burning device. Figure 8 This is a schematic diagram of a mirror file burning device provided in an embodiment of this application; as shown below. Figure 8 As shown, the image file burning device 800 includes: The acquisition unit 801 is used to acquire first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image. Filling unit 802 is used to fill the first data with the second data to obtain the third data; The first determining unit 803 is configured to determine a first writing method corresponding to the third data based on the second data and the first value; the first writing method includes at least writing to the first storage medium or erasing the first offset address and size in the first storage medium; the first value is 0; the first storage medium is an eMMC storage medium; The programming unit 804 is used to program the third data to the first storage medium according to the first programming method.

[0112] In some embodiments, the first determining unit 803 is further configured to, when the second data is a first value, use the method of erasing the first offset address and size in the first storage medium as the first burning method; and when the second data is not a first value, use the method of writing the third data into the first storage medium as the first burning method.

[0113] In some embodiments, the image file burning device 800 further includes a second determining unit; The acquisition unit 801 is further configured to acquire fourth data contained in the first image file; the fourth data is raw data. The second determining unit is used to determine the second burning method corresponding to the fourth data; The programming unit 804 is further configured to program the fourth data to the first storage medium based on the second programming method.

[0114] In some embodiments, the second determining unit is further configured to obtain a first memory space of a first size and copy the fourth data to the first memory space; the first size is 0×3000; and the method of writing the fourth data in the first memory space to the first storage medium is used as the second burning method.

[0115] In some embodiments, the second determining unit is further configured to obtain a first quantity of target data from the fourth data; copy the target data to the first memory space; and the first quantity matches the first size.

[0116] In some embodiments, before obtaining the first data contained in the first image file to be burned, the image file burning device 800 further includes a splitting unit for obtaining a second image file to be burned; if the second image file is larger than FASTBOOT_BUF_SIZE, the second image file is split into one or more first image files.

[0117] In some embodiments, the programming unit 804 is further configured to write the original data included in the second image file into the first storage medium when the second image file is less than or equal to the FASTBOOT_BUF_SIZE.

[0118] This application also provides an electronic device. Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; as shown below. Figure 9 As shown, the electronic device 900 includes a processor 901 and a memory 903. Optionally, the electronic device 900 may also include a communication bus 902.

[0119] In specific embodiments, the processor 901 described above can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), CPU, controller, microcontroller, and microprocessor. It is understood that for different devices, the electronic device used to implement the above processor function can also be other types, and this embodiment does not specifically limit it.

[0120] In this embodiment, the communication bus 902 is used to establish communication between the processor 901 and the memory 903; when the processor 901 executes the running program stored in the memory 903, it implements the following image file burning method: Obtain first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image; fill the first data with second data to obtain third data; determine the first burning method corresponding to the third data based on the second data and the first value; the first burning method includes at least writing to the first storage medium or erasing the first offset address and size in the first storage medium; the first value is 0; the first storage medium is an eMMC storage medium; burn the third data to the first storage medium according to the first burning method.

[0121] Furthermore, the processor 901 is also configured to, when the second data is a first value, use the method of erasing the first offset address and size in the first storage medium as the first writing method; and when the second data is not a first value, use the method of writing the third data into the first storage medium as the first writing method.

[0122] Furthermore, the processor 901 is also configured to acquire fourth data contained in the first image file; the fourth data is raw data; determine the second burning method corresponding to the fourth data; and burn the fourth data to the first storage medium based on the second burning method.

[0123] Furthermore, the processor 901 is also used to obtain a first memory space of a first size and copy the fourth data to the first memory space; the first size is 0×3000; the method of writing the fourth data in the first memory space to the first storage medium is used as the second burning method.

[0124] Furthermore, the processor 901 is also configured to obtain a first quantity of target data from the fourth data; copy the target data to the first memory space; and the first quantity matches the first size.

[0125] Furthermore, the processor 901 is also used to obtain a second image file to be burned; if the second image file is larger than FASTBOOT_BUF_SIZE, the second image file is divided into one or more first image files.

[0126] Furthermore, the processor 901 is also configured to write the original data included in the second image file into the first storage medium when the second image file is less than or equal to the FASTBOOT_BUF_SIZE.

[0127] This application provides a storage medium storing a computer program thereon. The computer-readable storage medium stores one or more programs, which can be executed by one or more processors. The computer program implements the image file burning method described above.

[0128] Based on the above embodiments, this application provides a computer program product, including a computer program that can be executed by one or more processors, and the computer program implements the image file burning method described above.

[0129] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause an image display device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.

[0131] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A method for burning image files, characterized in that, The method includes: Obtain the first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image. Fill the first data with the second data to obtain the third data; Based on the second data and the first value, a first programming method corresponding to the third data is determined; the first programming method includes at least writing to the first storage medium or erasing the first offset address and size within the first storage medium; the first value is 0; the first storage medium is an embedded multimedia card eMMC storage medium; The third data is written to the first storage medium according to the first writing method.

2. The method according to claim 1, characterized in that, The step of determining the first programming method corresponding to the third data based on the second data and the first value includes: When the second data is the first value, the method of erasing the first offset address and size in the first storage medium is taken as the first burning method; If the second data is not the first value, the method of writing the third data into the first storage medium shall be used as the first burning method.

3. The method according to claim 1, characterized in that, The method further includes: Obtain the fourth data contained in the first image file; the fourth data is the original raw data; Determine the second programming method corresponding to the fourth data; The fourth data is written to the first storage medium using the second writing method.

4. The method according to claim 3, characterized in that, The step of determining the second programming method corresponding to the fourth data includes: Obtain a first memory space of a first size, and copy the fourth data to the first memory space; the first size is 0×3000; The second burning method is to write the fourth data in the first memory space into the first storage medium.

5. The method according to claim 4, characterized in that, The step of copying the fourth data to the first memory space includes: Obtain a first quantity of target data from the fourth data; copy the target data to the first memory space; the first quantity matches the first size.

6. The method according to claim 1, characterized in that, Before obtaining the first data contained in the first image file to be burned, the process also includes: Obtain the second image file to be burned; If the second image file is larger than the fast startup cache size FASTBOOT_BUF_SIZE, the second image file is split into one or more of the first image files.

7. The method according to claim 6, characterized in that, The method further includes: If the second image file is less than or equal to the FASTBOOT_BUF_SIZE, the original data included in the second image file is written to the first storage medium.

8. A device for burning image files, characterized in that, The device includes: The acquisition unit is used to acquire the first data contained in the first image file to be burned; the first data is fill data; the first image file is a sparse image. A filling unit is used to fill the first data with the second data to obtain the third data; The first determining unit is configured to determine the first programming method corresponding to the third data based on the second data and the first value; the first programming method includes at least writing to the first storage medium or erasing the first offset address and size in the first storage medium; the first value is 0; the first storage medium is an embedded multimedia card eMMC storage medium; The programming unit is used to program the third data to the first storage medium according to the first programming method.

9. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the method according to any one of claims 1 to 7.

10. A computer program product comprising a computer program or computer-executable instructions, characterized in that, When the computer program or computer-executable instructions are executed by a processor, they implement the method described in any one of claims 1 to 7.