欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android.mk Apk/bin/lib/init.rc预编译处理

程序员文章站 2022-06-21 19:16:17
APK(Test.apk):LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := TestLOCAL_MODULE_CLASS := APPSLOCAL_MODULE_TAGS := optionalLOCAL_CERTIFICATE := platformLOCAL_SRC_FILES := $(LOCAL_MODULE).apkinclude $(BUILD_PREBUILT)Binary(test)...

APK(Test.apk):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := Test
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk

include $(BUILD_PREBUILT)

Binary(test),test.rc:

test保存在/system/bin;

test.rc保存在/system/etc/init.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := test
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := $(LOCAL_MODULE)

LOCAL_SHARED_LIBRARIES := libTest

LOCAL_INIT_RC := test.rc

include $(BUILD_PREBUILT)

lib(libTest.so):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libTest
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_SRC_FILES := $(LOCAL_MODULE).so
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/lib

include $(BUILD_PREBUILT)

在Android.mk中添加可以直接复制:

$(shell cp -rf $(PRODUCT_OUT)/vendor/lib/libtest1.so $(PRODUCT_OUT)/system/lib/)
$(shell cp -rf $(PRODUCT_OUT)/vendor/lib/libtest2.so $(PRODUCT_OUT)/system/lib/)

 

本文地址:https://blog.csdn.net/weixin_42326724/article/details/107943108