How Android adds 3rd party Lib libraries to kernel

Source: Internet
Author: User

Note: The Lib library can only be placed where kernel is compiled, as follows:
alps/kernel/
alps/mediatek/custom/common/kernel/
alps/mediatek/custom/$platform/kernel/
alps/mediatek/custom/$proj/kernel/
alps/mediatek/kernel/
alps/mediatek/platform/$platform/kernel/core/
alps/mediatek/platform/$platform/kernel/drivers/
Assume that the 3rd party library name is TEST.A
(1). If the stored directory exists makefile, simply add it at the end of the makefile:
Obj-y + = Test.a
Then copy the Test.a file to the directory,
Renamed to Test.a_shipped to prevent the clean kernel stage from removing the library!
Recompile kernel.
(2). If the stored directory does not exist makefile, such as in the alps/mediatek/custom/directory kernel directory is not makefile, then you need to add a makefile, the content and the 1th method is similar:
Obj-y: = XXX.O yyy.o test.a
The above means compiling xxx.c/yyy.c and test.a to kernel
Then copy the Test.a file to the directory and rename it to test.a_shipped
Recompile kernel.
Note: Files in the alps/mediatek/custom/common/kernel/touchpanel/xxx directory and alps/mediatek/custom/common/kernel/touchpanel/ src directory Merge, obj-y to add all of the two directories of obj to the line, or the compilation fails. You can also use the following makefile, automatically add all obj Obj-y, save trouble. Other directories are treated as if they were in a similar situation.
Add makefile (change all *.c to *.O and join Obj-y):
Include $ (mtk_path_build)/common.mk
Path: = $ (if $ (filter yes,$ (Kbuild_output_support)), $ (srctree)/$ (obj), $ (obj))
Obj-y: = $ (Patsubst%.c,%.o,$ (subst $ (path)/,,$ (call wildcard2,$ (path)/*.c))
Obj-y + = Test.a

Description: For kernel makefile Write rule description, can go to the network search related material reference, such as obj-y means to compile to kernel, and obj-m to compile to module,obj-n or obj-means not to compile

How Android adds 3rd party Lib libraries to kernel

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.