CN114625389A - Embedded equipment upgrading method, embedded equipment and storage device - Google Patents

Embedded equipment upgrading method, embedded equipment and storage device Download PDF

Info

Publication number
CN114625389A
CN114625389A CN202011476271.6A CN202011476271A CN114625389A CN 114625389 A CN114625389 A CN 114625389A CN 202011476271 A CN202011476271 A CN 202011476271A CN 114625389 A CN114625389 A CN 114625389A
Authority
CN
China
Prior art keywords
boot
upgrading
image
embedded
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011476271.6A
Other languages
Chinese (zh)
Inventor
王剑波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing A&e Technologies Co ltd
Original Assignee
Beijing A&e Technologies Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing A&e Technologies Co ltd filed Critical Beijing A&e Technologies Co ltd
Priority to CN202011476271.6A priority Critical patent/CN114625389A/en
Publication of CN114625389A publication Critical patent/CN114625389A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The application discloses an embedded device upgrading method, an embedded device and a storage device. The embedded equipment upgrading method comprises the following steps: mounting mobile storage equipment, wherein the mobile storage equipment stores a system mirror image to be upgraded, a boot mirror image of a temporary transition version and an upgrading script; programming the boot mirror image of the temporary transition version into a boot partition of the embedded equipment through the upgrading script; restarting the embedded device to the boot of the temporary transition version; and reading the system image to be upgraded from the mobile storage device, and burning the system image to be upgraded into a storage medium of the embedded device. The upgrading method is simple to operate, a serial port and a network environment do not need to be built to be connected with a remote server to download the upgrading file for upgrading, the root file system can be automatically upgraded under Boot, and users do not need to participate in the upgrading process.

Description

Embedded equipment upgrading method, embedded equipment and storage device
Technical Field
The present application relates to the field of embedded technologies, and in particular, to an embedded device upgrading method, an embedded device, and a storage apparatus.
Background
In the embedded field, how to upgrade the system by a simple and easy-to-use method is a very critical link in the research and development of embedded products. Because this is related to the life cycle of the product, the maintenance cost of the product, the perfection of the product functions, and so on. In embedded projects, a common upgrade is to a kernel, application, file system, etc. The file system comprises a root file system and a non-root file system.
The upgrading of the embedded device is usually realized by downloading an upgrading mirror image from a remote server through a network, and the remote online upgrading can only upgrade a non-root file system partition mirror image and needs to build a server and a network environment. Under the condition that a server and a network environment cannot be built or are not easy to build, how to upgrade the system is very important. And how to upgrade the mirror image of the root file system after the system is operated does not have a good scheme at present. Because the upgrade of the mirror image of the root file system needs to delete the whole root file system partition, the upgrade can be usually only performed under Boot, and after the kernel mounts the root file system and starts, if the root file system partition is directly erased, the whole system is crashed.
Disclosure of Invention
The upgrading method is simple in operation, does not need to build a serial port and a network environment to be connected with a remote server to download upgrading files, can automatically complete upgrading of a root file system under Boot, and does not need to participate in the upgrading process.
In order to solve the technical problem, the application adopts a technical scheme that: an embedded device upgrading method is provided, and the method comprises the following steps: mounting mobile storage equipment, wherein the mobile storage equipment stores a system mirror image to be upgraded, a boot mirror image of a temporary transition version and an upgrading script; programming the boot mirror image of the temporary transition version into a boot partition of the embedded equipment through the upgrading script; restarting the embedded device to the boot of the temporary transition version; and reading the system image to be upgraded from the mobile storage device, and burning the system image to be upgraded into a storage medium of the embedded device.
After the step of mounting the mobile storage device, the method further comprises: compressing and packaging the upgrading script, adding a file header to the compressed and packaged upgrading script, and judging whether the upgrading script meets a preset condition or not according to the file header; if yes, decompressing the compressed and packaged upgrading script; the step of programming the boot image of the temporary transition version into the boot partition of the embedded device through the upgrading script comprises the following steps: and programming the boot image of the temporary transition version into a boot partition of the embedded device through the decompressed upgrading script.
After the step of burning the system image to be upgraded into the storage medium of the embedded device, the method further comprises the following steps: and sending a prompt to the user when the progress of burning the system mirror image to be upgraded to the storage medium of the embedded equipment is confirmed to be completed.
The file header comprises upgrade version information and cyclic redundancy check, and the step of judging whether the upgrade script meets the preset conditions or not according to the file header comprises the following steps: and judging whether the upgrading script meets the preset condition or not according to the upgrading version information and the cyclic redundancy check.
Wherein the step of mounting the mobile storage device comprises: and after the mobile storage device is identified, mounting the mobile storage device to the specified directory.
The method for programming the boot mirror image of the temporary transition version into the boot partition of the embedded device through the upgrading script comprises the following steps:
the upgrade script erases the boot partition of the embedded device first, and then writes the boot image of the temporary transition version into the boot partition of the embedded device.
The mobile storage device is a USB interface memory or an SD card.
Wherein, the system mirror image to be upgraded includes: at least one of a boot image, a linux kernel image, a root file system image, and a system image of a non-root file system.
In order to solve the technical problem, the other technical scheme adopted by the application is as follows: an embedded device is provided, the embedded device comprising at least: the processor is coupled with the memory, the memory is used for storing program data, and the processor is used for executing the program data to realize the embedded device upgrading method of any one of the embodiments.
In order to solve the above technical problem, the present application adopts another technical solution: there is provided a storage device having stored thereon program data executable by a processor to implement the method of upgrading an embedded device of any of the above embodiments.
The beneficial effect of this application is: different from the situation of the prior art, the method for upgrading the embedded device provided by the application comprises the following steps: mounting a mobile storage device through an interface of the embedded device, and storing a system mirror image to be upgraded, a boot mirror image of a temporary transition version and an upgrading script in the mobile storage device so that the embedded device can obtain an upgrading file without building a serial port and a network environment, and then programming the boot mirror image of the temporary transition version into a boot partition of the embedded device through the upgrading script; restarting the embedded device to the boot of the temporary transition version; and reading the system image to be upgraded from the mobile storage device, and burning the system image to be upgraded into a storage medium of the embedded device so as to complete the system upgrade of the embedded device. The upgrading method is simple to operate, the root file system can be automatically upgraded under Boot, and users do not need to participate in the upgrading process.
Drawings
Fig. 1 is a schematic flowchart of an embodiment of an upgrade method for an embedded device provided in the present application;
FIG. 2 is a flowchart illustrating an upgrading method for an embedded device according to another embodiment of the present disclosure;
FIG. 3 is a schematic structural diagram of an embodiment of an embedded device provided in the present application;
fig. 4 is a schematic structural diagram of an embodiment of a memory device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that if directional indications (such as up, down, left, right, front, and back … …) are referred to in the embodiments of the present application, the directional indications are only used to explain the relative positional relationship between the components, the movement situation, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are changed accordingly.
Technical solutions between the embodiments may be combined with each other, but must be based on the realization of the technical solutions by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
The application provides an embedded device upgrading method, an embedded device and a storage device. Many embedded devices currently provide a USB (Universal Serial Bus) interface or an SD (Secure Digital card) interface, and a removable storage device can be inserted into the embedded devices to copy files. Aiming at the system upgrade of the embedded equipment, under the condition that a server and a network environment are not or are not easy to build, the system upgrade can be finished by inserting the mobile storage equipment and reading and programming each system image in the storage medium under the system and Boot without connecting a user with the server through a serial port or a network port to remotely download the upgrade image. The following describes the embedded device upgrading method provided in the present application in detail.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of an upgrade method for an embedded device provided in the present application, where the method includes:
s11: and mounting the mobile storage equipment, wherein the mobile storage equipment stores the system mirror image to be upgraded, the boot mirror image of the temporary transition version and the upgrade script.
When the embedded device is provided with a mobile storage device interface, after the embedded device system runs, if a user needs to upgrade some or all system images (Boot, Linux kernel, root file system, non-root file system and the like) by one key, a mobile storage device, such as an SD card or a USB interface memory, can be found first, and the system image to be upgraded, the Boot image of the temporary transition version and the upgrade script are copied to the mobile storage device through a computer.
Taking the embedded Linux device as an example, the system image to be upgraded may include: at least one of a boot image, a Linux kernel image, a root file system image, and a system image of a non-root file system. If the embedded device uses a high-version Linux kernel, the system image to be upgraded also comprises a device tree image corresponding to the drive file. In addition, for some special devices, it may also contain SPL (Second Program Loader) images that boot, and some other images necessary for system operation.
When a user inserts the mobile storage device, the system kernel of the embedded device can automatically identify the mobile storage device and mount the mobile storage device to a specified directory. These can be implemented by udev or mdev in an embedded Linux system.
S12: and programming the boot mirror image of the temporary transition version into the boot partition of the embedded device through the upgrading script.
The system of the embedded device can execute the programming of the boot image of the temporary transition version through the upgrading script. The upgrade script can be a shell script or other Linux-executable script, and the upgrade script is used for enabling a system running command of the embedded device to write a boot image (such as a U-boot image) of a temporary transition version.
In this embodiment, the upgrade script first erases the boot partition of the embedded device, and then writes the boot image of the temporary transition version into the boot partition of the embedded device. Specifically, the upgrade script may first erase the boot partition through the flash _ erase, and then burn the temporary transient version boot image in the mobile storage device to the corresponding boot partition through a command such as nand write.
Boot images are generally defined as Boot media for booting system boots, e.g., BIOS in Windows systems, Grub in X86 Linux systems, and U-Boot images in non-X86 embedded Linux systems. Taking the U-Boot of the embedded Linux system device as an example, the U-Boot is generally used for transmitting the reference to the Linux kernel and guiding the Linux kernel to start, and the mirror image is also needed for normal operation of the device. However, in order to automatically upgrade the system image under the boot, the embodiment needs to upgrade the boot image of a temporary transition version first, where the temporary transition version boot image is used to automatically read the system image to be upgraded in the mobile storage device under the boot, then write the system image to a storage medium (e.g., Flash) of the embedded device, and finally complete the upgrade.
For an embedded device without an operation interface, a user usually performs an upgrade script by knocking a command on the embedded device, or performs an upgrade script remotely controlled by a server. For the embedded device provided with the user operation interface, the user can select the upgrading script in the operation interface and then click the button to enable the background to automatically trigger execution. After the upgrade script is successfully executed, the embedded device may give a prompt of successful execution, and then prompt the user to restart the embedded device. If the execution fails, a prompt is also given to inform the user of the reason for the execution failure.
S13: and restarting the embedded device to the boot of the temporary transition version.
And after the step of programming the boot image of the temporary transition version into the boot partition of the embedded device is completed, restarting the embedded device to the boot of the temporary transition version, paying attention to that the mobile storage device is not unplugged when the embedded device is restarted, so that the mobile storage device can be detected when the embedded device is restarted and enters the boot stage of the temporary transition version.
S14: and reading the system mirror image to be upgraded from the mobile storage device, and burning the system mirror image to be upgraded into a storage medium of the embedded device.
And the embedded device automatically reads the system image to be upgraded from the mobile storage device after restarting to the boot of the temporary transition version, and then writes the system image to a storage medium (such as Flash) of the embedded device.
Taking a commonly used U-boot in the embedded device as an example, the environment variable boot cmd under the U-boot can be set to be a simple combination of usb, mmc, fatload, nand write and other commands. In order to conveniently inform the user that the automatic programming of the system image to be upgraded is completed, the embedded device can send a prompt to the user. Specifically, a custom command, such as a lighting command of the light emitting diode, may be added to the environment variable bootcmd, and whether the system image upgrade has been successfully completed is determined by turning on and off the light emitting diode.
Different from the situation of the prior art, the method for upgrading the embedded device of the embodiment can enable the embedded device to obtain the upgrade file without building a serial port and a network environment, is simple in operation, can automatically complete the upgrade of the root file system under Boot, and does not need to participate in the upgrade process.
Referring to fig. 2, fig. 2 is a schematic flowchart of another embodiment of an upgrade method for an embedded device provided in the present application, where in the embodiment, the method specifically includes:
s21: and mounting the mobile storage equipment, wherein the mobile storage equipment stores the system mirror image to be upgraded, the boot mirror image of the temporary transition version and the upgrade script.
Step S21 is the same as step S11, and is not repeated here.
S22: and compressing and packaging the upgrading script, and adding a file header to the compressed and packaged upgrading script.
In order to prevent the upgrade script from being selected by mistake during system upgrade, a compression and packaging mode can be adopted for the upgrade script, and a file header can be added in the upgrade script file after compression and packaging. Specifically, at least one of upgrade version information and a cyclic redundancy check may be included in the file header. Preferably, the file header may include both upgrade version information and cyclic redundancy check to increase reliability of system upgrade.
S23: and judging whether the upgrading script meets a preset condition or not according to the file header.
And after the compressed and packaged upgrade script is selected, the file header of the upgrade script needs to be read, so that whether the upgrade script meets the preset conditions or not is judged according to the file header. Specifically, when the file header includes the upgrade version information and the cyclic redundancy check, whether the upgrade script is the correct upgrade file can be judged according to the upgrade version information, whether the upgrade script file is damaged can be judged through the cyclic redundancy check, and if the upgrade script file is damaged, a prompt is sent to a user, and a reason of upgrade failure is prompted.
That is, in this embodiment, whether the upgrade script meets the preset condition may be determined according to the upgrade version information and the cyclic redundancy check. That is, the preset condition may be that the upgrade version information is consistent with the preset version information and that the upgrade script file is not damaged is determined through cyclic redundancy check.
S24: and if so, decompressing the compressed and packaged upgrade script.
If the upgrade script meets the preset conditions according to the file header, the correct upgrade script can be confirmed to be selected, and the compressed and packaged upgrade script is decompressed to obtain the original upgrade script.
S25: and programming the boot mirror image of the temporary transition version into the boot partition of the embedded device through the decompressed upgrading script.
And programming the boot mirror image of the temporary transition version into the boot partition of the embedded device through the decompressed upgrade script, namely the original upgrade script. This step is the same as step S12, and will not be described herein.
S26: and restarting the embedded device to the boot of the temporary transition version.
Step S26 is the same as step S13, and is not repeated here.
S27: and reading the system image to be upgraded from the mobile storage device, and burning the system image to be upgraded into a storage medium of the embedded device.
Step S27 is the same as step S14, and is not repeated here.
Different from the previous embodiment, in the method for upgrading an embedded device of this embodiment, the upgrade script is further compressed and packaged, and a file header is added to the compressed and packaged upgrade script, so as to determine whether the selected upgrade script is correct or not through the file header, thereby improving the reliability of system upgrade.
Based on this, the present application further provides an embedded device 100, please refer to fig. 3, and fig. 3 is a schematic structural diagram of an embodiment of the embedded device provided in the present application, in this embodiment, the embedded device 100 includes a processor 110 and a memory 120, the processor 110 is coupled to the memory 120, the memory 120 is used for storing a program, and the processor 110 is used for executing the program to implement the embedded device upgrade method of any of the above embodiments.
Processor 110 may be a CPU (Central Processing Unit); the processor 110 may also be an integrated circuit chip having signal processing capabilities; the processor 110 may also be a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like. The processor 110 may be a microprocessor or the processor 110 may be any conventional processor or the like.
Based on this, the present application further provides a memory device 200, please refer to fig. 4, and fig. 4 is a schematic structural diagram of an embodiment of the memory device provided in the present application. In this embodiment, the storage device 200 stores program data 210, and the program data 210 can be executed by the processor 110 to implement the embedded device upgrade method of any of the above embodiments.
The program data 210 may be stored in the storage device 200 in the form of a software product, and includes several instructions to make a device or a processor execute all or part of the steps of the methods according to the embodiments of the present application.
The storage device 200 is a medium in computer memory for storing some discrete physical quantity. The memory device 200 includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing the code of the program data 210.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. An embedded device upgrade method, the method comprising:
mounting mobile storage equipment, wherein the mobile storage equipment stores a system mirror image to be upgraded, a boot mirror image of a temporary transition version and an upgrading script;
burning the boot mirror image of the temporary transition version into a boot partition of the embedded equipment through the upgrading script;
restarting the embedded device to the boot of the temporary transition version;
and reading the system image to be upgraded from the mobile storage device, and burning the system image to be upgraded into a storage medium of the embedded device.
2. The method of claim 1, wherein after the step of mounting the mobile storage device, the method further comprises:
compressing and packaging the upgrading script, adding a file header to the compressed and packaged upgrading script,
judging whether the upgrading script meets a preset condition or not according to the file header;
if yes, decompressing the compressed and packaged upgrading script;
the step of programming the boot image of the temporary transition version into the boot partition of the embedded device through the upgrade script comprises the following steps:
and burning the boot mirror image of the temporary transition version into a boot partition of the embedded equipment through the decompressed upgrading script.
3. The method of claim 2, wherein after the step of burning the system image to be upgraded into the storage medium of the embedded device, the method further comprises:
and sending a prompt to a user when the progress of burning the system mirror image to be upgraded to the storage medium of the embedded equipment is confirmed to be completed.
4. The method of claim 2, wherein the file header includes upgrade version information and a cyclic redundancy check,
the step of judging whether the upgrade script meets the preset conditions or not according to the file header comprises the following steps:
and judging whether the upgrading script meets the preset condition or not according to the upgrading version information and the cyclic redundancy check.
5. The method of claim 1, wherein the step of mounting the mobile storage device comprises:
and after the mobile storage equipment is identified, mounting the mobile storage equipment to a specified directory.
6. The method of claim 1, wherein the step of burning the temporary transitional version of the boot image into the boot partition of the embedded device via the upgrade script comprises:
and the upgrade script firstly erases the boot partition of the embedded equipment and then writes the boot mirror image of the temporary transition version into the boot partition of the embedded equipment.
7. The method of claim 1, wherein the mobile storage device is a USB interface memory or an SD card.
8. The method of claim 1, wherein the system image to be upgraded comprises: at least one of a boot image, a linux kernel image, a root file system image, and a system image of a non-root file system.
9. An embedded device, characterized in that the embedded device comprises at least: a processor coupled to the memory, and a memory for storing program data, the processor for executing the program data to implement the embedded device upgrade method of any one of claims 1-8.
10. A storage means, characterized in that it stores program data executable by a processor to implement the method of upgrading an embedded device according to any of claims 1-8.
CN202011476271.6A 2020-12-14 2020-12-14 Embedded equipment upgrading method, embedded equipment and storage device Pending CN114625389A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011476271.6A CN114625389A (en) 2020-12-14 2020-12-14 Embedded equipment upgrading method, embedded equipment and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011476271.6A CN114625389A (en) 2020-12-14 2020-12-14 Embedded equipment upgrading method, embedded equipment and storage device

Publications (1)

Publication Number Publication Date
CN114625389A true CN114625389A (en) 2022-06-14

Family

ID=81897460

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011476271.6A Pending CN114625389A (en) 2020-12-14 2020-12-14 Embedded equipment upgrading method, embedded equipment and storage device

Country Status (1)

Country Link
CN (1) CN114625389A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115904820A (en) * 2023-02-21 2023-04-04 合肥康芯威存储技术有限公司 Recovery method and system for failed hard disk

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115904820A (en) * 2023-02-21 2023-04-04 合肥康芯威存储技术有限公司 Recovery method and system for failed hard disk

Similar Documents

Publication Publication Date Title
US8010959B2 (en) System and method for updating device drivers
KR100506203B1 (en) Booting and boot code update method and system thereof
EP1785855A2 (en) Method of booting a microprocessor system, method of updating contents of a serial flash memory array, microprocessor system, flash memory device and booting system
US20100325622A1 (en) Updating Firmware of an Electronic Device
KR101427755B1 (en) Device and method for firmware upgrade using usb
US20130282966A1 (en) Communicating to Update a Memory
EP2192516A1 (en) Method for upgrading antivirus software and terminal and system thereof
KR101640207B1 (en) Bootloader and embedded system upgrade method
WO2020062887A1 (en) Firmware upgrading method and system based on flash micro-controller, and flash micro-controller
JP2000357095A (en) Method and device for downloading software to embedded system
WO2003040917A2 (en) Implementation of in-system programming to update firmware on memory cards
US20040199911A1 (en) Apparatus and method for upgrading execution code of the portable memory device
US20080098388A1 (en) Safe Flashing
CN101807152A (en) Basic output and input system for self verification of selection read only memory and verification method thereof
CN109634781A (en) One kind is based on embedded program two-region Backup Images system and starting method
WO2018049798A1 (en) Method and apparatus for reconstructing cache partition
CN108153548A (en) A kind of EMMC firmware upgrade methods and device
CN114625389A (en) Embedded equipment upgrading method, embedded equipment and storage device
CN109871334B (en) Cable modem and method of operation
CN110908733A (en) Working mode determining method and device, and control method and device
CN113377425B (en) BMC firmware generation method and device, BMC starting method and device and storage medium
CN114995852A (en) Equipment upgrading method, equipment and computer readable storage medium
US20220179746A1 (en) Electronic apparatus and boot method thereof
CN112667444A (en) System upgrading method, storage medium and terminal equipment
CN113467842B (en) Method for starting embedded device suitable for industrial application scene, embedded device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination