如何在Android的模块依赖工作的? [英] How does module dependency work in Android?

查看:106
本文介绍了如何在Android的模块依赖工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我作出的苏二小的变化(https://github.com/git-core/su-binary)添加目标设置SUID。
该Android.mk我用: http://pastebin.com/N0gMJT4u
当运行在做Android源树的根,东西运行良好:

I made minor changes to su-binary (https://github.com/git-core/su-binary) adding a target to set SUID. The Android.mk I use : http://pastebin.com/N0gMJT4u When running make at the root of Android source tree, things run fine:

$ make -j5
[...]
system/core/rootdir/Android.mk:42: warning: ignoring old commands for target `out/target/product/panda/root/init.rc'
echo "Setting SUID/GUID to su-binary"
Setting SUID/GUID to su-binary
Installing busybox
chmod ug+s out/target/product/panda/system/xbin/su
[...]

当外部/苏二进制运行毫米-B HTTP ://pastebin.com/8HmUJBA0
对于同样的行为 MMM外部/苏二进制

When running mm -B in external/su-binary: http://pastebin.com/8HmUJBA0 Same behavior for mmm external/su-binary

据的https://groups.google.com/forum/#!msg/android-building/dtNZFj5pe1w/PRY2MXADXG4J

除了做名称的模块由鹰王的建议,你可以
  运行MM的目录里面建立(安装)中定义的所有模块
  那里。然而,这将打造的只有的这些模块,任何依赖
  模块会的的建造。因此,这只是增量有用
  建立在那里你跟踪依赖现有树木。

Apart from "make name-of-module" as suggested by Ying Wang, you can run "mm" inside a directory to build (and install) all modules defined there. However, this will build only those modules, any dependent modules will not be built. Hence, it's only useful for incremental builds of existing trees where you keep track of the dependencies.

试过了:

$ rm out/target/product/panda/system/xbin/su
$ make external/su-binary
[...]
make: Nothing to be done for `external/su-binary'.

$ rm out/target/product/panda/obj/EXECUTABLES/su_intermediates/su
$ make external/su-binary
[...]
make: Nothing to be done for `external/su-binary`.

如何模块依赖工作的Andr​​oid?

How does module dependency work in Android?

推荐答案

好吧,我得到它通过改变Android.mk运行:

Ok, I got it running by changing the Android.mk:


  1. 名称 $(SU_BINARY)目标不同,即 $(SU_BINARY)-post 。更好,因为之前,它具有相同的名称定义为目标的 LOCAL_MODULE BUILD_EXECUTABLE 组合。

  2. 之前把这个目标的包含$(BUILD_EXECUTABLE)

  1. name the $(SU_BINARY) target differently, ie $(SU_BINARY)-post. Better because before, it has the same name as the target defined by the LOCAL_MODULE and BUILD_EXECUTABLE combination.
  2. put this target before the include $(BUILD_EXECUTABLE)

它看起来像:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := su
LOCAL_SRC_FILES := su.c db.c activity.cpp

SU_SHARED_LIBRARIES := liblog libsqlite
ifeq ($(PLATFORM_SDK_VERSION),4)
    LOCAL_CFLAGS += -DSU_LEGACY_BUILD
    SU_SHARED_LIBRARIES += libandroid_runtime
else
    SU_SHARED_LIBRARIES += libcutils libbinder libutils
    LOCAL_MODULE_TAGS := eng
endif

LOCAL_C_INCLUDES += external/sqlite/dist

LOCAL_SHARED_LIBRARIES := $(SU_SHARED_LIBRARIES)

LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)


SU_INSTALL_DIR := $(TARGET_OUT)/xbin
SU_BINARY := $(SU_INSTALL_DIR)/su
# taken from busybox-android
$(SU_BINARY)-post: su
    @echo "Setting SUID/GUID to su-binary..."
    chmod ug+s $(TARGET_OUT_OPTIONAL_EXECUTABLES)/su
    ln -sf $(TARGET_OUT_OPTIONAL_EXECUTABLES)/su $(TARGET_OUT_EXECUTABLES)/su

ALL_DEFAULT_INSTALLED_MODULES += $(SU_BINARY)-post

include $(BUILD_EXECUTABLE)

ALL_DEFAULT_INSTALLED_MODULES 即将模块的安装,我认为以后很晚的规则。但我钻进去它来检查,​​如果这是什么我想在这里做的最好的解决方案。

ALL_DEFAULT_INSTALLED_MODULES is a rule coming very late after module installation I think. But I got to dig into it to check if that's the best solution for what I want to do here.

这篇关于如何在Android的模块依赖工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆