Log processing method and electronic device

By generating and recording logs during the startup process of electronic equipment, and performing optimized transfers between memories, the problem of insufficient log collection during the startup process of electronic equipment is solved, and the effective storage of logs and the reliability of fault analysis are achieved.

CN117112520BActive Publication Date: 2024-09-20HONOR DEVICE CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202310419364.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2024-09-20
Estimated Expiration
2043-04-10

AI Technical Summary

Technical Problem

In the process of running and starting the operating system of electronic equipment, there is a lack of log collection, which makes it difficult to determine the cause of the fault and affects fault analysis and location.

Method used

During the startup process of electronic equipment, logs are generated and recorded by the processor, and optimally transferred between memories to ensure that the logs are not lost during the startup process and after power outage. SSD or NOR flash is used as the target memory, which is preferred. SSD, if the SSD is lost, use NOR flash to avoid failure of log downloading.

Benefits of technology

It realizes the effective collection and storage of logs during the startup process and after power outage, ensuring the reliability and accuracy of fault analysis and avoiding the problem of log loss caused by SSD loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117112520B
    Figure CN117112520B
Patent Text Reader

Abstract

The present application provides a log processing method and an electronic device. In this method, after the electronic device is shut down and detects the power-on operation, it needs to enter the system startup phase. After the system startup is completed, the electronic device can be powered on normally. The system startup phase may include: an EC program startup phase, a BIOS startup phase, and an OS startup phase. Among them, the electronic device can generate an EC log in the EC program startup phase. Then, a BIOS log is generated in the BIOS startup phase. After the OS is started, the generated EC log and BIOS log are written to the target memory. By implementing the technical solution provided by the present application, logs (BIOS logs) can be collected during the BIOS operation process and the process of collecting BIOS logs can be optimized. In addition, the process of EC log collection can also be optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminals, and in particular to a log processing method and an electronic device. Background Art

[0002] When electronic devices such as personal computers (PCs) are used by users, logs need to be collected to record events that occur in the electronic devices, such as control trigger events, external device access events, etc. When an electronic device fails, the cause of the failure can be located based on the collected logs, supporting analysis and location of the failure, reproduction, and defect level assessment.

[0003] After the electronic device is shut down, it is necessary to run a startup program to start the operating system. After the operating system is started, the electronic device can be used normally. However, in the process of the electronic device running the startup program to start the operating system (OS), log collection is usually not performed. If the operating system fails to start after running the startup program, the cause of the failure may not be determined through the log.

[0004] Therefore, in the process of running the startup program to start the operating system, how to collect logs and optimize the process of collecting logs is a direction worth discussing. Summary of the invention

[0005] The present application provides a log processing method and an electronic device, which can collect logs and optimize the collected logs when the electronic device runs a startup program to start an operating system.

[0006] In a first aspect, the present application provides a log processing method, wherein the electronic device includes a processor, a first memory, a second memory, and a third memory, and the method includes: during the process of the processor running a startup program to start an operating system, a first log is generated, and the first log is used to record events involved in running the startup program; the processor records the first log in the first memory; when the second memory is available, the processor obtains the first log in the first memory and records it in the second storage; when the second memory is unavailable, the processor obtains the first log in the first memory and records it in the third memory.

[0007] In some embodiments, the boot program can be understood as the BIOS in the specification, the first log can be understood as the BIOS log in the specification, the first memory can be understood as the memory in the specification, the second memory can be understood as the SSD in the specification, and the third memory can be understood as the NOR flash in the description. The processor can be placed in the SOC, or understood as the SOC.

[0008] In the above embodiment, the process in which the processor runs the startup program to start the operating system can be regarded as the process in which the processor runs the BIOS to start the OS. At this time, the BIOS log in the process can be collected and written to the memory. Later, after entering the OS, the OS can write the log in the memory to the target memory. The SSD is preferably selected as the target memory. If the SSD is lost, the NOR flash is used as the target memory. In this way, during the operation of the BIOS, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of the loss of the SSD, the log can be recorded in the NOR flash to avoid the failure of the log to the disk and the loss due to the loss of the SSD.

[0009] In combination with the first aspect, in some embodiments, the data recorded in the first memory after the electronic device is powered off is lost, and the writing speed of the first memory is faster than that of the second memory and the third memory; the data recorded in the second memory and the third memory after the electronic device is powered off continues to be retained.

[0010] In the above embodiment, the first log generated during the startup program is recorded in the first memory with a faster writing speed, so that the first log can be recorded quickly. The first log is subsequently written to the second memory or the third memory where data is not lost after power failure, so that the data can be better preserved.

[0011] In combination with the first aspect, in some embodiments, during the process of the processor running the startup program, it is determined whether the second memory exists; if the second memory exists, it is determined whether the second memory is available; the second memory being available includes the second memory existing and being writable; the second memory being unavailable includes the second memory not existing, or existing but not writable.

[0012] In the above embodiment, the second memory being available can be understood as the second memory in the specification being not lost, and the second memory being unavailable can be understood as being lost in the specification.

[0013] In combination with the first aspect, in some embodiments, when the second memory exists, before determining whether the second memory is available, it includes: determining whether there is a bootable operating system program in the second memory; when there is a bootable operating system program, the processor starts the operating system based on the operating system program.

[0014] In the above embodiments, the operating system program can be understood as a program involved in the operation of the OS.

[0015] In combination with the first aspect, in some embodiments, the method further includes: when the second memory does not exist, the processor controls the electronic device to shut down or restart.

[0016] In the above embodiment, when the second memory does not exist, the operating system is not started this time, and the computer can be shut down or restarted.

[0017] In combination with the first aspect, in some embodiments, the electronic device also includes an embedded controller, and before the processor runs the startup program, the method also includes: in response to a power-on operation, the embedded controller controls the power-on of hardware in the electronic device, including controlling the power-on of the processor.

[0018] In combination with the first aspect, in some embodiments, the electronic device also includes a fourth memory, and during the process of the embedded controller controlling the power-on of the hardware in the electronic device, the method also includes: generating a second log, and the embedded controller writes the second log to the fourth memory; the fourth memory is a memory built into the embedded controller; when the processor obtains the first log record in the first memory and stores it in the second storage, the processor also obtains the second log record in the fourth memory and stores it in the second storage; when the processor obtains the first log record in the first memory and stores it in the third memory, the processor also obtains the second log record in the fourth memory and stores it in the third memory.

[0019] In the above embodiment, the second log can be understood as the EC log in the description. The fourth memory can be understood as the EC RAM in the description. In the process of EC running the EC program. EC logs can also be collected, and when the second memory is available, the EC logs are written to the second memory. Otherwise, they are stored in the third memory. In this way, the EC log can still be stored in the non-volatile memory when the second memory is unavailable.

[0020] In combination with the first aspect, in some embodiments, when the second memory does not exist, before the processor controls the electronic device to shut down or restart, the method also includes: the processor controls the electronic device to display a prompt message, and the prompt message is used to prompt that the operating system startup fails.

[0021] In the above embodiment, the prompt information may be “SSD is not detected!” in the description.

[0022] In combination with the first aspect, in some embodiments, after the operating system is started, the method further includes: when the first application is in an open state, the processor obtains the log from the second memory and uploads it to the cloud server of the first application.

[0023] In the above embodiment, the first application may be the PC application in the specification. Uploading the log to the cloud server is beneficial to the storage of the log.

[0024] In combination with the first aspect, in some embodiments, when the first application is in an open state, the processor also obtains logs from the third memory and uploads them to the cloud server of the first application.

[0025] In combination with the first aspect, in some embodiments, before the processor obtains the log from the second memory and uploads it to the cloud server of the first application, the processor also obtains the log from the third memory and writes it to the second memory.

[0026] In the above embodiment, the second memory has a larger memory than the third memory, and the logs in the third memory can be written to the second memory first, and then uploaded to the cloud server by the PC application.

[0027] In combination with the first aspect, in some embodiments, the boot program is a basic input / output system that supports the Unified Extensible Firmware Interface specification.

[0028] In a second aspect, the present application provides an electronic device, characterized in that the electronic device comprises one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code comprises computer instructions, and when the one or more processors execute the computer instructions, the one or more processors are used to call the computer instructions so that the electronic device performs the method described in the first aspect or any one of the embodiments of the first aspect.

[0029] In the above embodiment, the process in which the processor runs the startup program to start the operating system can be regarded as the process in which the processor runs the BIOS to start the OS. At this time, the BIOS log in the process can be collected and written to the memory. Later, after entering the OS, the OS can write the log in the memory to the target memory. The SSD is preferably selected as the target memory. If the SSD is lost, the NOR flash is used as the target memory. In this way, during the operation of the BIOS, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of the loss of the SSD, the log can be recorded in the NOR flash to avoid the failure of the log to the disk and the loss due to the loss of the SSD.

[0030] In a third aspect, the present application provides a computer storage medium, characterized in that a computer program is stored in the storage medium, and the computer program includes executable instructions, which, when executed by a processor, enable the processor to execute the method described in the first aspect or any one of the embodiments of the first aspect.

[0031] In the above embodiment, the process in which the processor runs the startup program to start the operating system can be regarded as the process in which the processor runs the BIOS to start the OS. At this time, the BIOS log in the process can be collected and written to the memory. Later, after entering the OS, the OS can write the log in the memory to the target memory. The SSD is preferably selected as the target memory. If the SSD is lost, the NOR flash is used as the target memory. In this way, during the operation of the BIOS, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of the loss of the SSD, the log can be recorded in the NOR flash to avoid the failure of the log to the disk and the loss due to the loss of the SSD.

[0032] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions so that the electronic device executes the method described in the first aspect or any one of the embodiments of the first aspect.

[0033] In the above embodiment, the process in which the processor runs the startup program to start the operating system can be regarded as the process in which the processor runs the BIOS to start the OS. At this time, the BIOS log in the process can be collected and written to the memory. Later, after entering the OS, the OS can write the log in the memory to the target memory. The SSD is preferably selected as the target memory. If the SSD is lost, the NOR flash is used as the target memory. In this way, during the operation of the BIOS, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of the loss of the SSD, the log can be recorded in the NOR flash to avoid the failure of the log to the disk and the loss due to the loss of the SSD.

[0034] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any one of the implementations of the first aspect.

[0035] In the above embodiment, the process in which the processor runs the startup program to start the operating system can be regarded as the process in which the processor runs the BIOS to start the OS. At this time, the BIOS log in the process can be collected and written to the memory. Later, after entering the OS, the OS can write the log in the memory to the target memory. The SSD is preferably selected as the target memory. If the SSD is lost, the NOR flash is used as the target memory. In this way, during the operation of the BIOS, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of the loss of the SSD, the log can be recorded in the NOR flash to avoid the failure of the log to the disk and the loss due to the loss of the SSD. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 The system startup process and log data collection process involved in the electronic device when it is turned on are shown;

[0037] Figure 2 The relative relationship between each memory and SOC is shown;

[0038] Figure 3 An exemplary process of collecting logs by an electronic device based on a log processing method is shown;

[0039] Figure 4 An exemplary user interface for displaying prompt information is shown;

[0040] Figure 5A as well as Figure 5B The schematic diagram of the scenario in which the OS boot fails due to SSD loss is shown in FIG.

[0041] Figure 6 A schematic diagram of interaction when logs are written to disk is shown in FIG.

[0042] Figure 7 An exemplary electronic device provided by the present application is shown. DETAILED DESCRIPTION

[0043] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0044] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0045] The boot program can be a basic input output system (BIOS) that supports the unified extensible firmware interface (UEFI) specification, also known as UEFI BIOS. BIOS is referred to below. When the boot program is BIOS, in one solution, the electronic device can first run the BIOS to identify and initialize the hardware. Then enter the boot loader stage and start the operating system in a preset manner. After the operating system completes startup, the electronic device will transfer system control from BIOS to OS. Subsequently, after entering the operating system, the electronic device can start a device management application (such as PC housekeeper) and collect logs involved in the operation of the operating system through the device management application.

[0046] Since the electronic device runs BIOS first and then runs OS, and the device management application is an application that is opened after the OS runs, the electronic device cannot collect logs involved in the BIOS running process.

[0047] In another solution, a log processing method is provided, in which an electronic device can collect logs (BIOS logs) during BIOS operation and optimize the process of collecting BIOS logs. In addition, the process of collecting EC logs can also be optimized. The EC log includes events involved in an embedded controller (EC) when running an EC program.

[0048] After the electronic device is shut down and detects the power-on operation, it needs to enter the system startup phase. After the system startup is completed, the electronic device can be normally powered on. The system startup phase may include: EC program startup phase, BIOS startup phase, and OS startup phase. Among them, the electronic device can generate an EC log in the EC program startup phase. Then, a BIOS log is generated in the BIOS startup phase. After the OS is started, the generated EC log and BIOS log are written to the target memory.

[0049] Among them, the process of optimizing log (EC log or BIOS log) collection occurs in the process of writing EC log and BIOS log to the target memory. Before writing EC log or BIOS log to the target memory, the electronic device will determine whether the target memory is SSD or NOR flash.

[0050] It should be understood here that collecting logs may include a process of generating logs and writing the logs into a storage device.

[0051] Figure 1 The system startup process and log data collection process involved in starting up an electronic device are shown.

[0052] like Figure 1 As shown, the execution direction indicated by the "black solid arrow" involves the system startup flow. The execution direction indicated by the "black dotted arrow" involves the log data flow. After the electronic device is shut down, the EC is always in the power-on state, and the EC can be used to receive power-on events. When the electronic device is turned off, the operating state of the electronic device can be S4 or S5. Among them, in some possible cases, the operating state indicated by S4 can also be called the disk wake-up state (suspend to disk, STD). The operating state indicated by S5 can also be called the shutdown state (shutdown). At this time, the EC is still in the shutdown state, and other parts or all of the hardware (including the processor) are in the power-off state.

[0053] After detecting the power-on operation, in response to the power-on operation, the EC starts the EC program to power on other hardware in the electronic device that is in a power-off state, so that the operation state of the electronic device is switched from S4 or S5 to S0. The operation state indicated by S0 can also be called a working state, at which time most or all of the hardware in the electronic device is in a power-on state, and the hardware in a power-on state also includes a system on chip (SOC). When the SOC is powered on, the EC can enter the operation state.

[0054] In some possible cases, the SOC includes a processor of the electronic device. The operations performed by the SOC can be regarded as being performed by the processor in the SOC.

[0055] Among them, the EC can write the log (EC log) generated during the EC program startup phase into the random access memory (RAM) in the EC. The RAM in the EC can also be called EC RAM. That is, the EC can write the EC log into the EC RAM.

[0056] After the SOC is powered on, the electronic device can run the BIOS through the SOC and enter the UEFI BIOS stage. In the UEFI BIOS stage, the SOC can identify and initialize the hardware through the BIOS. For example, the initialized hardware includes a hard disk (solid state disk, SSD) storing the OS program. Then, the SOC can determine whether the SSD exists. If the SSD exists, the OS is found in the SSD to determine whether to start the OS. In the case of determining to start the OS, the SOC continues to run the BIOS to start the OS. After the OS is started, the SOC can log the disk through the log disk module. For example, the log (EC log or BIOS log) can be obtained first. Subsequently, the log disk module can determine whether the SSD is lost. If the SSD is not lost, the log can be written to the SSD. In the case of the SSD being lost, the log can be written to the non-volatile flash memory (NOR flash). In this way, even if the SSD is lost, it is guaranteed that the log can be recorded in the NOR flash. Subsequently, the SOC can transfer system control from the BIOS to the OS.

[0057] Among them, SSD loss includes that the SSD does not exist (that is, the SSD cannot be detected) or the SSD exists but the SSD cannot be written. SSD is not lost includes that the SSD exists (that is, the SSD is detected) and the SSD can be written.

[0058] In some possible cases, the operation of writing logs to disk through the log writing module and the operation of transferring system control from BIOS to OS are both executed by SOC through OS calling ExitBootServive function.

[0059] After the OS gains control of the system, the system can enter the OS stage. Then the PC manager can be run based on the OS. The PC manager collects logs from the SSD or NOR flash and uploads them to the cloud server.

[0060] When it is determined that the SSD does not exist, or when the OS is not started, the SOC can still write logs to the disk through the log writing module. Then, the SOC can shut down or restart the electronic device.

[0061] In some possible cases, the operation of writing logs to disk through the log writing module and then shutting down or restarting the electronic device are all executed by the SOC calling the ResetSystem function through the BIOS.

[0062] In some possible cases, when it is determined that the SSD does not exist, the SOC may also display a prompt message to prompt the user that the SSD does not exist or the OS startup fails.

[0063] For the process of writing logs to disk, please refer to the above description, which will not be repeated here.

[0064] Figure 1 The ending operation shown in FIG. 1 includes the electronic device ending operation and entering a shutdown state after detecting the shutdown operation.

[0065] Depend on Figure 1 It can be seen that in this solution, during the BIOS operation, the BIOS log can be written to the memory so that the BIOS log can be collected. At the same time, in the case of SSD loss, the log can be recorded in the NOR flash to avoid the failure of the log to disk and the loss due to the loss of the SSD.

[0066] The storage devices involved in the aforementioned log collection process may include memory, SSD, NOR flash, and EC RAM. Figure 2 The relative relationship between each memory and SOC is shown. Figure 2 The process of collecting BIOS logs includes writing them to memory and then writing them to SSD or NOR flash, and the process of collecting EC logs includes writing them to EC RAM and then writing them to SSD or NOR flash.

[0067] like Figure 2As shown, EC RAM is a random access memory placed in EC. EC RAM, memory, SSD, and NOR flash are all connected to SOC through a bus. For SOC, EC RAM, memory, SSD, and NOR flash are all external memories, which can also be called auxiliary memories. SOC also includes complementary metal-oxide-semiconductor (CMOS) memory. For SOC, the CMOS is a built-in memory, which can also be called main memory.

[0068] It should be understood here that CMOS is the abbreviation of "complementary metal-oxide-semiconductor", which can be translated as "complementary metal oxide semiconductor", which is a semiconductor technology. The CMOS memory mentioned above can be regarded as a component or chip produced by a process using semiconductor technology, and can be understood as a RAM built into the SOC.

[0069] In this solution, the process of collecting BIOS logs includes writing to memory first and then writing to SSD or NOR flash because the writing speed of memory is faster than that of SSD and NOR flash. Therefore, in the process of running BIOS, in order to reduce time cost, the BIOS log can be recorded in memory first. That is, memory is used as a temporary storage. Memory is also a storage with high purchase cost, and the capacity of memory is small. Therefore, after running BIOS to start OS, the BIOS log recorded in memory needs to be written to SSD or NOR flash. After SOC transfers system control from BIOS to OS, the BIOS log recorded in memory can be deleted to release the storage space in memory. In some possible cases, the data recorded in memory is lost after power failure, so it is necessary to transfer the BIOS log recorded in memory to SSD or NOR flash where the data is still retained after power failure.

[0070] In this solution, if the SSD is not lost, the BIOS log is preferentially written from the memory to the SSD. In the case of the SSD being lost, the NOR flash is used as an "emergency" memory to write the BIOS log. The reason is that the capacity of the SSD is larger than that of the NOR flash. For example, the capacity of the SSD may include 512GB, which is mainly used to store OS and user data. Among them, the space used to store logs (BIOS logs or EC logs) is about 4M. The NOR flash can be used to store BIOS image files, and its capacity can be 16M. Among them, the space used to store logs (BIOS logs or EC logs) is about 4K (much less than 4M).

[0071] In some possible cases, the reasons for giving priority to SSD as the target storage may also include: although both NOR flash and SSD have a limit of about 100,000 rewrites. However, the capacity of NOR flash is smaller than that of SSD, so it is easier to fill it up, and an erase operation will be generated after it is full. Therefore, compared with SSD, the number of rewrites of NOR flash is easier to be exhausted. Moreover, once NOR flash fails, users cannot repair it by themselves, which may cause the electronic device to fail completely. However, after the SSD fails, it can be replaced, which will not cause the electronic device to fail completely.

[0072] The reason for recording the EC log to the EC RAM before writing it to the target storage is that when the electronic device is in the EC program startup phase and the BIOS has not yet started running, other memories are still powered off, while the EC is powered on, so the EC log can be written to the EC RAM first.

[0073] It should be understood here that for the EC log, if the SSD is not lost, the EC log is preferentially written from the EC RAM to the SSD. In the case of the SSD being lost, the NOR flash is used as an "emergency" memory to write the EC log. The reasons involved are the same as those for writing the BIOS log to the SSD or NOR flash. Please refer to the above related descriptions, which will not be repeated here.

[0074] It should also be understood that the reason why the BIOS log is collected and introduced into the memory here, rather than writing the BIOS log into the CMOS memory with a fast writing speed, is that the CMOS memory has a small capacity (for example, 256 bytes) and most of the storage space has been occupied by some existing needs, and the available space is usually 8 bytes. That is, although the CMOS memory has the characteristics of independent power supply by button batteries, simple data access, and data is not easily lost after power failure, there is insufficient space for storing BIOS logs.

[0075] What should be understood here is that the reason why data in CMOS memory is not easily lost after power failure is that CMOS memory is independently powered by a button battery, so data will not be lost after the system is powered off. The data will disappear only if the button battery is removed.

[0076] In some possible cases, EC can be connected to SOC via LPC bus or eSPI bus. NOR flash can be connected to SOC via SPI bus, memory can be connected to SOC via DDR bus, and SSD can be connected to SOC via PCIE bus.

[0077] Figure 3 An exemplary process of collecting logs by an electronic device based on a log processing method is shown.

[0078] The log processing method is applicable to log collection during the process of electronic equipment from shutdown to startup (including startup completion and startup failure). The details of the process can be referred to the following description of steps S101-S113, steps S1a-S1b, and steps S2a-S2b.

[0079] First, when the electronic device is powered off and detects a power-on operation, it first enters the EC program startup phase. For a detailed description of this process, please refer to the following description of step S101.

[0080] S101. When the EC is in the on state, in response to a power-on operation, trigger the electronic device to switch to the working state, including powering on the SOC.

[0081] After the electronic device is turned off, the EC may be in a powered-on state, and at this time the EC may be used to receive a power-on event. Upon detecting a power-on operation, in response to the power-on operation, the EC may run an EC program to trigger the electronic device to switch to a working state. When the electronic device is turned off, the operating state may be S4 or S5 as mentioned above.

[0082] The EC switches the electronic device from the shutdown state to the working state, including: powering on the hardware in the electronic device that is in the power-off state. For example, powering on the SOC so that the SOC can execute the operation of running the BIOS. During the process of the electronic device switching to the working state, the EC can also perform the following step S1a to obtain the EC log.

[0083] S1a.EC writes the EC log into EC RAM.

[0084] The EC log may include a log generated during the process of the electronic device switching to a working state.

[0085] In some possible cases, the EC may start collecting EC logs upon detecting a power-on operation.

[0086] In some possible cases, the EC log may include historical shutdown instructions (shoutdown code), battery abnormality data, etc. In actual situations, it may also include other contents, which are not limited in the embodiments of the present application.

[0087] It should also be understood that, in some possible cases, EC logs can be collected and stored in the EC RAM when the EC is in the turned-on state.

[0088] After the EC completes powering on the hardware, the following step S2a may also be performed.

[0089] S2a.EC enters runtime.

[0090] After the EC enters operation, it can monitor the status of some hardware in the electronic device to maintain the normal operation of the electronic device. For example, when the temperature of the electronic device is detected to be too high, the fan is turned on to cool the electronic device. It can also wait for the shutdown operation and power off the hardware in the electronic device.

[0091] The above functions of the EC after entering runtime are illustrative only. In actual situations, it may also have other functions, which are not limited in the embodiments of the present application.

[0092] After the SOC is powered on, the electronic device can run the BIOS based on the SOC and enter the BIOS startup phase, and start the operating system through the BIOS.

[0093] For the relevant contents involved in the BIOS startup phase, reference may be made to the following description of step S102 to step S107 .

[0094] S102. The SOC runs BIOS to initialize the hardware, including the SSD.

[0095] In some possible cases, the SOC may specifically run a pre-EFI initialization (PEI) program block in the BIOS, or may further run a driver execution environment (DXE) program block to initialize the hardware, wherein the initialized hardware may include an SSD.

[0096] After the hardware initialization is completed, the SOC can run the boot device selection (BDS) program block in the BIOS to enter the relevant process of OS startup. For the relevant content involved in this process, please refer to the following description of steps S103 to S109.

[0097] S103. The SOC determines whether the SSD exists.

[0098] The SSD includes an OS, so when the OS is started, it is first determined whether the SSD can be detected. If the SSD can be detected, the SOC determines that the SSD exists. If the SSD cannot be detected, the SOC determines that the SSD does not exist.

[0099] When it is determined that the SSD exists, the SOC may execute the following step S104 to continue the process of starting the operating system.

[0100] When it is determined that the SSD does not exist, the SOC stops the process of booting the OS. At this time, the SOC may execute the following step S106 to display a prompt message to prompt the user that the OS booting fails.

[0101] S104. The SOC determines whether to start the OS in the SSD.

[0102] The SOC may determine the location of the OS program in the SSD, and then detect whether the OS can run normally. If it is determined that the OS can run normally, the SOC determines to start the OS in the SSD. At this time, the SOC may perform the following step S109.

[0103] If the OS is not found in the SSD, or it is detected that the OS cannot be run normally, the SOC determines not to start the OS in the SSD. At this time, the SOC may perform the following step S105.

[0104] Among them, the reasons why the OS cannot run normally (OS startup failure) include but are not limited to one or more of the following situations: BIOS upgrade or BIOS to be repaired (recovery), BIOS setup modification, the electronic device is in a low-battery and over-temperature situation, the electronic device is in a situation where the battery level is checked without being turned on, the boot device is changed, the electronic device is in store mode, the electronic device is connected to external devices such as USB, operations on hot keys (such as shortcut keys) are detected during the startup process, etc.

[0105] The reason for the OS startup failure may be recorded in the BIOS log.

[0106] S105. When it is determined that the SSD is not lost, the SOC writes the EC log in the EC RAM and the BIOS log in the memory into the SSD.

[0107] The SOC determines whether the SSD is lost. If the SSD is not lost, the SOC writes one or more logs of the EC log in the EC RAM and the BIOS log in the memory to the SSD. For example, the EC log may be written to the SSD, the BIOS log may be written to the SSD, or the EC log and the BIOS log may be written to the SSD.

[0108] It should be understood here that, in the case of determining that the SOC is lost, the SOC can write one or more logs of the EC log in the EC RAM and the BIOS log in the memory to the NOR flash to ensure that the EC log or the BIOS log can be written to the disk.

[0109] S106. SOC displays prompt information.

[0110] When it is determined that the SSD is not detected, a prompt message (prompt message 1) may be displayed in the user interface of the electronic device, and the prompt message may be used to prompt related information such as a startup failure.

[0111] Figure 4 An exemplary user interface for displaying prompt information is shown.

[0112] like Figure 4 As shown, a prompt box may pop up in the user interface of the electronic device, and the prompt box may include a text prompt message: "SSD is not detected!".

[0113] It should be understood here that the aforementioned prompt information 1 is an exemplary description, and in actual situations it may also be other contents, which is not limited in the embodiments of the present application.

[0114] It should also be understood that, in some possible cases, the operation of displaying the prompt information 1 is optional, and the SOC may not display the prompt information 1.

[0115] S107.SOC writes the EC log in the EC RAM and the BIOS log in the memory into the NOR flash.

[0116] In the case where it is determined that the SSD is not detected, the SOC may determine that the SSD is lost. Then, one or more logs of the EC log in the EC RAM and the BIOS log in the memory may be written to the NOR flash. For example, the EC log may be written to the NOR flash, the BIOS log may be written to the NOR flash, or the EC log and the BIOS log may be written to the NOR flash.

[0117] After completing writing the log (including the EC log or the BIOS log) to the target memory (SSD or NOR flash), the SOC may perform the following step S108 to shut down or restart the electronic device.

[0118] S108. The SOC executes the operation of shutting down or restarting the electronic device.

[0119] In the case that the SSD does not exist or the SSD exists but the OS is not started, the OS startup fails, and the SOC can execute the operation of shutting down or restarting the electronic device.

[0120] A log (BIOS log) may be generated during the BIOS startup phase, and the SOC may further execute the following step S1b to obtain the BIOS log.

[0121] S1b.SOC writes the BIOS log to memory.

[0122] The BIOS log may include a log generated during the operation of the BIOS.

[0123] In some possible cases, the processor may start collecting the BIOS log after the BIOS starts running.

[0124] In some possible cases, the BIOS log may include but is not limited to the original image of OS boot failure, for example, one or more of the following contents: BIOS upgrade or BIOS to be repaired (recovery), BIOS setup modification, electronic device in low power and over temperature, electronic device in the state of not turning on to check power, boot device change, electronic device in store mode, electronic device connected to external devices such as USB, operation of hot keys (such as shortcut keys) detected during boot process, etc. In actual situations, it can also be other contents, which are not limited in the embodiments of the present application.

[0125] When it is determined that the SSD includes an OS program and it is detected that the OS can run normally, the SOC executes the following step S109 to start the OS.

[0126] S109. The SOC starts the OS.

[0127] After the OS is started, the EC log recorded in the EC RAM can be written to the SSD or NOR flash, and PC Manager can be run to transfer the log in the SSD or NOR flash to the cloud server. For a detailed description of this process, please refer to the following description of steps S110 to S113.

[0128] S110. When it is determined that the SSD is not lost, the SOC writes the EC log in the EC RAM and the BIOS log in the memory into the SSD.

[0129] The SOC determines whether the SSD is lost. If the SSD is not lost, the SOC writes one or more logs of the EC log in the EC RAM and the BIOS log in the memory to the SSD. For example, the EC log may be written to the SSD, the BIOS log may be written to the SSD, or the EC log and the BIOS log may be written to the SSD.

[0130] It should be understood here that in the case of SOC loss, SOC can write one or more logs of EC log in EC RAM and BIOS log in memory to NOR flash to ensure that EC log or BIOS log can be written to disk.

[0131] S111. SOC transfers system control from BIOS to OS.

[0132] In some possible cases, the system control is transferred from BIOS to OS loader first, and the BootService resources occupied by BIOS are released, retaining the RuntimeService type resources. The released BootService resources are recycled to OS loader, and as OS loader executes, OS finally obtains control of the system.

[0133] S112. The system enters the OS stage.

[0134] In some possible cases, when the system enters the OS, the SOC can display the content involved in the completion of the boot in the user interface.

[0135] S113. The SOC runs PC Manager and transmits the logs in the SSD, or the SSD and NOR flash to the cloud server through the PC Manager.

[0136] In some possible cases, when logs (EC logs or BIOS logs) are stored in NOR flash, SOC can also write the logs in NOR flash to SSD through PC Manager. Later, PC Manager collects system logs according to normal business logic and stores them in SSD. SOC can transfer the logs in SSD to cloud server through PC Manager.

[0137] In some other possible situations, the SOC can also obtain logs (EC logs or BIOS logs) from the SSD and NOR flash respectively through the PC manager and transmit them to the cloud server.

[0138] It should be understood here that after the control of the system is transferred from the BIOS to the OS, the SOC may execute the following step S2b to enable the BIOS to enter runtime.

[0139] S2b.BIOS enters runtime.

[0140] After the BIOS enters runtime, the control of the system is transferred from the BIOS to the OS, and the various resources occupied by the BIOS are recycled to the OS, leaving only the BIOS runtime services for the OS to use. At this point, if a catastrophic error occurs during OS operation, the BIOS can still provide error handling and disaster recovery after entering runtime.

[0141] The above functions after the BIOS enters runtime are exemplary descriptions. In actual situations, it may also have other functions, which are not limited in the embodiments of the present application.

[0142] It should be understood here that the aforementioned steps involve writing the EC log to the EC RAM, and then storing the EC log in the EC RAM on the target storage. Then, the relevant contents involved in transferring the EC log to the cloud server are optional. The electronic device may or may not perform the steps, and the embodiments of the present application do not limit the steps.

[0143] Combined with the above content, it can be understood that the BIOS log records the reason why the electronic device starts the OS (failed to start up). If the startup fails, the reason for the startup failure can be determined based on the BIOS log. And if the SSD is lost, the log in the BIOS can still be written to the NOR flash first, and then uploaded to the cloud server. The probability of obtaining the BIOS log in the case of a startup failure caused by the loss of the SSD is increased.

[0144] The following describes a scenario in which the OS fails to boot due to SSD loss during the boot process and the computer cannot boot. However, the "SSD loss" event is recorded as a BIOS log in the memory and subsequently written to the NOR flash.

[0145] Figure 5A as well as Figure 5B FIG. 4 is a schematic diagram showing a scenario in which an OS startup fails due to SSD loss.

[0146] like Figure 5A As shown in (1), it is an exemplary user interface involved in the shutdown of the electronic device. At time 1 (t1), a power-on operation is detected, and the electronic device performs related operations involved in the power-on. For example, running programs such as EC and BIOS to start the OS to start the device.

[0147] At time 2 (t2), the electronic device determines that the SSD is lost and cannot find the OS, and can display the following Figure 5A The prompt box shown in (2) may include text prompt information: "SSD is not detected!".

[0148] Subsequently, if the electronic device fails to start up, it can remain in the off state. Figure 5A The content shown in (3).

[0149] Although the SSD is lost, the BIOS logs corresponding to time 1 (t1) and time 2 (t2) can still be found in the electronic device when the computer is turned on next time.

[0150] like Figure 5B As shown in the figure, it is an exemplary user interface involved when an electronic device displays a BIOS log. It includes BIOS log information 1 and BIOS log information 2. Among them, BIOS log information 1 is used to indicate that the electronic device has a boot instruction at time 1, and BIOS log information 2 is used to indicate that the electronic device detects that the SSD is lost at time 2. Among them, BIOS log information 1 can be expressed as "t1: boot code", and BIOS log information 2 can be expressed as "t2: SSD is not detected".

[0151] It should be understood that the above-mentioned log information is represented by way of example and may be represented in other forms, which should not limit the embodiments of the present application.

[0152] In some possible cases, when it is determined in step S103 that the SSD exists, the determination of whether the SSD is lost involved in step S105 and step S110 may include determining whether the SSD can be written, and no longer determining whether the SSD exists.

[0153] In some other possible cases, when it is determined in step S103 that the SSD exists, the determination of whether the SSD is lost in step S105 and step S110 not only includes determining whether the SSD can be written. Before determining whether it can be written, it also includes determining whether the SSD exists again. It should be understood that only when it is determined that the SSD exists, it is determined whether the SSD can be written.

[0154] Figure 6 FIG. 4 shows an interactive diagram of when logs are written to disk.

[0155] like Figure 6 As shown, the interaction process when the log is written to the disk includes steps 1 to 4.

[0156] Step 1.BIOS starts the service.

[0157] The SOC can start the OS by running BOIS. In step 1, the SOC can first write the BIOS log of the BIOS startup phase into the memory. Then, the BIOS log in the memory and the EC log in the EC RAM are written into the EC RAM. For a detailed description of this process, please refer to the aforementioned description of steps S102-S107 and step S109, which will not be repeated here.

[0158] Among them, step 1 is Figure 6 ① shown in .

[0159] Step 2. SOC transfers system control from BIOS to OS, and BIOS enters runtime.

[0160] For the relevant description of step 2, please refer to the aforementioned description of step S111, which will not be repeated here.

[0161] Among them, step 2 is Figure 6 ② shown in .

[0162] Step 3. Open PC Manager in OS.

[0163] Among them, step 3 is Figure 6 ③ shown in .

[0164] Step 4. The OS starts the SSD driver, obtains logs from the SSD, and then transmits the logs to the cloud server through PC Manager.

[0165] In some possible cases, when logs (EC logs or BIOS logs) are stored in NOR flash, SOC can also write the logs in NOR flash to SSD first. Later, SOC can transfer the logs in SSD to cloud server through PC Manager.

[0166] Among them, step 4 is Figure 6 ④ shown in .

[0167] Figure 7 An exemplary electronic device provided by the present application is shown.

[0168] It should be understood that electronic devices may have Figure 7 The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0169] Figure 7 The electronic device is described by taking a personal computer (PC) as an example.

[0170] The electronic device may include: a processor 171 , a main memory 172 , an auxiliary memory 173 , a chipset 174 , a power switch 175 , an input / output device 176 , a USB communication processing module 177 , a wireless communication processing module 178 , and a buzzer 179 .

[0171] The processor 171 can be used to read and run computer-readable instructions. In a specific implementation, the processor 171 may mainly include a controller, an arithmetic unit, and a register. Among them, the controller is mainly responsible for decoding instructions and issuing control signals for operations corresponding to the instructions. The arithmetic unit is mainly responsible for performing fixed-point or floating-point arithmetic operations, shift operations, and logical operations, etc., and can also perform address operations and conversions. The register is mainly responsible for storing register operands and intermediate operation results temporarily stored during the execution of instructions.

[0172] For example, the aforementioned SOC can be regarded as a processor 171 , and the CMOS memory therein can be regarded as a register in the processor 171 .

[0173] The processor 171 may also be used to read and execute instructions related to BIOS so that the electronic device can start up normally.

[0174] The main memory 172 is coupled to the processor 171 and is used to store various software programs and / or multiple groups of instructions. The software programs and / or multiple groups of instructions in the main memory 172 can be directly read by the processor 171 .

[0175] The main memory 172 may also include non-volatile memory chips, such as one or more flash memory devices. The main memory 172 may store an operating system, such as an embedded operating system such as a real time multi-tasking operating system (uCOS), a Microsoft Windows operating system, and the like.

[0176] In some possible cases, the main memory 172 may also be the aforementioned SSD, which can be used to store the BIOS program, the EC log, and the BIOS log.

[0177] The auxiliary memory 173 is used to store various resources, such as pictures, audio and video, etc. In a specific implementation, the auxiliary memory 173 can be an external memory, and can include a large-capacity storage device, such as a disk storage device, etc. The auxiliary memory 173 can exchange information with the main memory 172 .

[0178] In some possible cases, the auxiliary memory 173 may also include NOR flash, EC RAM, and memory.

[0179] Chipset 174 may include one or more of a north bridge chip 174A and a south bridge chip 174B, which are used to connect a microprocessor (not shown) with other parts of the electronic device.

[0180] The north bridge chip 174A may be used to provide an interface between the processor 171 and other parts of the electronic device, for example, it may be used to provide an interface to the main memory 172. In addition, the north bridge chip 174A may also be used to provide a network communication function through a gigabit Ethernet adapter (GEA) (not shown).

[0181] The south bridge chip 174B can be used to control the input / output functions of the electronic device. In a specific implementation, one or more Universal Serial Bus (USB) ports, a sound adapter, an Ethernet controller, and one or more general input / output pins can be provided.

[0182] The south bridge chip 174B may also provide a bus for connecting peripheral devices, such as a SCSI host bus adapter (not shown) that complies with the BIOS boot specification (BBS) standard.

[0183] In other embodiments, the south bridge chip 174B may also provide one or more interfaces, which may be used to connect the auxiliary memory 173 to the electronic device so that the auxiliary memory 173 may exchange information with the main memory 172. In this way, the electronic device may read some program blocks of the standby BIOS stored in the auxiliary memory 173 into the main memory 172, so that the processor 171 may read and run some program blocks of the standby BIOS from the main memory 172.

[0184] The power switch 175 can be used to control the power supply to the electronic device. When the power switch is turned on, the electronic device can start running the BIOS, and when the BIOS runs normally, the electronic device can be turned on normally.

[0185] The input / output device 176 is used to provide a number of input / output ports, such as a keyboard port, a mouse port, a serial port, a parallel port, etc. Among them, the input device includes a keyboard, a mouse, and a camera. The output device may include a display screen, a printer, and a plotter.

[0186] In some possible cases, after the electronic device completes normal BIOS operation, a startup user interface may be displayed on the display screen of the electronic device.

[0187] The USB communication processing module 177 may be used to communicate with other devices via a USB interface (not shown).

[0188] The wireless communication processing module 178 may include one or more of a Bluetooth (BT) communication processing module 178A and a WLAN communication processing module 178B, and is used to establish a wireless communication connection with other electronic devices.

[0189] The buzzer 179 is used as a sound-generating device.

[0190] In some possible cases, when the electronic device is running BIOS and verifying whether there is a problem with the hardware, if there is a problem with a certain hardware, the buzzer 179 will emit a BIOS alarm sound. Different types of sounds indicate that different hardware has problems. For example, in some electronic devices, a long and a short BIOS alarm sound indicates that there is a problem with the RAM or the motherboard.

[0191] It is understandable that the electronic device involved in the embodiments of the present application may also be a mobile device, which is not limited here.

[0192] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0193] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0194] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0195] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A log processing method, characterized in that: The electronic device includes a processor, a first memory, a second memory, and a third memory, and the method includes: During the process of the processor running the startup program to start the operating system, a first log is generated, wherein the first log is used to record events involved in running the startup program; The processor records the first log into a first memory; When the second memory is available, the processor obtains the first log record in the first memory and stores it in the second memory; When the second memory is unavailable, the processor acquires the first log record in the first memory and stores it in the third memory; The second memory being available includes that the second memory exists and can be written; the second memory being unavailable includes that the second memory does not exist, or exists but cannot be written; the first memory is a volatile memory, and the data recorded therein is lost after the electronic device is powered off; the second memory and the third memory are non-volatile memories, and the data recorded therein continues to be retained after the electronic device is powered off, but the writing speed of the first memory is faster than that of the second memory and the third memory; the capacity of the second memory is larger than that of the third memory; In the case that the second memory is unavailable because the second memory does not exist, the electronic device does not start the operating system, and shuts down or restarts the startup program to start the operating system; In a case where the second memory exists and the operating system in the second memory is normal, the electronic device starts the operating system.

2. The method according to claim 1, characterized in that The method further comprises: During the process of the processor running the startup program, determining whether the second memory exists; In the case that the second memory exists, it is determined whether the second memory is available.

3. The method according to claim 1, characterized in that In the case where the second memory exists, before determining whether the second memory is available, the method includes: Determining whether there is a bootable operating system program in the second memory; When there is a bootable operating system program, the processor boots the operating system based on the operating system program.

4. The method according to claim 2 or 3, characterized in that: The method further comprises: When the second memory does not exist, the processor controls the electronic device to shut down or restart.

5. The method according to any one of claims 1 to 3, characterized in that: The electronic device further includes an embedded controller, and before the processor runs the startup program, the method further includes: In response to a power-on operation, the embedded controller controls the hardware in the electronic device to power on, including controlling the processor to power on.

6. The method according to claim 5, characterized in that The electronic device further includes a fourth memory, and during the process in which the embedded controller controls the hardware in the electronic device to power on, the method further includes: Generate a second log, and the embedded controller writes the second log into the fourth memory; the fourth memory is a memory built into the embedded controller; When the processor acquires the first log record in the first memory and stores it in the second memory, the processor further acquires the second log record in the fourth memory and stores it in the second memory; When the processor acquires the first log record in the first memory and stores it in the third memory, the processor further acquires the second log record in the fourth memory and stores it in the third memory.

7. The method according to claim 4, characterized in that In the case that the second memory does not exist, before the processor controls the electronic device to shut down or restart, the method further includes: The processor controls the electronic device to display a prompt message, where the prompt message is used to prompt that the operating system fails to start.

8. The method according to any one of claims 1 to 3, 6 or 7, characterized in that: After the operating system is started, the method further includes: When the first application is in an open state, the processor obtains logs from the second memory and uploads them to the cloud server of the first application.

9. The method according to claim 8, characterized in that When the first application is in an open state, the processor further obtains logs from the third memory and uploads them to the cloud server of the first application.

10. The method according to claim 8, characterized in that Before the processor obtains the log from the second memory and uploads it to the cloud server of the first application, the processor also obtains the log from the third memory and writes it to the second memory.

11. The method according to any one of claims 1 to 3, 6, 7 or 9, characterized in that: Also includes: The boot program is a basic input and output system that supports the unified extensible firmware interface specification.

12. An electronic device, characterized in that: The electronic device includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the one or more processors are used to call the computer instructions so that the electronic device executes the method as described in any one of claims 1-11.

13. A computer storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes executable instructions. When the executable instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Method and device for recording BIOS level logs

    CN101446915A

  • Selective backup of program data to non-volatile memory

    CN105164657A

  • Bug positioning method and device for solid state disk, electronic equipment and medium

    CN110618892A

  • Log management method, device and equipment and computer readable storage medium

    CN112685227A

  • Log recording method and device, equipment and storage medium

    CN114691025A