### Setup * Download the lastest alpine-minirootfs for armv7 from [alpinelinux](https://www.alpinelinux.org/downloads/) * Once you have root access use adb to push these files to `/data/` (e.g. `adb push setup.sh /data/`): * `alpine-minirootfs-3.22.1-armv7.tar.gz` * `setup.sh` * `busybox-armv7l` * Navigate to `/data` and then run `sh setup.sh` which should setup the chroot (mounting the `/dev` etc) * This will then drop you into a `localhost` shell, to get out ### Start Up Scripts * To start up a binary we need to insert a script somewhere in the start up procedure, I noted that the binary `debuggerd` is started and didn't think we needed this so instead replaced the binary with a shell script that would start my own programs. * Android mounts its `/system/bin` as read only so it is necessary to temporarily remount this to make the changes: * `mount -o remount,rw /system` * `chmod o+w /system/bin` * Backup debuggerd binary and then replace it with the shell script * `chmod o-w /system/bin` * `mount -o remount,ro /system` ### Links * [alpine-minirootfs](https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/armv7/alpine-minirootfs-3.22.1-armv7.tar.gz) * [Setting up chroot](https://wiki.alpinelinux.org/wiki/Alpine_Linux_in_a_chroot) * [android - changing system permissions](https://iamcmotc.blogspot.com/2015/04/android-how-to-run-script-or-system.html)