Http://blog.csdn.net/zhenyongyuan123/article/details/5587634
Three images are displayed at the android startup:
1. When the Linux system is started, the Linux little penguin screen (reboot) appears (Android 1.5 and later versions have canceled image loading );
2. The Android platform starts initialization and displays the text "a n d r I O D;
3. The Graphic System of the Android platform is started, and an animated image (start) containing the flashing Android text is displayed ).
Original address http://blog.csdn.net/zhenyongyuan123/article/details/5587634
1. boot images (Linux penguin) (images have been removed from Android 1.5 and later versions );
After Linux kernel boot starts, load the image.
The nologo is defined in logo. C. The fb_find_logo (INT depth) function determines whether to load the corresponding image based on the nologo value.
The Code is as follows:
Static int nologo;
Module_param (nologo, bool, 0 );
Module_parm_desc (nologo, "disables startup logo ");
/* Logo's are marked _ initdata. Use _ init_refok to tell
* Modpost that it is intended that this function uses data
* Marked _ initdata.
*/
Const struct linux_logo * _ init_refok fb_find_logo (INT depth)
{
Const struct linux_logo * logo = NULL;
If (nologo)
Return NULL;
......
}
Related code:
/Kernel/Drivers/Video/fbmem. c
/Kernel/Drivers/Video/logo. c
/Kernel/Drivers/Video/logo/kconfig
/Kernel/include/Linux/linux_logo.h
2. Boot text ("a n d r I O D ")
After the Android system is started, init. in C, main () calls load_565rle_image () function to read/initlogo. RLE (A 565 RLE Compressed Bitmap). If the read is successful, the logo image is displayed in/dev/graphics/fb0. If the read fails, set/dev/tty0 to text mode, open/dev/tty0, and output the text "a n d r I O D.
Define the name of the uploaded Image File
# Define init_image_file "/initlogo. RLE"
Int load_565rle_image (
Char * file_name );
# Endif
Load the/initlogo. RLE file in main () in init. C.
If (load_565rle_image (init_image_file) {// load initlogo. RLE file FD = open ("/dev/tty0", o_wronly); // set/dev/tty0 to text mode if (FD> = 0) {const char * MSG; MSG = "/N" "/N"/N "// console is 40 Cols x 30 lines" /n ""/N ""/N "/N" "/N" "a n d r o I d "; write (FD, MSG, strlen (MSG); close (FD) ;}} related code:/system/CORE/init. c/system/CORE/init. h/system/CORE/init. RC/s Ystem/CORE/init/logo. C *. RLE file creation steps:. use gimp or advanced batch converter to convert the image to raw format. B. use the rgb2565 tool that comes with Android to convert raw files to the RLE format (for example, rgb2565-RLE <initlogo. raw> initlogo. RLE ).
3. Boot animation (animated picture with Android flash)
Android 1.5:Android system login animation is similar to the Windows system scroll bar, is composed of foreground and background two PNG images, these two images exist in the mobile phone or simulator/system/framework/framework-res.apk file, the corresponding original file is located in/frameworks/base/CORE/RES/assets/images /. In the foreground image (android-logo-mask.png), The androidtext is empty, and the background image (android-logo-shine.png) is a simple texture. When the system logs on, the foreground image is displayed at the top layer, and the program code (bootanimation. android () controls the continuous scrolling of background images, and displays the background texture through the hollow-out part of foreground image text to achieve the animation effect.
Related code:
/Frameworks/base/libs/surfaceflinger/bootanimation. h
/Frameworks/base/libs/surfaceflinger/bootanimation. cpp
/Frameworks/base/CORE/RES/assets/images/android-logo-mask.png Android default foreground image, text section hollow out, size 256 × 64
/Frameworks/base/CORE/RES/assets/images/android-logo-shine.png Android Default background image with dynamic effect, size 512 × 64
Android 1.6 and later versions:
Init. c parsing init. RC (which defines the service: "service bootanim/system/bin/bootanimation"), and the bootanim Service is composed of surfaceflinger. readytorun () (property_set ("CTL. start "," bootanim ");) run the boot animation, bootfinished () (property_set (" CTL. stop ",
"Bootanim");) run the stop boot animation.
The bootanimation. h and bootanimation. cpp files are stored in the/frameworks/base/cmds/bootanimation directory, and an entry file bootanimation_main.cpp is added. The android. mk file shows that the boot animation is extracted from the original surfaceflinger to generate the executable file bootanimation. The android. mk code is as follows:
// ================= Android. mk =======================================
Local_path: = $ (call my-DIR)
Include $ (clear_vars)
Local_src_files: =/
Bootanimation_main.cpp/
Bootanimation. cpp
# Need "-LRT" on Linux simulator to pick up clock_gettime
Ifeq ($ (target_simulator), true)
Ifeq ($ (host_ OS), Linux)
Local_ldlibs + =-LRT
Endif
Endif
Local_shared_libraries: =/
Libcutils/
Libutils/
Libui/
Libcorecg/
Libsgl/
Libegl/
Libglesv1_cm/
Libmedia
Local_c_includes: =/
$ (Call include-path-for, corecg graphics)
Local_module: = bootanimation
Include $ (build_executable)
// ================================================ ====
(1) After ADB shell, you can directly run "bootanimation" to re-view the boot animation, which will remain in the animation state without stopping.
(2) After ADB shell, run the "setprop CTL. Start bootanim" command to execute the boot animation, and run the "setprop CTL. Stop bootanim" command to stop the boot animation. The two commands correspond to surfaceflinger. CPP statement: property_set ("CTL. start "," bootanim "); and property_set (" CTL. stop "," bootanim ");
Related Files:
/Frameworks/base/cmds/bootanimation. h
/Frameworks/base/cmds/bootanimation. cpp
/Frameworks/base/cmds/bootanimation/bootanimation_main.cpp
/System/CORE/init. c
/System/CORE/rootdir/init. RC
Reference:
Image Description: Android boot screen and boot Animation
Http://www.shudoo.com/09/1030/15/13418431.html
Initlogo. RLE: display an image on boot
Http://forum.xda-developers.com/showthread.php? T = 443431
Analysis of the Startup Process of the android root file system (Analysis of the init Daemon)
Http://crazier9527.javaeye.com/blog/454635
Http://blog.csdn.net/zhenyongyuan123/article/details/5587634
Author: zhenyongyuan123
Date: 2010/03/06, 2010/05/17
Web site: http://www.anymobile.org, http://blog.csdn.net/zhenyongyuan123