Macro definitions for compiling as Ko

Source: Internet
Author: User

I had a deep reflection on this blog!

I have always thought that my work is rigorous. I despise the servers on which code that has not been compiled and verified is submitted, which leads to code compilation errors on the servers.

For many years, I have insisted that the Code should be compiled once before confirmation. Therefore, there has never been a compilation accident.

Last week, I complained to a friend about the frequent server compilation errors in our company. It seems that I am serious and rigorous!

I think I'm proud...

I did something that I regretted yesterday. The ltr558 driver was previously compiled into the kernel and has been working very well. Because the initialization delay of the driver in the probe process is Ms, in order to accelerate the startup process, we need to compile the driver into a module and then load it with insmod.

This is simple. You only need to change config_input_ltr558_i2c = y to config_input_ltr558_i2c = m in arch/ARM/configs/xxxdefconfig. In this way, the corresponding driver is compiled into KO in the/system/lib/modules/directory, and then loaded into the corresponding init. RC using the insmod command. Taking it for granted, I modified these two parts and checked the compilation results. We can see that there is indeed a corresponding Ko generation. I think this is definitely okay. Therefore, the code is directly pushed without being downloaded to the mobile phone for testing.

This morning, I received an email from the tester. P & L-sensor is invalid! I quickly burned yesterday's IMG to the mobile phone to confirm, and it really fell...

If I didn't want to do it yesterday, I wouldn't be so embarrassed...

I found this issue for one day today.

# If (defined (config_input_ltr558_i2c ))

Register the I2C device corresponding to ltr_558als

# Endif

It turns out that when config_input_ltr558_i2c = m, the macro's judgment result is false, so the code of the registered device won't be compiled!

Change to the following:

# If (defined (config_input_ltr558_i2c) | defined (config_input_ltr558_i2c_module ))

Register the I2C device corresponding to ltr_558als

# Endif

When config_input_ltr558_i2c = m, the macro config_input_ltr558_i2c_module is automatically defined!

I didn't find out where the macro config_input_ltr558_i2c_module was defined, but through the experiment method, I got a conclusion:

When config_input_ltr558_i2c = Y: defined (config_input_ltr558_i2c) returns true defined (config_input_ltr558_i2c_module) returns false

When config_input_ltr558_i2c = m: defined (config_input_ltr558_i2c) returns false defined (config_input_ltr558_i2c_module) returns true

By the way, we found a feature of android4.1.

Init: Skipping Insecure File '/system/lib/modules/ltr_558als.ko'

If your Ko permission is incorrect, the above error message will be reported when the module is loaded through init. RC! The permissions for these Ko files should be 0644

//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////

Root cause:

After the ltr558 compilation method is set to = m in arch/ARM/configs/, the board is ignored. the related macro switch in C causes the device of ltr558 to be unregistered, and the driver's probe is not executed. P & L-sensor is invalid.

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.