Software upgrade package generation and verification method, device, equipment and medium
Patent Information
- Application Number
- CN202510353573.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2026-09-25
AI Technical Summary
[0003]在快节奏的软件集成基础上,容易出现软件包上传错误的情况
[0061]本发明实施例的软件升级包生成方法,通过版本控制策略确定多个版本校验字段以及该多个版本校验字段对应的值,分别将多个版本校验字段对应的值写入待升级电子控制单元的第一升级包文件的第一指定地址,从而获得第二升级包文件,该第二升级包文件不仅包括用于对待升级电子控制单元进行升级的代码还包括用于对该升级包的进行校验的多个版本校验字段。该方法在升级包中内置多个版本校验字段,通过该多个版本校验字段对升级包进行校验,可以避免将错误的升级包刷写到待升级电子控制单元上,从而避免资源浪费,同时,通过多个版本校验字段可以提高校验的准确性和有效性,保证了终端升级的安全性。
Smart Images

Figure CN122816656A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for generating and verifying software upgrade packages. Background Technology
[0002] As the electronic and electrical architecture of intelligent vehicles has become increasingly complex in recent years, OEMs are choosing to use more ECUs (Electronic Control Units) to achieve integrated functionality. Currently, a single car may contain up to a hundred ECUs. Under the current agile development and verification methods in automobiles, the total number and frequency of ECU upgrade packages uploaded / created during the vehicle development process have surged.
[0003] In the fast-paced environment of software integration, errors in software package uploads are common. Currently, software package version information is typically identified by the software upgrade package name, but this may not match the version information in the actual upgrade file. This can lead to incorrect software upgrade packages being flashed onto vehicles, reducing development efficiency, wasting unnecessary resources, and in severe cases, even causing vehicle safety accidents. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, embodiments of the present invention provide a software upgrade package generation method, a software upgrade package verification method, a software upgrade method, an apparatus, a device, and a medium.
[0005] In a first aspect, embodiments of the present invention provide a method for generating a software upgrade package, comprising:
[0006] Obtain a first upgrade package file for the electronic control unit to be upgraded, the first upgrade package file including code for upgrading the electronic control unit to be upgraded;
[0007] Based on the version control policy, determine multiple version verification fields and the values corresponding to the multiple version verification fields;
[0008] Write the values corresponding to the multiple version verification fields to the first designated address of the first upgrade package file to obtain the second upgrade package file.
[0009] Optionally, multiple version verification fields may be determined according to the version control policy, including: determining multiple version verification fields based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file.
[0010] Optionally, the method further includes: calculating the code in the first upgrade package file to obtain a first verification code;
[0011] The step of writing the values corresponding to the plurality of version verification fields to a first designated address of the first upgrade package file to obtain a second upgrade package file includes: writing the values corresponding to the plurality of version verification fields to a first designated address of the first upgrade package file, and writing the first verification code to a second designated address of the first upgrade package file to obtain a second upgrade package file.
[0012] Optionally, the method further includes:
[0013] The code in the first upgrade package file is concatenated with the values of the multiple version verification fields to obtain verification data;
[0014] The verification data is calculated to obtain a second verification code;
[0015] The step of writing the values corresponding to the plurality of version verification fields to a first designated address in the first upgrade package file to obtain the second upgrade package file includes:
[0016] The values corresponding to the multiple version verification fields are written to the first designated address of the first upgrade package file, and the second verification code is written to the third designated address of the first upgrade package file to obtain the second upgrade package file.
[0017] Optionally, the verification fields include one or more of the following: electronic control unit name, software version number, software ID, and communication matrix version information.
[0018] Secondly, embodiments of the present invention provide a software upgrade package verification method, including:
[0019] In response to a software upgrade package verification command, obtain a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification command;
[0020] Obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and obtain the expected values of the multiple version verification fields from the verification standard file;
[0021] The actual value and expected value of each version verification field are compared respectively. If the actual value and expected value of each version verification field are the same, the upgrade package to be verified is determined to have passed the verification.
[0022] Optionally, the verification standard file includes a third verification code, which is used to verify the first verification code at the second specified address in the upgrade package to be verified.
[0023] The method further includes: obtaining a first verification code from a second designated address of the upgrade package to be verified; obtaining a third verification code from the verification standard file; and comparing the first verification code and the third verification code.
[0024] The step of determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value includes: determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value and the first verification code is the same as the third verification code.
[0025] Optionally, the verification standard file further includes a fourth verification code, which is used to verify the second verification code at the third specified address in the upgrade package to be verified;
[0026] The method further includes: obtaining a second verification code from a third designated address of the upgrade package to be verified; obtaining a fourth verification code from the verification standard file; and comparing the second verification code and the fourth verification code.
[0027] The step of determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value includes: determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value and the second verification code is the same as the fourth verification code.
[0028] Thirdly, embodiments of the present invention provide a software upgrade method, including:
[0029] In response to a software upgrade command, obtain the verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade command;
[0030] Based on the aforementioned verification standard file, the version of the upgrade package to be verified is verified.
[0031] If all the upgrade packages to be verified pass the version verification, the upgrade packages to be verified will be integrated into the baseline.
[0032] In response to the full push command, obtain the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified;
[0033] The expected verification information and the actual verification information are compared. If the expected verification information and the actual verification information are the same, it is determined that all the upgrade packages to be verified have passed the verification, and the upgrade packages to be verified are pushed to the electronic control unit to be upgraded.
[0034] Fourthly, embodiments of the present invention provide a software upgrade package generation apparatus, comprising:
[0035] The first acquisition module is used to acquire a first upgrade package file of the electronic control unit to be upgraded, the first upgrade package file including code for upgrading the electronic control unit to be upgraded.
[0036] The version determination module is used to determine multiple version verification fields and the values corresponding to the multiple version verification fields according to the version control strategy.
[0037] The upgrade package generation module is used to write the values corresponding to the multiple version verification fields into the first specified address of the first upgrade package file to obtain the second upgrade package file.
[0038] Optionally, the version determination module is used to: determine multiple version verification fields based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file.
[0039] Optionally, the device further includes a first verification code generation module, used to: calculate the code in the first upgrade package file to obtain a first verification code;
[0040] The upgrade package generation module is further configured to: write the values corresponding to the plurality of version verification fields to a first designated address of the first upgrade package file, and write the first verification code to a second designated address of the first upgrade package file to obtain a second upgrade package file.
[0041] Optionally, the device further includes a second verification code generation module, configured to: concatenate the code in the first upgrade package file with the values of the plurality of version verification fields to obtain verification data; and calculate the verification data to obtain a second verification code.
[0042] The upgrade package generation module is further configured to: write the values corresponding to the plurality of version verification fields to a first designated address of the first upgrade package file, and write the second verification code to a third designated address of the first upgrade package file to obtain a second upgrade package file.
[0043] Fifthly, embodiments of the present invention provide a software upgrade package verification device, comprising:
[0044] The second acquisition module is used to acquire, in response to the software upgrade package verification instruction, a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification instruction;
[0045] The parsing module is used to obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and to obtain the expected values of the multiple version verification fields from the verification standard file.
[0046] The judgment module is used to compare the actual value and the expected value of each version verification field. If the actual value and the expected value of the version verification field are the same, the upgrade package to be verified is determined to have passed the verification.
[0047] Optionally, the verification standard file includes a third verification code, which is used to verify the first verification code at the second specified address in the upgrade package to be verified.
[0048] The parsing module is further configured to: obtain a first verification code from the second specified address of the upgrade package to be verified; obtain a third verification code from the verification standard file; the judgment module is further configured to: compare the first verification code and the third verification code; and determine that the upgrade package to be verified has passed verification if the actual value of the version verification field is the same as the expected value and the first verification code is the same as the third verification code.
[0049] Optionally, the verification standard file further includes a fourth verification code, which is used to verify the second verification code at the third specified address in the upgrade package to be verified;
[0050] The parsing module is further configured to: obtain a second verification code from the third specified address of the upgrade package to be verified; obtain a fourth verification code from the verification standard file; the judgment module is further configured to: compare the second verification code and the fourth verification code; and determine that the upgrade package to be verified has passed verification if the actual value of the version verification field is the same as the expected value and the second verification code is the same as the fourth verification code.
[0051] Sixthly, embodiments of the present invention provide a software upgrade apparatus, comprising:
[0052] The third acquisition module is used to acquire, in response to a software upgrade command, a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade command.
[0053] The first verification module is used to perform version verification on the upgrade package to be verified based on the verification standard file.
[0054] The baseline integration module is used to integrate the upgrade packages to be verified into the baseline when all the upgrade packages to be verified pass the version verification.
[0055] The fourth acquisition module is used to respond to the full push command to acquire the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified.
[0056] The second verification module is used to compare the expected verification information with the actual verification information. If the expected verification information and the actual verification information are the same, it determines that all the upgrade packages to be verified have passed the verification and pushes the upgrade packages to be verified to the electronic control unit to be upgraded.
[0057] Optionally, the real verification information includes one or more of the following: the name, quantity, and file timestamp of the upgrade package to be verified, wherein the file timestamp is used to indicate the time when the upgrade package to be verified was generated.
[0058] In a seventh aspect, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor, when executing the program stored in the memory, implements the software upgrade package generation method, the software upgrade package verification method, or the software upgrade method provided in any embodiment of the present invention.
[0059] Eighthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the software upgrade package generation method, software upgrade package verification method, or software upgrade method provided in any embodiment of the present invention.
[0060] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0061] The software upgrade package generation method of this invention determines multiple version verification fields and their corresponding values through a version control strategy. The values corresponding to these multiple version verification fields are then written to a first designated address in the first upgrade package file of the electronic control unit to be upgraded, thereby obtaining a second upgrade package file. This second upgrade package file includes not only code for upgrading the electronic control unit but also multiple version verification fields for verifying the upgrade package. This method embeds multiple version verification fields within the upgrade package. Verifying the upgrade package using these multiple version verification fields avoids writing erroneous upgrade packages to the electronic control unit to be upgraded, thus preventing resource waste. Furthermore, the multiple version verification fields improve the accuracy and effectiveness of the verification, ensuring the security of the terminal upgrade. Attached Figure Description
[0062] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0063] Figure 1 A flowchart illustrating a software upgrade package generation method according to an embodiment of the present invention is shown;
[0064] Figure 2 A flowchart illustrating a software upgrade package generation method according to another embodiment of the present invention is shown;
[0065] Figure 3 A flowchart illustrating a software upgrade package generation method according to another embodiment of the present invention is shown;
[0066] Figure 4 A flowchart illustrating a software upgrade package verification method according to an embodiment of the present invention is shown;
[0067] Figure 5 A flowchart illustrating a software upgrade method according to an embodiment of the present invention is shown;
[0068] Figure 6 A schematic diagram of the structure of a software upgrade package generation apparatus according to an embodiment of the present invention is shown;
[0069] Figure 7 A schematic diagram of the structure of a software upgrade package verification device according to an embodiment of the present invention is shown;
[0070] Figure 8 A schematic diagram of the structure of a software upgrade device according to an embodiment of the present invention is shown;
[0071] Figure 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. Detailed Implementation
[0072] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0073] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0074] Figure 1A flowchart illustrating a method for generating a software upgrade package according to an embodiment of the present invention is shown. This method can be applied to an electronic device capable of generating software upgrade packages, which can modify the software upgrade package, for example, by adding data to it. The software upgrade package (hereinafter referred to as the upgrade package) refers to a software package containing a series of updates and improvements for upgrading an existing software version to a higher version. Optionally, the software upgrade package contains all necessary files and settings to ensure that users can retain all the functionality of the current version while obtaining the new features of the new version and fixing previously existing problems.
[0075] like Figure 1 As shown, the method for generating the software upgrade package includes:
[0076] Step S101: Obtain the first upgrade package file of the electronic control unit to be upgraded. The first upgrade package file includes code for upgrading the electronic control unit to be upgraded.
[0077] An Electronic Control Unit (ECU) is a crucial component in a car, often referred to as the car's "brain." It processes information collected by various sensors based on preset programs and data, and outputs commands to control various parts of the car, thereby controlling its functions. The ECU to be upgraded can be any ECU in the car that requires a software update. The first upgrade package file contains the code for updating the software in the ECU to be upgraded. The format of the first upgrade package file can correspond to the type of ECU to be upgraded; this invention does not impose any limitations. As an optional example, the format of the first upgrade package file can be .s19 (.s19 files are a type of S-record format, mainly used for embedded system programming and microcontroller programming), .hex (.hex files are a common burning file format used to burn program code into non-volatile memory), .lbf (.lbf files are used for specific binary data storage or configuration files), etc.
[0078] It is worth noting that the first upgrade package file also includes at least one reserved address range (e.g., a first specified address, a second specified address, a third specified address, etc.). This reserved address range can be used to add information for verifying the upgrade package version and / or verifying information for the code used to upgrade the software. The code included in the first upgrade package will not occupy this reserved address range. The length of this reserved address range can be flexibly set according to the application scenario, and this invention does not impose any limitations on it. As an optional example, the length of this reserved address range can be 8 bytes.
[0079] Step S102: Determine multiple version verification fields and their corresponding values according to the version control policy.
[0080] The version control policy specifies several fields used for version verification (i.e., version verification fields) and how each field should be assigned a value. This version control policy manages the version information of software upgrade packages. Version verification fields must be stored at a specific address within the upgrade package file and be accessible through that address. The method for assigning values to version verification fields remains consistent with the design of each software version.
[0081] As an optional example, the version control policy indicates that the version verification fields include one or more of the following: Electronic Control Unit Name (ECUName), Software Version Number (VersionNumber), Software ID (SoftwareId), and Communication Matrix Version Information (DBCVersion). The Communication Matrix (DataBase Container, DBC) is a format used to describe messages and signals in a CAN bus network (CAN bus is a serial communication protocol). It is a database file, typically composed of communication and signal definitions in the CAN network, and can be used to configure and manage the communication protocol on the CAN bus.
[0082] Step S103: Write the values corresponding to the multiple version verification fields to the first designated address of the first upgrade package file to obtain the second upgrade package file. The second upgrade package file includes not only the code for upgrading the electronic control unit to be upgraded, but also multiple version verification fields for verifying the upgrade package. These multiple version verification fields can identify the version of the upgrade package file, preventing incorrect upgrade packages from being flashed onto the electronic control unit to be upgraded.
[0083] The software upgrade package generation method of this invention determines multiple version verification fields and their corresponding values through a version control strategy. The values corresponding to these multiple version verification fields are then written to a first designated address in the first upgrade package file of the electronic control unit to be upgraded, thereby obtaining a second upgrade package file. This second upgrade package file includes not only code for upgrading the electronic control unit but also multiple version verification fields for verifying the upgrade package. This method embeds multiple version verification fields within the upgrade package. Verifying the upgrade package using these multiple version verification fields avoids writing erroneous upgrade packages to the electronic control unit to be upgraded, thus preventing resource waste. Furthermore, the multiple version verification fields improve the accuracy and effectiveness of the verification, ensuring the security of the terminal upgrade.
[0084] In some optional embodiments, the values corresponding to all version verification fields indicated by the version control policy can be added to the first upgrade package file. In other optional embodiments, the values corresponding to only some version verification fields indicated by the version control policy can be added to the first upgrade package file.
[0085] As an optional example, the number of version verification fields to be added to the first upgrade package file can be determined based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file. For example, for one type of electronic control unit, the version verification fields required for its corresponding upgrade package include the electronic control unit name, software version number, software ID, and communication matrix version information; for another type of electronic control unit, the version verification fields required for its upgrade package include the software version number and communication matrix version information. As another example, if the first upgrade package file is an APP upgrade file, the required version verification fields include the electronic control unit name, software version number, software ID, and communication matrix version information. If the first upgrade package file is a BT upgrade file, the required version verification fields include the software version number and communication matrix version information.
[0086] This embodiment determines multiple version verification fields to be added to the first upgrade package file based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file. Different version verification fields can be added for different electronic control units or different types of upgrade packages. For upgrade packages with some version verification fields added, the size of the upgrade package can be reduced, thereby reducing the network resource requirements during software upgrades.
[0087] Figure 2 A flowchart illustrating a software upgrade package generation method according to another embodiment of the present invention is shown. Figure 2 As shown, the method includes:
[0088] Step S201: Obtain the first upgrade package file of the electronic control unit to be upgraded. The first upgrade package file includes code for upgrading the electronic control unit to be upgraded.
[0089] Step S202: Based on the version control policy, determine multiple version verification fields and their corresponding values.
[0090] Step S203: Calculate the code in the first upgrade package file to obtain the first verification code.
[0091] Step S204: Write the values corresponding to the multiple version verification fields to the first designated address of the first upgrade package file, and write the first verification code to the second designated address of the first upgrade package file to obtain the second upgrade package file.
[0092] Steps S201-S202 can be referred to Figure 1 The steps S101-S102 shown are not described again here.
[0093] For steps S203-S204, in this embodiment, the version verification field in the second upgrade package file can be used to verify the version of the upgrade package file, and the first verification code can be used to verify the code in the upgrade package file to identify whether the code has been tampered with. Optionally, a Cyclic Redundancy Check (CRC) or a hash algorithm can be used to calculate the code in the first upgrade package file to obtain the first verification code.
[0094] The software upgrade package generation method provided in this invention writes the values corresponding to multiple version verification fields to a first designated address of a first upgrade package file of the electronic control unit to be upgraded, and writes a first verification code to a second designated address of the first upgrade package file, thereby obtaining a second upgrade package file. This second upgrade package file includes not only code for upgrading the electronic control unit to be upgraded, but also multiple version verification fields for verifying the version of the upgrade package and a first verification code for verifying the code within the upgrade package. This method incorporates multiple version verification fields into the upgrade package, and by verifying the upgrade package using these fields, it avoids writing erroneous upgrade packages to the electronic control unit to be upgraded, thus preventing resource waste. Simultaneously, the first verification code can identify whether the code in the upgrade package has been tampered with, ensuring the validity of the code.
[0095] Figure 3 A flowchart illustrating a software upgrade package generation method according to another embodiment of the present invention is shown. Figure 3 As shown, the method includes:
[0096] Step S301: Obtain the first upgrade package file of the electronic control unit to be upgraded. The first upgrade package file includes code for upgrading the electronic control unit to be upgraded.
[0097] Step S302: Based on the version control policy, determine multiple version verification fields and their corresponding values.
[0098] Step S303: Concatenate the code in the first upgrade package file with the values of multiple version verification fields to obtain verification data.
[0099] Step S304: Calculate the verification data to obtain the second verification code.
[0100] Step S305: Write the values corresponding to the multiple version verification fields to the first specified address of the first upgrade package file, and write the second verification code to the third specified address of the first upgrade package file to obtain the second upgrade package file.
[0101] Steps S301-S302 can be referred to Figure 1 The steps S101-S102 shown are not described again here.
[0102] For steps S303-S305, in this embodiment, the code in the first upgrade package file is concatenated with the values of multiple version verification fields, and the concatenated data is used as verification data. The verification data is then used to calculate the second verification code. Figure 2 The first checksum shown only applies to the code in the upgrade package file, while Figure 3 The second checksum shown applies to the code and multiple version checksum fields in the upgrade package file as a whole. This second checksum can verify the code and multiple version checksum fields in the upgrade package file as a whole.
[0103] Figure 4 A flowchart illustrating a software upgrade package verification method according to an embodiment of the present invention is shown. Figure 4 As shown, the method includes:
[0104] Step S401: In response to the software upgrade package verification command, obtain the verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification command.
[0105] The verification standard file is used to verify the upgrade package file, and it includes expected values for multiple version verification fields. This verification standard file can be provided by the initiator of the software upgrade package verification process. Optionally, the name of the verification standard file corresponds to the name of the upgrade package to be verified, and the corresponding verification standard file can be obtained through the name of the upgrade package to be verified. Again, optionally, the filename and extension of the verification standard file are case-sensitive, and the name must match that of the upgrade package to be verified.
[0106] Step S402: Obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and obtain the expected values of multiple version verification fields from the verification standard file.
[0107] Step S403: Compare the actual value and expected value of the verification field for each version. If the actual value and expected value of the version verification field are the same, the upgrade package to be verified is determined to have passed the verification.
[0108] For example, if the version verification fields included in the upgrade package to be verified include the electronic control unit name, software version number, software ID, and communication matrix version information, then the actual values and expected values of the electronic control unit name, software version number, software ID, and communication matrix version information are compared one by one. If the actual values and expected values of all version verification fields are the same, the upgrade package is determined to have passed verification; otherwise, the upgrade package fails verification. If the upgrade package fails verification, it indicates that there is a version issue with the upgrade package, and the developers need to make changes until verification passes.
[0109] The software upgrade package verification method of this invention verifies the version of the upgrade package by comparing the actual value of the version verification field in the upgrade package with the expected value. This can prevent the version information from being maliciously tampered with, avoid writing incorrect upgrade packages to the electronic control unit, and ensure the accuracy of subsequent upgrades.
[0110] In optional embodiments (e.g.) Figure 2 In the aforementioned embodiment, the upgrade package to be verified further includes a first verification code. When verifying the upgrade package, the code included in the upgrade package is verified using this first verification code. Optionally, the verification standard file further includes a third verification code, which is used to verify the first verification code at a second specified address in the upgrade package. Therefore, the software upgrade package verification method further includes: obtaining the first verification code from the second specified address of the upgrade package; obtaining the third verification code from the verification standard file; and comparing the first verification code and the third verification code. If the actual value of the version verification field is the same as the expected value, and the first verification code and the third verification code are the same, the upgrade package is determined to have passed verification. If the actual value of the version verification field is the same as the expected value, and the first verification code and the third verification code are different, the upgrade package is determined to have failed verification.
[0111] In optional embodiments (e.g.) Figure 3In the aforementioned embodiment, the upgrade package to be verified further includes a second verification code. When verifying the upgrade package, the second verification code is used to verify the code and version verification fields included in the upgrade package. Optionally, the verification standard file further includes a fourth verification code, which is used to verify the second verification code at a third specified address in the upgrade package. Therefore, the software upgrade package verification method further includes: obtaining the second verification code from the third specified address of the upgrade package if the actual values of all version verification fields are the same as the expected values; obtaining the fourth verification code from the verification standard file; and comparing the second verification code and the fourth verification code. If the actual values of the version verification fields are the same as the expected values, and the second verification code and the fourth verification code are the same, the upgrade package is determined to have passed verification. If the actual values of the version verification fields are the same as the expected values, and the second verification code and the fourth verification code are different, the upgrade package is determined to have failed verification.
[0112] Figure 5 A flowchart illustrating a software upgrade method according to an embodiment of the present invention is shown. Figure 5 As shown, the software upgrade method includes:
[0113] Step S501: In response to the software upgrade command, obtain the verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade command. Optionally, the name of the verification standard file corresponds to the name of the upgrade package to be verified, and the corresponding verification standard file can be obtained through the name of the upgrade package to be verified.
[0114] Step S502: Based on the verification standard file, perform version verification on the upgrade package to be verified. This step S502 can be referenced... Figure 4 The embodiments shown are not described in detail here to avoid repetition.
[0115] Step S503: If all upgrade packages to be verified pass version verification, integrate them into the baseline. In software engineering, a baseline is a stable version of software documentation or source code (or other deliverables).
[0116] Step S504: In response to the full push command, obtain the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified. The full push command instructs the upgrade package integrated into the baseline to be pushed to the electronic control unit to be upgraded. The actual verification information is used to further verify the upgrade package to be pushed. Optionally, the actual verification information may include one or more of the following: the name, quantity, and file timestamp of the upgrade package to be verified, where the file timestamp can be used to indicate the time when the upgrade package to be verified was generated. The expected verification information may include the expected name, quantity, and file timestamp of the upgrade package to be verified.
[0117] In this embodiment, the name and file timestamp of the upgrade package to be verified can be backed up when the upgrade package is generated, in order to obtain the actual verification information. It is expected that the verification information can be provided by the person initiating the full rollout process.
[0118] Step S505: Compare the expected verification information with the actual verification information. If the expected verification information and the actual verification information are the same, determine that all upgrade packages to be verified have passed the verification, and push the upgrade packages to be verified to the electronic control unit to be upgraded.
[0119] This step compares the values of each item in the expected verification information with the actual verification information. For example, first, it compares whether the actual name of each upgrade package to be verified is the same as the expected name. If the names are the same, it compares the actual quantity of upgrade packages to be verified with the expected quantity. If the quantities are the same, it compares the actual file timestamp of each upgrade package to be verified with the expected file timestamp. If the file timestamps are the same, it can be determined that the upgrade package to be verified has passed verification, and the upgrade package to be verified can be pushed to the electronic control unit to be upgraded.
[0120] The software upgrade method of this invention verifies the upgrade package to be verified according to a verification standard file before integrating it into the baseline, and further verifies it according to expected verification information before pushing it to the electronic control unit to be upgraded. This can prevent incorrect upgrade packages from being incorrectly flashed onto the vehicle. This method, through pre-verification, avoids the need for re-flashing the electronic control unit after incorrect upgrade packages have been flashed, greatly reducing the probability of re-flashing and effectively improving upgrade efficiency.
[0121] In an optional embodiment, the expected verification information may also include the encryption status of the upgrade packages to be verified. For example, the expected verification information may indicate that some upgrade packages are encrypted while others are not. Therefore, in comparing the expected verification information and the actual verification information, this software upgrade method also includes verifying whether the encryption status of all upgrade packages to be verified is consistent with the encryption status indicated by the expected verification information.
[0122] Figure 6 A schematic diagram of the structure of a software upgrade package generation apparatus according to an embodiment of the present invention is shown. Figure 6 As shown, the software upgrade package generation device 600 includes:
[0123] The first acquisition module 601 is used to acquire the first upgrade package file of the electronic control unit to be upgraded. The first upgrade package file includes code for upgrading the electronic control unit to be upgraded.
[0124] Version determination module 602 is used to determine multiple version verification fields and their corresponding values according to the version control policy.
[0125] The upgrade package generation module 603 is used to write the values corresponding to multiple version verification fields into the first specified address of the first upgrade package file to obtain the second upgrade package file.
[0126] Optionally, a version determination module is used to: determine multiple version verification fields based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file.
[0127] Optionally, the device further includes a first verification code generation module, used to: calculate the code in the first upgrade package file to obtain a first verification code;
[0128] The upgrade package generation module is also used to: write the values corresponding to multiple version verification fields to the first specified address of the first upgrade package file, and write the first verification code to the second specified address of the first upgrade package file to obtain the second upgrade package file.
[0129] Optionally, the device further includes a second verification code generation module, used to: concatenate the code in the first upgrade package file with the values of multiple version verification fields to obtain verification data; and calculate the verification data to obtain a second verification code;
[0130] The upgrade package generation module is also used to: write the values corresponding to multiple version verification fields to the first specified address of the first upgrade package file, and write the second verification code to the third specified address of the first upgrade package file to obtain the second upgrade package file.
[0131] The software upgrade package generation apparatus described above can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the software upgrade package generation method provided in the embodiments of the present invention.
[0132] Figure 7 A schematic diagram of the structure of a software upgrade package verification device according to an embodiment of the present invention is shown. Figure 7 As shown, the software upgrade package verification device 700 includes:
[0133] The second acquisition module 701 is used to acquire, in response to the software upgrade package verification instruction, a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification instruction.
[0134] The parsing module 702 is used to obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and to obtain the expected values of multiple version verification fields from the verification standard file.
[0135] The judgment module 703 is used to compare the actual value and the expected value of the verification field of each version. If the actual value and the expected value of the version verification field are the same, it is determined that the upgrade package to be verified has passed the verification.
[0136] Optionally, the verification standard file may also include a third verification code, which is used to verify the first verification code at the second specified address in the upgrade package to be verified.
[0137] The parsing module is also used to: obtain the first verification code from the second specified address of the upgrade package to be verified; obtain the third verification code from the verification standard file; the judgment module is also used to: compare the first verification code and the third verification code; if the actual value of all version verification fields is the same as the expected value, and the first verification code is the same as the third verification code, then the upgrade package to be verified is determined to have passed the verification.
[0138] Optionally, the verification standard file also includes a fourth verification code, which is used to verify the second verification code at the third specified address in the upgrade package to be verified.
[0139] The parsing module is also used to: obtain the second verification code from the third specified address of the upgrade package to be verified; obtain the fourth verification code from the verification standard file; the judgment module is also used to: compare the second verification code and the fourth verification code; if the actual value of all version verification fields is the same as the expected value, and the second verification code is the same as the fourth verification code, then the upgrade package to be verified is determined to have passed the verification.
[0140] The software upgrade package verification device described above can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the software upgrade package verification method provided in the embodiments of the present invention.
[0141] Figure 8 A schematic diagram of the structure of a software upgrade device according to an embodiment of the present invention is shown. Figure 8 As shown, the software upgrade device 800 includes:
[0142] The third acquisition module 801 is used to acquire the verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade instruction in response to the software upgrade instruction.
[0143] The first verification module 802 is used to perform version verification on the upgrade package to be verified based on the verification standard file.
[0144] The baseline integration module 803 is used to integrate the upgrade packages to be verified into the baseline when all the upgrade packages to be verified have passed the version verification.
[0145] The fourth acquisition module 804 is used to respond to the full push command to acquire the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified.
[0146] The second verification module 805 is used to compare the expected verification information with the actual verification information. If the expected verification information and the actual verification information are the same, it determines that all upgrade packages to be verified have passed the verification and pushes the upgrade packages to be verified to the electronic control unit to be upgraded.
[0147] The software upgrade device described above can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the software upgrade method provided in the embodiments of the present invention.
[0148] Figure 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. Figure 9 As shown, the electronic device includes:
[0149] The system includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904. The processor 901, communication interface 902, and memory 903 communicate with each other via the communication bus 904.
[0150] Memory 903 is used to store computer programs;
[0151] The processor 901, when executing the program stored in the memory 903, implements the software upgrade package generation method, software upgrade package verification method, or software upgrade method provided in any embodiment of the present invention.
[0152] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0153] The communication interface is used for communication between the aforementioned terminal and other devices.
[0154] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0155] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0156] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the software upgrade package generation method, software upgrade package verification method, or software upgrade method provided in any of the above embodiments.
[0157] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the software upgrade package generation method, software upgrade package verification method, or software upgrade method provided in any of the above embodiments.
[0158] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of the present invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0159] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Without further limitations, 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 said element.
[0160] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0161] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A method for generating a software upgrade package, characterized in that, include: Obtain a first upgrade package file for the electronic control unit to be upgraded, the first upgrade package file including code for upgrading the electronic control unit to be upgraded; Based on the version control policy, determine multiple version verification fields and the values corresponding to the multiple version verification fields; Write the values corresponding to the multiple version verification fields to the first designated address of the first upgrade package file to obtain the second upgrade package file.
2. The method according to claim 1, characterized in that, Based on the version control policy, several version verification fields are determined, including: Based on the type of the electronic control unit to be upgraded and / or the type of the first upgrade package file, multiple version verification fields are determined.
3. The method according to claim 1, characterized in that, The method further includes: The code in the first upgrade package file is calculated to obtain the first verification code; The step of writing the values corresponding to the plurality of version verification fields to a first designated address in the first upgrade package file to obtain the second upgrade package file includes: The values corresponding to the multiple version verification fields are written to a first designated address in the first upgrade package file, and the first verification code is written to a second designated address in the first upgrade package file to obtain a second upgrade package file.
4. The method according to claim 1 or 3, characterized in that, The method further includes: The code in the first upgrade package file is concatenated with the values of the multiple version verification fields to obtain verification data; The verification data is calculated to obtain a second verification code; The step of writing the values corresponding to the plurality of version verification fields to a first designated address in the first upgrade package file to obtain the second upgrade package file includes: The values corresponding to the multiple version verification fields are written to the first designated address of the first upgrade package file, and the second verification code is written to the third designated address of the first upgrade package file to obtain the second upgrade package file.
5. The method according to claim 1, characterized in that, The verification fields include one or more of the following: electronic control unit name, software version number, software ID, and communication matrix version information.
6. A method for verifying software upgrade packages, characterized in that, include: In response to a software upgrade package verification command, obtain a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification command; Obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and obtain the expected values of the multiple version verification fields from the verification standard file; The actual value and expected value of each version verification field are compared respectively. If the actual value and expected value of each version verification field are the same, the upgrade package to be verified is determined to have passed the verification.
7. The method according to claim 6, characterized in that, The verification standard file includes a third verification code, which is used to verify the first verification code at the second specified address in the upgrade package to be verified. The method further includes: obtaining a first verification code from a second designated address of the upgrade package to be verified; obtaining a third verification code from the verification standard file; and comparing the first verification code and the third verification code. The step of determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value includes: determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value and the first verification code is the same as the third verification code.
8. The method according to claim 6 or 7, characterized in that, The verification standard file also includes a fourth verification code, which is used to verify the second verification code at the third specified address in the upgrade package to be verified. The method further includes: obtaining a second verification code from a third designated address of the upgrade package to be verified; obtaining a fourth verification code from the verification standard file; and comparing the second verification code and the fourth verification code. The step of determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value includes: determining that the upgrade package to be verified has passed verification when the actual value of the version verification field is the same as the expected value and the second verification code is the same as the fourth verification code.
9. A software upgrade method, characterized in that, include: In response to a software upgrade command, obtain the verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade command; Based on the aforementioned verification standard file, the version of the upgrade package to be verified is verified. If all the upgrade packages to be verified pass the version verification, the upgrade packages to be verified will be integrated into the baseline. In response to the full push command, obtain the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified; The expected verification information and the actual verification information are compared. If the expected verification information and the actual verification information are the same, it is determined that all the upgrade packages to be verified have passed the verification, and the upgrade packages to be verified are pushed to the electronic control unit to be upgraded.
10. A software upgrade package generation device, characterized in that, include: The first acquisition module is used to acquire a first upgrade package file of the electronic control unit to be upgraded, the first upgrade package file including code for upgrading the electronic control unit to be upgraded. The version determination module is used to determine multiple version verification fields and the values corresponding to the multiple version verification fields according to the version control strategy. The upgrade package generation module is used to write the values corresponding to the multiple version verification fields into the first specified address of the first upgrade package file to obtain the second upgrade package file.
11. A software upgrade package verification device, characterized in that, include: The second acquisition module is used to acquire, in response to the software upgrade package verification instruction, a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade package verification instruction; The parsing module is used to obtain the actual values of multiple version verification fields from the first specified address of the upgrade package to be verified, and to obtain the expected values of the multiple version verification fields from the verification standard file. The judgment module is used to compare the actual value and the expected value of each version verification field. If the actual value and the expected value of the version verification field are the same, the upgrade package to be verified is determined to have passed the verification.
12. A software upgrade device, characterized in that, include: The third acquisition module is used to acquire, in response to a software upgrade command, a verification standard file corresponding to the upgrade package to be verified indicated by the software upgrade command. The first verification module is used to perform version verification on the upgrade package to be verified based on the verification standard file. The baseline integration module is used to integrate the upgrade packages to be verified into the baseline when all the upgrade packages to be verified pass the version verification. The fourth acquisition module is used to respond to the full push command to acquire the expected verification information corresponding to the upgrade package to be verified, and the actual verification information corresponding to the upgrade package to be verified. The second verification module is used to compare the expected verification information with the actual verification information. If the expected verification information and the actual verification information are the same, it determines that all the upgrade packages to be verified have passed the verification and pushes the upgrade packages to be verified to the electronic control unit to be upgraded.
13. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method as described in any one of claims 1-9.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-9.