完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Platform: RK3288 OS: Android 5.1 Kernel: 3.10.79 1.删除system/extras/su/Android.mk 屏蔽系统su编译 2.使用 PRODUCT_COPY_FILES 拷贝附件的su到out/../system/xbin/目录下 例 PRODUCT_COPY_FILES +=$(CUR_PATH)/su:system/xbin/su 在 devicerockchiprk3288device.mk 文件中 PRODUCT_COPY_FILES += device/rockchip/rk3288/rk3288_box/init.rc:root/init.rc device/rockchip/rk3288/fstab.rk30board.bootmode.unknown:root/fstab.rk30board.bootmode.unknown + $(LOCAL_PATH)/su:system/xbin/su device/rockchip/rk3288/rk3288_box/fstab.rk30board.bootmode.emmc:root/fstab.rk30board.bootmode.emmc 并把 su 文件中放在此文件同一目录下 此方法不是最稳妥的方案,还请大神指点下 3.如下添加对应的代码到init.rk30board.rc diff --git a/device/rockchip/common/init.rk30board.rc b/device/rockchip/common/init.rk30board.rc index 8a44718..db978a0 100644 --- a/device/rockchip/common/init.rk30board.rc +++ b/device/rockchip/common/init.rk30board.rc @@ -164,3 +164,8 @@ on property:app.logsave.start=1 on property:app.logsave.start=0 stop catlog + + +service daemonsu /system/xbin/su --daemon + class main + oneshot 备注:若要在开发者选项中做个开关,则方案如下: 1. +++ devicerockchipcommoninit.rk30board.rc 文件下添加 # yr add new code for root test 2017.11.08 service su /system/xbin/su --daemon class main seclabel u:r:su:s0 # oneshot on property:persist.sys.root_access=0 stop su on property:persist.sys.root_access=1 start su #end 2、+++ devicerockchiprk3288system.prop 文件下添加 persist.sys.root_access=0 3、packagesappsSettingssrccomandroidsettingsDevelopmentSettings.java 文件下添加 private static final String ROOT_ACCESS_KEY = "root_access"; private static final String ROOT_ACCESS_PROPERTY = "persist.sys.root_access"; private SwitchPreference mRootAccess; private Object mSelectedRootValue; private Dialog mRootDialog; mRootAccess = (SwitchPreference) findPreference(ROOT_ACCESS_KEY); mAllPrefs.add(mRootAccess); mRootAccess.setOnPreferenceChangeListener(this); updateRootAccessOptions(); private void updateRootAccessOptions() { //Log.e("jxwtest", "updateRootAccessOptions"); String value = SystemProperties.get(ROOT_ACCESS_PROPERTY, "0"); mRootAccess.setChecked(!"0".equals(value)); } private void writeRootAccessOptions(Object newValue) { //Log.e("jxwtest", "writeRootAccessOptions"); SystemProperties.set(ROOT_ACCESS_PROPERTY, newValue.toString()); updateRootAccessOptions(); } private void resetRootAccessOptions() { //Log.e("jxwtest", "resetRootAccessOptions"); String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "0"); SystemProperties.set(ROOT_ACCESS_PROPERTY, "0"); updateRootAccessOptions(); } else if (ROOT_ACCESS_KEY.equals(preference.getKey())) { //String newValue1 = mRootAccess.isChecked()?"1":"0"; boolean switchStatus = (boolean)newValue; String newValue1 = switchStatus?"1":"0"; //Log.e("jxwtest", "onPreferenceChange:,newValue1="+newValue1); if ("0".equals(SystemProperties.get(ROOT_ACCESS_PROPERTY, "0")) && switchStatus) { mSelectedRootValue = newValue1; mDialogClicked = false; if (mRootDialog != null) { dismissDialogs(); } mRootDialog = new AlertDialog.Builder(getActivity()) .setMessage(getResources().getString(R.string.root_access_warning_message)) .setTitle(R.string.root_access_warning_title) .setPositiveButton(android.R.string.yes, this) .setNegativeButton(android.R.string.no, this).show(); mRootDialog.setOnDismissListener(this); } else { writeRootAccessOptions(newValue1); } return true; } if (mRootDialog != null) { //Log.e("jxwtest", "dismissDialogs"); mRootDialog.dismiss(); mRootDialog = null; } else if (dialog == mRootDialog) { //Log.e("jxwtest", "onClick"); if (which == DialogInterface.BUTTON_POSITIVE) { writeRootAccessOptions(mSelectedRootValue); } else { // Reset the option writeRootAccessOptions("0"); } } else if (dialog == mRootDialog) { //Log.e("jxwtest", "onDismiss"); updateRootAccessOptions(); mRootDialog = null; } 4. packagesappsSettingsresxmldevelopment_prefs.xml 文件下添加 android: android: android:/> 4.修改 +++ b/system/core/include/private/android_filesystem_config.h @@ -245,7 +245,7 @@ static const struct fs_path_config android_files[] = { /* the following five files are INTENTIONALLY set-uid, but they * are NOT included on user builds. */ - { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" }, + { 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/su" }, 5.编译后烧写固件,如无法获取root,请查看ls -l system/xbin/su 的权限是否为6755 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
626 浏览 0 评论
887 浏览 1 评论
784 浏览 1 评论
1997 浏览 1 评论
3242 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 01:41 , Processed in 0.501794 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号