[This article is comprehensive and correct] Create a startup logo for Android

Source: Internet
Author: User

1. Remove the boot cursor of Embedded Linux:

Enter the drivers/Video/console/fbcon. c file in the current directory of the kernel.
Comment out the content in static void fb_flashcursor (void * private) and static void fbcon_cursor (struct vc_data * VC, int mode) to make it an empty function.


2. 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 ).

4. Splash (logo running in lk)


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

(1) Let the Kernel support startup logo

Make menuconfig in the kernel directory

Device Drivers ----> graphics support ---->

Select the bootup logo ----> standard 224-color Linux logo

(2) create a pngformat image for logostartup logo_linux_clut224.png

(3) sudo apt-Get install netpbm


# Pngtopnm logo_linux_clut224.png> logo_linux.pnm

# Pnmquant 224 logo_linux.pnm> logo_linux_224.pnm

# Pnmtoplainpnm logo_linux_224.pnm> logo_linux_clut224.ppm

(4) Put the logo file into the kernel

Copy the created logo file to the/Drivers/Video/logo folder.

Replace the logo_linux_clut224.ppm File

(5) recompile the kernel

 

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 function 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 the 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"
"/N"
"/N"
"/N"
"/N" // console is 40 Cols x 30 lines
"/N"
"/N"
"/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
/System/CORE/init/logo. c
* Steps for creating the RLE file:
A. 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: the logon animation of the Android system is similar to the scroll bar of the Windows system. It consists of two PNG images, foreground and background, these two images exist in the mobile phone or simulator/system/framework/framework-res.apk file, corresponding to the original file in/frameworks/base/CORE/RES/assets/images /. The android text section on the foreground image (android-logo-mask.png) is hollow out, 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 ");) execute 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. Run the "getprop CTL. Start bootanim" command to stop the boot animation. The two commands correspond to surfaceflinger. CPP: 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

4. Splash (logo running in lk)

Splash.png graph to generate splash. raw565

1. Convert splash.png-depth 8 RGB: Splash. Raw

2. rgb2565 <splash. Raw> splash. raw565

The related code is as follows:

Invalid T. C

Lcdc. c

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.