【发布时间】:2013-06-29 05:40:32
【问题描述】:
使用谷歌 (occam) 的最新库存 rom .img 为 Nexus 4 编写根脚本,我有以下代码 sn-p:
./adb wait-for-device
echo "remounting system"
./adb shell "mount -o remount,rw /system"
./adb push su /system/bin/
echo "pushing super user"
./adb push Superuser.apk /system/app/
echo "pushing busybox"
./adb push busybox /system/xbin/
./adb shell "chmod 06755 /system/bin/su"
./adb shell "chmod 0644 /system/app/Superuser.apk"
./adb shell "chmod 04755 /system/xbin/busybox"
./adb shell "cd /system/xbin"
./adb shell "busybox --install /system/xbin/"
我不断收到错误
mount: Operation not permitted
failed to copy 'su' to '/system/bin//su': Read-only file system
pushing super user
failed to copy 'Superuser.apk' to '/system/app//Superuser.apk': Read-only file system
pushing busybox
failed to copy 'busybox' to '/system/xbin//busybox': Read-only file system
Unable to chmod /system/bin/su: No such file or directory
Unable to chmod /system/app/Superuser.apk: No such file or directory
Unable to chmod /system/xbin/busybox: No such file or directory
/system/bin/sh: busybox: not found
我尝试过使用多种方法来获取 r/w 访问权限,但似乎没有任何效果。由于其他人将使用该脚本,因此我必须自动化此过程,因此它需要自动化友好,但我无法弄清楚这一点。
我也试过了
#su
#mount
#mount | grep system
然后输入带有系统挂载的分区并将其更改为 r/w 访问,但这也没有奏效。
在这一点上真的很沮丧。任何人都可以帮忙吗?
【问题讨论】:
-
愚蠢的问题,但是您的设备是否已植根?你不能访问
SU,除非设备已经root并且你需要mount -
不,没有root。这就是我在这里尝试做的。但是我遇到的是我无法在没有写权限的情况下将任何文件推送到设备的根目录到 /system 文件夹。也许我在这方面也完全错了,对于 shell 脚本和 adb 来说还是很新的。
-
我的理解一直是,当你 root 手机时,一个新图像会被推送到手机上,这有效地添加了
su可执行文件,并添加了在应用程序尝试时检查 su 权限的代码访问 su 权限。我会首先下载 Android 源代码,编译并将其推送到测试设备(如 Panda 板)上,然后尝试弄清楚如何将su可执行文件推送到它上面。然后也许为 Nexus 4 制作图像并将其推送到手机上。我在这里也可能完全错了.. -
如果你的设备没有root,那么你就不能在不发现和利用现有软件中的一些安全错误的情况下进行特权操作。从根本上说,您正在尝试做一些不应该做的事情。
-
感谢阿里的洞察力。我相信这就是问题所在。我之前的图像是一个股票 rom,但已作为 root 方法的一部分发布。它停止工作了,我想我不知道
su必须是我正在组合的新图像的一部分。