Run Gentoo on Android via Chroot
What is Chroot?
Well it’s not a virtual machine or emulation, it’s an honest to goodness linux install…running inside of another linux install. Inception style.
Chroot in essence is a method of running a linux distribution that is not at the standard “/” location, for example in this guide gentoo will be running in /data/local/mnt/. You then “chroot” to that directory and voila you have jumped into that linux distribution and can proceed as if you were running linux natively.
This guide will provide instructions on how to install gentoo on an android tablet. It is assumed that you are doing this on a unix system (debian, gentoo, fedora ubuntu etc) (syntax for some commands might be slightly different for different distributions
Familiarity with a linux environment is required and i assume that some blanks can be filled in, we are installing gentoo after all ;)
First I’d like to thank the people over at linuxonandroid for providing the bootscripts which I based mine off of.
Requirements
- Rooted android tablet with superuser (in this case i’m using a Nexus 10)
- A compiled version of busybox-android get it here (Full credit for this goes to Stephen (Stericson) )
- Android Terminal Emulator
Creating the Image
All steps in this part will be performed on your linux install. we will copy this image to the device later
Create a linux image using dd
Configure this to the size you want, the filesystem of the sdcard partition on your device might be a limitation.
Run mkfs.ext2 on it
NOTE: depending on the size of your partition you may have to increase the number of inodes availible
Download the gentoo stage3 bz2 from:
http://distfiles.gentoo.org/releases/arm/autobuilds/current-stage3-armv7a/
Download the latest portage tree
http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
Create a temporary folder and mount the gentoo image
Extract the stage3 and portage tree archives
extract the stage3 tarball into the mounted image extract the portage tree into the usr directory that was just created
I assume the files were downloaded a directory one level above tmp
Create some folders (check if they exist first)
Copy the img to your android device!
unmount the img first before copying
Transfer the img to your android device via usb or similar means.
Chroot into the image
Copy the busybox executable to /data/local so that you can execute it
(feel free to use your own version of busybox)
Copy the following script into the same directory
(run this in side android terminal emulator)
Make them executable
Make sure the boot script points to the correct image file and run it.
add DNS servers
Get portage working.
df error: cannot read table of mounted file systems
and that’s it!
Thanks to linuxonandroid for their usefull app and scripts And Andrew Seidl for his help in getting everything figured out.