CN106293708B - Information processing method and storage device - Google Patents

Information processing method and storage device Download PDF

Info

Publication number
CN106293708B
CN106293708B CN201610615799.4A CN201610615799A CN106293708B CN 106293708 B CN106293708 B CN 106293708B CN 201610615799 A CN201610615799 A CN 201610615799A CN 106293708 B CN106293708 B CN 106293708B
Authority
CN
China
Prior art keywords
boot
variable
byte
storage
storage medium
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.)
Active
Application number
CN201610615799.4A
Other languages
Chinese (zh)
Other versions
CN106293708A (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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201610615799.4A priority Critical patent/CN106293708B/en
Publication of CN106293708A publication Critical patent/CN106293708A/en
Priority to US15/664,038 priority patent/US20180032351A1/en
Application granted granted Critical
Publication of CN106293708B publication Critical patent/CN106293708B/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/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping

Landscapes

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

Abstract

The embodiment of the invention discloses an information processing method and electronic equipment, wherein the method comprises the following steps: installing a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.

Description

Information processing method and storage device
Technical Field
The present invention relates to the field of information technologies, and in particular, to an information processing method and a storage device.
Background
After some operating systems (e.g., a Unified Extensible Firmware Interface (UEFI) operating system) are installed, a UEFI boot variable is generated in a flash memory of the UEFI to record a storage path of a boot program given by the UEFI operating system. The UEFI boot variable also records the name of the operating system.
Because the UEFI boot variables are stored in the flash of the UEFI, if the storage medium storing the os code and the boot code is moved to another electronic device (e.g., the electronic device a), the UEFI boot variables are not stored in the flash of the UEFI of the electronic device a, and thus the boot code of the UEFI os cannot be found to boot the UEFI os.
Disclosure of Invention
In view of the above, embodiments of the present invention are directed to an information processing method and an electronic device, which at least partially solve the above problems.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a first aspect of an embodiment of the present invention provides an information processing method, including:
installing a first operating system;
acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
generating a guide variable according to the storage path and the system name;
storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
Based on the scheme, the protection guide record comprises a guide entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code includes:
storing the store path in the store path bytes;
storing the system name in the system name byte;
and storing the partition identification of the partition where the boot code is in the storage partition byte.
Based on the scheme, the guide entry field comprises a storage path byte length byte and a system name length byte;
the method further comprises the following steps:
storing the byte number required by the storage variable storage in the storage path length byte;
and storing the byte number required by the system name storage in the system name length byte.
Based on the scheme, the boot entry field comprises a start identification byte and a check byte;
the method further comprises the following steps:
storing a start identifier in the start identifier byte;
and storing the check code of the data stored in the boot entry field in the check byte.
Based on the above scheme, the method further comprises:
reading a first boot variable from the first storage medium when the first operating system is started;
reading a second boot variable in a second storage medium;
judging whether the first guide variable and the second guide variable are consistent;
when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
Based on the above scheme, when the first boot variable and the second boot variable are inconsistent, reading the boot code of the first operating system according to the first boot variable includes:
replacing a second boot variable in the second storage medium with the first boot variable when the first boot variable and the second boot variable are inconsistent;
and reading the boot code of the first operating system based on the replaced second boot variable.
Based on the above scheme, the method further comprises:
and when the first boot variable and the second boot variable are consistent, reading the boot code according to the second boot variable.
A second aspect of an embodiment of the present invention provides an electronic device, including a processor and a memory connected to the processor, where the memory includes at least a first storage medium detachably connected to the processor:
the processor is used for installing a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
Based on the scheme, the protection guide record comprises a guide entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the processor is specifically configured to store the storage path in the storage path byte of the first storage medium, where the system name byte stores the system name and the storage partition byte stores the partition identifier of the partition where the boot code is located.
Based on the scheme, the guide entry field comprises a storage path byte length byte and a system name length byte;
the processor is further configured to store, in the storage path length byte of the first storage medium, a number of bytes required for storing the storage variable, and store, in the system name length byte, a number of bytes required for storing the system name.
Based on the scheme, the boot entry field comprises a start identification byte and a check byte;
the processor is further configured to store a start identifier in the start identifier byte of the first storage medium, and store a check code of data stored in the boot entry field in the check byte.
Based on the scheme, the memory further comprises a second storage medium different from the first storage medium; the processor is connected with the second storage medium;
the processor is further used for reading a first boot variable from the first storage medium when the first operating system is started; reading a second boot variable in a second storage medium; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
Based on the above scheme, the processor is specifically configured to replace the first boot variable with a second boot variable in the second storage medium when the first boot variable and the second boot variable are inconsistent; and reading the boot code of the first operating system based on the replaced second boot variable.
Based on the above scheme, the processor is further configured to read the boot code according to the second boot variable when the first boot variable and the second boot variable are consistent.
A third aspect of embodiments of the present invention provides an electronic device, including:
an installation unit for installing a first operating system;
an obtaining unit, configured to obtain a storage path of a boot code of the first operating system and a system name of the first operating system;
the generating unit is used for generating a guide variable according to the storage path and the system name;
a storage unit, configured to store the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code.
According to the information processing method and the electronic device provided by the embodiment of the invention, the boot variables and the boot codes are stored in the same storage medium, so that the boot variables and the boot codes are synchronously migrated when the storage medium is migrated, and the problem that the first operating system cannot be booted due to the fact that the boot codes cannot be read according to the boot variables because the boot variables and the boot codes are not migrated together is avoided; the system name of the first operating system is also included in the boot variables, so that the correctness of the system name of the first operating system is ensured at the same time. Furthermore, in this embodiment, the boot variable is written to a reserved byte of the protected boot record of the first storage medium, where the reserved byte is a storage byte reserved for temporary definition of specific information. Therefore, the method can avoid occupying storage bytes distributed to other information by the first storage medium, reduce storage conflict of the information and has the characteristic of strong compatibility with the prior art.
Drawings
Fig. 1 is a schematic flowchart of a first information processing method according to an embodiment of the present invention;
FIG. 2 is a layout diagram of a first storage medium according to an embodiment of the present invention;
fig. 3 is a schematic storage diagram of a PMBR according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a second information processing method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a first electronic device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a second electronic device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a third electronic device according to an embodiment of the present invention;
fig. 8 is a flowchart illustrating a third information processing method according to an embodiment of the present invention.
Detailed Description
The technical solution of the present invention is further described in detail with reference to the drawings and the specific embodiments of the specification.
The first embodiment is as follows:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
The information processing method according to this embodiment may be applied to various electronic devices, such as a desktop computer, a notebook computer, a tablet computer, or a server.
The boot code, which may also be referred to as a boot program, is code that boots the first operating system.
The step S110 installs a first operating system, which may be various types of operating systems, such as a common Windows system; in this embodiment, the first operating system may also be a UEFI system or the like. After installing the first operating system, operating code of the first operating system may be stored in reserved bytes of a Protected Master Boot Record (PMBR) section of a1 st sector in the first storage medium. For example, the first storage medium is a storage medium in a disk partitioning Table (GPT) format. The boot variable may be stored in a reserved byte of the PMBR in the first storage medium of the GPT format.
FIG. 2 is a diagram illustrating a GPT format layout of the first storage medium; the first storage medium includes a primary partition table region, a backup partition table region, and respective partitions.
The main Partition Table area stores a PMBR and a Partition Table (PTH). The back-to-back partition table area stores a partition table for backup.
The partition table includes a partition table header and a partition entry field for each partition. The nth dicing entry field can be used to indicate at least the start position and the end position of the nth partition. In fig. 3, the LBA is a Logical block Address and a Logical block Address; LBA0 represents logical block address 1, LBA1 represents logical block address 1, and LBAm represents logical block m. One of the logical block addresses corresponds to one logical block.
Table 1 may be a definition of a PMBR of a first storage medium of one of the GPT formats:
Figure GDA0003086632540000081
TABLE 1
In this embodiment, the storage path and the system name of the boot code of the first operating system are acquired, and the storage path and the system name can be generated automatically according to the storage location of the boot program by the electronic device through executing a predetermined program code; the electronic equipment is automatically generated and has the characteristic of low error rate.
In step S130, a boot variable is generated according to the storage path and the system name. Generally, the boot code is stored in the hard disk, and the boot program is stored in the BIOS, so that the BIOS can execute the boot code, and the boot program is read from a corresponding storage location of the hard disk according to the boot variable stored in the BIOS, thereby completing the boot process of starting the operating system. However, in this embodiment, the boot variable and the boot code are stored in the same storage medium, which is referred to as a first storage medium in this embodiment. In this way, when the first storage medium is migrated from one electronic device to another electronic device, the electronic device may still obtain the storage location of the boot variable according to the boot variable in the first storage medium, and may accurately obtain the system name of the first operating system located in the first storage medium according to the boot variable. Obviously, the boot variables and the boot codes are stored in the same storage medium together, so that the problem of loss or error of the boot variables caused by storage medium migration in the prior art is simply solved.
In addition, in this embodiment, in order to avoid adverse effects on the current storage of the first storage medium, in this embodiment, the boot variable is stored in the reserved byte of the PMBR of the 1 st sector, so that the compatibility with the prior art is good, and the characteristic of strong compatibility is achieved.
Example two:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
The protected boot record includes a boot entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the step S140 may include:
storing the store path in the store path bytes;
storing the system name in the system name byte;
and storing the partition identification of the partition where the boot code is in the storage partition byte.
In this embodiment, in order to facilitate the electronic device to read the boot variable, in this embodiment, a field dedicated to storing the boot entry is provided, and in this embodiment, in order to accurately and easily read the boot variable, in this embodiment, a storage path storing a boot variable in a storage path byte is provided, and a system name storing a system name of the first operating system in a system name byte is provided. In this embodiment, for the convenience of the electronic device to read the boot variable, a storage partition byte is further provided for storing a partition identifier of a partition where the boot code is located. Conveniently, the electronic device reads the boot code from the corresponding partition in combination with the boot variable and the partition identification. The embodiment provides simple and easy storage of the guide variable.
The reserved bytes of the PMBR have 440 bytes, and when the first storage medium has boot code and operation code storing a plurality of operating systems, it is apparent that 440 bytes can be used for boot variable storage of the boot code of the plurality of operating systems. As shown in fig. 3, s boot variables are stored in 440 bytes, and may include a boot entry field 1, a boot entry field 2 … …, a boot entry field s, and the like.
Example three:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
The protected boot record includes a boot entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the step S140 may include:
storing the store path in the store path bytes;
storing the system name in the system name byte;
and storing the partition identification of the partition where the boot code is in the storage partition byte.
The boot entry field comprises a storage path byte length byte and a system name length byte;
the method further comprises the following steps:
storing the byte number required by the storage variable storage in the storage path length byte;
and storing the byte number required by the system name storage in the system name length byte.
The electronic equipment can distinguish the length of the storage path in the field of the guide entrance and the length of the system name so as to read and analyze the information conveniently. In this embodiment, the leading entry byte further includes a storage path length byte and a system name length byte to indicate the required number of bytes of the corresponding information.
Example four:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
The protected boot record includes a boot entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the step S140 may include:
storing the store path in the store path bytes;
storing the system name in the system name byte;
and storing the partition identification of the partition where the boot code is in the storage partition byte.
The boot entry field comprises a storage path byte length byte and a system name length byte;
the method further comprises the following steps:
storing the byte number required by the storage variable storage in the storage path length byte;
and storing the byte number required by the system name storage in the system name length byte.
The boot entry field comprises a start identification byte and a check byte;
the method further comprises the following steps:
storing a start identifier in the start identifier byte;
and storing the check code of the data stored in the boot entry field in the check byte.
In the embodiment, the start identifier is stored by the start identifier byte, which facilitates the electronic device to easily confirm that the reading of the boot variable is entered by scanning or reading the start identifier.
In addition, in order to ensure the accuracy of the information, check bytes are introduced in the implementation, check codes are stored in the check bytes, the check codes can be used for checking other information in the boot entry field, if the check is correct, the boot variables stored in the current boot entry byte are considered to be correct, otherwise, errors can be considered to occur, so that the phenomenon of illegal tampering is prevented, and the storage reliability of the boot variables is improved.
Table 2 is a definition of the bootstrap entry field:
Figure GDA0003086632540000131
Figure GDA0003086632540000141
TABLE 2
Example five:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
As shown in fig. 4, the method further comprises:
step S210: reading a first boot variable from the first storage medium when the first operating system is started;
step S220: reading a second boot variable in a second storage medium;
step S230: judging whether the first guide variable and the second guide variable are consistent;
step S240: when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
In this embodiment, when the first operating System is started, a second boot variable may be stored in a second storage medium of a general Basic Input Output System (BIOS); in this embodiment, the boot variable stored in the first storage medium is a first boot variable. However, there may be a hard disk migration phenomenon, so in this embodiment, when the boot variable is read, the first boot variable is read from the first storage medium and compared with the second boot variable in the second storage medium of the BIOS. In this embodiment, the second storage medium is obviously not the same storage medium as the first storage medium, and is a storage medium which does not store the boot variable and the operation code of the first operating system.
In this embodiment, the step S210 may specifically include: reading the first boot variable from a reserved byte of a protected boot record in sector 1 of a first storage medium storing the boot code. The first and second lead variables will be aligned at step S230. When the first guide variable is inconsistent with the second guide variable, namely the first guide variable is different from the second guide variable, directly reading a guide code according to the first guide variable with the first guide variable as a standard; obviously, the problem that the boot code cannot be read correctly due to hard disk migration, and an operating system cannot be booted normally is solved.
It is worth noting that: the present embodiment is a further improvement on any of the foregoing embodiments, and reference may be made to embodiments two to four for specific storage locations and specific storage manners of the first boot variable in the first storage medium, which is not repeated here.
Example six:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
As shown in fig. 4, the method further comprises:
step S210: reading a first boot variable from the first storage medium when the first operating system is started;
step S220: reading a second boot variable in a second storage medium;
step S230: judging whether the first guide variable and the second guide variable are consistent;
step S240: when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
The step S240 may include:
replacing a second boot variable in the second storage medium with the first boot variable when the first boot variable and the second boot variable are inconsistent;
and reading the boot code of the first operating system based on the replaced second boot variable.
Replacing the first boot variable with a second boot variable in a second storage medium, in this embodiment, on one hand, to facilitate the BIOS to read the boot code currently; on the other hand, the BIOS can read the boot variables conveniently next time.
Example seven:
as shown in fig. 1, the present embodiment provides an information processing method including:
step S110: installing a first operating system;
step S120: acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
step S130: generating a guide variable according to the storage path and the system name;
step S140: storing the boot variable in a reserved byte of a storage protection boot record in sector 1 of a first storage medium storing the boot code.
As shown in fig. 3, the method further comprises:
step S210: reading a first boot variable from the first storage medium when the first operating system is started;
step S220: reading a second boot variable in a second storage medium;
step S230: judging whether the first guide variable and the second guide variable are consistent;
step S240: when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
In this embodiment, when the first boot variable and the second boot variable are consistent, it indicates that the boot variable stored in the second storage medium is correct, so that the boot code can be directly read by the second boot variable.
Example eight:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
The processor 110 described in this embodiment may correspond to various processing chips or processing circuits, and may specifically include a central processing unit CPU, a microprocessor MCU, a digital signal processor DSP, an application processor AP, a programmable array PLC, an application specific integrated circuit ASIC, or the like. In this embodiment, the processor 110 may execute a predetermined code to complete the operations of installing the first operating system, generating the boot variable, and the like.
The memory 120 may be a variety of storage media, preferably a memory formed of a non-transitory storage medium, such as a memory formed of a flash memory. For example, the first storage medium 121 may be a non-transitory storage memory made of flash.
The processor 110 is detachably connected to the first storage medium 121, so that after the first storage medium 121 is detached and connected to other processors, since the operation code, the boot code and the boot variable given by the first operating system are stored in the same memory, other processors can determine the storage location of the boot code and determine the system name of the first operating system directly according to the boot variable stored in the memory; the problem that in the prior art, the electronic device stores the boot code and the boot variable in different memories, and after the first storage medium 121 is migrated, the electronic device cannot find the boot code and cannot boot the first operating system is solved.
Also shown in fig. 5 is a bus 130 that connects the processor 110 and the memory 120. The bus may be any type of bus capable of exchanging information, and may be, for example, a PCI bus or an IIS bus. The first storage medium 121 may be connected to the processor 110 through a removable interface on a PCI bus or an IIS bus.
Example nine:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
The protected boot record includes a boot entry field;
the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the processor 110 is specifically configured to store the storage path in the storage path byte of the first storage medium 121, where the system name byte stores the system name and the storage partition byte stores the partition identifier of the partition where the boot code is located.
In this embodiment, the boot entry field may be a field newly added to the boot entry field. In this embodiment, in order to facilitate information reading of subsequent electronic devices, the boot entry field is divided into at least a storage path byte, a system name byte, and a storage partition byte, so that the electronic device determines the content of the currently read information directly according to which byte the read information comes from, so as to simplify information reading. In this embodiment, the boot entry field further includes a partition identifier, which is a partition stored for the boot code. In some embodiments, the boot variable may further include the partition identifier, i.e., the partition identifier is a component of the boot variable and may be a part other than the boot variable.
Example ten:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
The protected boot record includes a boot entry field; the boot entry field comprises a storage path byte, a system name byte and a storage partition byte; the processor 110 is specifically configured to store the storage path in the storage path byte of the first storage medium 121, where the system name byte stores the system name and the storage partition byte stores the partition identifier of the partition where the boot code is located.
The boot entry field comprises a storage path byte length byte and a system name length byte; the processor 110 is further configured to store, in the storage path length byte of the first storage medium, a number of bytes required for storing the storage variable, and store, in the system name length byte, a number of bytes required for storing the system name.
In this embodiment, the processor 110 is further configured to write the byte number required by the storage path and the system name into the storage path length byte and the system name byte stored in the first storage medium 121, so that a subsequent processor can conveniently read the storage path and the system name according to the stored required byte number; and simplifying the reading of the storage path and the system name by a subsequent processing area.
Example eleven:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
The protected boot record includes a boot entry field; the boot entry field comprises a storage path byte, a system name byte and a storage partition byte; the processor 110 is specifically configured to store the storage path in the storage path byte of the first storage medium 121, where the system name byte stores the system name and the storage partition byte stores the partition identifier of the partition where the boot code is located.
In this embodiment, the boot entry field includes a start identification byte and a check byte; the processor 110 is further configured to store a start identifier in the start identifier byte of the first storage medium, where the check byte stores a check code of data stored in the boot entry field. Through the introduction of the starting byte and the storage of the check code in the check byte, one side facilitates the reading of the guide variable by the electronic equipment, and the other side can also utilize the check code to carry out information verification, thereby ensuring the accuracy of the storage of the guide variable.
Example twelve:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
As shown in fig. 6, the memory 120 further includes a second storage medium 122 different from the first storage medium 121; the processor 110 is connected to the second storage medium 122;
the processor 110 is further configured to read a first boot variable from the first storage medium 121 when the first operating system is started; reading a second boot variable in the second storage medium 122; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
The processor 110 is specifically configured to read the first boot variable from a reserved byte of a protected boot record of the 1 st sector of the first storage medium 121.
The second storage medium 122 may include a storage medium integrally provided with a BIOS in the electronic device. A connection is established between the processor 110 and the second storage medium 122, which may be a detachable connection or a non-detachable connection.
The processor 110 may read the first boot variable and the second boot variable from the first storage medium 121 and the second storage medium 122, respectively, through execution of the predetermined code, compare the first boot variable and the second boot variable, determine that the first boot variable and the second boot variable are different, and read the boot code based on the first boot variable, which may reduce a phenomenon that the boot code cannot be read or cannot boot the first operating system.
Example thirteen:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
As shown in fig. 6, the memory 120 further includes a second storage medium 122 different from the first storage medium 121; the processor 110 is connected to the second storage medium 122;
the processor 110 is further configured to read a first boot variable from the first storage medium 121 when the first operating system is started; reading a second boot variable in the second storage medium 122; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
The processor 110 is specifically configured to read the first boot variable from a reserved byte of a protected boot record of the 1 st sector of the first storage medium 121.
The processor 110 is specifically configured to replace the first boot variable with a second boot variable in the second storage medium when the first boot variable and the second boot variable are inconsistent; and reading the boot code of the first operating system based on the replaced second boot variable.
In this embodiment, if the first boot variable and the second boot variable are inconsistent, in this embodiment, the processor 110 replaces the second boot variable in the second storage medium with the first boot variable, so as to facilitate the next fast reading of the boot variable.
Example fourteen:
as shown in fig. 5, the present embodiment provides an electronic device, which includes a processor 110 and a memory 120 connected to the processor 110, where the memory 120 includes at least a first storage medium 121 detachably connected to the processor 110:
the processor 110 is configured to install a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; the boot variable is stored in a reserved byte of a storage protection boot record in sector 1 of the first storage medium 121 storing the boot code.
As shown in fig. 6, the memory 120 further includes a second storage medium 122 different from the first storage medium 121; the processor 110 is connected to the second storage medium 122;
the processor 110 is further configured to read a first boot variable from the first storage medium 121 when the first operating system is started; reading a second boot variable in the second storage medium 122; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
The processor 110 is further configured to read the boot code according to the second boot variable when the first boot variable and the second boot variable are consistent.
In this embodiment, when the processor 110 determines that the first boot variable and the second boot variable are consistent, the boot code is read directly according to the second boot variable, and the display is feasible and the reading efficiency is high.
Example fifteen:
as shown in fig. 7, an embodiment of the present invention further provides an electronic device, including:
an installation unit 210 for installing a first operating system;
an obtaining unit 220, configured to obtain a storage path of a boot code of the first operating system and a system name of the first operating system;
a generating unit 230, configured to generate a boot variable according to the storage path and the system name;
a storage unit 240, configured to store the boot variable in a reserved byte of a protected boot record in a1 st sector of the first storage medium storing the boot code.
The electronic device in this embodiment may be an apparatus corresponding to any of the method embodiments described above. The mounting unit 210, the obtaining unit 220 and the generating unit 230 may all correspond to a processor or a processing circuit, which may be referred to in the related description of the previous embodiments, and are not repeated again. In this embodiment, the storage unit 240 may correspond to various storage chips, and may store the boot variable and the boot code in the first storage medium at the same time, so as to avoid the problem that the boot code cannot be read and the first operating system cannot be booted due to the migration of the storage medium.
In some embodiments, the protected boot record includes a boot entry field; the boot entry field includes a storage path byte, a system name byte, and a storage partition byte.
The storage unit 240 is specifically configured to store the storage path in the storage path byte; storing the system name in the system name byte; and storing the partition identification of the partition where the boot code is in the storage partition byte.
Further, the bootstrap entry field includes a storage path byte length byte and a system name length byte; the storage unit 240 is further configured to store, in the storage path length byte, a number of bytes required for storing the storage variable; and storing the byte number required by the system name storage in the system name length byte.
Further, the boot entry field includes a start identification byte and a check byte; the storage unit 240 is further configured to store a start identifier in the start identifier byte; and storing the check code of the data stored in the boot entry field in the check byte.
In some embodiments, the electronic device further comprises a processing unit;
the processing unit may correspond to the processor or the processing circuit described above. The processing unit is specifically configured to read a first boot variable from the first storage medium when the first operating system is started; reading a second boot variable in a second storage medium of the first operating system; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable. For example, the processing unit is specifically configured to, when the first boot variable and the second boot variable are inconsistent, replace the first boot variable with the second boot variable in the second storage medium; and reading the boot code of the first operating system based on the replaced second boot variable.
In yet other embodiments, the processing unit may be further configured to read the boot code according to the second boot variable when the first boot variable and the second boot variable are consistent.
In combination with the above embodiments, a specific example is provided below:
as shown in fig. 8, the present example provides an information processing method including two stages:
the first stage is as follows: original system of memory
Step S1: starting an Operating System (OS) installation program;
step S2: establishing a hard disk GPT partition table;
step S3: installing a UEFI operating system;
step S4: writing a boot variable of UEFI;
step S5: the boot variables are written to a special sector of the storage medium. The special sector herein may be a sector in which the PMBR is recorded. The sector in which the PMBR is recorded is typically the 1 st sector of the storage medium.
And a second stage: a system in which the storage medium is moved;
step S6: powering up and starting an operating system;
step S7: detecting a boot entry field of the special sector;
step S8: determine if it is detected that the boot variable read from the BIOS is consistent with the boot variable in the boot entry field? If yes, the process proceeds to step S10, otherwise, the process proceeds to step S9.
Step S9: the UEFI OS boot variables are reconstructed. The creation here writes the boot variables in the boot entry field of the special sector to the storage medium of the BIOS.
Step S10: and booting the UEFI operating system by using a boot program. The boot program is the aforementioned boot code.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be separately used as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (11)

1. An information processing method characterized by comprising:
installing a first operating system;
acquiring a storage path of a boot code of the first operating system and a system name of the first operating system;
generating a guide variable according to the storage path and the system name;
storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code; wherein the protected boot record includes a boot entry field; the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
wherein the storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code comprises: storing the store path in the store path bytes; storing the system name in the system name byte; storing the partition identification of the partition where the boot code is in the storage partition byte;
reading a first boot variable from the first storage medium and a second boot variable in a second storage medium when the first operating system is started; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading a boot code of the first operating system according to the first boot variable; wherein the first storage medium is different from the second storage medium.
2. The method of claim 1,
the boot entry field comprises a storage path length byte and a system name length byte;
the method further comprises the following steps:
storing the byte number required by the storage path storage in the storage path length byte;
and storing the byte number required by the system name storage in the system name length byte.
3. The method of claim 2,
the boot entry field comprises a start identification byte and a check byte;
the method further comprises the following steps:
storing a start identifier in the start identifier byte;
and storing the check code of the data stored in the boot entry field in the check byte.
4. The method of claim 1,
when the first boot variable and the second boot variable are inconsistent, reading the boot code of the first operating system according to the first boot variable, including:
replacing a second boot variable in the second storage medium with the first boot variable when the first boot variable and the second boot variable are inconsistent;
and reading the boot code of the first operating system based on the replaced second boot variable.
5. The method of claim 1,
the method further comprises the following steps:
and when the first boot variable and the second boot variable are consistent, reading the boot code according to the second boot variable.
6. An electronic device comprising a processor and a memory coupled to the processor, the memory comprising at least a first storage medium removably coupled to the processor:
the processor is used for installing a first operating system; acquiring a storage path of a boot code of the first operating system and a system name of the first operating system; generating a guide variable according to the storage path and the system name; storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code; wherein the protected boot record includes a boot entry field; the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
the processor is specifically configured to store the storage path in the storage path byte of the first storage medium, where the system name byte stores the system name and the storage partition byte stores a partition identifier of a partition where the boot code is located;
wherein the memory further comprises a second storage medium different from the first storage medium; the processor is connected with the second storage medium;
the processor is further used for reading a first boot variable from the first storage medium when the first operating system is started; reading a second boot variable in the second storage medium; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading boot code of the first operating system according to the first boot variable.
7. The electronic device of claim 6,
the boot entry field comprises a storage path length byte and a system name length byte;
the processor is further configured to store the number of bytes required for storage path storage in the storage path length byte of the first storage medium, and store the number of bytes required for storage system name in the system name length byte.
8. The electronic device of claim 7,
the boot entry field comprises a start identification byte and a check byte;
the processor is further configured to store a start identifier in the start identifier byte of the first storage medium, and store a check code of data stored in the boot entry field in the check byte.
9. The electronic device of claim 6,
the processor is specifically configured to replace the first boot variable with a second boot variable in the second storage medium when the first boot variable and the second boot variable are inconsistent; and reading the boot code of the first operating system based on the replaced second boot variable.
10. The electronic device of claim 6,
the processor is further configured to read the boot code according to the second boot variable when the first boot variable and the second boot variable are consistent.
11. An electronic device, comprising:
an installation unit for installing a first operating system;
an obtaining unit, configured to obtain a storage path of a boot code of the first operating system and a system name of the first operating system;
the generating unit is used for generating a guide variable according to the storage path and the system name;
a storage unit for storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code; wherein the protected boot record includes a boot entry field; the boot entry field comprises a storage path byte, a system name byte and a storage partition byte;
wherein the storing the boot variable in a reserved byte of a storage protection boot record in a1 st sector of a first storage medium storing the boot code comprises: storing the store path in the store path bytes; storing the system name in the system name byte; storing the partition identification of the partition where the boot code is in the storage partition byte;
the processing unit is used for reading a first boot variable from the first storage medium and reading a second boot variable in a second storage medium of the first operating system when the first operating system is started; judging whether the first guide variable and the second guide variable are consistent; when the first boot variable and the second boot variable are inconsistent, reading a boot code of the first operating system according to the first boot variable; wherein the first storage medium is different from the second storage medium.
CN201610615799.4A 2016-07-29 2016-07-29 Information processing method and storage device Active CN106293708B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610615799.4A CN106293708B (en) 2016-07-29 2016-07-29 Information processing method and storage device
US15/664,038 US20180032351A1 (en) 2016-07-29 2017-07-31 Information processing method and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610615799.4A CN106293708B (en) 2016-07-29 2016-07-29 Information processing method and storage device

Publications (2)

Publication Number Publication Date
CN106293708A CN106293708A (en) 2017-01-04
CN106293708B true CN106293708B (en) 2021-08-13

Family

ID=57663204

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610615799.4A Active CN106293708B (en) 2016-07-29 2016-07-29 Information processing method and storage device

Country Status (1)

Country Link
CN (1) CN106293708B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255532A (en) * 2018-01-16 2018-07-06 联想(北京)有限公司 A kind of operating system migration method and apparatus
CN110187843B (en) * 2019-06-04 2020-06-26 苏州浪潮智能科技有限公司 Method, system, terminal and storage medium for keeping name sequence of storage medium unchanged

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090013165A1 (en) * 2000-01-06 2009-01-08 Chow David Q Portable usb device that boots a computer as a server
CN101548265A (en) * 2006-12-31 2009-09-30 桑迪士克股份有限公司 Portable multi-platform booting systems and architectures
CN102200921A (en) * 2010-03-25 2011-09-28 微软公司 Intelligent boot device selection and recovery

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100481005C (en) * 2003-10-27 2009-04-22 美国能量变换公司 System and method for updating a software program
US8185727B2 (en) * 2008-04-24 2012-05-22 Dell Products, Lp Method of using an information handling system having a boot file, and an information handling system and machine-executable code for carrying out the method
US20090327741A1 (en) * 2008-06-30 2009-12-31 Zimmer Vincent J System and method to secure boot uefi firmware and uefi-aware operating systems on a mobile internet device (mid)
CN102043640A (en) * 2009-10-23 2011-05-04 富港电子(东莞)有限公司 Flash system and program updating method thereof
JP2012043309A (en) * 2010-08-20 2012-03-01 Sharp Corp System module and electric equipment
CN103430147B (en) * 2011-03-18 2016-03-30 富士通株式会社 The control method of signal conditioning package and signal conditioning package
CN103885784B (en) * 2014-04-09 2017-01-18 中国人民解放军理工大学 Method for establishing Android platform with security module and plugging function
CN105282613A (en) * 2014-06-24 2016-01-27 日照海帝电器有限公司 Smart television software upgrading method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090013165A1 (en) * 2000-01-06 2009-01-08 Chow David Q Portable usb device that boots a computer as a server
CN101548265A (en) * 2006-12-31 2009-09-30 桑迪士克股份有限公司 Portable multi-platform booting systems and architectures
CN102200921A (en) * 2010-03-25 2011-09-28 微软公司 Intelligent boot device selection and recovery

Also Published As

Publication number Publication date
CN106293708A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN110096314B (en) Interface initialization method, device, equipment and computer readable storage medium
CN103970557A (en) Storage device and system starting method thereof
CN105814541A (en) Computer device and memory starting method for computer device
CN107526687B (en) Multi-configuration memory system and operating method thereof
CN103593281A (en) Test system and test method
CN106293708B (en) Information processing method and storage device
CN106484719B (en) Method and terminal for expanding mobile phone storage
CN110765032A (en) Method for reading and writing I2C memory based on system management bus interface
CN110297726B (en) Computer system with serial presence detection data and memory module control method
CN106775847B (en) Board card software version updating method and device
CN111158968A (en) BIOS configuration information self-checking method, device and storage medium
CN114185571A (en) Firmware upgrading method and device of CPLD, terminal and readable storage medium
CN107665129A (en) Information processing method and storage device
CN110502282B (en) Loading method, device and equipment of multi-channel NTB card and readable storage medium
US20180032351A1 (en) Information processing method and storage device
CN111782474A (en) Log processing method and device, electronic equipment and medium
US20110296071A1 (en) Blade server and method for address assignment in blade server system
CN110618828A (en) Data updating method and device
JP6835423B1 (en) Information processing system and its initialization method
US20170131946A1 (en) Method and device for formatting storage of mobile terminal
CN108052337A (en) A kind of firmware upgrade method and device of eMMC production tools
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN110569059A (en) USB-based system partition upgrading method under uboot
CN112486578B (en) Method, system, terminal and storage medium for dynamically loading BMC (baseboard management controller) with sensor
US7447899B2 (en) Method for conserving system resources

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant