构建Android具有超级用户 [英] Build Android with Superuser
问题描述
有谁知道如何从源代码构建机器人时,包括超级用户的权限?
Does anyone know how to include super-user privileges when building android from source?
请让我知道,如果你做的!
Please let me know if you do!
谢谢, 凯文
推荐答案
要获得根(ED)的外壳,编辑系统/核心/ ROOTDIR
或init.rc关联到你的android的源设备(例如设备/ TI /熊猫/ init.rc
的PANDABOARD),并更改这些行:
To get a root(ed) shell, edit system/core/rootdir
or the init.rc associated to your device (e.g. device/ti/panda/init.rc
for pandaboard) in android sources, and change those lines:
service console /system/bin/sh
class core
console
disabled
user shell
group log
到
service console /system/bin/sh
class core
console
disabled
user root
group root
要嵌入Superuser.apk在AOSP,你必须获取并建立:
To embed Superuser.apk in AOSP, you have to fetch and build:
- su-binary (e.g. in
external/
) and stub/removesystem/extras/su
package. - Superuser (e.g. in
packages/app/
)
您可能还需要设置 /系统/ XBIN /苏
的苏二进制/ Android.mk粘滞位。举例来说,我用下面的Makefile:
You may also have to set the sticky bit of /system/xbin/su
in su-binary/Android.mk. For instance, I used following makefile:
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
SU_CMD := su
SYMLINKS := $(addprefix $(TARGET_OUT_EXECUTABLES)/,$(SU_CMD))
$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(SU_BINARY)-post $(LOCAL_PATH)/Android.mk
@echo "Symlink: $@ -> /system/xbin/$(SU_CMD)"
@mkdir -p $(dir $@)
@rm -rf $@
@ln -sf /system/xbin/$(SU_CMD) $@
ALL_DEFAULT_INSTALLED_MODULES += $(SU_BINARY)-post $(SYMLINKS)
include $(BUILD_EXECUTABLE)
这篇关于构建Android具有超级用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!