User:Jlyo/WIP:s6/android

From Alpine Linux
Revision as of 18:09, 30 April 2015 by Jlyo (talk | contribs) (Off to a start)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Notes about my Alpine Linux installation on a 64GB OnePlus One phone using s6 to boot Alpine's userspace.

Similar Debian instructions

There are two boot configurations I went through:

  1. Boot stock Android init, chrooting into Alpine. Hooks into /data/local/userinit.d/*
  2. Boot a custom init, where the Android root filesystem is a chroot under Alpine, but keeping Android's init as PID 1.

Unlock the bootloader and root your phone

Warning: Unlocking your bootloader will revert your phone to it's stock image, causing you to lose all your personal data on your phone!


Unlocking the bootloader is necessary, however rooting your phone ("ROM") is not if you hack on the boot image initrd.

fastboot oem unlock

Flash TWRP to the recovery partition. Install SuperSU.

Install Alpine in a chroot

Installing Alpine Linux in a chroot

Hack on Android's boot.img to boot Alpine

  • Download stock boot.img, unpack, hack, repack, flash.
  • Change kernel command line so SELinux is set to permissive (TODO: figure out how to return it to enforcing)
fastboot boot boot.img
fastboot flash boot boot.img

Further investigations

  • Employ PID namespaces, so s6-svscan can be the real PID 1, and not a fork(). This requires you to change your kernel configuration and recompile the kernel.
  • Mount namespaces (?). Mount namespaces are already enabled in the OnePlus kernel.
  • Employ s6-sudod so Android proceses can enter the Alpine environment (without SSH)
    • Figure out how to open a new PTY and/or set terminal line disciplines so we can have process control in our shell.