CN102662785B - Method and device for acquiring kernel error information of Android system - Google Patents

Method and device for acquiring kernel error information of Android system Download PDF

Info

Publication number
CN102662785B
CN102662785B CN201210107127.4A CN201210107127A CN102662785B CN 102662785 B CN102662785 B CN 102662785B CN 201210107127 A CN201210107127 A CN 201210107127A CN 102662785 B CN102662785 B CN 102662785B
Authority
CN
China
Prior art keywords
kernel
error information
storage space
interface
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210107127.4A
Other languages
Chinese (zh)
Other versions
CN102662785A (en
Inventor
周长生
李增波
谢志宇
秦勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN201210107127.4A priority Critical patent/CN102662785B/en
Publication of CN102662785A publication Critical patent/CN102662785A/en
Application granted granted Critical
Publication of CN102662785B publication Critical patent/CN102662785B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method and a device for acquiring kernel error information of an Android system, which are used for storing the error information in time when the kernel of the Android system fails without depending on a debugging interface and a data connecting line, so as to provide guarantee for solving the failure. The method comprises the following steps: when the kernel of the Android system fails to operate, calling a preset interface write function; writing error information into a designated storage space of a nonvolatile memory through the interface write function; and acquiring the error information from the specified storage space through a predefined interface reading function.

Description

Method and device for acquiring kernel error information of Android system
Technical Field
The invention relates to the technical field of communication, in particular to a method and a device for acquiring kernel error information of an Android system.
Background
With the increasing functions and the increasing complexity of the smart phone adopting the Android system platform, errors occurring in the smart phone are difficult to find, and particularly, for some serious errors, such as kernel panic with serious errors of system crash, restart and the like. In the Android smart phone development process, the Linux kernel panic is a serious error, and a dead halt is usually caused in the smart phone.
At present, in the Android smart phone development process, a data line (such as a log line) is connected to a debugging interface of a mobile phone to connect the mobile phone with terminal equipment such as a computer (such as a PC), when a serious error such as kernel panic occurs, error information output through the debugging interface is printed and output to the connected terminal equipment such as the PC through the data line, the reason of the error is analyzed by checking the error information stored in the terminal equipment such as the PC, and further measures are taken.
However, in the external field test and trial phase of the smart phone development process, the external field test phase refers to testing the consistency of the communication protocol of the telecom operator, the trial phase refers to testing the consistency of the communication protocol by a specific person after the development of the smart phone is completed, in both cases, the debugging interface of the smart phone cannot be connected with a data line in real time, and thus cannot be connected with terminal equipment such as a PC in real time, even some smart phones are designed, and the debugging interface is not reserved at all in consideration of saving hardware cost, and the kernel exception of the Android system is often irregular, accidental, and disposable, so that the error information cannot be output to other debugging terminal equipment through the debugging interface.
Meanwhile, when serious errors such as kernel panic occur, the system is easy to crash or the system does not respond, so that the application cannot run normally, the error information cannot be stored in the mobile phone or the memory card of the mobile phone, if the error information cannot be kept in real time, the reason of the error is difficult to know, and great inconvenience is caused for solving the problem.
Disclosure of Invention
The invention provides a method and a device for acquiring kernel error information of an Android system, which are used for storing the error information in time when the kernel of the Android system fails without depending on a debugging interface and a data connecting line, so as to provide guarantee for solving the failure.
The embodiment of the invention provides the following specific technical scheme:
a method for acquiring kernel error information of an Android system comprises the following steps:
when the kernel of the Android system fails to operate, calling a preset interface write function;
writing error information into a designated storage space of a nonvolatile memory through the interface write function;
and acquiring the error information from the specified storage space through a predefined interface reading function.
An Android system kernel error information acquisition device comprises:
the system comprises a first processing unit, a second processing unit and a control unit, wherein the first processing unit is used for calling a preset interface write function when an Android system kernel fails in operation;
the second processing unit is used for writing error information into a specified storage space of the nonvolatile memory through the interface writing function;
and the third processing unit is used for acquiring the error information from the specified storage space through a predefined interface reading function.
Based on the technical scheme, in the embodiment of the invention, when the kernel of the Android system has a fault in operation, the preset interface write function is called, the error information is written into the specified storage space of the nonvolatile memory through the interface write function, the error information is acquired from the specified storage space through the predefined interface read function of the specified storage space, and the cause of the fault is determined through analysis according to the error information, so that the error information can be timely stored when the kernel of the Android system has a fault without depending on a debugging interface of an intelligent terminal and other terminal devices connected with the debugging interface through a data connecting line, and the solution of the fault is guaranteed.
Drawings
FIG. 1 is a flowchart of a method for acquiring kernel error information of an Android system in an embodiment of the present invention;
fig. 2 is a structural diagram of an apparatus for acquiring kernel error information of an Android system according to an embodiment of the present invention.
Detailed Description
In order to timely store error information when an Android system kernel fails and provide guarantee for solving a failure without depending on a debugging interface of an intelligent terminal and other terminal devices connected with the debugging interface through a data connection line, embodiments of the present invention provide a method and an apparatus for acquiring Android system kernel error information.
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
As shown in fig. 1, in the embodiment of the present invention, a detailed method flow for acquiring kernel error information of an Android system is as follows:
step 101: and calling a preset interface write function when the kernel of the Android system fails.
In the embodiment of the invention, before the kernel of the Android system fails to operate, a specified storage space is reserved in the nonvolatile memory. The nonvolatile memory can be of various types, for example, a flash memory.
Specifically, before the kernel of the Android system runs, information for allocating the specified storage space is transmitted to the kernel through an initialization program (Bootloader), the kernel allocates the specified storage space according to the information, when the kernel of the Android system is started, the specified storage space is registered as specified storage equipment, and an interface read function and an interface write function for calling are determined.
The interface write function is used for writing information into a designated storage space of the nonvolatile memory by the kernel; the interface read function is used for the kernel to read information from the designated storage space of the non-volatile memory.
The Bootloader is a section of initialization program which runs before the kernel of the operating system runs, application equipment can be initialized and a memory space mapping map can be established through the initialization program, so that the software and hardware environment of the system is initialized to be in a proper state to prepare a correct running environment for calling the kernel of the operating system, in the embedded system, the Bootloader program is similar to the BIOS firmware program of other systems, and the loading and starting tasks of the whole system are completed by the Bootloader program.
In this embodiment, a Bootloader program is used to perform Memory space mapping, and map a reserved specified storage space in a Memory to a storage Technology Device (MTD), so that the specified storage space can be called by a kernel and can be called by an upper application.
For example, creating a pancic partition as a specified storage space, running a Bootloader program before running an Android system kernel, namely when the Android system is started, transmitting partition information for allocating the specified storage space to the kernel through the Bootloader program, and performing partition operation on a nonvolatile memory by the kernel according to the partition information to create the pancic partition; in the process of starting an Android system kernel, when partition information of a nonvolatile memory is detected, a panic partition is registered as storage technology equipment, an interface read function and an interface write function for calling are determined, and read-write operation is performed on the panic partition by calling the interface read function and the interface write function.
Step 102: and writing error information into the designated storage space of the nonvolatile memory through the interface writing function.
Specifically, error information when the kernel runs in a fault is acquired, an interface write function is called, and the error information is written into a file and then stored in a specified storage space (namely, a specified storage device).
The error information refers to operation information when a kernel fault occurs, the operation information of the kernel is stored in the dynamic memory, and the operation information is obtained from the dynamic memory when the kernel fails, so that the error information when the kernel fails can be obtained.
For example, a dump panic module is added in a Linux kernel, the module registers a notifier processing function and a proc file system processing node when the system is started, when serious errors such as panic occur in the system, the notifier processing function of the dump panic module is notified, the notifier function acquires running information, namely error information, and calls an interface write function of a specified storage space to write the error information into the specified storage space; the function of the proc file system node is to call an interface read function of the specified storage space to obtain error information stored in the specified storage space.
The error information may include the occurrence time of the kernel fault, kernel version information, system software/hardware version information, stack information, and usage statistical information of the memory, etc. of the kernel before the fault. Specifically, a source program corresponding to a binary code operated by a kernel when a fault occurs can be acquired through kernel version information and system software/hardware version information; the calling relation between the functions in the source program can be determined through the information of the stack.
Step 103: error information is obtained from the specified storage space through a predefined interface read function.
Specifically, when the kernel runs normally, the error information is acquired from the specified storage space through the interface read function, and is transmitted to a virtual file system (proc file system) through the kernel, the proc file system transmits the error information to the user service program, and the user service program displays or transmits the acquired error information to other equipment for display, and then analyzes and determines the fault reason.
The proc file system is a file system supported by the Android system, and can be used for inquiring and setting the running condition of the system and various system parameters. The user service program can not directly access the memory and needs to access through the proc file system, the file system plays a role in shielding upper application programs and bottom hardware drivers, and various user service programs can access different hardware by taking the file system as a uniform interface. For example, after the mobile phone is turned on, the user service program sends a command through an interface or a serial port, reads information stored in the memory by calling an interface read function of the memory through the proc file system, and then sends the acquired information to the debugging computer.
For example, a kpanic node is registered in a proc file system, the node has a read-write function, and the read function is that when a kernel is normally started, error information of serious faults such as panic and the like can be read through the read function of the node; the writing function is to control the panic partition through the node, such as erasing the panic partition and testing the panic partition. Wherein, the kernel suspends and outputs a panic message when panic failure occurs, and the system is reset manually by a user.
In a preferred implementation, before writing the error information into the specified storage space of the nonvolatile memory through the interface write function, the error information stored in the specified storage space is erased, and then the error information of this time is stored, so that the error information stored in the specified storage space is ensured to be error information when the kernel fails once, and overflow caused by insufficient specified storage space can be effectively avoided.
In practical application, the information in the designated storage space may also be erased according to the number of times of kernel failures, for example, if a kernel operation failure occurs every 5 times, the historical error information stored in the designated storage space is erased before the error information is stored in the designated storage space at the 5 th time, so as to avoid the shortage of the designated storage space. In practical applications, if there are other ways, this embodiment also includes them.
The interface read function and the interface write function of the specified storage space can also be used for a user to inquire error information or for other modules in the kernel to call, for example, for a dump panic module to call. Specifically, when the error information stored in the specified storage space is queried through the interface read function, the upper layer application calls the proc file system, and then the proc file system calls the interface read function of the specified storage space through the kernel, so as to query the error information stored in the specified storage space.
In the embodiment of the present invention, the nonvolatile memory may be a flash memory (such as a nand flash memory, a norflash memory, etc.), or may be an Embedded Multimedia Memory Card (EMMC) or other nonvolatile hardware media that can store information.
For example, in a specific implementation, a panic partition is predefined in a nonvolatile memory of an Android platform intelligent terminal, and the partition is hooked through a standard kernel interface function (such as a mount function), so that a function in a kernel can access the partition and perform read-write operation on the partition; when the kernel fails, formatting the pancic partition to erase the information stored on the pancic partition, creating and opening a file (for example, completing an open function of Linux), performing write operation on the file (for example, completing a write function of Linux), and writing error information into the file; and calling an interface write function of the panic partition (such as a nand standard operation interface of a nand flash memory, a nor standard operation interface of a nor flash memory or an EMMC standard operation interface of an EMMC memory) to save the file to the panic partition.
Based on the foregoing principle, as shown in fig. 2, an embodiment of the present invention further provides an apparatus for acquiring kernel error information in an Android system, where the principle of the apparatus for solving the problem is similar to that of the method for acquiring kernel error information in the foregoing embodiment, and the implementation of the apparatus may refer to implementation of the method, and repeated details are not described here, and the apparatus mainly includes the following processing units:
the first processing unit 201 is configured to call a predetermined interface write function when an Android system kernel fails to operate;
a second processing unit 202 for writing error information to a specified storage space of the nonvolatile memory through the interface write function;
a third processing unit 203, configured to obtain error information from the specified storage space through a predefined interface read function.
The first processing unit 201 is further configured to reserve a specified storage space in the nonvolatile memory before the Android system kernel fails to operate.
The first processing unit 201 is specifically configured to, before an Android system kernel runs, transmit information for allocating a specified storage space to the kernel through an initialization program (Bootloader), and allocate the specified storage space by the kernel according to the information; and the method is also used for registering the specified storage space as the specified storage equipment when the kernel of the Android system is started, and determining an interface reading function and an interface writing function for calling.
The second processing unit 202 is specifically configured to obtain error information when the kernel fails to operate, call an interface write function, write the error information into a file, and store the file in an assigned storage space.
The third processing unit 203 is specifically configured to invoke an interface read function, obtain error information from a specified storage space, transmit the error information to a proc file system through a kernel, and transmit the error information to a user service program through the proc file system, where the proc file system is a file system supported by an Android system.
Based on the technical scheme, in the embodiment of the invention, when the kernel of the Android system has a fault in operation, the preset interface write function is called, the error information is written into the specified storage space of the nonvolatile memory through the interface write function, the error information is acquired from the specified storage space through the predefined interface read function of the specified storage space, and the cause of the fault is determined through analysis according to the error information, so that the error information can be timely stored when the kernel of the Android system has a fault without depending on a debugging interface of an intelligent terminal and other terminal devices connected with the debugging interface through a data connecting line, and the solution of the fault is guaranteed.
In addition, in the embodiment of the invention, the error information when the kernel fails is stored by using the nonvolatile memory of the intelligent terminal, the partition is created aiming at the specified storage space by developing codes in the kernel, the error information of the kernel is stored into the partition when the running error of programs such as kernel failure occurs, and the information in the partition is not lost when the intelligent terminal is restarted or recovers to normal running, so that the information stored in the partition can be acquired by an interface read function and an interface write function which are predefined aiming at the partition.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (6)

1. A method for acquiring kernel error information of an Android system is characterized by comprising the following steps:
before the operation of an Android system kernel, transmitting information of a specified storage space for allocating a nonvolatile memory to the kernel through an initialization program Bootloader, and allocating the specified storage space by the kernel according to the information of the specified storage space;
when the kernel of the Android system is started, registering the specified storage space as specified storage equipment, and determining an interface reading function and an interface writing function for calling;
when the kernel of the Android system fails to operate, calling a preset interface write function;
writing error information into a designated storage space through the interface write function;
and acquiring the error information from the specified storage space through the predefined interface read function.
2. The method of claim 1, wherein writing error information to a specified memory space of a non-volatile memory via the interface write function comprises:
and acquiring the error information when the kernel fails to operate, calling the interface write function, writing the error information into a file, and storing the file in the specified storage space.
3. The method of claim 1 or 2, wherein retrieving the error information from the designated storage space comprises:
and calling the interface reading function, acquiring the error information from the designated storage space, transmitting the error information to a proc file system through the kernel, and transmitting the error information to a user service program through the proc file system, wherein the proc file system is a file system supported by an Android system.
4. An Android system kernel error information obtaining device is characterized by comprising:
the Android system comprises a first processing unit, a second processing unit and a third processing unit, wherein the first processing unit is used for transmitting information for allocating a designated storage space to an inner core through an initialization program Bootloader before the inner core of the Android system runs, and the inner core allocates the designated storage space according to the information of the designated storage space; the memory management system is also used for registering the specified storage space as specified storage equipment when the kernel of the Android system is started, determining an interface read function and an interface write function for calling, and calling a preset interface write function when the kernel of the Android system fails to operate;
the second processing unit is used for writing error information into a specified storage space of the nonvolatile memory through the interface writing function;
and the third processing unit is used for acquiring the error information from the specified storage space through a predefined interface reading function.
5. The apparatus according to claim 4, wherein the second processing unit is specifically configured to obtain the error information when a kernel fails to operate, call the interface write function, write the error information into a file, and store the error information in the specified storage space.
6. The apparatus according to claim 4 or 5, wherein the third processing unit is specifically configured to invoke the interface read function, obtain the error message from the specified storage space, and transfer the error message to a proc file system via the kernel, where the proc file system transfers the error message to a user service program, and the proc file system is a file system supported by an Android system.
CN201210107127.4A 2012-04-12 2012-04-12 Method and device for acquiring kernel error information of Android system Active CN102662785B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210107127.4A CN102662785B (en) 2012-04-12 2012-04-12 Method and device for acquiring kernel error information of Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210107127.4A CN102662785B (en) 2012-04-12 2012-04-12 Method and device for acquiring kernel error information of Android system

Publications (2)

Publication Number Publication Date
CN102662785A CN102662785A (en) 2012-09-12
CN102662785B true CN102662785B (en) 2020-09-25

Family

ID=46772284

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210107127.4A Active CN102662785B (en) 2012-04-12 2012-04-12 Method and device for acquiring kernel error information of Android system

Country Status (1)

Country Link
CN (1) CN102662785B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103077035B (en) * 2013-01-09 2017-08-25 上海斐讯数据通信技术有限公司 A kind of process configuration management system and implementation method
TWI489268B (en) * 2013-04-09 2015-06-21 Wistron Corp Operation system debugging device and method
CN104346265B (en) * 2013-07-29 2018-03-27 比亚迪股份有限公司 The acquisition methods and device of terminal device and its log information
CN104951395A (en) * 2014-03-27 2015-09-30 浙江大华技术股份有限公司 Debugging information processing method and device for embedded system
US9984606B2 (en) 2014-08-12 2018-05-29 Samsung Electronics Co., Ltd. Device and method of providing sampled data and device and method of displaying diagnosis interface
CN104536886A (en) * 2014-12-23 2015-04-22 浪潮电子信息产业股份有限公司 Method for selecting kernel debugging mode
CN106682162B (en) * 2016-12-26 2021-03-09 浙江宇视科技有限公司 Log management method and device
CN109542696B (en) * 2017-09-22 2023-04-28 龙芯中科技术股份有限公司 Method and device for acquiring equipment data, readable storage medium and electronic equipment
KR20190037666A (en) * 2017-09-29 2019-04-08 에스케이하이닉스 주식회사 Data storage device and operating method thereof
CN108363659B (en) * 2018-02-23 2021-06-29 青岛海信移动通信技术股份有限公司 Method and device for processing abnormity of electronic equipment
CN109165110A (en) * 2018-07-27 2019-01-08 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN109343996A (en) * 2018-10-30 2019-02-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN109815140A (en) * 2019-01-05 2019-05-28 咪付(广西)网络技术有限公司 A kind of automatization test system and method for the realization of embedded type C language
CN110673974A (en) * 2019-08-20 2020-01-10 中科创达软件股份有限公司 System debugging method and device
CN111158945B (en) * 2019-12-31 2023-12-22 奇安信科技集团股份有限公司 Kernel fault processing method, device, network security equipment and readable storage medium
CN112052125A (en) * 2020-09-28 2020-12-08 联想(北京)有限公司 Dump processing method and device for operating system kernel and electronic equipment
CN112748885B (en) * 2021-01-18 2023-01-17 联想(北京)有限公司 Information processing method, device, equipment and storage medium
CN112948311B (en) * 2021-03-30 2022-11-08 几维通信技术(深圳)有限公司 Serial port information interception method in Linux system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101115264A (en) * 2006-07-24 2008-01-30 中兴通讯股份有限公司 Communication terminal failure monitoring system and implementing method thereof
CN101448172A (en) * 2007-11-27 2009-06-03 上海未来宽带技术及应用工程研究中心有限公司 Method for automatically testing stability of set-top box in batches
CN102355642A (en) * 2011-09-26 2012-02-15 广东欧珀移动通信有限公司 Automated testing method of cell phone short messages

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101115264A (en) * 2006-07-24 2008-01-30 中兴通讯股份有限公司 Communication terminal failure monitoring system and implementing method thereof
CN101448172A (en) * 2007-11-27 2009-06-03 上海未来宽带技术及应用工程研究中心有限公司 Method for automatically testing stability of set-top box in batches
CN102355642A (en) * 2011-09-26 2012-02-15 广东欧珀移动通信有限公司 Automated testing method of cell phone short messages

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Android通过Log解决问题的例子(经验之谈);无;《百度文库(http://wenku.baidu.com/view/18f04500de80d4d8d15a4fa6.html)》;20110623;正文第1页第8段-14段,第6-8页 *

Also Published As

Publication number Publication date
CN102662785A (en) 2012-09-12

Similar Documents

Publication Publication Date Title
CN102662785B (en) Method and device for acquiring kernel error information of Android system
CN102760090B (en) Debugging method and computer system
US9262283B2 (en) Method for reading kernel log upon kernel panic in operating system
CN101377749B (en) Method, programmable logic device, system and apparatus for checking memory data
CN104063305A (en) Pressure testing method, device and system for intelligent terminal software
CN108509215B (en) System software replacing method and device, terminal equipment and storage medium
CN106547574A (en) The outside download system and method for a kind of DSP programs and FPGA programs
US10606677B2 (en) Method of retrieving debugging data in UEFI and computer system thereof
CN103827834A (en) Migration method of in-memory data, computer and device
CN103678053A (en) Computer self-check method and system
KR102331926B1 (en) Operation method of host system including storage device and operation method of storage device controller
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN108985402B (en) RAID card information acquisition method and related device
CN111158950A (en) Positioning system and method for abnormal reset of embedded computer system
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
US10922023B2 (en) Method for accessing code SRAM and electronic device
CN114496053A (en) Data anomaly detection method, device and equipment and computer readable storage medium
CN111061603B (en) Motherboard capable of recording self-checking data, computer and recording method of self-checking data
CN111651177A (en) Android platform-based number writing method and device and computer readable medium
CN114765051A (en) Memory test method and device, readable storage medium and electronic equipment
CN111159123A (en) Embedded reliable parameter storage file system and method
CN101739262A (en) Firmware updating method and electronic device using same
CN114116034A (en) Distributed flashing method and device
CN117412029A (en) Detection method and device of image sensor, electronic equipment and storage medium
CN113791936A (en) Data backup method and device and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 266100 No. 151, Zhuzhou Road, Laoshan District, Shandong, Qingdao

Patentee after: Qingdao Hisense Mobile Communication Technology Co.,Ltd.

Address before: 266100 No. 151, Zhuzhou Road, Laoshan District, Shandong, Qingdao

Patentee before: HISENSE MOBILE COMMUNICATIONS TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder