how to install busybox in android using adb

不问归期 提交于 2021-02-07 06:48:29

问题


I am trying to install busybox on an android emulator.

I downloaded and compiled busybox and have the busybox binary on my pc.

i then did adb push busybox /data/local/tmp

then did adb shell, then #cd /data/local/tmp , then #chmod 777 busybox, then tried #./busybox --install it says busybox command not found.

I also copied the file to /system/busybox. but ./busybox --install says busybox command not found.


回答1:


First do adb push busybox /data/local/busybox to copy the busybox into the android phone system then go to the android shell by doing adb shell. Get the superuser by typing su from you android phone grant superuser request then back to the shell and type

cd /data/local
chmod 755 busybox
./busybox
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
mkdir /system/xbin
cp /data/local/busybox /system/xbin
cd /system/xbin
busybox --install .
mount -o ro,remount -t yaffs2 /dev/block/mtdblock4 /system
sync
reboot

Note: /dev/block/mtdblock4 may not be the /system partition on every device or emulator. It's best to execute the 'mount' command without parameters first in the shell, and look which device or partition is mounted as /system.




回答2:


On a rooted phone, install this apk: https://f-droid.org/en/packages/ru.meefik.busybox/

f-droid is a good option as it is open source and officially allows downloading APKs, unlike the play store, which may not be available on test devices.

That app also has a simple install GUI, but the most reliable way to install it is to do simply:

adb shell
cp /data/data/ru.meefik.busybox/files/bin/busybox /system/xbin/
busybox ls



回答3:


There are a couple of small changes to gregko and hayder Jawad's answer to get this working on the Pixel 2 emulator.

You have to start the emulator using the -writable-system flag as per this answer, otherwise you won't be able to remount the /system directory with the rw flag.

On the Pixel 2 emulator, /system is mounted at /dev/block/vda and /system/xbin already exists.

Thus, assuming you've pushed the binary to /data/local/busybox as per the first half of the answer, the shell commands to install busybox into the Pixel 2 emulator are

su
cd /data/local
chmod 755 busybox
./busybox
mount -o rw,remount -t ext4 /dev/block/vda /system
cp /data/local/busybox /system/xbin
cd /system/xbin
busybox --install .
mount -o ro,remount -t ext4 /dev/block/vda /system
sync
reboot

The busybox download page might be a bit unclear for beginners (like me). For 32-bit x86 processors, you'll want to use the i686 binary file.




回答4:


I did the following very simple steps:

  1. Download busybox apk to my laptop from here
  2. Install apk using: adb install <apk file path>
  3. Run busybox shell: busybox ash

Once in shell you can use busybox commands.



来源:https://stackoverflow.com/questions/21900603/how-to-install-busybox-in-android-using-adb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!