Android Device Setup
Tools
-
Termux + Python3 (https://github.com/termux/termux-app)
Termux is an Android app that provides a terminal emulator and a GNU/Linux environment, allowing you to run command-line tools and programs directly on your Android device. It is commonly used on non-rooted devices, but it does provide an easy way to install some packages, such as Python 3.
# open Termux and update the packages
adb shell 'pkg update'
adb shell 'pkg upgrade'
adb shell 'pkg install python'The packages are installed into
/data/data/com.termux/files/usr/bin. -
Magisk + Magisk Modules (https://magiskmanager.com/)
Magisk is an open-source tool for customizing Android that allows users to gain root access while leaving the system partition untouched ("systemless"). It also allows you to extend its functionality with various modules.
Install Magisk
If you used Magisk to root your device, then it is already installed. If not, then use these instructions:
- Download the Magisk App APK file from its website or Github
- Install the app to your device
adb install Magisk.apk
Install Magisk Module(s)
- Search for the functionality you are looking for and download the app
- Push the module file to the device and place it in /sdcard
adb push filename /sdcard - Open the Magisk App and tap on the Modules button in the bottom navigation bar
- Select the module for installation
- Reboot the device once installation completes
Rooting the Device
Google is more open to rooting the device than Apple is with jailbreaking. Specifically, the Pixel line is well known to be rootable if you purchase one directly from Google. However, if you get the device from a cellular carrier there is a good chance that it is not rootable.
Essentially, to root an Android device you must be able to unlock the bootloader. Once it is unlocked, you can then use Magisk to patch the boot.img file from the factory images, and then flash that to the bootloader.
Below is a simple example using a Pixel 6:
-
On the device, unlock the bootloader. This is done in the Settings app. Select the About page, then tap on the Build number 7 times. Then go back one level and select System => Developer options. Scroll down to OEM unlocking and toggle the switch to on.
-
Download the proper factory image for your device and the Android version you have. This link is for the Nexus & Pixel lines: https://developers.google.com/android/images
-
Extract the main zip file, then look for another zip file named image-(devicecodename)*.zip. Unzip this file as well. Inside will be the
boot.imgfile. -
Download the Magisk APK file from https://github.com/topjohnwu/magisk/releases/
-
Next, push the boot.img file to the device using
adband then install the Magisk APK:adb push boot.img /sdcard
adb install Magisk-v29.0.apk -
On the device, launch the Magisk app. On the Home tab, tap on the Install link at the top, then select the boot.img and allow it to patch it. This will create a new .img file in the same location.
-
Pull the patched .img file back to your computer.
adb pull /sdcard/Download/magisk_patched_(random).img -
Flash the patched .img file to the device
adb reboot bootloader
fastboot flash boot magisk_patched_(random).img
fastboot reboot