Android/SharkBait/User Guide

This article is intended for devices that are supported by SharkBait. The current list of supported devices is as follows:


 * Huawei Nexus 6P

If your device is not in the list, consult the Porter's Guide for instructions on how to add support for a device. The rest of this article assumes that you have a device that's supported. Let's get started!

Install a normal Android system
The first step is to install a normal version of Android on your device. Note that the system should have ADB root access (i.e. ability to and get  running as root). Lineage OS should be a good choice in many cases.

Flash boot.img to disable full-disk encryption
The supported devices have corresponding pages that contain links to scripts that modifies the extracted from the device to disable forced encryption. Clone the SharkBait Setup repository to your work computer and do the following.

After the device has boot up, verify that the following command doesn't output anything, which indicates that forced encryption has been disabled:

Setup Gentoo chroot in /data/gnu
Gain root access via adb. Make path ; this will be the home of Gentoo root, which will become the system root soon. Follow Guide on Gentoo Wiki to set up the Gentoo root. Note the following points during the setup:


 * Pick stage3 tarballs that can be found here instead of AMD64 stage3 tarballs;
 * Add user to gid 3003 :
 * Install the proj/android.git overlay that contains Android-specific kernel sources and utilities. Refer to eselect repository or Layman for how to add an overlay to the system.
 * Choose instead of the general  when picking the kernel source. Install  for packages that want the  virtual. Also, install  with exactly the same version as the sources from the overlay.
 * Install for automatic deploying boot.img on Android.
 * Read post-installation message carefully.
 * Configure the kernel as the following:
 * Some kernels require a specific version of compiler. Try using an older version of compiler if problems occur (e.g. compile errors, unable to boot, etc.)
 * change the kernel config according to your needs
 * try your best to config as builtin instead of modules due to poor module dependency system in Android kernel source
 * before : adb has strange environment variables that breaks build
 * skip the installation of kernel (do not yet --  needs the current boot.img to deploy Android container)
 * Skip configuring the bootloader
 * skip the installation of kernel (do not yet --  needs the current boot.img to deploy Android container)
 * Skip configuring the bootloader

We need LXC to run Android in a container. The kernel sources of supported devices have necessary LXC options enabled by default. Install and do the following:

Install the kernel
Now go to  and install the kernel:

Reboot and test!
The genuine test for installing an operating system is rebooting and see if things work out as expected. Reboot the phone the Android way: select &quot;Reboot&quot; in the power menu. The phone should boot up normally. To go back into Gentoo, &quot;dial home&quot; via the shell script installed at :

Join #shark-bait @ Freenode for discussion or for help in case anything goes wrong. Also, if you have other devices that are not yet supported by SharkBait, you can help with porting them, following the Porter's Guide.