Method and device for starting Android operating system, equipment and medium

By compressing linux image files during the startup process of the linux kernel of the Android operating system and importing the initial random access memory file system, the problem of slower startup speed of the Android operating system is solved, and faster system startup time and higher efficiency are achieved.

CN119847632APending Publication Date: 2025-04-18镁佳(北京)科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411912254.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The Android operating system is slow to start, especially when a large number of APK files are installed, which affects the device's boot time.

Method used

During the startup process of the Linux kernel, the compressed files, scripts and drivers are imported into the initial random access memory file system to generate a temporary root file system, and the startup script of the Linux kernel is executed based on this.

Benefits of technology

By compressing linux image files, the size of the kernel image is reduced, the startup time of the Android system is shortened, the memory usage is optimized, and the system startup efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847632A_ABST
    Figure CN119847632A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Android operating systems, and discloses a method, a device, equipment and a medium for starting an Android operating system, and the method comprises the following steps: in a linux kernel starting process, compressing a linux mirror image file; importing the compressed linux mirror image file, the script and the driving program into an initial random access memory file system; loading the initial random access memory file system to a memory to generate a temporary root file system; and executing a startup script of the linux kernel based on the temporary root file system. By compressing the linux mirror image file, the size of the linux kernel mirror image can be remarkably reduced, the small linux kernel mirror image can be loaded into a memory more quickly, and the starting time of the Android system is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Android operating systems, and in particular to a method, apparatus, device and medium for starting an Android operating system. Background Art

[0002] Android operating system is a free and open source operating system based on Linux operating system, which can be used in mobile devices such as smart phones and tablets. Android operating system adopts a layered system architecture. From the architecture diagram, Android operating system is divided into four layers, from high to low, they are application layer, application framework layer, system runtime layer and Linux kernel layer.

[0003] During the startup of the Android operating system, the SystemServer program starts the application management service (PackageManagerService), which is responsible for scanning specific directories in the system, finding application files, that is, files with the suffix APK, and then parsing these files to obtain relevant information about the application and complete the installation process of the application. The more APK files are installed, the more time is required, which greatly affects the startup time of the Android operating system, thereby affecting the boot time of the device installed with the Android operating system. Summary of the invention

[0004] In view of this, the present invention provides a method, apparatus, device and medium for starting an Android operating system to solve the problem of slow startup speed of the Android operating system in the related art.

[0005] In a first aspect, the present invention provides a method for starting an Android operating system, the method comprising: compressing a Linux image file during the Linux kernel startup process; importing the compressed Linux image file, script and driver into an initial random access memory file system; loading the initial random access memory file system into a memory to generate a temporary root file system; and executing a startup script of the Linux kernel based on the temporary root file system.

[0006] In an optional embodiment, the method also includes: before executing the startup script of the Linux kernel, executing a startup loader to boot and load the Linux kernel; after executing the startup script of the Linux kernel, starting an initial user space process, and initializing the Android operating system based on the initial user space process; starting an Android application incubator process, creating a Java virtual machine based on the Android application incubator process, and registering a Java local interface based on the Java virtual machine; starting a system server process, and starting a Binder thread pool based on the system server process; starting an Android system desktop launcher based on the system server process, and displaying shortcut icons of installed applications on the desktop of the Android operating system based on the Android system desktop launcher to complete the startup of the Android operating system.

[0007] In an optional embodiment, the method further includes: in the process of starting the system server process, constructing a dependency matrix, and determining the dependency of the application based on the dependency matrix, wherein the dependency matrix is ​​used to characterize the dependency relationship between the applications; if the dependency of the target application is higher than a preset threshold, executing the target application in the main thread; if the dependency of the target application is lower than or equal to the preset threshold, executing the target application in a child thread, and sending the execution result in the child thread to the main thread.

[0008] In an optional implementation, the method further includes: based on the Android application incubator process, preloading classes, class libraries, cache icons and layout files of the Android framework; based on the Android application incubator process, listening for connection requests from the system service process.

[0009] In an optional implementation, the compressing the Linux image file includes: compressing the Linux image file based on an LZ4 compression algorithm.

[0010] In an optional implementation, after executing the startup script of the Linux kernel, the initial user space process is started, and based on the initial user space process, the Android operating system is initialized, including: based on the initial user space process, reading and parsing the initial user space process configuration file; based on the configuration instructions in the initial user space process configuration file, starting the Android application incubator process; based on the initial user space process, monitoring system events, and triggering corresponding operations based on the monitored system events.

[0011] In a second aspect, the present invention provides a device for starting an Android operating system, the device comprising: a compression module, used to compress a Linux image file during the Linux kernel startup process; a transmission module, used to import the compressed Linux image file, scripts and drivers into an initial random access memory file system; a loading module, used to load the initial random access memory file system into a memory to generate a temporary root file system; and an execution module, used to execute the startup script of the Linux kernel based on the temporary root file system.

[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for starting an Android operating system according to the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to cause a computer to execute the method for starting an Android operating system according to the first aspect or any corresponding embodiment thereof.

[0014] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method for starting an Android operating system according to the first aspect or any corresponding embodiment thereof.

[0015] During the Linux kernel startup process of the Android operating system, by compressing the Linux image file, the size of the Linux kernel image can be significantly reduced. A smaller Linux kernel image can be loaded into the memory faster, shortening the startup time of the Android system; using the compressed Linux image file and the temporary root file system can optimize memory usage. During the Android operating system startup process, the compressed Linux image file, scripts and drivers are imported into the initial random access memory file system and then loaded into the memory, so that the Android operating system can access the aforementioned files faster, thereby improving the system startup efficiency; during the Android system startup process, the system loads the required scripts and drivers, uses the temporary root file system, does not need to rely on persistent storage devices, and makes the system easier to update and repair. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 A schematic diagram of a process for starting an Android operating system provided by an embodiment of the present invention is shown;

[0018] Figure 2 Another schematic flow chart of a method for starting an operating system provided by an embodiment of the present invention is shown;

[0019] Figure 3 A schematic diagram of the process of asynchronous initialization is shown;

[0020] Figure 4 A schematic diagram of the structure of a device for starting an Android operating system provided by an embodiment of the present invention is shown;

[0021] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0023] According to an embodiment of the present invention, a method embodiment for starting an Android operating system is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0024] In this embodiment, a method for starting an Android operating system is provided, which can be used for a terminal having an Android operating system, such as a mobile phone or a tablet computer. Figure 1 A flow chart of a method for starting an Android operating system provided by an embodiment of the present invention is shown, Figure 1 As shown, the process includes the following steps:

[0025] Step S101, during the Linux kernel startup process, compress the Linux image file.

[0026] In this step, after the linux kernel is compiled, an uncompressed linux kernel image is generated. The linux kernel image file can be compressed using a compression algorithm, such as a gzip compression algorithm, to obtain a compressed linux image file. The compressed linux image file includes: a compressed kernel code and a decompression program.

[0027] When the Android operating system starts, the boot loader (BootLoader) loads the compressed kernel code into the memory. After the loading is completed, the decompression program will automatically run to decompress the compressed kernel code into the random access memory (Random Access Memory, referred to as RAM).

[0028] Step S102, importing the compressed Linux image file, script and driver into the initial random access memory file system (initramfs).

[0029] In this step, the script may include initialization scripts and configuration files. Drivers may be used to support the normal operation of hardware devices. initramfs includes various files and directories required during the startup process of the Android operating system.

[0030] This step ensures that the Android operating system loads and runs necessary components, providing a basis for the subsequent Linux kernel startup.

[0031] Step S103, loading the initial random access memory file system into the internal memory to generate a temporary root file system.

[0032] In this step, you can use BootLoader to load the kernel image and initramfs image into the memory according to the configuration. When the Linux kernel starts, initramfs will be loaded into the memory and become a temporary root file system. The kernel will execute the startup script from the temporary root file system. The temporary root file system is used to assist in mounting the real root file system, allowing the Android operating system to perform necessary initialization and configuration work before the real root file system is mounted.

[0033] During the Linux startup process, the Boot Loader loads the kernel image and initramfs into the memory. The Linux kernel first starts Initramfs, loads the file system support and driver program, and after the file system is loaded, unloads the file system generated by Initramfs, and the system will be transferred to the real root file system.

[0034] Step S104: Execute the startup script of the Linux kernel based on the temporary root file system.

[0035] In this step, after the temporary root file system is loaded, the kernel will execute the startup script. After the real root file system is mounted, the control can be transferred from the temporary root file system to the actual root file system through the startup script, which can be achieved through commands such as switch_root or pivot_root. When the Linux kernel starts, you can set the cache, protected memory, schedule list, and load drivers. After completing the system settings, search for the init.rc file in the Android system file and start the initial user space process.

[0036] Among them, by setting the cache and configuring the kernel's cache mechanism, memory usage can be optimized and performance can be improved. By setting the protected memory, the kernel memory area can be initialized and protected to prevent illegal access. By setting the task scheduler based on the schedule list, the priority and execution order of the process can be managed. By loading the driver, the necessary kernel modules and drivers can be loaded to support the normal operation of the hardware device.

[0037] The method for starting the Android operating system provided in this embodiment can significantly reduce the size of the Linux kernel image by compressing the Linux image file during the process of starting the Linux kernel in the process of starting the Android operating system, and the smaller Linux kernel image can be loaded into the memory faster, shortening the startup time of the Android system; using the compressed Linux image file and the temporary root file system, the memory usage can be optimized, and during the startup of the Android operating system, the compressed Linux image file, script and driver are imported into the initial random access memory file system and loaded into the memory, so that the Android operating system can access the aforementioned files faster, improving the startup efficiency of the system; during the startup of the Android system, the system loads the required scripts and drivers, uses the temporary root file system, does not need to rely on a persistent storage device, and makes the system easier to update and repair. Based on the compressed kernel image, the operating system attacker needs to decompress the kernel image to perform malicious operations, which can reduce the possibility of successful attacks and increase the security of the system. Based on the compressed kernel image and the temporary root file system, the system can be supported for rapid recovery and disaster response, and when the Android system crashes or needs to be restarted, the kernel and necessary components can be loaded faster, reducing the system recovery time and management burden.

[0038] In some optional embodiments, the aforementioned method for starting an operating system also includes: before executing the startup script of the Linux kernel, executing a startup loader to boot and load the Linux kernel; after executing the startup script of the Linux kernel, starting the initial user space process, and initializing the Android operating system based on the initial user space process; starting the Android application incubator process, creating a Java virtual machine based on the Android application incubator process, and registering a Java local interface based on the Java virtual machine; starting the system server process, and starting the Binder thread pool based on the system server process; starting the Android system desktop launcher based on the system server process, and displaying the shortcut icons of the installed applications on the desktop of the Android operating system based on the Android system desktop launcher to complete the startup of the Android operating system.

[0039] In this embodiment, Figure 2 Another schematic diagram of a method for starting an operating system provided by an embodiment of the present invention is shown. Figure 2 As shown, the method for starting the Android operating system includes:

[0040] Step S201, start the power supply, boot the chip code to start execution from a predefined location, load the boot BootLoader program into the RAM program, and execute it.

[0041] Step S202, execute the BootLoader program, boot and load the Linux kernel, and perform hardware initialization.

[0042] Step S203, during the Linux kernel startup process, set the cache, protected memory, plan list and load the driver. After completing the system settings, search for the init.rc file in the Android system file and start the initial user space (init) process. The init process is the first process in the user space and its process number (PID) is 1.

[0043] Wherein, step S203 includes step S2031 and step S2032. In step S2031, a compression algorithm may be used to compress the image file to generate a compressed Linux image file.

[0044] Step S2032, the initramfs program provides a temporary root file system, and packages the compressed Linux image file, script and driver program and imports them into the temporary root file system.

[0045] Step S204, the init process initializes and starts the attribute service, and starts the Android application incubator (Zygote) process. The Zygote process is used to incubate new processes. Other application processes, including the system service (SystemServer) process, are incubated by the Zygote process.

[0046] The Zygote process is created by the user-level process init started by the Linux kernel. It creates a Dalvik virtual machine instance when it starts. Whenever a new application process is hatched, this virtual machine instance is copied to the new application process, so that each application process has an independent virtual machine instance.

[0047] Step S205, start the Zygote process, create a Java virtual machine based on the Zygote process, register a Java local interface based on the Java virtual machine, create a server Socket, and start the system server (SystemServer) process.

[0048] In this step, when the Zygote process starts, a Java virtual machine instance is created. The virtual machine instance will be shared by subsequent application processes, which can speed up the application startup.

[0049] Java Native Interface (JNI) allows Java code to interact with code written in other languages. After the Zygote process creates a Java virtual machine, it registers a series of JNI methods that allow Java code to call native methods to access underlying system resources or implement specific functions.

[0050] The Zygote process also creates a server-side Socket for communicating with the Activity Manager Service (AMS) in the System Server process. AMS sends a request to the Zygote process through the Socket to incubate a new application process.

[0051] The Zygote process also starts the SystemServer process. The SystemServer process is responsible for initializing various key services of the Android system, such as ActivityManagerService, etc. These services provide necessary support for the operation of the Android operating system.

[0052] Step S206, start the system server process, based on the system server process, start the Binder thread pool and the system server manager (SystemServiceManager), and start various system servers.

[0053] In this step, Binder is a mechanism used for inter-process communication (IPC) in the Android system. The Binder thread pool is used to manage and distribute Binder requests to ensure that communication between multiple processes can be carried out efficiently and securely. SystemServer initializes the Binder thread pool when it starts so that it can communicate with other processes (such as application processes) later.

[0054] SystemServer creates, starts and manages various system services through the system server manager. These system services include but are not limited to ActivityManagerService, PackageManagerService, WindowManagerService, etc., which together provide support for the operation of the Android system.

[0055] Step S207, based on the system server process, start the activity management server (ActivityManagerService, referred to as AMS), start the Android system desktop launcher, based on the Android system desktop launcher, display the shortcut icons of the installed applications on the desktop of the Android operating system, and complete the startup of the Android operating system.

[0056] AMS is the core service responsible for managing activities in the Android operating system. During the SystemServer startup process, AMS will be started first so that it can handle subsequent application startup and Activity management requests. AMS is responsible for starting, switching, scheduling, and destroying Activities, as well as managing the application's tasks and return stack.

[0057] After AMS is started, SystemServer will check the current default Launcher configuration and start the default Launcher application. If the system does not set a default Launcher, AMS will select one from the available Launchers to start. Launcher startup is mainly done through the Intent mechanism. AMS will send an Intent request to the Launcher to start the home screen Activity.

[0058] After the Launcher is started, it will be responsible for displaying the home screen, managing application icons, and providing an interface for launching applications. The Launcher will query the installed application information from the PackageManagerService and generate a shortcut icon for each application. These shortcut icons will be placed on the home screen, and users can start the corresponding application by clicking them.

[0059] Thus, the Android operating system startup process includes: starting the BoolLoader program, Linux kernel, init process, Zygote process, SystemServer process and Launcher program. Among them, the drive time is accelerated by compressing the Linux kernel image, and the SystemServer program starts the local service layer to initialize the installed applications. It takes about 30s to 60s from booting to entering the user interface.

[0060] In some optional embodiments, the aforementioned method for starting the Android operating system also includes: in the process of starting the system server process, constructing a dependency matrix, and determining the dependency of the application based on the dependency matrix, wherein the dependency matrix is ​​used to characterize the dependency relationship between the applications; if the dependency of the target application is higher than a preset threshold, executing the target application in the main thread; if the dependency of the target application is lower than or equal to the preset threshold, executing the target application in a child thread, and sending the execution result in the child thread to the main thread.

[0061] In this embodiment, the aforementioned asynchronous initialization method can be implemented by the Async Task program, and the time-consuming operation is executed in the acquired thread by the AsyncTask program, and the result is published to the main thread. The dependency matrix can be a two-dimensional array or a graph structure, in which each element represents the dependency of one application on another application. The dependency can be binary dependency or no dependency or more fine-grained high dependency, medium dependency and low dependency. The dependency of the target application can be determined based on the sum of the dependencies between the target application and each application.

[0062] Figure 3 FIG. 1 shows a schematic diagram of the process of asynchronous initialization. Figure 3As shown, step S301, determine whether the dependency of the target application process is higher than a preset threshold, if higher, proceed to step S302, if not higher, proceed to step S303; step S302, if the dependency of the target application is higher than the preset threshold, import the target application into the main thread based on the Handler program, distribute it to the corresponding processing function based on the Looper program, and execute the target application; step S303, if the dependency of the target application is lower than or equal to the preset threshold, import the target application into the child thread based on the Handler program, distribute it to the corresponding processing function based on the Looper program, and execute the target application;

[0063] The average dependency of each application can be obtained, and the preset threshold can be set to be higher than the average dependency. For example, the preset threshold can be set to the average dependency plus one. The target application can be imported into the main thread or child thread through the handler. The handler is a component in Android that handles inter-thread communication and is used to receive and process data sent by the child thread in the main thread to facilitate UI updates or other operations.

[0064] The pseudo code for implementing the aforementioned asynchronous initialization method through the Async Task program and importing the Handler program in the Android operating system is as follows:

[0065]

[0066]

[0067] In this way, when SystemServer starts the Binder thread pool and the system server manager, a lightweight asynchronous task class is provided through the AsyncTask program, and then the application dependencies are judged through the dependency matrix. Applications with high dependencies are imported into the main thread through the Handler program for initialization, and applications with low dependencies are imported into the child thread through the Handler program and then initialized. After the initialization is completed, the result is sent back to the main thread. By initializing the applications in sequence, the startup speed of the Android operating system can be accelerated.

[0068] In some optional implementations, the aforementioned method for starting the Android operating system also includes: based on the Android application incubator process, preloading classes, class libraries, cache icons and layout files of the Android framework; based on the Android application incubator process, listening for connection requests from the system service process.

[0069] In this embodiment, the preloaded Android framework classes and class libraries include the Android framework's Java class library. By preloading the Android framework's classes, class libraries, cache icons, and layout files, it is possible to facilitate the rapid startup of the application process.

[0070] The Zygote process creates a server-side socket to listen for connection requests from system service processes. When a new process needs to be run, the system communicates with the Zygote process through this socket and requests Zygote to hatch a new application process.

[0071] In some optional implementations, compressing the Linux image file includes: compressing the Linux image file based on an LZ4 compression algorithm.

[0072] In this implementation, the kernel image is compressed using the LZ4 compression algorithm and the pseudo code for importing the initranfs program is as follows:

[0073] sudo apt-install lz4

[0074] lz4 -9vmlinuz vmlinuz.lz4

[0075] cat< <eof>> / etc / default / grub

[0076] initrdfi= / initr.conf

[0077] EOF

[0078] echo'compact / boot / vmlinuz.lz4'> / initr.conf

[0079] update-grub

[0080] The Linux image file is compressed by the LZ4 algorithm to obtain a compressed piggy data file. The compressed piggy data file, script and driver are input into the file system generated by the initramfs program.

[0081] In this way, the Linux kernel image file can be compressed and decompressed very quickly. The LZ4 algorithm occupies lower memory resources during the compression process. The LZ4 algorithm optimizes the encoding strategy and decoding engine, which is more friendly in terms of CPU consumption.

[0082] In some optional implementations, after executing the Linux kernel startup script, the initial user space process is started, and based on the initial user space process, the Android operating system is initialized, including: based on the initial user space process, reading and parsing the initial user space process configuration file; based on the configuration instructions in the initial user space process configuration file, starting the Android application incubator process; based on the initial user space process, monitoring system events, and triggering corresponding operations based on the monitored system events.

[0083] In this embodiment, during the initial user space (init) process startup phase, the init process will parse the init.rc configuration file and start the Zygote, ServiceManager, surfaceFlinger, and MediaServer systems according to the configuration file. The init process will monitor system events and trigger corresponding operations based on the events.

[0084] In this way, by reading and parsing the init.rc configuration file, the Android system can flexibly load and configure the various services required by the system. This allows developers or system administrators to customize system behavior by modifying configuration files without having to directly modify the kernel or system code. This flexibility makes system configuration more convenient and efficient. Starting the Zygote process based on configuration instructions ensures that the necessary frameworks and resources are automatically loaded and initialized when the system starts, preparing for subsequent application operations. In addition, the Zygote process is also responsible for incubating new application processes, further improving the overall performance of the system by sharing preloaded resources.

[0085] In the related art, starting the Android operating system includes: starting the Linux kernel, local service layer, Dalvik virtual machine, Android service layer and application layer from bottom to top. Among them, the local service layer and Android service layer have more than 60 modules, so the normal startup process is slow, and it takes about 1 minute from booting to entering the user interface.

[0086] The embodiment of the present invention also provides a method for starting an Android operating system, comprising:

[0087] Step S601, start the power supply, guide the chip code to start execution from the predefined location, load the boot BoolLoader program into the RAM program, and execute

[0088] Step S602, executing the BoolLoader program, booting and loading the Linux kernel operating system, and performing hardware initialization;

[0089] Step S603, when the Linux kernel starts, the cache, protected memory, schedule list and driver loading are set. After the system settings are completed, the init.rc file is searched in the system files and the init process is started;

[0090] Step S6031, compress the Image file using the lz4 compression algorithm to generate a compressed piggy data file;

[0091] Step S6032: the initramfs program provides a temporary root file system and packages the piggy data file, scripts and driver into the temporary root file system.

[0092] Step S604, the init process initializes and starts the attribute service, and starts the Zygote process;

[0093] Step S605, the Zygote process creates a javaVM, registers JNI for the javaVM, creates a server-side Socket, and starts the SystemServer process;

[0094] Step S606, SystemServer starts the Binder thread pool and the system server manager, and starts various system servers;

[0095] Step S6061, the AsyncTask program provides a lightweight asynchronous task class to execute time-consuming operations in a background thread;

[0096] Step S6062, determining the initialization order according to the business logic and component dependency of the application, if the application dependency is high, importing the application into the main thread based on the Handler program, if the application dependency is low, importing the application into the child thread based on the Handler program;

[0097] Step S6063, the Looper program receives the message sent by the Handler and distributes it to the corresponding processing function. After that, the initialization task executed in the child thread is completed and the result is sent back to the main thread;

[0098] Step S607, SystemServer starts ActivityManagerService, and then starts Launcher. After Launcher is started, shortcut icons of installed applications are displayed on the interface to complete the startup of the Android operating system.

[0099] Thus, the startup process of the Android operating system includes starting: BoolLoader program, Linux kernel, init process, Zygote process, SystemServer process and Launcher program. Among them, the driving time is accelerated by compressing the Linux kernel image, and the AsyncTask program is used to distinguish applications according to their dependencies, and the applications with high dependencies are initialized first, and the remaining applications are initialized accordingly after startup. In the embodiment of the present invention, it takes about 30s to 40s from booting to entering the user interface.

[0100] Use the lz4 compression algorithm to compress the Image file, package the compressed piggy data file, script, and driver program and import them into the temporary root file, which can speed up the startup by 20 seconds. Add the AsyncTask program to provide a lightweight asynchronous task class, and initialize it through the application, which can further speed up the startup by 10 seconds.

[0101] In this embodiment, a device for starting an Android operating system is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0102] This embodiment provides a device for starting an Android operating system. Figure 4 A schematic diagram of the structure of a device for starting an Android operating system provided by an embodiment of the present invention is shown, Figure 4 As shown, including:

[0103] The compression module 401 is used to compress the Linux image file during the Linux kernel startup process.

[0104] The transmission module 402 is used to import the compressed Linux image file, script and driver into the initial random access memory file system.

[0105] The loading module 403 is used to load the initial random access memory file system into the memory to generate a temporary root file system.

[0106] The execution module 404 is used to execute the startup script of the Linux kernel based on the temporary root file system.

[0107] In some optional embodiments, the aforementioned device further includes:

[0108] The first startup module is used to execute the startup loader and boot the Linux kernel before executing the startup script of the Linux kernel.

[0109] The second startup module is used to start the initial user space process after executing the startup script of the Linux kernel, and initialize the Android operating system based on the initial user space process.

[0110] The third startup module is used to start the Android application incubator process, create a Java virtual machine based on the Android application incubator process, and register a Java local interface based on the Java virtual machine.

[0111] The fourth startup module is used to start the system server process, and based on the system server process, start the Binder thread pool.

[0112] The fifth startup module is used to start the Android system desktop launcher based on the system server process, and based on the Android system desktop launcher, display the shortcut icons of the installed applications on the desktop of the Android operating system to complete the startup of the Android operating system.

[0113] In some optional implementations, the fourth startup module includes:

[0114] The first unit of the fourth startup module is used to build a dependency matrix in the process of starting the system server process, and determine the dependency of the application based on the dependency matrix, wherein the dependency matrix is ​​used to characterize the dependency relationship between the applications; if the dependency of the target application is higher than a preset threshold, the target application is executed in the main thread; if the dependency of the target application is lower than or equal to the preset threshold, the target application is executed in a child thread, and the execution result in the child thread is sent to the main thread.

[0115] In some optional implementations, the third startup module includes:

[0116] The first unit of the third startup module is used to preload classes, class libraries, cache icons and layout files of the Android framework based on the Android application incubator process; based on the Android application incubator process, monitor connection requests from the system service process.

[0117] In some optional embodiments, the compression module includes:

[0118] Compression unit, used to compress Linux image files based on LZ4 compression algorithm.

[0119] In some optional implementations, the second startup module includes:

[0120] The first unit of the second startup module is used to read and parse the initial user space process configuration file based on the initial user space process; start the Android application incubator process based on the configuration instructions in the initial user space process configuration file; monitor system events based on the initial user space process, and trigger corresponding operations based on the monitored system events.

[0121] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0122] The device for starting the Android operating system in this embodiment is presented in the form of a functional unit, where the unit refers to an application specific integrated circuit (ASIC) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0123] The embodiment of the present invention also provides a computer device having the above Figure 4 Device shown for booting of Android operating system.

[0124] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of a graphical user interface on an external input / output device (such as a display device coupled to an interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0125] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0126] The aforementioned memory 20 stores instructions executable by at least one processor 10, so that the aforementioned at least one processor 10 executes the method shown in the above embodiment.

[0127] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0128] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0129] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0130] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (such as a light emitting diode) and a tactile feedback device (such as a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0131] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0132] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0133] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.< / eof>

Claims

1. A method for starting an Android operating system, characterized in that: The method comprises: During the Linux kernel boot process, compress the Linux image file; Import the compressed Linux image file, scripts and drivers into the initial RAM file system; Loading the initial random access memory file system into the internal memory to generate a temporary root file system; Based on the temporary root file system, a startup script of the Linux kernel is executed.

2. The method according to claim 1, characterized in that The method further comprises: Before executing the startup script of the Linux kernel, executing a startup loader to boot and load the Linux kernel; After executing the startup script of the Linux kernel, starting the initial user space process, and initializing the Android operating system based on the initial user space process; Starting an Android application incubator process, creating a Java virtual machine based on the Android application incubator process, and registering a Java local interface based on the Java virtual machine; Start a system server process, and based on the system server process, start a Binder thread pool; Based on the system server process, the Android system desktop launcher is started, and based on the Android system desktop launcher, the shortcut icons of the installed applications are displayed on the desktop of the Android operating system to complete the startup of the Android operating system.

3. The method according to claim 2, characterized in that The method further comprises: In the process of starting the system server process, a dependency matrix is ​​constructed, and the dependency of the application is determined based on the dependency matrix, wherein the dependency matrix is ​​used to characterize the dependency relationship between the application programs; If the dependency of the target application is higher than a preset threshold, executing the target application in the main thread; If the dependency of the target application is lower than or equal to the preset threshold, the target application is executed in the child thread, and the execution result in the child thread is sent to the main thread.

4. The method according to claim 2, characterized in that: The method further comprises: Based on the Android application incubator process, preloading classes, class libraries, cache icons and layout files of the Android framework; Based on the Android application incubator process, a connection request from the system service process is monitored.

5. The method according to claim 1, characterized in that The compressing the Linux image file includes: compressing the Linux image file based on an LZ4 compression algorithm.

6. The method according to claim 1, characterized in that After executing the startup script of the Linux kernel, starting the initial user space process, and initializing the Android operating system based on the initial user space process, including: Based on the initial user space process, reading and parsing an initial user space process configuration file; Based on the configuration instructions in the initial user space process configuration file, starting the Android application incubator process; System events are monitored based on the initial user space process, and corresponding operations are triggered based on the monitored system events.

7. A device for starting an Android operating system, characterized in that: The device comprises: Compression module, used to compress Linux image files during Linux kernel startup; The transfer module is used to import the compressed Linux image file, scripts and drivers into the initial random access memory file system; A loading module, used for loading the initial random access memory file system into the internal memory to generate a temporary root file system; An execution module is used to execute a startup script of the Linux kernel based on the temporary root file system.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for starting an Android operating system according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for starting an Android operating system according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the method for starting an Android operating system according to any one of claims 1 to 6.