Gentoo chroot on android 10 device
I was in a pinch over the weekend and needed a quick gentoo env to test something but only had my stupid android 10 smartphone with me, so wat do? I'm documenting the following recipe that (so far) works for me and preserving the tarball here to my www for possible future needs.
Grab the stage3 for armv7 using curl inside termux.
`curl -sSL4 http://btc.info.gf/devel/gentoo/arm/android/stage3-arm64-20200704.tar.xz`
Gotta fucking fix hardlinks cuz of some android kernel herpderpery so we use proot, also from termux.
`proot --link2symlink tar -C $GENTOO/data -xf stage3-arm64-20200704.tar.xz`
Now make a script that starts up the chroot inside termux and fire it off:
`cat >chroot.sh << EOF #!/usr/bin/env bash set -eu set -o pipefail unset LD_PRELOAD export GENTOO=/data/data/com.termux/gentoo export EPREFIX=/data/gentoo64 proot --link2symlink -r $GENTOO -0 -w / \ -b /dev -b /proc -b /sys \ $EPREFIX/bin/sh -c \ "HOME=$EPREFIX/root $EPREFIX/startprefix" EOF chmod +x chroot.sh sh chroot.sh
Now from inside the chroot, fix your `/etc/resolv.conf` since this can't be copied from android system. Then source your profile and set ENV.
source /etc/profile export PS1="(chroot) $PS1"
Normally this is the step where one sets up portage, but resist the temptation to `emerge-webrsync` here. I'd simply crossdev the packages I needed on a much more capable machine and set up my `/etc/portage/make.conf` to emerge packages from a local binhost.
CAVEATS
This thing will bitch about `proc/` not being mounted on most devices. However, I'm able to see chroot processes inside htop in another termux session.
Because of the extreme minimal size of the environment, user is expected to be capable of building their own env using crossdev as explained above
UPDATE: I forgot to mention that I mounted one of these Kingston 8GB microsd cards before unpacking the fs: