From Alpine Linux
Jump to: navigation, search
Underconstruction clock icon gray.svg
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Jlyo on 30 Apr 2015.)

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.