Equipment processing method, equipment and storage medium

By writing exception information to the storage space in the startup process of the electronic device, the problem of difficulty in positioning after the electronic device enters the download mode is solved, and the effect of quickly positioning abnormal codes and improving testing efficiency is achieved.

CN120104382APending Publication Date: 2025-06-06HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311615591.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

After the electronic equipment is developed and debugged or shipped from the factory, it may enter the download mode due to hardware, software or environmental reasons, resulting in a black screen on the display screen and the user presses the power button without response. The debugging cycle is long and the problem is not easy to reappear, causing difficulty in positioning.

Method used

In the startup process of the electronic device, if the first program in the second stage program executes an abnormality, the exception program and its execution status are indicated by writing the first information, including preset flag bits and call stack information, in the first storage space, so that the engineer can quickly locate the exception code.

Benefits of technology

This method provides engineers with a basis for quickly locating abnormal codes, improving testing efficiency, reducing debugging cycles, and reducing the difficulty of problem positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104382A_ABST
    Figure CN120104382A_ABST
Patent Text Reader

Abstract

The invention provides an equipment processing method, equipment and a storage medium, and relates to the technical field of terminals.The method comprises the steps that starting or restarting operation of a user is received, electronic equipment enters a starting process, and the starting process comprises a first-stage program, a second-stage program and an operating system program which are executed in sequence; if the first program in the second-stage program is executed abnormally, first information is written into the first storage space, and the first information is used for indicating that the first program is executed abnormally. The first program is any program in the second-stage programs, and the first storage space is a storage space in the memory of the electronic equipment. According to the method, the first information indicates which section of program is executed abnormally in the second-stage program, such as the first program, so that a basis is provided for an engineer to quickly position an abnormal code, the engineer can repair the first program in a targeted manner, and the test efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a device processing method, a device and a storage medium. Background Art

[0002] During the R&D and debugging stage or after leaving the factory, electronic devices may enter download mode due to hardware, software, environmental and other reasons. Download mode is a self-protection mode of the device. In this mode, the display of the electronic device is in a black screen state. When the user presses the power button, the electronic device does not respond at all, and the user experience is extremely poor.

[0003] The above situation usually requires the device to be returned to the factory for inspection. Engineers try to reproduce the problem by disassembling the device and connecting the serial port to locate the abnormal code. Currently, the debugging cycle is long and the problem is not easy to reproduce, making it difficult to locate. Summary of the invention

[0004] The embodiments of the present application provide a device processing method, a device, and a storage medium, which provide a basis for engineers to quickly locate abnormal codes and improve test efficiency.

[0005] In a first aspect, an embodiment of the present application proposes a device processing method, which is applicable to any electronic device, and the method includes: in response to a first operation of a user, entering a boot process, the boot process includes a first stage program, a second stage program and an operating system program executed in sequence; if a first program in the second stage program is executed abnormally, first information is written in a first storage space, the first program is any program in the second stage program, and the first information is used to indicate that the first program is executed abnormally; the first storage space is a storage space in the memory of the electronic device.

[0006] This embodiment shows that when the second-stage program in the boot process is abnormal, the electronic device can write first information into the storage space. The first information indicates which program in the second-stage program is executing abnormally, such as the first program, and provides a basis for engineers to quickly locate the abnormal code, so that engineers can repair the first program in a targeted manner, thereby improving testing efficiency.

[0007] In an optional embodiment of the first aspect, if the first program in the second stage program executes abnormally, the first information is written in the first storage space, including: if the first program in the second stage program executes abnormally, the first information is written in the first storage space by calling a preset interface corresponding to the first program; the first information includes a preset flag bit, and the preset flag bit is used to indicate that the first program executes abnormally.

[0008] This embodiment shows that the first program execution exception is recorded by writing a preset flag bit, that is, the preset flag bit uniquely indicates the first program execution exception.

[0009] In an optional embodiment of the first aspect, the first information also includes call stack information, and the call stack information is used to indicate the execution status of the first program. The first information shown in this embodiment also records call stack information, and the call stack information indicates the execution status of the first program, so that engineers can quickly locate the abnormal code position based on the call stack information.

[0010] In an optional embodiment of the first aspect, after the first phase of the boot process is completed, a first storage space is created. The first storage space is used to record the first information.

[0011] In an optional embodiment of the first aspect, the first stage program includes a first boot program, and the second stage program includes a second boot program and a kernel program that are executed sequentially.

[0012] In an optional embodiment of the first aspect, the first boot program is a primary boot loader PBL, and the second boot program includes an extensible boot loader xbl of a unified extensible firmware interface UEFI and an application boot loader abl of the UEFI, which are executed sequentially.

[0013] In an optional embodiment of the first aspect, if the first program in the second-stage program is executed abnormally, writing the first information in the first storage space by calling a preset interface corresponding to the first program includes any of the following:

[0014] If the xbl of UEFI is executed abnormally, first information is written into the first storage space by calling the first interface corresponding to the xbl, where the first information includes a first flag bit, and the first flag bit is used to indicate that the xbl is executed abnormally; or

[0015] If the abl of UEFI is executed abnormally, first information is written into the first storage space by calling the second interface corresponding to the abl, where the first information includes a second flag bit, and the second flag bit is used to indicate that the abl is executed abnormally; or

[0016] If the kernel program is executed abnormally, first information is written into the first storage space by calling a third interface corresponding to the kernel program, where the first information includes a third flag bit, and the third flag bit is used to indicate that the kernel program is executed abnormally.

[0017] Calling the first interface can also be described as calling the first function, calling the second interface can also be described as calling the second function, and calling the third interface can also be described as calling the third function.

[0018] Exemplarily, the first flag bit is recorded as cookie1, the second flag bit is recorded as cookie2, and the third flag bit is recorded as cookie3.

[0019] By calling the first interface or the first function, the indication information and the execution status indicating the abnormality of xbl execution can be written into the first storage space, providing data support for the subsequent reading and analysis of logs from the first storage space.

[0020] By calling the second interface or the second function, it is possible to write indication information and execution status indicating abnormal execution of abl into the first storage space, thereby providing data support for subsequent reading and analyzing logs from the first storage space.

[0021] By calling the third interface or the third function, it is possible to write indication information and execution status indicating kernel execution exception into the first storage space, thereby providing data support for subsequent reading and analyzing logs from the first storage space.

[0022] In an optional embodiment of the first aspect, the method further includes: if the first-stage program detects that the preset flag bit is not an initial value, the electronic device enters a download mode; the display screen state of the electronic device entering the download mode is a black screen state, and the electronic device is unresponsive. This embodiment shows the device state of the electronic device entering the download mode.

[0023] In an optional embodiment of the first aspect, an interface of the electronic device is used to connect a cable, and the electronic device is connected to an external device via the cable. The method also includes: after the electronic device and the external device establish a communication connection via the cable, receiving a port query request from the external device; in response to the port query request, obtaining first information from a first storage space; encrypting the first information to obtain a log file; and sending a port query response to the external device, the port query response including the log file.

[0024] This embodiment shows a test scenario, in which an electronic device is connected to an external device and a log file is read from a specific port of the electronic device so that an engineer can locate the cause of an abnormality of the electronic device.

[0025] In an optional embodiment of the first aspect, the method further includes: executing an operating system program when both the first-stage program and the second-stage program execute normally.

[0026] In this embodiment, after the operating system program is executed, the electronic device is powered on normally.

[0027] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the memory storing a computer program, the processor executing the computer program stored in the memory, so that the electronic device performs any method as in the first aspect.

[0028] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method according to any one of the first aspects is implemented.

[0029] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes any method of the first aspect.

[0030] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute any method as in the first aspect.

[0031] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method described in any one of the first aspects.

[0032] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding optional embodiments are similar and will not be repeated herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 1 ;

[0034] Figure 2 A schematic diagram of a test scenario provided for an embodiment of the present application;

[0035] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0037] Figure 5 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 2 ;

[0038] Figure 6 A diagram showing changes in the interface of a laptop computer in a test scenario provided in an embodiment of the present application;

[0039] Figure 7 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 3 ;

[0040] Figure 8 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 4 . DETAILED DESCRIPTION

[0041] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0042] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0043] It should be noted that the "when..." in the embodiment of the present application can be the instant when a certain situation occurs, or it can be a period of time after a certain situation occurs, and the embodiment of the present application does not specifically limit this. In addition, the display interface provided in the embodiment of the present application is only an example, and the display interface can also include more or less content.

[0044] In order to facilitate understanding of the technical solution of the present application, the professional terms involved in the embodiments of the present application are first explained below.

[0045] First, the download mode, also known as the 9008 mode, is a self-protection mode of the built-in chip of the electronic device. In this mode, some low-level operations can be performed on the electronic device, such as burning firmware, calibrating electrical signals, etc. After the electronic device is connected to an external device, the external device can perform some low-level operations on the electronic device through the 9008 port of the electronic device.

[0046] Second, the Primary Boot Loader (PBL) is a hardened code inside the chip built into the electronic device. The chip comes with it when it leaves the factory, and users or developers cannot view or modify its internal code. The electronic device with this chip built in will first execute PBL after powering on to initialize the central processing unit (CPU) so that the CPU can work normally.

[0047] Third, the Unified Extensible Firmware Interface (UEFI) is a standard that describes a new type of interface in detail. Its main purpose is to provide a set of consistent and correctly specified boot services on all platforms before the operating system is loaded (that is, before the operating system starts).

[0048] UEFI is regarded as the successor of the Basic Input Output System (BIOS).

[0049] UEFI consists of two parts: extensible boot loader (xbl) and application boot loader (abl). xbl is mainly responsible for core application functions such as chip driving and charging, while abl includes chip-independent applications such as fast boot fastboot.

[0050] Different users or developers have different implementations of UEFI's xbl and abl, that is, users or developers can customize xbl and abl.

[0051] Fourth, Universal Flash Storage (UFS) is a non-volatile storage technology used for long-term data storage. It is often used to save operating systems, applications, multimedia files, and other user data. UFS has high read and write speeds and retains data so it will not be lost even when power is off or the device is turned off.

[0052] Fifth, black screen is a screen state of the display of the electronic device. In the black screen state, the display of the electronic device is off, and the states of other modules or components of the electronic device are not limited, for example, other modules or components operate normally.

[0053] Sixth, port is the exit for the device to communicate with the outside world. Ports can be divided into virtual ports and physical ports, where virtual ports are invisible and physical ports are visible ports, also known as interfaces. In the embodiment of the present application, port 9008 is a virtual port, which is a port provided by a built-in chip of an electronic device. For example, a user can run an application provided by the chip on a personal computer PC, access port 9008 on a mobile phone, and exchange information.

[0054] Sixth, serial port, referred to as serial port, also known as serial communication interface (usually refers to COM interface), is an expansion interface that uses serial communication method, and data is transmitted sequentially one bit at a time.

[0055] Seventh, hardware contacts, also known as hardware contact points, are two contacts on the motherboard of an electronic device. In some environments, such as moisture, dust, classical induction, etc., the hardware contacts may be short-circuited. Short-circuit is also called short circuit.

[0056] Eighth, the call stack is a stack in computer science that stores messages about subroutines that are running, also known as the execution stack or control stack. In the embodiment of the present application, the call stack information can record the execution status of each stage in the electronic device startup process, such as the location of execution exceptions, etc.

[0057] Figure 1 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 1 . Take the mobile phone as an example, Figure 1 , the boot process includes:

[0058] S11, after the mobile phone is started, it enters the PBL stage.

[0059] In response to the user pressing the power button, the phone starts up. The code in the PBL stage has the following detection capabilities:

[0060] 1) Check whether the hardware contacts are short-circuited; 2) Check UFS; 3) Check the DLOAD cookie flag.

[0061] In some embodiments, the PBL stage is started, and first the hardware contacts are detected to see if they are short-circuited. If the hardware contacts are not short-circuited, the UFS is detected. If there is no abnormality in the UFS, the DLOAD cookie flag is detected. If the DLOAD cookie flag is not set, the mobile phone will enter the UEFI stage.

[0062] The DLOAD cookie flag being set may also be described as the DLOAD cookie flag being modified.

[0063] The DLOAD cookie flag is set to indicate that the phone had an error in the UEFI-xbl stage, UEFI-abl stage, or kernel stage during the previous boot process. It should be understood that the DLOAD cookie flag will be set if an error occurs in any stage of UEFI-xbl, UEFI-abl, or kernel.

[0064] Exemplarily, the initial value of the DLOAD cookie flag is 0. If the value of the DLOAD cookie flag is detected to be 1, it is considered that the DLOAD cookie flag is set.

[0065] In some embodiments, if a hardware contact short is detected during the PBL phase, the mobile phone will be triggered to enter the download mode.

[0066] In some embodiments, if a UFS anomaly is detected during the PBL phase, the mobile phone will be triggered to enter the download mode.

[0067] In some embodiments, if the DLOAD cookie flag is detected to be set during the PBL phase, the mobile phone is triggered to enter the download mode.

[0068] S12. Start UEFI-xbl and UEFI-abl in sequence.

[0069] UEFI-xbl can be regarded as the bottom-level execution program of UEFI, and UEFI-abl can be regarded as the upper-level execution program of UEFI. After UEFI-xbl is executed without exception, it enters the UEFI-abl stage.

[0070] The aforementioned PBL stage, UEFI-xbl stage and UEFI-abl stage can be regarded as the first stage of the boot process. The program in the first stage can be called a boot program. If the boot program is executed without exception, the mobile phone will enter the second stage of the boot process. The second stage includes the kernel stage (S13) and the android stage (S14).

[0071] In some embodiments, when UEFI-abl is started, the mobile phone interface may display a static icon, such as the Honor logo.

[0072] S13. Start the kernel.

[0073] UEFI-abl is responsible for loading the kernel image into memory and booting the kernel from a fixed memory address. This phase is also called the kernel boot phase. Subsequently, the kernel calls the start_kernel function to formally enter the kernel program and perform most of the kernel initialization work.

[0074] For the UEFI-xbl stage, UEFI-abl stage, and kernel stage, each stage calls different interfaces and can set the DLOAD cookie flag.

[0075] In some embodiments, reference Figure 1If the UEFI-xbl stage is abnormal, the first interface can be called to set the DLOADcookie flag. If the UEFI-abl stage is abnormal, the second interface can be called to set the DLOAD cookie flag. If the kernel stage is abnormal, the third interface can be called to set the DLOAD cookie flag.

[0076] S14. Start Android and turn on the phone.

[0077] If there is no abnormality in the kernel stage, the Android program will be executed, and the phone interface will display the boot animation.

[0078] Starting an Android program includes starting an application, etc.

[0079] It should be noted that the boot process of the electronic device described in the above embodiment is only an example, and the steps in the boot process of different versions of the Android system may be adjusted, and this application does not make any specific limitations on this.

[0080] In the above startup process, if any of the following situations occurs:

[0081] 1) Hardware contact short circuit is detected in the PBL stage; 2) UFS abnormality is detected in the PBL stage; 3) Code execution abnormality is detected in the UEFI-xbl stage; 4) Code execution abnormality is detected in the UEFI-abl stage; 5) Code execution abnormality is detected in the kernel stage, and the phone will enter download mode.

[0082] In the first two cases, the phone will directly enter the download mode. In the last three cases, after the DLOAD cookie flag is set, the phone will automatically restart and enter the download mode again when entering the PBL stage because the DLOAD cookie flag is set. After the phone enters the download mode, it will remain in a black screen state. If the user presses the power button for a long time, the phone will not respond at all, and the user experience is extremely poor. When such problems occur, the phone often needs to be returned to the factory for further testing.

[0083] When the phone has a black screen and does not respond after restarting, engineers can connect the phone to a computer to detect the cause of the black screen and then update the phone's built-in programs in a targeted manner. The above operation is also called a flashing operation.

[0084] Figure 2 A schematic diagram of a test scenario provided in an embodiment of the present application. Figure 1 , the electronic device 100 is connected to the external device 300 through the interface and the cable 200, Figure 2 For example, the electronic device 100 is a mobile phone and the external device 300 is a notebook computer.

[0085] In one test scenario, the engineer does not need to disassemble the phone. He directly connects one end of the cable to the external interface of the phone (such as the USB Type C interface) and the other end of the cable to the laptop. Figure 1 , the laptop can obtain log files, such as command 6log, through the mobile phone's port 9008. Engineers can locate the cause of the black screen of the mobile phone by analyzing the log files.

[0086] At present, engineers can obtain the following information through log files: 1) Whether the hardware contacts are short-circuited; 2) Whether the UFS is abnormal; 3) Whether the DLOAD cookie flag is set.

[0087] If the first item is abnormal, that is, the hardware contacts are short-circuited, the problem can be located on the mobile phone motherboard.

[0088] If the second item is abnormal, that is, UFS is abnormal, the problem can be located in UFS.

[0089] If the third item is abnormal, that is, the DLOAD cookie flag is set, it is impossible to further locate the problem because it is impossible to determine which stage of the UEFI-xbl stage, UEFI-abl stage, and kernel stage the error occurred.

[0090] In another test scenario, engineers need to disassemble the phone, connect one end of the cable to the internal interface of the phone, and the other end of the cable to a laptop. The laptop can locate the problem by obtaining the serial port log. The internal interface is also called a serial port. It should be understood that the serial port log is printed in real time. If a problem occurs at a certain stage during the boot process of the phone, it will be reflected in the serial port log in real time.

[0091] In some embodiments, if the UEFI-xbl stage is abnormal, after the engineer updates the code of the UEFI-xbl stage, the update package of the UEFI-xbl stage can be transmitted to the mobile phone through the laptop.

[0092] In some embodiments, if the UEFI-abl stage is abnormal, after the engineer updates the code of the UEFI-abl stage, the update package of the UEFI-abl stage can be transmitted to the mobile phone through the laptop computer.

[0093] In some embodiments, if the kernel stage is abnormal, after the engineer updates the code of the kernel stage, the update package of the kernel stage can be transmitted to the mobile phone through the laptop computer.

[0094] The second test scenario described above attempts to reproduce the problem by disassembling the device and connecting it to the serial port. The specific stage corresponding to the problem is located through the serial port log, so as to repair the problem in a targeted manner.

[0095] The above test process usually requires disassembly testing, the test cycle is long, and the problem is not easy to reproduce. In this regard, an embodiment of the present application proposes a test method for an electronic device, which is applied to an electronic device, and a new storage space is opened in the memory area of ​​the electronic device, and the storage space can be used to record the abnormal flags and execution status of multiple stages after the PBL stage. For an electronic device that enters download mode when the DLOAD cookie flag is set, an engineer can connect the electronic device to an external device and obtain a log file by reading a specific port of the electronic device, for example, the specific port is port 9008. The log file records the specific information that the DLOAD cookie flag is set, such as the cookie flag and call stack information, so that engineers can quickly locate the stage corresponding to the problem, thereby fixing the problem in a targeted manner and improving test efficiency.

[0096] In order to facilitate understanding of the solution, the hardware and software structure of the electronic device of the present application will first be described in conjunction with the accompanying drawings.

[0097] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. Figure 3 The electronic device 100 may include: a processor 110, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a button 190, a display screen 194, etc.

[0098] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In some embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0099] The processor 110 may include one or more processing units. For example, the processor 100 may include an application processor (AP), a controller, etc. Different processing units may be independent devices or integrated into one or more processors.

[0100] In some embodiments, the electronic device 100 may also include one or more processors 110 .

[0101] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory, which can store instructions or data that have just been used or are cyclically used by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory, avoiding repeated access, reducing the waiting time of the processor 110, and improving the efficiency of the system.

[0102] In some embodiments, the processor 110 may include one or more interfaces. The interface may include a universal serial bus USB interface 130, etc. The USB interface 130 is used to connect a cable.

[0103] The USB interface 130 is an interface that complies with USB standard specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to charge the electronic device 100 by connecting a charger via a cable, may be used to transmit data between the electronic device 100 and an external device, or may be used to connect headphones to play audio through the headphones.

[0104] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0105] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142 , it can also power the electronic device 100 through the power management module 141 .

[0106] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status.

[0107] In some embodiments, the power management module 141 may also be disposed in the processor 110. In some embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.

[0108] The electronic device 100 can realize the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute instructions to generate or change display information.

[0109] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, after the electronic device 100 is turned on, the display screen 194 may first display the device icon logo, and then display the boot animation. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0110] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can enable the electronic device 100 to perform various functional applications and data processing by running the above instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data (such as photos, contacts, etc.) created during the use of the electronic device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. In some embodiments, the processor 110 can enable the electronic device 100 to perform various functional applications and data processing by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor 110.

[0111] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0112] The above-mentioned electronic devices may also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. The electronic devices may be mobile phones, smart TVs, wearable devices, tablet computers (Pad), computers with wireless transceiver functions, virtual reality (VR) electronic devices, augmented reality (AR) electronic devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technologies and specific device forms used by the electronic devices.

[0113] In some embodiments, the electronic device may include a hardware layer and an operating system running on the hardware layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), a memory (also called main memory), and external devices. The operating system may be, for example, an iOS operating system, an Android operating system, a Windows operating system, a Linux system, or other embedded systems. Applications may be installed and run on the operating system.

[0114] The present application embodiment takes the Android system as an example, for example, Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application. Figure 4 , divides the Android system of electronic devices into four layers, from top to bottom: application layer, application framework layer, system runtime layer and kernel layer.

[0115] The application layer can include a series of application packages, such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, video, short message and other applications.

[0116] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0117] The system runtime layer includes the Android runtime and system libraries.

[0118] The Android runtime is responsible for scheduling and management of the Android system, which includes the core library and the virtual machine. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0119] The system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0120] The kernel layer is a layer between hardware and software. The kernel layer at least includes display driver, camera driver, audio driver, etc., and the embodiment of the present application does not impose any restrictions on this.

[0121] exist Figure 4 Based on the software structure of the electronic device shown, refer to Figure 1 After the electronic device is turned on, the following steps are executed in sequence: PBL→UEFI-xbl→UEFI-abl. PBL, UEFI-xbl and UEFI-abl are the boot programs in the boot process of the electronic device. If there is no abnormality in the boot program, the kernel is started. Figure 4 The kernel layer shown in the figure can be regarded as the bottom layer of the Android system. When the kernel layer is started without any abnormality, the upper layer of the Android system is started. The upper layer is relative to the bottom layer. The upper layer of the Android system includes Figure 4The system runtime layer, application framework layer and application layer shown are started in the following order: system runtime layer→application framework layer→application layer. In some embodiments, during the application layer startup phase, the display screen of the electronic device may display a startup animation.

[0122] Based on the software and hardware structure of the aforementioned electronic device, an embodiment of the present application provides a testing method for an electronic device, which improves the processing flow of abnormalities in each stage after the PBL stage in the startup process of the electronic device, such as setting different cookie flags for each stage, and saving the execution status and cookie flags of each stage to a newly opened memory, so that when the log file is subsequently obtained from the memory, the stage of the startup abnormality can be directly located through the log file, thereby improving the test efficiency.

[0123] For example, Figure 5 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 2 Taking the mobile phone as an example, Figure 5 The boot process of also includes S11 to S14, and S11 and S14 can refer to the above embodiment. This embodiment mainly improves S12, S13 and S14, and the improvements of S12 to S14 are described in turn below.

[0124] (I) Improvements to S12

[0125] If there is no abnormality in PBL, the phone starts UEFI-xbl. The UEFI-xbl stage may include:

[0126] 1. Create reserved memory.

[0127] The reserved memory is a storage space newly opened in the memory, which is used to record relevant information when any stage after the PBL stage in the boot process is executed abnormally, and the relevant information includes the indication information and execution status of the execution abnormality of any stage.

[0128] In some embodiments, the reserved memory is created during the initialization phase of UEFI-xbl.

[0129] 2. When UEFI-xbl is executed abnormally, the indication information and execution status of the UEFI-xbl execution abnormality are stored in the reserved memory.

[0130] In some embodiments, the first flag is set by calling the first interface, and the first call stack information is saved to the reserved memory. The first flag is used to indicate that the UEFI-xbl execution is abnormal, and the first call stack information includes the execution status of the UEFI-xbl, such as the location of the UEFI-xbl execution abnormality. Exemplarily, the first flag is recorded as cookie1.

[0131] In some embodiments, calling the first interface can be described as calling a first function.

[0132] The first interface can be regarded as an improved interface of the UEFI-xbl stage. By calling the first interface, the indication information and execution status of the UEFI-xbl execution exception can be written into the memory, providing data support for the subsequent reading and analysis of logs from the memory.

[0133] (II) Improvements to S13

[0134] If there is no abnormality in UEFI-xbl, the phone starts UEFI-abl. The UEFI-abl stage may include:

[0135] When UEFI-abl is executed abnormally, indication information and execution status of the UEFI-abl execution abnormality are stored in the reserved memory.

[0136] In some embodiments, the second flag is set by calling the second interface, and the second call stack information is saved to the reserved memory. The second flag is used to indicate that the UEFI-abl execution is abnormal, and the second call stack information includes the execution status of the UEFI-abl, such as the location of the UEFI-abl execution abnormality. Exemplarily, the second flag is recorded as cookie2.

[0137] In some embodiments, calling the second interface can be described as calling a second function.

[0138] The second interface can be regarded as an improved interface of the UEFI-abl stage. By calling the second interface, the indication information and execution status of UEFI-abl execution exception can be written into the memory, providing data support for the subsequent reading and analysis of logs from the memory.

[0139] (III) Improvements to S14

[0140] If there is no abnormality in UEFI-abl, the phone starts the kernel. The kernel stage includes:

[0141] When the kernel execution is abnormal, the indication information and execution status of the kernel execution abnormality are stored in the reserved memory.

[0142] In some embodiments, a third flag is set by calling a third interface, and the third call stack information is saved to the reserved memory. The third flag is used to indicate that the kernel execution is abnormal, and the third call stack information includes the execution status of the kernel, such as the location of the kernel execution exception. Exemplarily, the third flag is recorded as cookie3.

[0143] In some embodiments, calling the third interface can be described as calling a third function.

[0144] The first interface can be regarded as an improved interface of the kernel stage. By calling the third interface, the indication information and execution status of the kernel execution exception can be written into the memory, providing data support for the subsequent reading and analysis of logs from the memory.

[0145] Based on the aforementioned improvements, in order to improve the efficiency of mobile phone testing, new storage space can be opened up in the mobile phone memory to record relevant information about execution anomalies at each stage of the mobile phone startup process, so that engineers can read the log files through the specific port of the mobile phone when testing the mobile phone later, so as to quickly analyze and locate the cause of the mobile phone anomaly.

[0146] Combination Figure 2 The test scenario, exemplary, Figure 6 This is a diagram of the interface changes of a laptop computer in the test scenario provided in the embodiment of the present application. After the engineer gets the abnormal machine, he first connects the mobile phone 100 to the laptop computer 300 through the cable 200. Figure 2 After the mobile phone establishes a communication connection with the laptop through a cable, Figure 6 As shown in a, in response to the user double-clicking the test tool 301 on the desktop of the laptop, the laptop sends a port query request to the mobile phone. The test tool 301 can be a test tool provided by the mobile phone built-in chip manufacturer, which is used to read the specific port of the mobile phone, such as port 9008, to obtain the log file.

[0147] In response to the port query request, the mobile phone obtains the first information from the first storage space of the memory, encrypts the first information, and generates a log file. The mobile phone sends a port query response to the laptop computer, and the port query response includes the log file. When the mobile phone sends the log file to the laptop computer, the interface of the laptop computer can display the sending progress, such as Figure 6 As shown in b, after the user double-clicks the test tool 301, a window 302 pops up on the laptop computer, and the window 302 displays a progress bar of the laptop computer reading the mobile phone log file. The user can manually close the window 302 after reading the complete log file.

[0148] Users can view the log files in the default path of the test tool. Figure 6 As shown in c, window 303 under the default path of the test tool displays the log file read from the specific port of the mobile phone, such as file name 1. Usually, the format of the log file is binary format, and the user can use the decoding tool provided by the mobile phone chip manufacturer to read the content in the log file.

[0149] Engineers can use the content in the log file to determine the cause of the device abnormality and locate the location of the abnormal program, including the following situations:

[0150] In case 1, a hardware contact short is detected during the PBL phase, and the log records the reason for entering the download mode as the hardware contact short.

[0151] In case 2, a UFS exception is detected during the PBL phase, and the log records the reason for entering the download mode as a USF exception.

[0152] Case 3: The PBL stage detects that the DLOAD cookie flag is set, and the log records the reason for entering the download mode as the DLOAD cookie flag is set to the first flag cookie1, indicating that the UEFI-xbl is abnormal. The log also records the execution status of the UEFI-xbl.

[0153] Case 4: The PBL stage detects that the DLOAD cookie flag is set, and the log records the reason for entering the download mode as the DLOAD cookie flag is set to the second flag cookie2, indicating that UEFI-abl is abnormal. The log also records the execution status of UEFI-abL.

[0154] Case 5: In the PBL stage, it is detected that the DLOAD cookie flag is set. The log records the reason for entering the download mode as the DLOAD cookie flag is set to the third flag cookie3, indicating a kernel exception. The log also records the execution status of the kernel.

[0155] By improving the interface function in the middle stage of the boot process, when an exception occurs in any stage, the corresponding improved interface is called to record the indication information and execution status of the exception in the newly opened memory. In this way, engineers can read and analyze logs through specific ports, improve test efficiency, and then debug and update the code of the exception stage in a targeted manner.

[0156] The present application embodiment also provides a device processing method, which is exemplary: Figure 7 Schematic diagram of the startup process of the electronic device provided in the embodiment of the present application Figure 3 ,like Figure 7 As shown, the startup process of the electronic device includes: a first-stage program, a second-stage program and an operating system program which are executed in sequence.

[0157] In response to the first operation of the user, the electronic device enters the power-on process. The first operation may be an operation in which the user presses a power-on key of the electronic device, or an operation in which the user triggers the restart of the electronic device, which is not limited in the embodiment of the present application.

[0158] In the boot process, if the first program in the second stage program is executed abnormally, first information is written in the first storage space, the first program is any program in the second stage program, and the first information is used to indicate that the first program is executed abnormally.

[0159] The first storage space is a storage space in the memory of the electronic device.

[0160] The first-stage program is usually a hardened code in the built-in chip of the electronic device, and the first-stage program cannot be modified.

[0161] like Figure 7 As shown, the second-stage program may include multiple programs, such as program 1 to program n, where n is a positive integer greater than 1, and the first program is any program in the multiple programs, such as the first program is program 1. The second-stage program is customizable, that is, the user or developer can modify and update the second-stage program.

[0162] The operating system program may be, for example, an Android operating system program, an iOS operating system program, a Windows operating system program, etc. The operating system program may include application programs, etc.

[0163] The first stage program can be regarded as a pre-program of the second stage program. When the first stage program runs normally, the second stage program is executed. The second stage program can be regarded as a pre-program of the operating system program. When the second stage program runs normally, the operating system program is executed.

[0164] The first stage program can also be described as the primary boot program.

[0165] The above embodiment shows that when the second-stage program in the boot process is abnormal, the electronic device can write the first information in the storage space. The first information indicates which program in the second-stage program is executed abnormally, such as the first program, which provides a basis for engineers to quickly locate the abnormal code, facilitates engineers to repair the first program in a targeted manner, and improves testing efficiency.

[0166] It should be understood that the booting processes of different electronic devices are different, and the execution order of each program in the booting process is usually fixed, and the execution principle and effect are similar to the above embodiment.

[0167] In some embodiments, if the first program in the second-stage program is executed abnormally, writing the first information in the first storage space includes: if the first program in the second-stage program is executed abnormally, writing the first information in the first storage space by calling a preset interface corresponding to the first program. The first information includes a preset flag bit, and the preset flag bit is used to indicate that the first program is executed abnormally.

[0168] The above embodiment shows that the first program execution exception is recorded by writing a preset flag bit, that is, the preset flag bit uniquely indicates the first program execution exception. It should be understood that the second program (such as Figure 7 If program 2) in the program is executed abnormally, other preset flag bits can be written to indicate that the second program is executed abnormally.

[0169] In some embodiments, the first information further includes call stack information, and the call stack information is used to indicate the execution status of the first program. The execution status of the first program includes the location of the first program execution exception.

[0170] The first information shown in the above embodiment also records call stack information, which indicates the execution status of the first program, so that engineers can quickly locate the abnormal code position based on the call stack information.

[0171] In some embodiments, after the first phase of the boot process is completed, a first storage space is created, and the first storage space is used to record the first information.

[0172] In some embodiments, Figure 8 As shown, the first stage program includes a first boot program, and the second stage program includes a second boot program and a kernel program which are executed in sequence.

[0173] In one example, the first boot program is a PBL program, and the second boot program includes an extensible boot loader xbl of a unified extensible firmware interface UEFI and an application boot loader abl of UEFI, which are executed in sequence.

[0174] Based on the above example, if the first program in the second stage program is executed abnormally, the first information is written into the first storage space by calling a preset interface corresponding to the first program, including any of the following:

[0175] If the xbl of UEFI is executed abnormally, first information is written into the first storage space by calling the first interface corresponding to xbl, where the first information includes a first flag bit, and the first flag bit is used to indicate that the xbl is executed abnormally. Or

[0176] If the abl execution of UEFI is abnormal, by calling the second interface corresponding to abl, the first information is written into the first storage space, the first information includes a second flag bit, and the second flag bit is used to indicate that the abl execution is abnormal. Or

[0177] If the kernel program is executed abnormally, first information is written into the first storage space by calling a third interface corresponding to the kernel program, where the first information includes a third flag bit, and the third flag bit is used to indicate that the kernel program is executed abnormally.

[0178] Calling the first interface can also be described as calling the first function, calling the second interface can also be described as calling the second function, and calling the third interface can also be described as calling the third function. Exemplarily, the first flag bit is recorded as cookie1, the second flag bit is recorded as cookie2, and the third flag bit is recorded as cookie3.

[0179] By calling the first interface or the first function, the indication information and the execution status indicating the abnormality of xbl execution can be written into the first storage space, providing data support for the subsequent reading and analysis of logs from the first storage space.

[0180] By calling the second interface or the second function, it is possible to write indication information and execution status indicating abnormal execution of abl into the first storage space, thereby providing data support for subsequent reading and analyzing logs from the first storage space.

[0181] By calling the third interface or the third function, it is possible to write indication information and execution status indicating kernel execution exception into the first storage space, thereby providing data support for subsequent reading and analyzing logs from the first storage space.

[0182] Exemplarily, after the electronic device executes PBL and there is no abnormality, it executes xbl. If xbl is executed abnormally, first information is written in the first storage space, and the first information is used to indicate that xbl is abnormal and the abnormal position, and the program after xbl is no longer executed. The electronic device automatically restarts, and detects that the flag bit is set in the PBL stage, such as the flag bit is cookie1, and the electronic device enters the download mode. Subsequently, the xbl abnormality and the abnormal position can be learned by reading the first information in the first storage space.

[0183] Exemplarily, after the electronic device executes PBL and there is no abnormality, it executes xbl. After xbl has no abnormality, it executes abl. If abl is executed abnormally, first information is written in the first storage space. The first information is used to indicate the abl abnormality and the abnormal location. The program after abl is no longer executed. The electronic device automatically restarts. In the PBL stage, it is detected that the flag bit is set. For example, the flag bit is cookie2, and the electronic device enters the download mode. Subsequently, the abl abnormality and the abnormal location can be learned by reading the first information in the first storage space.

[0184] Exemplarily, after the electronic device executes PBL and there is no abnormality, it executes xbl, after xbl has no abnormality, it executes abl, after abl has no abnormality, it executes kernel, if the kernel executes abnormally, writes first information in the first storage space, the first information is used to indicate the kernel abnormality and the abnormal location, and no longer executes the program after the kernel, the electronic device automatically restarts, and detects that the flag bit is set in the PBL stage, such as the flag bit is cookie3, the electronic device enters the download mode. The kernel abnormality and the abnormal location can be learned later by reading the first information in the first storage space.

[0185] In some embodiments, if the first stage program detects that the preset flag is not an initial value, the electronic device enters the download mode, the display screen of the electronic device entering the download mode is black, and the electronic device does not respond.

[0186] The above embodiment shows the device state of the electronic device entering the download mode.

[0187] In some embodiments, an interface of the electronic device is used to connect a cable, and the electronic device is connected to an external device via the cable. The method also includes: after the electronic device and the external device establish a communication connection via the cable, receiving a port query request from the external device; in response to the port query request, obtaining first information from a first storage space; encrypting the first information to obtain a log file; and sending a port query response to the external device, the port query response including the log file.

[0188] For example, refer to Figure 2 , the electronic device is a mobile phone, the external device is a laptop, the display screen of the mobile phone that enters the download mode is in a black screen state, and the mobile phone is unresponsive. The engineer can connect the mobile phone to the laptop through a cable, and then read the first information from the first storage space of the mobile phone, and present the first information on the display interface of the laptop, so that the engineer can locate the cause of the abnormality of the mobile phone.

[0189] The above embodiment shows a test scenario, in which an electronic device is connected to an external device and a log file is read from a specific port of the electronic device so that an engineer can locate the cause of an abnormality of the electronic device.

[0190] In some embodiments, when both the first-stage program and the second-stage program are executed normally, the operating system program is executed. It should be understood that if any of the first-stage program and the second-stage program is executed abnormally, the electronic device will automatically restart and enter the download mode in the PBL stage. When both the first-stage program and the second-stage program are executed normally, the electronic device executes the operating system program and the electronic device boots up normally.

[0191] An embodiment of the present application provides an electronic device, which includes: a processor and a memory; the memory stores a computer program; the processor executes the computer program stored in the memory, so that the electronic device executes the above method.

[0192] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.

[0193] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.

[0194] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that is intended to carry or store the required program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disks and optical disks as used herein include optical disks, laser disks, optical disks, digital versatile disks (DVD), floppy disks and Blu-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.

[0195] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.

[0196] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0197] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.

Claims

1. A device processing method, It is characterized in that include: In response to a first operation of the user, a boot process is entered, wherein the boot process includes sequentially executing a first stage program, a second stage program, and an operating system program; If the execution of a first program in the second-stage program is abnormal, first information is written into the first storage space, the first program being any program in the second-stage program, and the first information is used to indicate that the execution of the first program is abnormal; The first storage space is a storage space in the memory of the electronic device.

2. The method according to claim 1, It is characterized in that If the first program in the second-stage program is executed abnormally, writing the first information into the first storage space includes: If the first program in the second-stage program is executed abnormally, writing the first information into the first storage space by calling a preset interface corresponding to the first program; The first information includes a preset flag bit, and the preset flag bit is used to indicate that the first program is executed abnormally.

3. The method according to claim 1 or 2, It is characterized in that The first information also includes call stack information, and the call stack information is used to indicate the execution status of the first program.

4. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: After the first phase of the boot process is completed, the first storage space is created.

5. The method according to any one of claims 1 to 4, It is characterized in that The first stage program includes a first boot program, and the second stage program includes a second boot program and a kernel program which are executed in sequence.

6. The method according to claim 5, It is characterized in that The first boot program is a primary boot loader PBL, and the second boot program includes an extensible boot loader xbl of a unified extensible firmware interface UEFI and an application boot loader abl of UEFI which are executed in sequence.

7. The method according to any one of claims 1 to 6, It is characterized in that If the first program in the second-stage program is executed abnormally, writing the first information in the first storage space by calling a preset interface corresponding to the first program includes any of the following: If the xbl of UEFI is executed abnormally, the first information is written into the first storage space by calling the first interface corresponding to the xbl, where the first information includes a first flag bit, and the first flag bit is used to indicate that the xbl is executed abnormally; or If the abl of UEFI is executed abnormally, the first information is written into the first storage space by calling a second interface corresponding to the abl, where the first information includes a second flag bit, and the second flag bit is used to indicate that the abl is executed abnormally; or If the kernel program executes abnormally, the first information is written into the first storage space by calling a third interface corresponding to the kernel program, wherein the first information includes a third flag bit, and the third flag bit is used to indicate that the kernel program executes abnormally.

8. The method according to any one of claims 1 to 7, It is characterized in that The method further comprises: If the first-stage program detects that the preset flag bit is not an initial value, the electronic device enters a download mode; The display screen state of the electronic device entering the download mode is a black screen state, and the electronic device is unresponsive.

9. The method according to claim 8, It is characterized in that The interface of the electronic device is used to connect a cable, and the electronic device is connected to an external device through the cable. The method further includes: After the electronic device and the external device establish a communication connection through the cable, receiving a port query request from the external device; In response to the port query request, acquiring the first information from the first storage space; Encrypting the first information to obtain a log file; A port query response is sent to the external device, where the port query response includes the log file.

10. The method according to any one of claims 1 to 9, It is characterized in that The method further comprises: When both the first-stage program and the second-stage program are executed normally, the operating system program is executed.

11. An electronic device, It is characterized in that include: Processor and memory; The memory stores a computer program; The processor executes the computer program stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 10.

12. A chip, It is characterized in that The chip comprises a processor, and the processor is used to call a computer program in a memory to execute the method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed, the computer is caused to perform the method according to any one of claims 1 to 10.