CN111338771A - Boot program switching processing method and device, computer equipment and medium - Google Patents

Boot program switching processing method and device, computer equipment and medium Download PDF

Info

Publication number
CN111338771A
CN111338771A CN202010090985.7A CN202010090985A CN111338771A CN 111338771 A CN111338771 A CN 111338771A CN 202010090985 A CN202010090985 A CN 202010090985A CN 111338771 A CN111338771 A CN 111338771A
Authority
CN
China
Prior art keywords
boot
program
flag
bootstrap
standby
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.)
Granted
Application number
CN202010090985.7A
Other languages
Chinese (zh)
Other versions
CN111338771B (en
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.)
Shenzhen Genew Technologies Co Ltd
Original Assignee
Shenzhen Genew 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 Shenzhen Genew Technologies Co Ltd filed Critical Shenzhen Genew Technologies Co Ltd
Priority to CN202010090985.7A priority Critical patent/CN111338771B/en
Publication of CN111338771A publication Critical patent/CN111338771A/en
Application granted granted Critical
Publication of CN111338771B publication Critical patent/CN111338771B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a bootstrap program switching processing method and device, computer equipment and media, wherein the method comprises the following steps: reserving a byte space in a FLASH chip for storing a boot _ flag of a main bootstrap program; when the CPU is powered on, executing the instruction from the standby bootstrap program; reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of a starting identifier; instructions to continue execution of the standby boot program if boot _ flag < ═ 0xf 0; and if the boot _ flag is larger than 0xf0, loading the address of the primary bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the primary bootstrap program. The bootstrap program switching processing of the invention has simple operation, easy realization, fast switching action, convenient use for users, simple realization and high reliability.

Description

Boot program switching processing method and device, computer equipment and medium
Technical Field
The present application relates to the field of embedded driver technologies, and in particular, to a method and an apparatus for processing boot program switch, a computer device, and a readable storage medium.
Background
In a computer system, the boot program is very important, and if it is destroyed, the computer system cannot boot and becomes "brick" unless the boot program is re-burned with a hardware tool. Many embedded devices protect the boot program and even do two boot programs. Under normal conditions, the CPU is running the main bootstrap program. Generally, the boot program is upgraded by simply updating the main boot program, while the spare boot program retains the most basic functionality and is not upgraded in most cases. If the system cannot be normally started after the main bootstrap program is upgraded, and thus the function of online upgrading cannot be used, the main bootstrap program must be set to be invalid and started from the standby bootstrap program.
How to switch the main/standby lead lines? In the prior art, a main bootstrap program is set to be unavailable or deleted directly by using a relevant command, and then a CPU starts a standby bootstrap program. The prior art requires tools, typically serial line and serial terminal software, to interface with the command line of the device. In addition, if none of the active boot programs can be launched to the command line, then the method of command unset is not feasible at all. Finally, the starting program can only be updated by a method of burning the chip. The bootstrap program switching processing in the prior art is very troublesome, complex in operation, time-consuming and labor-consuming, and inconvenient for users to use.
Therefore, the prior art is in need of improvement.
Disclosure of Invention
The present invention provides a method and an apparatus for processing bootstrap program switching, a computer device, and a readable storage medium, which are provided to solve the technical problems in the prior art, and the method and the apparatus for processing bootstrap program switching are simple in operation, easy to implement, fast in switching action, convenient for a user to use, simple to implement, and high in reliability.
The technical scheme of the invention is as follows:
a method of bootstrap handover processing, wherein the method comprises:
reserving a byte space in a FLASH chip for storing a boot _ flag of a main bootstrap program;
when the CPU is powered on, the standby bootstrap program executes the instruction, and the internal register of the CPU is initialized to complete the configuration of the FLASH;
reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of a starting identifier;
judging whether a boot flag is larger than 0xf0, and if the boot flag is smaller than or equal to 0xf0, continuing to execute the instruction of the standby bootstrap program;
and if the boot _ flag is larger than 0xf0, loading the address of the primary bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the primary bootstrap program.
The boot program switching processing method, wherein the step of continuing to execute the instruction of the standby boot program if the boot _ flag is less than or equal to 0xf0 comprises:
if the boot _ flag is not greater than 0xf0, continuing to execute the instructions of the standby bootstrap program;
upgrading the main bootstrap program;
start the kernel or execute boot commands.
The boot program switching processing method, wherein if the boot _ flag is greater than 0xf0, the step of loading the address of the primary boot program into a program counting register PC of the CPU and completing the jump from the standby boot program to the primary boot program includes:
if the boot _ flag is greater than 0xf0, then a status indicator light on the device is illuminated;
modifying the CPU running program counter PC into the address space of the main bootstrap program, and skipping to the main bootstrap program;
then the first bit1 from low to high of the boot _ flag is set to 0 and stored in flash.
The boot program switching processing method, wherein the step of setting the first bit1 of the boot _ flag from low to high as 0 and storing in the flash further comprises:
lighting a red light to indicate that the main bootstrap program is entered currently;
initializing each driver and module;
the main bootstrap program is completely started;
after the main bootstrap program is completely started, the green light is lightened, and the red light is extinguished;
setting boot _ flag to be 0xff, and writing the flag into flash;
start the kernel or execute boot commands.
The bootstrap program switching processing method further comprises the following steps:
if the main bootstrap program is forced to be invalid; with the RESET key RESET system, boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
The bootstrap program switching processing method further comprises the following steps:
after a RESET key is pressed, the CPU is directly RESET and started from a standby bootstrap program;
after pressing the RESET key for four times, the boot _ flag is 0xf0, and according to the preset judgment condition, the condition for executing the main boot presentation is not satisfied, and the standby boot program is continuously executed;
and in the standby boot program, controlling to renew the main boot program by utilizing the online upgrading function.
A boot program switch processing apparatus, wherein the apparatus comprises:
the preset module is used for reserving a byte space in the FLASH chip for storing a boot _ flag of the main bootstrap program;
the initialization module is used for executing the instruction from the standby bootstrap program when the CPU is powered on, initializing an internal register of the CPU and finishing the configuration of the FLASH;
the reading module is used for reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of the starting identifier;
the first control module is used for judging whether a boot _ flag of the starting identifier is larger than 0xf0, and if the boot _ flag is smaller than or equal to 0xf0, continuing to execute the instruction of the standby bootstrap program;
and the second control module is used for loading the address of the main bootstrap program into a program counting register PC of the CPU and finishing the jump from the standby bootstrap program to the main bootstrap program if the boot _ flag of the starting identifier is larger than 0xf 0.
The bootstrap program switching processing device further includes:
the forced execution module is used for setting the main bootstrap program as invalid if the main bootstrap program needs to be forced; with the RESET key RESET system, boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of any of the boot program switch processing methods when executing the computer program.
A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of any of the boot program switching processing methods.
Compared with the prior art, the embodiment of the invention has the following advantages:
the invention provides a boot program switching processing method and device, a computer device and a readable storage medium, and provides a method for setting a main boot program to be invalid and then starting from a standby boot program. The write 0 feature of NOR FLASH (a non-volatile FLASH memory) is utilized, i.e., FLASH can only write from 1 to 0, but not from 0 to 1, unless the entire block of FLASH is erased. The state is recorded by the number of 1 in one byte (8bit) of FLASH, and the first 1 from low to high of the 8bit data is written into 0 every time the FLASH is started. 8 bits can write 8 times of 0 in total, and then the number of times of starting is recorded eight times at most. In addition, the device provides a RESET button (like the warm start button of a PC) which, when pressed, RESETs the system. The bootstrap program switching processing of the invention has simple operation, easy realization, fast switching action, convenient use for users, simple realization and high reliability.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating a bootstrap switching processing method according to embodiment 1 of the present invention.
Fig. 2 is a schematic structural diagram of a boot master/standby boot introduction structure of a CPU in a boot program switching processing method according to embodiment 1 of the present invention.
Fig. 3 is a flowchart of a boot program switching processing method according to another embodiment of the present invention.
Fig. 4 is a flowchart illustrating a configuration of a boot program switching processing method according to another embodiment of the present invention after a RESET key is pressed.
Fig. 5 is a schematic structural diagram of a bootstrap switching processing device according to an embodiment of the present invention.
Fig. 6 is an internal structural diagram of a computer device in an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
The inventor finds out through research how is the main/standby lead line switched in the prior art? In the prior art, a main bootstrap program is set to be unavailable or deleted directly by using a relevant command, and then a CPU starts a standby bootstrap program. The prior art requires tools, typically serial line and serial terminal software, to interface with the command line of the device. In addition, if none of the active boot programs can be launched to the command line, then the method of command unset is not feasible at all. Finally, the starting program can only be updated by a method of burning the chip. The technical problems of very troublesome bootstrap program switching processing, complex operation, time and labor waste and inconvenience for users in the prior art are solved.
In order to solve the above problems, various non-limiting embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Referring to fig. 1, fig. 1 shows a boot program switching processing method according to an embodiment of the present invention, the method includes the following steps:
step S100, reserving a byte space in the FLASH chip for storing a boot _ flag of a main bootstrap program;
step S200, when the CPU is powered on, executing an instruction from the standby bootstrap program, initializing an internal register of the CPU, and completing the configuration of the FLASH;
step S300, reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of a starting identifier;
step S400, judging whether a boot _ flag of the starting identifier is larger than 0xf0, and if the boot _ flag is not larger than 0xf0, continuing executing the instruction of the standby bootstrap;
that is, it is determined whether the boot flag is greater than 0xf0, and if the boot flag is less than or equal to 0xf0, the instruction of the standby boot program continues to be executed.
Step S500, if the boot _ flag is larger than 0xf0, loading the address of the main bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the main bootstrap program;
step S600, if the main bootstrap program needs to be forcibly set as invalid; with the RESET key RESET system, boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
That is, in the embodiment of the present invention in which the above steps are performed, a method is proposed that can set the primary boot program to be invalid and then start from the standby boot program. The write 0 characteristic of NOR FLASH (non-volatile FLASH) is utilized, i.e., FLASH can only write from 1 to 0, but not from 0 to 1, unless the entire block of FLASH is erased. The state is recorded by the number of 1 in one byte (8bit) of FLASH, and the first 1 from low to high of the 8bit data is written into 0 every time the FLASH is started. 8 bits can write 8 times of 0 in total, and then the number of times of starting is recorded eight times at most. In addition, the device provides a RESET button (like the warm start button of a PC) which, when pressed, RESETs the system.
In the embodiment of the invention, firstly, a byte space is reserved in a FLASH chip for storing a boot _ flag of a main bootstrap program, and the default value is 0 xff. As shown in fig. 2, after the CPU is powered on, after approximately tens of instructions are executed in the standby boot program (generally, the CPU is configured most basically, and can access the FLASH chip), a) reads the value of the boot _ flag. If the boot _ flag is less than 0xf0, continuing to execute the standby boot program; if the boot flag is larger than 0xf0, a status indicator lamp (generally a red lamp) on the device is lighted, then the CPU running program counter PC is modified to the address space of the main bootstrap program, the main bootstrap program is jumped to, then the first bit1 of the boot flag from low to high is set to 0, and the first bit1 is stored in the flash. b) After the main bootstrap program is completely started, assigning the boot _ flag to be 0xff, lighting a second lamp (generally a green lamp) of the equipment, and turning off a first lamp (a red lamp);
the time interval of the two processes of a/b is about more than ten seconds, and two traffic lights are used as the running state of the CPU. If the active bootstrap program needs to be set to be invalid, the following operations are continuously performed for 4 times: when the red light of the device is on and the green light is not on, the system is RESET through the RESET key. Thus boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
The invention is further illustrated in detail by means of a specific application example.
Referring to fig. 3, fig. 3 shows a boot program switching processing method according to another embodiment of the present invention, and as shown in fig. 3, the method according to this embodiment of the present invention includes the following steps:
step S1, after the CPU is powered on, executing the instruction from the standby bootstrap program, and entering step S2;
step S2, initializing the interior of the CPU;
at this stage, the internal register of the CPU is initialized to complete the most basic configuration so that it can normally operate, and then the process proceeds to step S3;
step S3, FLASH initialization;
the configuration of the FLASH is completed, and the FLASH can be read and written normally; proceeding to step S4;
step S4, reading a boot _ flag from the flash;
reading data of one byte from a fixed position of the FLASH to a boot _ flag variable, and then entering a step S5;
step S5, judging whether the boot _ flag is larger than 0xf0, if not, entering step S6, and if so, entering step S10;
step S6, if the boot _ flag is not more than 0xf0, continuing to execute the instruction of the standby boot program; and proceeds to step S7;
step S7, upgrading the main bootstrap program, and entering step S8;
step S8, start kernel or execute boot command.
S10, if the boot _ flag is larger than 0xf0, loading the address of the main bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the main bootstrap program; and proceeds to step S11;
and step S11, writing the first from low to high boot _ flag into 0, and writing the 0 into FLASH for storage.
In this step, the boot _ flag stores a fixed position of the NOR FLASH, the occupied space is 8 bits, and the default value is 0b 1111-1111. The main lead sequence writes 0 to its first 1 from low to high. For example, when the current value is 0b1111-1111, then it is written 0b1111-1110, next time it is written 0b1111-1100, 0b1111-1000, 0b1111-0000 and so on, 8 1's can be written 0 in total, and 8 times can be written in total; then, the process proceeds to step S12,
Step S12, lighting a red light to indicate that the current main bootstrap program is entered; and proceeds to step S13;
step S13, initializing each driver and module, wherein the period is long, generally several seconds; then proceeds to step S14;
step S14, the main bootstrap program is completely started, and the process goes to step S15;
step S15, after the main bootstrap program is completely started, the green light is lightened, and the red light is extinguished; and proceeds to step S16;
step S16, setting the boot _ flag to 0xff, and writing the boot _ flag into the flash; then proceeds to step S17;
step S17, starting a kernel or executing a boot command;
in the invention, the kernel is started or the boot command is executed according to the actual situation. The kernel is automatically started by default, and boot various commands can be executed under the condition of keyboard input.
In a further embodiment, after the above steps, when the red light is turned on, the CPU is directly RESET and started from the standby boot program after the RESET key is pressed. As shown in fig. 4. The order of change of values of the boot _ flag is 0b1111-1110- >0b1111-1100- >0b1111-1000- >0b1111-0000 per RESET execution. After the RESET key is pressed four times, the boot _ flag is 0xf0, and according to the preset judgment condition, the condition for executing the primary boot presentation is not satisfied, and the standby boot program is continuously executed.
In the standby boot program, the primary boot program may be re-updated using the online upgrade function.
Therefore, the bootstrap program switching processing method is simple in operation, easy to implement, fast in switching action, convenient for users to use, simple to implement and high in reliability.
In one embodiment, the present invention provides a boot program switching processing apparatus, as shown in fig. 5, the apparatus including:
a preset module 41, configured to reserve a byte space in the FLASH chip to store a boot _ flag of the master boot program;
the initialization module 42 is used for executing the instruction from the standby bootstrap program when the CPU is powered on, initializing the internal register of the CPU and completing the configuration of the FLASH;
a reading module 43, configured to read data of one byte from a fixed position of the FLASH to a boot _ flag variable;
the first control module 44 is configured to determine whether a boot _ flag is greater than 0xf0, and if the boot _ flag is less than 0xf0, continue to execute the instruction of the standby boot program;
and the second control module 45 is configured to load the address of the primary boot program into the program count register PC of the CPU if the boot _ flag is greater than 0xf0, and complete the jump from the standby boot program to the primary boot program.
In a further embodiment, as shown in fig. 5, the apparatus for processing bootstrap switching further includes:
a forced execution module 46, configured to set the active bootstrap program as invalid if the active bootstrap program needs to be forced; through a RESET key RESET system, boot _ flag is equal to 0xf0, and a standby bootstrap program is started by a CPU; as described above.
In one embodiment, the present invention provides a computer device, which may be a terminal, having an internal structure as shown in fig. 6. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of generating a natural language model. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the illustration in fig. 6 is merely a block diagram of a portion of the structure associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The embodiment of the invention provides computer equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to realize the following steps:
reserving a byte space in a FLASH chip for storing a boot _ flag of a main bootstrap program;
when the CPU is powered on, the standby bootstrap program executes the instruction, and the internal register of the CPU is initialized to complete the configuration of the FLASH;
reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of a starting identifier;
judging whether a boot _ flag is larger than 0xf0, and if the boot _ flag is not larger than 0xf0, continuing to execute the instruction of the standby bootstrap program;
if the boot flag is greater than 0xf0, loading the address of the main bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the main bootstrap program; as described above.
In summary, compared with the prior art, the embodiment of the invention has the following advantages:
the invention provides a boot program switching processing method and device, a computer device and a readable storage medium, and provides a method for setting a main boot program to be invalid and then starting a standby boot program. The write 0 feature of NOR FLASH (a non-volatile FLASH memory) is utilized, i.e., FLASH can only write from 1 to 0, but not from 0 to 1, unless the entire block of FLASH is erased. The state is recorded by the number of 1 in one byte (8bit) of FLASH, and the first 1 from low to high of the 8bit data is written into 0 every time the FLASH is started. 8 bits can write 8 times of 0 in total, and then the number of times of starting is recorded eight times at most. In addition, the device provides a RESET button (like the warm start button of a PC) which, when pressed, RESETs the system. The bootstrap program switching processing of the invention has simple operation, easy realization, fast switching action, convenient use for users, simple realization and high reliability.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for bootstrap handover processing, the method comprising:
reserving a byte space in a FLASH chip for storing a boot _ flag of a main bootstrap program;
when the CPU is powered on, the standby bootstrap program executes the instruction, and the internal register of the CPU is initialized to complete the configuration of the FLASH;
reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of a starting identifier;
judging whether a boot flag is larger than 0xf0, and if the boot flag is smaller than or equal to 0xf0, continuing to execute the instruction of the standby bootstrap program;
and if the boot _ flag is larger than 0xf0, loading the address of the primary bootstrap program into a program counting register PC of the CPU, and completing the jump from the standby bootstrap program to the primary bootstrap program.
2. The boot program switchover processing method of claim 1, wherein said step of continuing to execute the instruction of the standby boot program if the boot _ flag is less than or equal to 0xf0 comprises:
if the boot _ flag is not greater than 0xf0, continuing to execute the instructions of the standby bootstrap program;
upgrading the main bootstrap program;
start the kernel or execute boot commands.
3. The boot program switchover processing method of claim 1, wherein if the boot _ flag is greater than 0xf0, the step of loading the address of the active boot program into a program count register PC of the CPU, and completing the jump from the standby boot program to the active boot program comprises:
if the boot _ flag is greater than 0xf0, then a status indicator light on the device is illuminated;
modifying the CPU running program counter PC into the address space of the main bootstrap program, and skipping to the main bootstrap program;
then the first bit1 from low to high of the boot _ flag is set to 0 and stored in flash.
4. The bootstrap handover processing method of claim 3, wherein said step of then setting 0 to a first bit1 of a boot _ flag from low to high and storing in a flash further comprises:
lighting a red light to indicate that the main bootstrap program is entered currently;
initializing each driver and module;
the main bootstrap program is completely started;
after the main bootstrap program is completely started, the green light is lightened, and the red light is extinguished;
setting boot _ flag to be 0xff, and writing the flag into flash;
start the kernel or execute boot commands.
5. The bootstrap handover processing method of claim 1, further comprising the steps of:
if the main bootstrap program is forced to be invalid; with the RESET key RESET system, boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
6. The bootstrap handover processing method according to claim 1, characterized by further comprising the steps of:
after a RESET key is pressed, the CPU is directly RESET and started from a standby bootstrap program;
after pressing the RESET key for four times, the boot _ flag is 0xf0, and according to the preset judgment condition, the condition for executing the main boot presentation is not satisfied, and the standby boot program is continuously executed;
and in the standby boot program, controlling to renew the main boot program by utilizing the online upgrading function.
7. A boot program switch processing apparatus, characterized in that the apparatus comprises:
the preset module is used for reserving a byte space in the FLASH chip for storing a boot _ flag of the main bootstrap program;
the initialization module is used for executing the instruction from the standby bootstrap program when the CPU is powered on, initializing an internal register of the CPU and finishing the configuration of the FLASH;
the reading module is used for reading data of one byte from a fixed position of the FLASH to a boot _ flag variable of the starting identifier;
the first control module is used for judging whether a boot _ flag of the starting identifier is larger than 0xf0, and if the boot _ flag is smaller than or equal to 0xf0, continuing to execute the instruction of the standby bootstrap program;
and the second control module is used for loading the address of the main bootstrap program into a program counting register PC of the CPU and finishing the jump from the standby bootstrap program to the main bootstrap program if the boot _ flag of the starting identifier is larger than 0xf 0.
8. The boot program switch processing apparatus according to claim 7, further comprising:
the forced execution module is used for setting the main bootstrap program as invalid if the main bootstrap program needs to be forced; with the RESET key RESET system, boot _ flag will be equal to 0xf0 and the CPU will start the standby boot process.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the bootstrap switching processing method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the bootstrap switching processing method of any one of claims 1 to 6.
CN202010090985.7A 2020-02-13 2020-02-13 Method and device for processing boot program switching, computer equipment and medium Active CN111338771B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010090985.7A CN111338771B (en) 2020-02-13 2020-02-13 Method and device for processing boot program switching, computer equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010090985.7A CN111338771B (en) 2020-02-13 2020-02-13 Method and device for processing boot program switching, computer equipment and medium

Publications (2)

Publication Number Publication Date
CN111338771A true CN111338771A (en) 2020-06-26
CN111338771B CN111338771B (en) 2023-06-30

Family

ID=71183609

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010090985.7A Active CN111338771B (en) 2020-02-13 2020-02-13 Method and device for processing boot program switching, computer equipment and medium

Country Status (1)

Country Link
CN (1) CN111338771B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986383A (en) * 2021-10-28 2022-01-28 山东云海国创云计算装备产业创新中心有限公司 Boot loader starting method and related device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1658161A (en) * 2004-02-21 2005-08-24 华为技术有限公司 System with primary application and spare program and starting method
US20070186092A1 (en) * 2006-02-09 2007-08-09 Nec Electronics Corporation Multiprocessor system and boot-up method of slave system
CN101158907A (en) * 2007-10-26 2008-04-09 中兴通讯股份有限公司 Bootstrap on-line upgrading method
CN102662749A (en) * 2012-03-23 2012-09-12 中兴通讯股份有限公司 Method and device for realizing switching between dual Boots
CN103116511A (en) * 2013-01-29 2013-05-22 烽火通信科技股份有限公司 Double-booting method based on single FLASH storage chip
CN103853608A (en) * 2012-12-04 2014-06-11 天津中兴软件有限责任公司 Double-Boot switching implementation method
CN108182079A (en) * 2017-12-21 2018-06-19 中国船舶重工集团公司第七0七研究所 A kind of TMS320C6748 program loading methods based on serial ports

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1658161A (en) * 2004-02-21 2005-08-24 华为技术有限公司 System with primary application and spare program and starting method
US20070186092A1 (en) * 2006-02-09 2007-08-09 Nec Electronics Corporation Multiprocessor system and boot-up method of slave system
CN101158907A (en) * 2007-10-26 2008-04-09 中兴通讯股份有限公司 Bootstrap on-line upgrading method
CN102662749A (en) * 2012-03-23 2012-09-12 中兴通讯股份有限公司 Method and device for realizing switching between dual Boots
CN103853608A (en) * 2012-12-04 2014-06-11 天津中兴软件有限责任公司 Double-Boot switching implementation method
CN103116511A (en) * 2013-01-29 2013-05-22 烽火通信科技股份有限公司 Double-booting method based on single FLASH storage chip
CN108182079A (en) * 2017-12-21 2018-06-19 中国船舶重工集团公司第七0七研究所 A kind of TMS320C6748 program loading methods based on serial ports

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986383A (en) * 2021-10-28 2022-01-28 山东云海国创云计算装备产业创新中心有限公司 Boot loader starting method and related device

Also Published As

Publication number Publication date
CN111338771B (en) 2023-06-30

Similar Documents

Publication Publication Date Title
JP3838840B2 (en) Computer
JP3372964B2 (en) Computer system
US6401198B1 (en) Storing system-level mass storage configuration data in non-volatile memory on each mass storage device to allow for reboot/power-on reconfiguration of all installed mass storage devices to the same configuration as last use
US5870520A (en) Flash disaster recovery ROM and utility to reprogram multiple ROMS
US7039799B2 (en) Methods and structure for BIOS reconfiguration
KR100280637B1 (en) Computer system capable of data update of fixed flash ROM and its control method
JP4527348B2 (en) Interface device, method of updating firmware in interface device, and program thereof
KR0121551B1 (en) Portable computer having menu selection function using icons
WO2012071852A1 (en) Method and apparatus for upgrading bootstrap program
JP2000293367A (en) Nonvolatile-memory built-in microcomputer
CN111338771A (en) Boot program switching processing method and device, computer equipment and medium
US6543008B1 (en) Computer system and program rewriting method
JP2000163268A (en) Computer
US20020193939A1 (en) Vehicle-mounted navigation apparatus
JP2007148695A (en) Information processor and method of rewriting boot program
JP2002175193A (en) Device and method for rewriting program
JPH0612217A (en) Personal computer and menu screen display method
KR20030060342A (en) Booting method for personal digital assistant
JP2008009494A (en) Image forming device
JP2003288213A (en) Boot program storage device and method of storing boot program of electronic appliance
JP4408504B2 (en) GAME DEVICE AND ALLOCATION METHOD
KR101236981B1 (en) Hibernation booting system using a hidden area
JP2000020157A (en) Host linked processor with hibernation processing function
JP2008003668A (en) System and method of rewriting control program, rewriting program, information processor, and program and method of controlling the same
JP2002073360A (en) Start information rewrite device

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
GR01 Patent grant
GR01 Patent grant