CN110569059A - USB-based system partition upgrading method under uboot - Google Patents
USB-based system partition upgrading method under uboot Download PDFInfo
- Publication number
- CN110569059A CN110569059A CN201910887700.XA CN201910887700A CN110569059A CN 110569059 A CN110569059 A CN 110569059A CN 201910887700 A CN201910887700 A CN 201910887700A CN 110569059 A CN110569059 A CN 110569059A
- Authority
- CN
- China
- Prior art keywords
- partition
- file
- usb
- disk
- upgraded
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/654—Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
Abstract
The invention provides a USB-based system partition upgrading method under uboot, which comprises the following steps: s1, judging whether a U disk exists in the system; s2, further judging whether the partition of the U disk is in FAT32 format under the condition that the U disk exists in the system; s3, judging whether a Config file exists in the partition under the condition that the partition of the U disk is in the FAT32 format; s4, under the condition that the Config file exists in the partition, analyzing whether the partition name of bootargs in the Config file is consistent with the partition name of the bootargs file in the equipment; s5, when the partition name of bootargs in the Config file is consistent with the partition name of bootargs files in the device, judging whether files to be upgraded exist in the partitions of the U disk; and S6, when the file to be upgraded exists in the partition of the U disk, checking the first 64 bytes of the file to be upgraded. The USB-based system partition upgrading method under uboot of the invention realizes the flexibility and stability of system upgrading on one hand, and further ensures that the file to be upgraded is the latest version on the other hand.
Description
Technical Field
the invention belongs to the technical field of Linux kernels, and particularly relates to a USB-based system partition upgrading method under uboot.
Background
at present, a common mode of upgrading system partitions under the uboot of the existing USB is realized by an upper-layer user, and the mode has the defects of poor reliability and low flexibility; the method for realizing the system partition upgrading under the uboot based on the USB is provided by Hai in the later period, is relatively flexible and has good reliability, but the method has the defect that whether the image file is the latest version cannot be judged before upgrading.
Disclosure of Invention
in view of this, the present invention aims to provide a USB-based method for upgrading a system partition under uboot, and the technical scheme adopted by the present invention is to place an image file and a configuration file Config to be upgraded of a system into a first partition of a USB disk, and to require that the partition of the USB disk is in a FAT32 format, then copy a partition image meeting the upgrade requirement into a memory, and finally write the partition image onto the flash from the memory.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a system partition upgrading method under USB-based uboot comprises the following steps:
s1, judging whether a U disk exists in the system;
S2, further judging whether the partition of the U disk is in FAT32 format under the condition that the U disk exists in the system;
S3, judging whether a Config file exists in the partition under the condition that the partition of the U disk is in the FAT32 format;
S4, under the condition that the Config file exists in the partition, analyzing whether the partition name of bootargs in the Config file is consistent with the partition name of the bootargs file in the equipment;
S5, when the partition name of bootargs in the Config file is consistent with the partition name of bootargs files in the device, judging whether files to be upgraded exist in the partitions of the U disk;
S6, when the file to be upgraded exists in the partition of the U disk, checking the first 64 bytes of the file to be upgraded;
and S7, copying the upgrade file to a memory according to the verification result, and judging whether the system is upgraded or not.
Further, when the judgment results of the S1-S6 are all 'yes', the upgraded system is started;
If the judgment result of any one step from S1 to S6 is 'no', the system starts the original system.
further, the method for determining whether the usb disk exists in the system in step S1 includes: in Uboot console, command usb start is executed, and the system prompts "n storage devices(s) found", where n >0, by calling function file _ fat _ detect fs in fat file system source code to check whether the current Device is a U disk.
further, the method for determining whether the partition of the usb disk is in the FAT32 format in step S2 includes: the method is implemented in the source code of the fat file system, and the format of the current U disk is checked through the function file _ fat _ read.
further, the method for detecting whether the Config file exists in the system in step S3 includes: and executing a command title on the Uboot console, displaying the files in the current U disk, and calling a function file _ fat _ read in a fat file system to realize.
further, the method for determining whether the partition names of bootargs in the Config file and the partition names of bootargs files in the device are consistent in step S4 includes: by comparing partition names.
further, the method for determining whether the partition of the usb disk has the file to be upgraded in step S5 includes: in the fat file system source code, the fat file system function file _ fat _ read is called to realize the file system source code.
Further, the method for checking the first 64 bytes of the file to be upgraded in step S6 includes: the 64 byte content is compared with the correct information.
Compared with the prior art, the USB-based system partition upgrading method under uboot has the following advantages:
The USB-based system partition upgrading method under uboot realizes flexibility and stability of system upgrading, meanwhile, compared with the prior art, the USB-based system partition upgrading method solves the problem that whether the image file is the latest version cannot be judged before the system is upgraded, and ensures that the file to be upgraded is the latest version.
drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
Fig. 1 is a schematic flowchart of a method for upgrading a system partition under a USB-based Uboot according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
in the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless otherwise specified.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art through specific situations.
the present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows a flow chart of system partition upgrade under Uboot, and the upgrade process is as follows: firstly, judging whether a U disk exists or not, wherein the judging method is that in a uboot container, a command usb start is executed, and when a system prompts 'n storage Device(s) found', wherein n >0, a function file _ fat _ detectfs is called in fat file system source codes to check whether current equipment is the U disk or not; if the USB flash disk exists, whether the partition of the USB flash disk is in the FAT32 format is further judged, the judgment method is realized in the source code of the FAT file system, and the function file _ FAT _ read can check the format of the current USB flash disk; if the partition is in FAT32 format, then judging whether a Config file exists in the partition, wherein the judgment method is that command titles are executed on the uboot console, the current files in the U disk can be displayed, and when the command titles are realized, a function file _ FAT _ read in a FAT file system is called to realize; when the Config file exists, analyzing whether the partition names of bootargs in the Config file are consistent with the partition names of bootargs files in the equipment or not, if not, indicating that the version verification of the file to be upgraded is successful, and judging whether the version verification of the file to be upgraded is realized in the function code or not by comparing the partition names; judging whether a file to be upgraded exists in a partition of the U disk, wherein the judging method is realized in a fat file system source code, calling a fat file system function file _ fat _ read, and if so, checking the first 64 bytes of the file to be upgraded, wherein the checking method is to compare the 64-byte content (including a CPU (central processing unit) architecture, a magic, a mirror image type and the like) with correct information, the process is realized in a code, and if the checking is successful, the upgrading file is ready to be copied to a memory; and then writing the data from the memory back to the flash, if the data is successful, starting the upgraded system, and if any link fails, starting the original system.
the USB-based system partition upgrading method under the uboot can judge the version of an upgrading file, read bootargs in a Config file, analyze the names of all partitions in the bootargs, simultaneously analyze the names of the partitions in the bootargs in equipment, and if the names of the bootargs and the names of the partitions in the bootargs are different, the versions are considered to be different, and upgrading is achieved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (8)
1. a system partition upgrading method under uboot based on USB is characterized by comprising the following steps:
S1, judging whether a U disk exists in the system;
S2, further judging whether the partition of the U disk is in FAT32 format under the condition that the U disk exists in the system;
S3, judging whether a Config file exists in the partition under the condition that the partition of the U disk is in the FAT32 format;
S4, under the condition that the Config file exists in the partition, analyzing whether the partition name of bootargs in the Config file is consistent with the partition name of the bootargs file in the equipment;
S5, when the partition name of bootargs in the Config file is consistent with the partition name of bootargs files in the device, judging whether files to be upgraded exist in the partitions of the U disk;
S6, when the file to be upgraded exists in the partition of the U disk, checking the first 64 bytes of the file to be upgraded;
And S7, copying the upgrade file to a memory according to the verification result, and judging whether the system is upgraded or not.
2. The USB-based suboot system partition upgrade method according to claim 1, wherein: when the judgment results of the S1-S6 are all 'yes', starting the upgraded system;
If the judgment result of any one step from S1 to S6 is 'no', the system starts the original system.
3. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for determining whether the usb disk exists in the system in step S1 includes: in the uboot console, the command usb start is executed, and when the system prompts "n storage devices(s) found", where n >0, the implementation is to call the function file _ fat _ detectfs in the fat file system source code to check whether the current Device is a usb disk.
4. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for determining whether the partition of the usb disk is in the FAT32 format in step S2 includes: the method is implemented in the source code of the fat file system, and the format of the current U disk is checked through the function file _ fat _ read.
5. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for detecting whether the system has the Config file in step S3 includes: and executing a command title in the Uboot console, displaying the files in the current U disk, and calling a function file _ fat _ read in a fat file system to realize.
6. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for determining whether the partition names of bootargs in the Config file and the partition names of bootargs files in the device are consistent in step S4 includes: by comparing partition names.
7. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for judging whether the partition of the usb disk has the file to be upgraded in step S5 includes: in the fat file system source code, the fat file system function file _ fat _ read is called to realize the file system source code.
8. The USB-based suboot system partition upgrade method according to claim 1, wherein: the method for checking the first 64 bytes of the file to be upgraded in the step S6 includes: by comparing the 64 byte content with the correct information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910887700.XA CN110569059A (en) | 2019-09-19 | 2019-09-19 | USB-based system partition upgrading method under uboot |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910887700.XA CN110569059A (en) | 2019-09-19 | 2019-09-19 | USB-based system partition upgrading method under uboot |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110569059A true CN110569059A (en) | 2019-12-13 |
Family
ID=68781197
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910887700.XA Pending CN110569059A (en) | 2019-09-19 | 2019-09-19 | USB-based system partition upgrading method under uboot |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110569059A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112783537A (en) * | 2020-12-31 | 2021-05-11 | 浙江万胜智能科技股份有限公司 | Embedded linux operating system upgrading method and system based on MTD storage equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101183312A (en) * | 2007-12-12 | 2008-05-21 | 中兴通讯股份有限公司 | Method for realizing version upgrade and backup of terminal by switch-in USB memory apparatus |
CN102385520A (en) * | 2011-09-06 | 2012-03-21 | 四川金网通电子科技有限公司 | USB (Universal Serial Bus) upgrading method based on partition name for digital television set-top box |
CN103136002A (en) * | 2011-11-25 | 2013-06-05 | 航天信息股份有限公司 | Automatic upgrade control method based on UBoot instruction and system |
US20140181051A1 (en) * | 2012-12-21 | 2014-06-26 | Zetta, Inc. | Systems and methods for on-line backup and disaster recovery with local copy |
CN103970557A (en) * | 2013-02-04 | 2014-08-06 | 中兴通讯股份有限公司 | Storage device and system starting method thereof |
CN107105345A (en) * | 2017-02-17 | 2017-08-29 | 青岛海信宽带多媒体技术有限公司 | A kind of set top box upgrading method and set top box |
-
2019
- 2019-09-19 CN CN201910887700.XA patent/CN110569059A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101183312A (en) * | 2007-12-12 | 2008-05-21 | 中兴通讯股份有限公司 | Method for realizing version upgrade and backup of terminal by switch-in USB memory apparatus |
CN102385520A (en) * | 2011-09-06 | 2012-03-21 | 四川金网通电子科技有限公司 | USB (Universal Serial Bus) upgrading method based on partition name for digital television set-top box |
CN103136002A (en) * | 2011-11-25 | 2013-06-05 | 航天信息股份有限公司 | Automatic upgrade control method based on UBoot instruction and system |
US20140181051A1 (en) * | 2012-12-21 | 2014-06-26 | Zetta, Inc. | Systems and methods for on-line backup and disaster recovery with local copy |
CN103970557A (en) * | 2013-02-04 | 2014-08-06 | 中兴通讯股份有限公司 | Storage device and system starting method thereof |
CN107105345A (en) * | 2017-02-17 | 2017-08-29 | 青岛海信宽带多媒体技术有限公司 | A kind of set top box upgrading method and set top box |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112783537A (en) * | 2020-12-31 | 2021-05-11 | 浙江万胜智能科技股份有限公司 | Embedded linux operating system upgrading method and system based on MTD storage equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109408153B (en) | Software starting method and software upgrading method | |
US8954805B2 (en) | Computer booting method and computer system | |
US7801930B2 (en) | Recording medium, host device, and data processing method | |
US20060282653A1 (en) | Method for updating frimware of memory card | |
CN108170455B (en) | Upgrade package packaging method and upgrade method | |
CN101436138A (en) | Control device and control method for software upgrade and dynamic rolling back | |
WO2014194865A1 (en) | Firmware upgrade method and apparatus, and communication device | |
CN111813428A (en) | Method and device for upgrading terminal firmware, electronic equipment and storage medium | |
CN112732310A (en) | Firmware upgrading method, system, equipment and medium based on embedded boot partition | |
CN112631628A (en) | Singlechip upgrading method, singlechip and storage medium | |
CN114780019A (en) | Electronic device management method and device, electronic device and storage medium | |
CN110569059A (en) | USB-based system partition upgrading method under uboot | |
US8949588B1 (en) | Mobile telephone as bootstrap device | |
US20030037279A1 (en) | HDD data backup and recovery method | |
CN106445737A (en) | Multi-backup starting method | |
CN106293708B (en) | Information processing method and storage device | |
CN114780120A (en) | Upgrading method, equipment and storage medium | |
CN114880003A (en) | System upgrading method of intelligent terminal, intelligent terminal and storage medium | |
CN114296764A (en) | System upgrading method and device, storage medium and electronic equipment | |
CN113190244A (en) | Method and device for upgrading wireless module, computer equipment and storage medium | |
CN105278993A (en) | Linux system based drive module upgrading method and apparatus | |
CN117369905B (en) | Starting method and system of flash memory platform, electronic equipment and storage medium | |
CN117608618B (en) | Server firmware upgrading method and device, storage medium and electronic equipment | |
CN110007930B (en) | Application deployment method and system | |
CN110187844B (en) | Method and device for automatically identifying and mounting nodes of hard RAID (redundant array of independent disk) equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191213 |