This shows you the differences between two versions of the page.
— |
smd:laboratoare:old:09 [2019/03/06 15:03] (current) adriana.draghici created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Lab 09. Rooting ===== | ||
+ | |||
+ | === Rooting a virtual device === | ||
+ | |||
+ | Resources: | ||
+ | * {{smd:laboratoare:supersu-v2.79-201612051815.zip|SuperSU package}} | ||
+ | * <code>unzip supersu-v2.79-201612051815.zip -d SuperSU</code> | ||
+ | |||
+ | Create a virtual device for the emulator using AVD Manager: Pixel XL, Android 7.1.1, API 25. | ||
+ | |||
+ | Start the virtual device with a writable system partition and with SELinux disabled: | ||
+ | <code> | ||
+ | ./emulator -avd Pixel_XL_API_25 -writable-system -selinux disabled | ||
+ | </code> | ||
+ | |||
+ | Run adb as root: | ||
+ | <code> | ||
+ | adb root | ||
+ | adb remount | ||
+ | </code> | ||
+ | |||
+ | Install Superuser.apk (found in SuperSU archive, common folder) on the device: | ||
+ | <code> | ||
+ | adb install common/Superuser.apk | ||
+ | </code> | ||
+ | |||
+ | Push **su** binary (found in SuperSU archive, x86 folder) on the device, in **/system/xbin/**: | ||
+ | <code> | ||
+ | adb push push x86/su.pie /system/xbin/su | ||
+ | </code> | ||
+ | |||
+ | Change permissions to **su** binary: | ||
+ | <code> | ||
+ | adb shell chmod 0755 /system/xbin/su | ||
+ | </code> | ||
+ | |||
+ | Set SELinux on permissive mode: | ||
+ | <code> | ||
+ | adb shell setenforce 0 | ||
+ | </code> | ||
+ | |||
+ | Install **su**: | ||
+ | <code> | ||
+ | adb shell su --install | ||
+ | </code> | ||
+ | |||
+ | Run **su** as daemon: | ||
+ | <code> | ||
+ | adb shell su --daemon& | ||
+ | </code> | ||
+ | |||
+ | Open SuperSU application and let it update the su binary. | ||
+ | |||
+ | Restart adb as non-root. | ||
+ | <code> | ||
+ | adb unroot | ||
+ | </code> | ||
+ | |||
+ | Enter adb shell and then access root using **su**. | ||
+ | <code> | ||
+ | adb shell | ||
+ | su | ||
+ | </code> | ||
+ | |||
+ | Check if packet routing is enabled and enable it: | ||
+ | <code> | ||
+ | sysctl net.ipv4.ip_forward | ||
+ | sysctl -w net.ipv4.ip_forward=1 | ||
+ | </code> | ||