Method for solving problem of slow transmission during USB flash by using compressed mirror image mode

By compressing and cutting the image file on the flashing tool, using the gzip, lz4 or lzma algorithm, transmitting and decompressing it before burning, it solves the time-consuming problem of transmission and burning caused by USB2.0 bandwidth limitations and achieves a more efficient Flashing process.

CN118796240APending Publication Date: 2024-10-18JINDI SPACE TIME (ZHUHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410742346.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

The bandwidth limitation of USB2.0 causes the software image file transfer and burning process to take too long, especially due to the large size of the image file and the limited transfer rate, which cannot be effectively improved.

Method used

Using compressed image technology, the flash tool uses gzip, lz4 or lzma algorithms to compress the image file and transfer it to the device, and decompress it on the device for programming, reducing the amount of data and transmission time.

Benefits of technology

It significantly reduces the time-consuming USB transmission and programming, improves the overall flashing speed, and the decompression rate is much higher than the transmission rate of USB2.0, solving the USB performance bottleneck problem.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796240A_ABST
    Figure CN118796240A_ABST
Patent Text Reader

Abstract

The invention discloses a method for solving the problem of slow transmission during USB flash by using a mirror image compression mode. The method comprises the following steps: Step 1, selecting a compression algorithm according to comprehensive efficiency; 2, the tool end processes the mirror image when programming the mirror image, compresses the mirror image into data corresponding to a compression algorithm, and transmits the data to the equipment end through a USB; and step 3, after the device side receives the compressed mirror image, processing the compressed mirror image, detecting the compressed mirror image as data corresponding to the compression algorithm, decompressing the data, and then burning the data to a storage medium. According to the method, the mirror image is compressed into the gzip data through the flash tool end, the gzip data is transmitted to the equipment end through the USB, and after the gzip data is detected by the equipment end, the data is decompressed and then programmed to the storage medium, so that the overall flash speed is increased, the decompression rate of the equipment end is increased, the data volume transmission is reduced, and the programming time consumption caused by the USB performance bottleneck is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for solving the problem of slow transmission during USB flashing by using a compressed image. Background Art

[0002] As software applications become more and more complex, the size of their image files is also getting larger. If USB2.0 is used as a data transmission method, it will be limited by the bandwidth limitation of USB2.0, resulting in time-consuming data transmission to the device end.

[0003] To increase the transmission rate of the image, there are generally the following methods:

[0004] 1. Improve the USB transfer rate;

[0005] 2. Reduce the size of the image file.

[0006] Due to the bandwidth limitation of USB2.0, the maximum theoretical rate is 480Mb / s. In addition to the bandwidth loss of transmission, the maximum transmission rate is generally 30Mb / s. For downloading an 8GB image, it takes more than 4 minutes at the highest rate. And for desktop system firmware packages, the size is generally in the order of GB. Therefore, limited by the transmission performance of USB2.0 and the size of the image file, the time consumed for burning also increases. Summary of the invention

[0007] The purpose of the present invention is to provide a technical solution to the problem of slow transmission during USB flashing by compressing the image in order to solve the shortcomings of the prior art. The image is compressed into gzip data by the flashing tool end, and then transmitted to the device end via USB. After the device end detects it as gzip data, the data is decompressed and then burned to a storage medium, thereby improving the overall flashing speed, increasing the decompression rate of the device end, reducing the amount of data transmission, and thus reducing the burning time caused by the USB performance bottleneck.

[0008] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0009] A method for solving the problem of slow transmission when flashing a device via USB by using a compressed image, characterized by comprising the following steps:

[0010] Step 1. Select compression algorithm based on comprehensive efficiency;

[0011] Step 2: The tool processes the image when burning it, and compresses it into data corresponding to the compression algorithm and transmits it to the device via USB;

[0012] Step 3: After receiving the compressed image, the device processes it and detects it as data corresponding to the compression algorithm. It then decompresses the data and burns it to the storage medium.

[0013] Further, the compression algorithm in step S1 includes gzip, lz4 or lzma.

[0014] Furthermore, the comprehensive efficiency in step S1 includes compression, decompression and compression rate.

[0015] Further, the tool end in step S2 processes the image when burning the image, including the following steps:

[0016] Step 2.1 Get the single transmission size limit of the device end, set to A;

[0017] Step 2.2 determines whether the size of the image file is greater than A. If not, write it to the device and complete the image burning;

[0018] Step 2.3 If yes, cut the image file into N data files of size A;

[0019] Step 2.4 compress the data into a format corresponding to the compression algorithm;

[0020] Step 2.5 Write to the device;

[0021] Step 2.6 determines whether the burning of all data files is completed. If so, the image burning is completed;

[0022] If no in Step 2.7, jump to Step 2.3.

[0023] Further, the device end in step S3 receives the compressed image and processes it, including the following steps:

[0024] Step3.1 The device receives the image file;

[0025] Step 3.2 defines a static offset address addr_t;

[0026] Step 3.2 Define a static partition name part_t;

[0027] Step 3.3 determines whether it is data corresponding to the compression algorithm. If not, set the offset address addr_t to 0, set the partition name part_t to the partition name to be written, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size;

[0028] Step 3.4 If yes, determine whether the written partition name is consistent with addr_t. If yes, decompress the format data corresponding to the compression algorithm into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size;

[0029] Step 3.5 If not, set the offset address addr_t to 0, decompress the format data corresponding to the compression algorithm into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size.

[0030] The present invention has the following beneficial effects due to the adoption of the above technical solution:

[0031] Compared with the traditional image flashing, the present invention basically directly transmits the complete image file to the device end. The transmission performance of the present invention can reduce the time consumption of flashing.

[0032] The flashing tool of the present invention can compress data in a multi-threaded manner, and the decompression rate of the device end is much higher than the transmission rate of USB2.0.

[0033] The USB transmission of the present invention is a compressed image, which reduces the amount of data transmission, thereby reducing the burning time caused by the USB performance bottleneck. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The present invention will be further described below in conjunction with the accompanying drawings:

[0035] Figure 1 A flowchart of a method for solving the problem of slow transmission when flashing a USB device by using a compressed image in the present invention;

[0036] Figure 2 It is a schematic diagram of the process of image processing by the tool end when burning the image in the present invention;

[0037] Figure 3 It is a schematic diagram of the process flow of processing after the device receives the compressed image in the present invention. DETAILED DESCRIPTION

[0038] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0041] like Figure 1 As shown in the figure, a method for solving the slow transmission when flashing a USB device by using a compressed image is provided in the present invention, comprising the following steps:

[0042] Step 1. Select compression algorithm based on comprehensive efficiency;

[0043] The compression algorithm includes gzip, lz4 or lzma. The overall efficiency includes compression, decompression and compression ratio.

[0044] By comparing gzip, lz4 or lzma compression algorithms, this application prefers gzip as the optimal compression algorithm to improve the overall flashing speed.

[0045] Taking an 8.25GB image with a USB transfer rate of 26MB / s as an example, the image data after compression using gzip is 2466MB, and the total time consumed for decompression and USB transfer is reduced by 46% compared to the original, as shown in Table 1.

[0046]

[0047] Table 1

[0048] The time consumption comparison of various compression algorithms is shown in Table 2

[0049] Compression Algorithm File size (MB) Compressed file size (MB) Compression Compression time(s) Decompression time(s) gzip 256 106 41.41% 12.5 3.215 lz4 256 142 55.47% 0.8 2.403 lmao 256 76 29.69% 2min14s 23.379

[0050] Table 2

[0051] Step 2: The tool processes the image when burning it, and compresses it into data corresponding to the compression algorithm and transmits it to the device via USB;

[0052] The tool side processes the image when burning the image, including the following steps:

[0053] Step 2.1 Get the single transmission size limit of the device, set it as A, and take A as 128MB;

[0054] Step 2.2 Determine whether the size of the image file is greater than 128MB. If not, write it to the device and complete the image burning;

[0055] Step 2.3 If yes, cut the image file into N data files of 128MB each;

[0056] Step 2.4 compress the data into gzip format;

[0057] Step 2.5 Write to the device;

[0058] Step 2.6 determines whether the burning of all data files is completed. If so, the image burning is completed;

[0059] If no in Step 2.7, jump to Step 2.3.

[0060] The flashing tool will first obtain the device's single transmission size limit, such as 128MB, for image file cutting. The flashing tool runs in the background in a multi-threaded manner, splits the file data into N 128MB files, and compresses the data files into gzip format. The flashing tool burns the generated gzip format files to the device.

[0061] Step 3: After receiving the compressed image, the device processes it and detects it as data corresponding to the compression algorithm. It then decompresses the data and burns it to the storage medium.

[0062] After receiving the compressed image, the device performs the following processing:

[0063] Step3.1 The device receives the image file;

[0064] Step 3.2 defines a static offset address addr_t;

[0065] Step 3.2 Define a static partition name part_t;

[0066] Step 3.3 determines whether it is gzip data. If not, set the offset address addr_t to 0, set the partition name part_t to the partition name to be written, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size;

[0067] Step 3.4 If yes, determine whether the written partition name is consistent with addr_t. If yes, decompress the gzip format data into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size;

[0068] Step 3.5 If not, set the offset address addr_t to 0, decompress the gzip format data into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size.

[0069] After receiving the image file, the device will set a static variable to record the partition offset address and partition name of the burned image. For continuous burning of compressed images of the same partition, the partition offset will be accumulated, and the large image file will eventually be written to the specified partition. At this time, since the USB transmission is in compressed format, the amount of data transmitted is reduced, thereby reducing the time consumption of USB data transmission.

[0070] The above are only specific embodiments of the present invention, but the technical features of the present invention are not limited thereto. Any simple changes, equivalent replacements or modifications made based on the present invention to achieve basically the same technical effects are all included in the protection scope of the present invention.

Claims

1. A method for solving the problem of slow transmission when flashing a device via USB by using a compressed image, characterized in that The steps include: Step 1. Select compression algorithm based on comprehensive efficiency; Step 2: The tool processes the image when burning it, and compresses it into data corresponding to the compression algorithm and transmits it to the device via USB; Step 3: After receiving the compressed image, the device processes it and detects it as data corresponding to the compression algorithm. It then decompresses the data and burns it to the storage medium.

2. The method of solving the problem of slow transmission when flashing a device via USB by using a compressed image according to claim 1, characterized in that: The compression algorithm in step S1 includes gzip, lz4 or lzma.

3. The method for solving the problem of slow transmission when flashing a device via USB by using a compressed image according to claim 1, characterized in that: The comprehensive efficiency in step S1 includes compression, decompression and compression rate.

4. The method for solving the slow transmission problem when flashing a device via USB by using a compressed image according to claim 1, characterized in that: The tool end in step S2 processes the image when burning the image, including the following steps: Step 2.1 Get the single transmission size limit of the device end, set to A; Step 2.2 determines whether the size of the image file is greater than A. If not, write it to the device and complete the image burning; Step 2.3 If yes, cut the image file into N data files of size A; Step 2.4 compress the data into a format corresponding to the compression algorithm; Step 2.5 Write to the device; Step 2.6 determines whether the burning of all data files is completed. If so, the image burning is completed; If no in Step 2.7, go to Step 2.

3.

5. The method of solving the slow transmission problem when flashing a device via USB by using a compressed image according to claim 1, characterized in that: After receiving the compressed image in step S3, the device performs the following processing: Step3.1 The device receives the image file; Step 3.2 defines a static offset address addr_t; Step 3.2 defines a static partition name part_t; Step 3.3 determines whether it is data corresponding to the compression algorithm. If not, set the offset address addr_t to 0, set the partition name part_t to the partition name to be written, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size; Step 3.4 If yes, determine whether the written partition name is consistent with addr_t. If yes, decompress the format data corresponding to the compression algorithm into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size; Step 3.5 If not, set the offset address addr_t to 0, decompress the format data corresponding to the compression algorithm into an image file, write the image file to the offset address addr_t of the partition, and complete the image burning by adding the offset address addr_t to the image file size.