Android Training Course (12)

Source: Internet
Author: User

#059

#060 get_hardware_name ();

This code obtains information about the hardware running on the current android system, such as the CPU name of the hardware. It mainly reads related information from/proc/cpuinfo.

 

 

#061 snprintf (tmp, sizeof (tmp), "/init. % s. rc", hardware );

#062 parse_config_file (tmp );

This code is the name of the hardware obtained from the previous step, and then the name of the hardware (/init. hardware name. rc) to obtain the configuration file of the corresponding hardware, and load the configuration file parameters into the linked list.

 

 

#063

#064 action_for_each_trigger ("early-init", action_add_queue_tail );

#065 drain_action_queue ();

This code first adds commands identified by early-init to a command queue so that the drain_action_queue function can execute functions in the configuration file one by one, in this way, in different configuration files, as long as it is marked as the first function to be executed, it can be run preferentially.

 

#066

#067 INFO ("device init ");

#068 device_fd = device_init ();

This code traverses/sys, adds a device event response, and creates a device node.

 

 

#069

#070 property_init ();

This code initializes attributes. Each attribute has a name and value, which are in string format. Attributes are widely used in Android systems to record system settings or information exchange between processes. Properties are globally visible throughout the system. Each process can get/set attributes. During system initialization, Android will allocate a shared memory area to store the attributes. Here, it mainly reads the attributes from the/default. prop attribute file. This is a bit like the function of the Registry in Windows.

 

 

#071

#072 // only listen for keychords if ro. debuggable is true

#073 debuggable = property_get ("ro. debuggable ");

#074 if (debuggable &&! Strcmp (debuggable, "1 ")){

#075 keychord_fd = open_keychord ();

#076}

This code is used to obtain the debugging flag from the property. If debugging is available, open the combination button and enter the driver.

 

 

 

#077

#078 if (console [0]) {

#079 snprintf (tmp, sizeof (tmp), "/dev/% s", console );

#080 lele_name = strdup (tmp );

#081}

#082

#083 fd = open (console_name, O_RDWR );

#084 if (fd> = 0)

#085 have_console = 1;

#086 close (fd );

This code is used to determine whether a console exists. If not, try to use the default console.

 

 

#087

#088 if (load_565rle_image (INIT_IMAGE_FILE )){

#089 fd = open ("/dev/tty0", O_WRONLY );

#090 if (fd> = 0 ){

#091 const char * msg;

#092 msg = ""

#093 ""

#094 ""

#095 ""

#096 ""

#097 ""

#098 "" // console is 40 cols x 30 lines

#099 ""

#100 ""

#101 ""

#102 ""

#103 ""

#104 ""

#105 ""

#106 "a n d r o I D ";

#107 write (fd, msg, strlen (msg ));

#108 close (fd );

#109}

#110}

This code first calls the load_565rle_image function to try to load the custom LOGO image. If it fails, the android string is displayed directly on the screen. Here, we can customize the LOGO image display of different manufacturers, so that the system can be initialized, more humane waiting, more beautiful personality

Related Article

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.