Open shlatchz opened 7 years ago
I've installed the su, using the following Android.mk:
# Root AOSP source makefile
# su is built here, and
my_path := $(call my-dir)
SUPERUSER_EMBEDDED := true
LOCAL_PATH := $(my_path)
include $(CLEAR_VARS)
LOCAL_MODULE := su
LOCAL_MODULE_TAGS := eng debug optional
LOCAL_LDFLAGS := -static
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_C_INCLUDES := include/
LOCAL_STATIC_LIBRARIES := \
liblog \
libc \
libselinux \
libcutils
LOCAL_SRC_FILES := su.c daemon.c activity.c db.c utils.c pts.c sqlite3.c hacks.c binds.c
LOCAL_CFLAGS := -DSQLITE_OMIT_LOAD_EXTENSION -std=gnu11
LOCAL_CFLAGS += -DREQUESTOR=\"$(shell cat $(LOCAL_PATH)/packageName)\"
ifdef SUPERUSER_EMBEDDED
LOCAL_CFLAGS += -DSUPERUSER_EMBEDDED
endif
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
include $(BUILD_EXECUTABLE)
ifdef SUPERUSER_EMBEDDED
# make sure init.superuser.rc is imported from
# init.rc or similar
SUPERUSER_RC := $(TARGET_ROOT_OUT)/init.superuser.rc
$(SUPERUSER_RC): $(LOCAL_PATH)/init.superuser.rc | $(ACP)
$(copy-file-to-new-target)
SUPERUSER_MARKER := $(TARGET_OUT_ETC)/.has_su_daemon
$(SUPERUSER_MARKER): $(LOCAL_INSTALLED_MODULE)
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) touch $@
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SUPERUSER_RC) $(SUPERUSER_MARKER)
endif
And the Superuser app using the following Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
SUPERUSER_PACKAGE := com.koushikdutta.superuser
LOCAL_STATIC_JAVA_LIBRARIES := libarity android-support-v4
LOCAL_PACKAGE_NAME := Superuser
LOCAL_SRC_FILES := $(call all-java-files-under,src) $(call all-java-files-under,../Widgets/src)
LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
LOCAL_AAPT_FLAGS := --extra-packages com.koushikdutta.widgets -S $(LOCAL_PATH)/../Widgets/res --auto-add-overlay --rename-manifest-package $(SUPERUSER_PACKAGE)
include $(BUILD_PACKAGE)
Everything was compiled successfuly, and the Superuser program is visible, but I get this error in logcat:
09-27 11:59:00.516 1363 1363 W Superuser: java.io.IOException: Error running exec(). Command: [su] Working Directory: null Environment: null
Meaning that the app cannot run su
command :/
Implementing the changes in here helped, but the SuperUser program is still buggy for me..
09-27 16:10:14.814 1449 1449 E AndroidRuntime: FATAL EXCEPTION: main
09-27 16:10:14.814 1449 1449 E AndroidRuntime: Process: com.koushikdutta.superuser, PID: 1449
09-27 16:10:14.814 1449 1449 E AndroidRuntime: android.view.InflateException: Binary XML file line #108: Binary XML file line #108: Error inflating class <unknown>
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.superuser.PinViewHelper.<init>(PinViewHelper.java:29)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.superuser.SettingsFragment$2.<init>(SettingsFragment.java:73)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.superuser.SettingsFragment.setPin(SettingsFragment.java:73)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.superuser.SettingsFragment.checkPin(SettingsFragment.java:114)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.superuser.SettingsFragment$7.onClick(SettingsFragment.java:293)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.widgets.ListItem.onClickInternal(ListItem.java:226)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.koushikdutta.widgets.BetterListFragment$1.onItemClick(BetterListFragment.java:354)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.AdapterView.performItemClick(AdapterView.java:310)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.AbsListView.performItemClick(AbsListView.java:1145)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.AbsListView$3.run(AbsListView.java:3903)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #108: Error inflating class <unknown>
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:645)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: ... 19 more
09-27 16:10:14.814 1449 1449 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Native Method)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:619)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: ... 28 more
09-27 16:10:14.814 1449 1449 E AndroidRuntime: Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010000 a=-1}
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.content.res.TypedArray.getDrawable(TypedArray.java:867)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.View.<init>(View.java:3954)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.view.ViewGroup.<init>(ViewGroup.java:573)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:203)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:199)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:195)
09-27 16:10:14.814 1449 1449 E AndroidRuntime: ... 30 more
Were you able to build the APK under N, with JDK8?
I would also love documentation on how to integrate this (particularly suhide) in AOSP/CM.
Hi shlatchz ,
I managed to build su with AOSP but seems the generated binaries are not the right one.
did you manage to complete the integration and get root access ?
I am working on snapdragon 820 , android 6.0.1.
Any suggestions/pointers please
Is there a guide on how to add both the su executable and the SuperUser application to the AOSP build and compile it along with the rest of the AOSP code? Do I just copy the su part to /system/extras/su/ and the application to /packages/apps/ ? While Android.mk should I use for the app? A guide for that would be awesome.
Thanks!