CN110716845A - Method for reading log information of Android system - Google Patents

Method for reading log information of Android system Download PDF

Info

Publication number
CN110716845A
CN110716845A CN201910935721.4A CN201910935721A CN110716845A CN 110716845 A CN110716845 A CN 110716845A CN 201910935721 A CN201910935721 A CN 201910935721A CN 110716845 A CN110716845 A CN 110716845A
Authority
CN
China
Prior art keywords
log information
base address
flash memory
kernel
pstore
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910935721.4A
Other languages
Chinese (zh)
Other versions
CN110716845B (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.)
Shanghai Longcheer Technology Co Ltd
Original Assignee
Shanghai Longcheer 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 Shanghai Longcheer Technology Co Ltd filed Critical Shanghai Longcheer Technology Co Ltd
Priority to CN201910935721.4A priority Critical patent/CN110716845B/en
Publication of CN110716845A publication Critical patent/CN110716845A/en
Application granted granted Critical
Publication of CN110716845B publication Critical patent/CN110716845B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Stored Programmes (AREA)

Abstract

Compared with the prior art, the method for reading the log information of the Android system comprises the steps of firstly establishing association between a Bootloader of the Android system and a base address of a Pstore file system in Kernel; reading the base address and the log information stored in the space behind the base address and writing the log information into a blank storage area of a flash memory; then writing an instruction for entering a downloading mode into the CPU; and when receiving the instruction for triggering the entering of the download mode, triggering the entering of the download mode so as to read the log information stored in the blank storage area of the flash memory. The method can be used for reading the Pstore log information for analysis and fault location without depending on the full starting of the Android system, and has practical significance for improving the equipment development efficiency and seeking equipment performance improvement countermeasures.

Description

Method for reading log information of Android system
Technical Field
The application relates to the technical field of computer information processing, in particular to a technology for reading log information of an Android system.
Background
The Android system is adopted in a large proportion of terminal equipment in the current information era, is an operating system of a free and open source code based on Linux kernel, is named as the Android system in Chinese, and is the largest operating system of the intelligent terminal equipment in the world.
A normal Android device, from a system perspective, a boot process is as shown in fig. 1: the method comprises the steps that a Bootloader (boot loader) is loaded on a hardware platform firstly, the Kernel is started by the boot loader, and then after the Kernel is started, the Android related modules are started by Linux. In the Android device, BootLoader runs before Kernel runs after the device is started, hardware can be initialized, memory space mapping is established, and a running environment is prepared for loading Kernel. Kernel is the core part of the operating system, consisting of the parts of the operating system that manage memory, files, peripherals and system resources.
The device generates relevant log information from starting, initializing to completely starting an operating system and running various application programs, the relevant log information is usually stored in a corresponding storage area of the RAM, but data stored in the corresponding storage area of the RAM when the device runs last time after the device is restarted is lost or covered, and the relevant log information stored in the corresponding storage area of the RAM is only the log information which is run when the device runs next time.
If the Android device is started and runs to a Kernel stage and some unrecoverable exceptions are trapped, except for no better means for restarting the device, before restarting the device, the Kernel records fault scene information such as registers and stacks with exceptions as logs for fault analysis and positioning, the information is called Kernel oops information, Ramoops refers to a function for storing the Kernel oops information by using a RAM space, and in a version after linux Kernel 3.10.4, the Ramoops is realized by using a Pstore (persistent storage) mechanism. The Pstore is a data reading mechanism, and when the Kernel is abnormal, the Pstore mechanism can read the running log information of the Kernel stored in a storage area such as a RAM or a hard disk, and the running log information is mounted on a directory tree of the sys system in a file system mode. The Ramops takes Kernel Oops information of the Android device during starting up as a system log to be written into a specific address in a memory, and after the device is restarted (hot started) in a charged mode, a Pstore mechanism reads the system log from the specific memory address and mounts the system log on a directory tree of a sys system in a file system mode for a user to read.
If the android device is not powered off since the android device is started last time, most of data of the last device operation is still reserved in the RAM from the restart to the Bootloader stage, wherein the data includes log information stored by a Pstore mechanism.
The existing reading method of the Pstore log information is usually performed after the Android system is completely started, when the Android system has abnormal problems such as system crash, crash and the like, the related log information is often required to be acquired to analyze the reasons which may cause the abnormal problems, but the existing reading method of the log information cannot read the log information related to the abnormal problems.
Disclosure of Invention
In order to solve the above problems, an object of the present application is to provide a method for reading log information of an Android system.
According to one aspect of the application, a method for reading log information of an Android system is provided, wherein the method comprises the following steps:
establishing association with a base address of a Pstore file system in Kernel in a Bootloader of an Android system;
reading the base address and the log information stored in the space behind the base address and writing the log information into a blank storage area of a flash memory;
after the log information is written, writing an instruction for entering a downloading mode into the CPU;
and when receiving the instruction for triggering the entering of the download mode, triggering the entering of the download mode so as to read the log information stored in the blank storage area of the flash memory.
Preferably, the way of establishing an association with the base address of the Pstore file system in Kernel includes any one of the following:
in the Bootloader, defining a storage address of the random access memory, and introducing the storage address into Kernel to be used as a base address of a Pstore file system in the Kernel;
a pointer variable is defined that is assigned to the base address of the Pstore file system in Kernel.
Preferably, the blank storage area of the flash memory comprises any one of:
a segment of reserved partition in the flash memory;
the end blank part of a certain partition in the flash memory.
Preferably, the method for reading the log information of the Android system further includes:
reading the base address and the log information stored in the space behind the base address, writing the log information into a blank storage area of a flash memory, and writing an instruction for entering a downloading mode into the CPU after the log information is written is realized by adding a main function in the Bootloader.
Preferably, the method for reading the log information of the Android system further includes: and binding the main function with the instruction for triggering the downloading mode by adding a fastboot command, so that the function of the main function is called when the instruction for triggering the downloading mode is triggered.
Compared with the prior art, the method for reading the log information of the Android system comprises the steps of firstly establishing association between a Bootloader of the Android system and a base address of a Pstore file system in Kernel; reading the base address and the log information stored in the space behind the base address and writing the log information into a blank storage area of a flash memory; then writing an instruction for entering a downloading mode into the CPU; and when receiving the instruction for triggering the entering of the download mode, triggering the entering of the download mode so as to read the log information stored in the blank storage area of the flash memory. By the method, the device is switched to the fastboot mode when the device is restarted, then the instruction is input, the downloading mode is entered, and the system log information of the last device in operation can be read in the downloading mode. The method can be used for reading the Pstore log information for analysis and fault location under the condition that the Android system cannot be started normally, and has practical significance for improving equipment development efficiency and seeking equipment performance improvement countermeasures.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1 shows a boot flow block diagram of an Android system device 1;
fig. 2 shows a flowchart of a method for reading log information of an Android system according to an aspect of the present application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present invention is described in further detail below with reference to the attached drawing figures.
In a typical configuration of the present application, each module and trusted party of the system includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
In order to further explain the technical means and effects adopted by the present application, the following description clearly and completely describes the technical solution of the present application with reference to the accompanying drawings and preferred embodiments.
Fig. 2 shows a flow chart of a method for reading log information of an Android system in one aspect of the present application, where the method of an embodiment includes:
s21, establishing association with the base address of a Pstore file system in Kernel in a Bootloader of an Android system;
s22, reading the base address and the log information stored in the space behind the base address and writing the log information into the blank storage area of the flash memory;
s23, after the log information is written, writing an instruction for entering a downloading mode into the CPU;
s24, when receiving the trigger command, entering a download mode to read the log information stored in the blank area of the flash memory.
In the application, the method is executed through a device 1, where the device 1 is a mobile terminal device, a wearable device or other devices, such as a smart phone, a tablet computer, a smart watch, a smart bracelet, smart glasses, an unmanned vehicle, and the like, in which an Android system is installed.
The mobile terminal device, wearable device or other device is merely an example, and other existing or future devices and/or resource sharing platforms, as applicable to the present application, are also intended to be included within the scope of the present application and are hereby incorporated by reference.
In this embodiment, in step S21, an association is established between the Bootloader of the Android system and the base address of the Pstore file system in Kernel.
The Bootloader and the Kernel of the Android system are all based on a stage in a boot initialization process of the Android system device 1.
Preferably, the way of establishing an association with the base address of the Pstore file system in Kernel includes any one of the following:
in the Bootloader, defining a storage address of the random access memory, and introducing the storage address into Kernel to be used as a base address of a Pstore file system in the Kernel;
a pointer variable is defined that is assigned to the base address of the Pstore file system in Kernel.
Specifically, a reasonable memory address is defined according to the memory distribution state of the device 1, and the memory address is transmitted to the Kernel through a commandline (command line) to serve as a Pstore file system base address of a ramoops mechanism in the Kernel.
Or, a pointer variable may be directly defined according to the memory distribution state of the device 1, and assigned as the base address of the Pstore file system used in the current Kernel.
Continuing in this embodiment, in step S22, the log information stored in the base address and the space behind the base address is read and written into the blank storage area of the flash memory.
Preferably, the blank storage area of the flash memory comprises any one of:
a segment of reserved partition in the flash memory;
the end blank part of a certain partition in the flash memory.
Specifically, according to the storage space planning condition of the flash memory of the device 1, a segment of reserved partition which is not planned to be used is used for storing the log information read from the base address of the Pstore file system and the space behind the Pstore file system.
Or according to the storage space planning status of the flash memory of the device 1, the unused blank portion at the end of a certain partition is used for storing the log information read from the base address of the Pstore file system and the space behind the Pstore file system.
No matter what method is adopted to plan the blank storage area of the flash memory, the size of the allocated blank storage area is enough to store the log information read from the base address of the Pstore file system and the space behind the Pstore file system, and it is ensured that the situation that the partial content of the log information read from the base address of the Pstore file system and the space behind the Pstore file system is lost due to no storage space caused by the insufficient size of the planned blank storage area of the flash memory is avoided, so that the integrity of the log information is possibly influenced.
Continuing in this embodiment, in the step S23, after writing the log information is completed, an instruction to enter the download mode is written to the CPU.
Preferably, the method comprises the steps of reading the base address and the log information stored in the space behind the base address by adding a main function in the Bootloader, writing the log information into a blank storage area of the flash memory, and writing an instruction for entering a download mode into the CPU after the log information is written.
Continuing in this embodiment, in step S24, when a trigger instruction is received, a download mode is entered to read log information stored in a blank storage area of the flash memory.
Preferably, a newly added fastboot command is bound with the main function, so that when the fastboot command is triggered, the function of the main function is called.
The new adding command is bound with the main function through a new adding command in a fastboot command set, the new adding command is input to trigger the main function when the device 1 is in a fastboot mode, the purpose that the log information stored in the base address and the space behind the base address is read and written into a blank storage area of the flash memory is achieved, after the log information is written, an instruction entering a downloading mode is written into a CPU, and the CPU enters the downloading mode to read the log information stored in the blank storage area of the flash memory is achieved.
Specifically, after the device 1 is restarted, the device enters a fastboot mode under user intervention, and the user inputs the new adding command to trigger the main function in the fastboot mode.
Further, when the device 1 is in the download mode, the user can read the log information written into the blank storage area of the flash memory from the device 1 through a special tool for further analysis, so as to determine the specific reason of the last abnormality of the device 1.
According to yet another aspect of the present application, there is also provided a computer readable medium having stored thereon computer readable instructions executable by a processor to implement the foregoing method.
According to another aspect of the present application, there is also provided an apparatus for reading log information of an Android system, where the apparatus includes:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform operations of the method as previously described.
For example, the computer readable instructions, when executed, cause the one or more processors to: establishing association with a base address of a Pstore file system in Kernel in a Bootloader of an Android system; reading the base address and the log information stored in the space behind the base address and writing the log information into a blank storage area of a flash memory; after the log information is written, writing an instruction for entering a downloading mode into the CPU; and when receiving the instruction for triggering the entering of the download mode, triggering the entering of the download mode so as to read the log information stored in the blank storage area of the flash memory.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (7)

1. A method for reading log information of an Android system is characterized by comprising the following steps:
establishing association with a base address of a Pstore file system in Kernel in a Bootloader of an Android system;
reading the base address and the log information stored in the space behind the base address and writing the log information into a blank storage area of a flash memory;
after the log information is written, writing an instruction for entering a downloading mode into the CPU;
and when a trigger instruction is received, entering a downloading mode to read the log information stored in the blank storage area of the flash memory.
2. The method according to claim 1, wherein the way to establish an association with the base address of the Pstore file system in Kernel comprises any one of:
in the Bootloader, defining a storage address of the random access memory, and introducing the storage address into Kernel to be used as a base address of a Pstore file system in the Kernel;
a pointer variable is defined that is assigned to the base address of the Pstore file system in Kernel.
3. The method of claim 2, wherein the blank storage area of the flash memory comprises any one of:
a segment of reserved partition in the flash memory;
the end blank part of a certain partition in the flash memory.
4. The method according to any one of claims 1 to 3, further comprising:
and reading the base address and the log information stored in the space behind the base address by adding a main function in the Bootloader, writing the log information into a blank storage area of the flash memory, and writing an instruction for entering a downloading mode into a CPU after the log information is written.
5. The method of claim 4, further comprising:
and a newly added fastboot command, which is bound with the main function, so that when the fastboot command is triggered, the function of the main function is called.
6. A computer-readable medium, wherein,
stored thereon computer readable instructions executable by a processor to implement the method of any one of claims 1 to 5.
7. An apparatus for log information reading of an Android system, wherein the apparatus comprises:
one or more processors; and
memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method of any of claims 1 to 5.
CN201910935721.4A 2019-09-29 2019-09-29 Log information reading method of Android system Active CN110716845B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910935721.4A CN110716845B (en) 2019-09-29 2019-09-29 Log information reading method of Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910935721.4A CN110716845B (en) 2019-09-29 2019-09-29 Log information reading method of Android system

Publications (2)

Publication Number Publication Date
CN110716845A true CN110716845A (en) 2020-01-21
CN110716845B CN110716845B (en) 2024-03-12

Family

ID=69211124

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910935721.4A Active CN110716845B (en) 2019-09-29 2019-09-29 Log information reading method of Android system

Country Status (1)

Country Link
CN (1) CN110716845B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112052445A (en) * 2020-09-21 2020-12-08 深兰科技(上海)有限公司 Method for controlling ADB (Android device) permission of Android device, Android device and storage medium
CN112115097A (en) * 2020-09-28 2020-12-22 合肥沛睿微电子股份有限公司 Access method of running log information and storage device
CN113535660A (en) * 2021-07-28 2021-10-22 展讯通信(天津)有限公司 Android log storage method and device
US11520681B2 (en) * 2018-01-23 2022-12-06 Amlogic (Shanghai) Co., Ltd. System log collection method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120239715A1 (en) * 2011-03-15 2012-09-20 Fujitsu Limited Information processing apparatus with log output function, mobile terminal device, and log output control method
US9003106B1 (en) * 2012-11-26 2015-04-07 Emc Corporation Crash consistency
CN106682162A (en) * 2016-12-26 2017-05-17 浙江宇视科技有限公司 Log management method and device
CN109101358A (en) * 2018-07-27 2018-12-28 郑州云海信息技术有限公司 Server system and its hardware log recording device and method
CN109189612A (en) * 2018-09-04 2019-01-11 广东小天才科技有限公司 Log processing method and electronic equipment when a kind of linux kernel exception
CN110147304A (en) * 2019-04-03 2019-08-20 珠海全志科技股份有限公司 A kind of method and apparatus of acquisition system bootload log

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120239715A1 (en) * 2011-03-15 2012-09-20 Fujitsu Limited Information processing apparatus with log output function, mobile terminal device, and log output control method
US9003106B1 (en) * 2012-11-26 2015-04-07 Emc Corporation Crash consistency
CN106682162A (en) * 2016-12-26 2017-05-17 浙江宇视科技有限公司 Log management method and device
CN109101358A (en) * 2018-07-27 2018-12-28 郑州云海信息技术有限公司 Server system and its hardware log recording device and method
CN109189612A (en) * 2018-09-04 2019-01-11 广东小天才科技有限公司 Log processing method and electronic equipment when a kind of linux kernel exception
CN110147304A (en) * 2019-04-03 2019-08-20 珠海全志科技股份有限公司 A kind of method and apparatus of acquisition system bootload log

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JOE SYLVE等: ""Acquisition and analysis of volatile memory from android devices"", 《DIGITAL INVESTIGATION》, vol. 8, no. 3, 29 February 2012 (2012-02-29) *
徐远超;孙凤芸;闫俊峰;万虎;: "面向Android系统的目录自适应日志模式选择机制", 计算机应用, no. 10, 10 October 2015 (2015-10-10) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11520681B2 (en) * 2018-01-23 2022-12-06 Amlogic (Shanghai) Co., Ltd. System log collection method
CN112052445A (en) * 2020-09-21 2020-12-08 深兰科技(上海)有限公司 Method for controlling ADB (Android device) permission of Android device, Android device and storage medium
CN112115097A (en) * 2020-09-28 2020-12-22 合肥沛睿微电子股份有限公司 Access method of running log information and storage device
CN112115097B (en) * 2020-09-28 2023-08-29 合肥沛睿微电子股份有限公司 Access method and storage device for operation log information
CN113535660A (en) * 2021-07-28 2021-10-22 展讯通信(天津)有限公司 Android log storage method and device
CN113535660B (en) * 2021-07-28 2023-09-05 展讯通信(天津)有限公司 Android log storage method and device

Also Published As

Publication number Publication date
CN110716845B (en) 2024-03-12

Similar Documents

Publication Publication Date Title
CN110716845B (en) Log information reading method of Android system
CN108763099B (en) System starting method and device, electronic equipment and storage medium
JP7012074B2 (en) Virtual disk expansion method and equipment
CN112667246B (en) Application function expansion method and device and electronic equipment
CN114327777B (en) Method and device for determining global page directory, electronic equipment and storage medium
CN111124288A (en) VPD storage management method, device, equipment and readable storage medium
CN116049207A (en) Application SQL script processing method and device, processor and electronic equipment
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
CN110837446A (en) Equipment management method and device applied to embedded system, medium and embedded equipment
US10552135B1 (en) Reducing a size of an application package
CN111913753A (en) Method and system for changing starting mode in cloud migration of windows system
CN116880877A (en) Virtual machine enhancement tool upgrading method and device, computer equipment and storage medium
CN116382713A (en) Method, system, device and storage medium for constructing application mirror image
CN113467893B (en) Automatic testing method and device for virtual machine, storage medium and processor
CN114840307A (en) Container loading method, device, equipment and storage medium
CN113986744A (en) Method and device for testing warehouse and table components and storage medium
CN114064323A (en) Resource sharing method, terminal, and computer-readable medium
CN110515751B (en) Method and system for loading and running VxWorks real-time protection process
CN111651177A (en) Android platform-based number writing method and device and computer readable medium
CN111737223A (en) File copying method, device, equipment and storage medium
US20190114249A1 (en) Method of executing instructions of core, method of debugging core system, and core system
CN115080390A (en) Method, device and equipment for software patch package regression test
CN111367836B (en) Processing method and device for database
CN117349887A (en) Mobile system packaging method
US9483399B2 (en) Sub-OS virtual memory management layer

Legal Events

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