gpt4 book ai didi

android - 模块依赖性在 Android 中是如何工作的?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:13:36 26 4
gpt4 key购买 nike

我对 su-binary ( https://github.com/git-core/su-binary ) 做了一些小改动,添加了一个目标来设置 SUID。我使用的 Android.mk:http://pastebin.com/N0gMJT4u在 Android 源代码树的根目录下运行 make 时,运行正常:

$ 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
[...]

在外部/su-binary 中运行 mm -B 时:http://pastebin.com/8HmUJBA0mmm external/su-binary

的行为相同

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

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`.

模块依赖在 Android 中是如何工作的?

最佳答案

好的,我通过更改 Android.mk 使其运行:

  1. 以不同方式命名$(SU_BINARY) 目标,即$(SU_BINARY)-post。更好,因为之前,它与 LOCAL_MODULEBUILD_EXECUTABLE 组合定义的目标同名。
  2. 将此目标放在 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 是我认为在模块安装后很晚才出现的规则。但我必须深入研究它,看看这是否是我在这里要做的事情的最佳解决方案。

关于android - 模块依赖性在 Android 中是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10654049/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com