Each revision of Android is meant to be compiled with a specific set of dependencies. No effort is made upstream to support multiple build environments.
Building with different environments often yields build errors due to untested dependencies versions.
So we document here how to recreate these recommended build environments.
Ubuntu support:
,2013-10-15 - Lucid (10.04) 2013-10-15,2015-03-16 - Precise (12.04), probably with 4.4 KitKat - https://web.archive.org/web/20131015123913/http://source.android.com/source/initializing.html 2015-03-16, - Trusty (14.04) https://web.archive.org/web/20150316053136/https://source.android.com/source/initializing.html
Java support:
,2014-03-31 - Sun JDK 5/6 2014-03-31, - OpenJDK 7 - https://web.archive.org/web/20140331004436/https://source.android.com/source/initializing.html
lxc-create -n android -t download -- -d ubuntu -r trusty -a amd64 lxc-start -n replicant -d lxc-attach -n replicant # clean-up non-free sources sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list apt-get update
wget http://archive.trisquel.info/trisquel/pool/main/d/debootstrap/debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz tar xzf debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz cp -a debootstrap-1.0.59ubuntu0.3+7.0trisquel1/scripts/{toutatis,trisquel} /usr/share/debootstrap/scripts/ cp -a /usr/share/lxc/templates/lxc-ubuntu /usr/share/lxc/templates/lxc-trisquel sed -i -e 's/main restricted universe multiverse/main/' \ -e 's/.*lxcguest/#&/' /usr/share/lxc/templates/lxc-trisquel lxc-create -n replicant -t trisquel -- -r toutatis -a amd64 --mirror http://archive.trisquel.info/trisquel/ \ --security-mirror http://archive.trisquel.info/trisquel/
lxc-create -n replicant -t download -- -d ubuntu -r precise -a amd64 lxc-start -n replicant -d lxc-attach -n replicant # clean-up non-free sources sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list apt-get update
wget http://archive.trisquel.info/trisquel/pool/main/d/debootstrap/debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz tar xzf debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz cp -a debootstrap-1.0.59ubuntu0.3+7.0trisquel1/scripts/{taranis,trisquel} /usr/share/debootstrap/scripts/ cp -a /usr/share/lxc/templates/lxc-ubuntu /usr/share/lxc/templates/lxc-trisquel sed -i -e 's/main restricted universe multiverse/main/' \ -e 's/lucid/taranis/' /usr/share/lxc/templates/lxc-trisquel lxc-create -n replicant -t trisquel -- -r taranis -a amd64 --mirror http://archive.trisquel.info/trisquel/ \ --security-mirror http://archive.trisquel.info/trisquel/ lxc-start -n replicant -d lxc-attach -n replicant # 'lxcguest' fixes a number of issues but seem to disable init.. dhclient /etc/init.d/ssh restart
You'll need git > 1.7.2 for repo
:
cd /usr/src/ apt-get install wget gcc libssl-dev zlib1g-dev libcurl4-gnutls-dev libexpat-dev gettext wget https://www.kernel.org/pub/software/scm/git/git-2.4.6.tar.gz tar xf git-2.4.6.tar.gz cd git-2.4.6/ make -j4 # ~2mn make install prefix=/usr/local
apt-get install ubuntu-archive-keyring lxc-create -n replicant -t ubuntu -- -r lucid -a amd64 lxc-start -n replicant -d lxc-attach -n replicant # clean-up non-free sources sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list apt-get update # 'lxcguest' fixes a number of issues but seem to disable init.. dhclient /etc/init.d/ssh restart
You'll need git > 1.7.2 for repo
:
cd /usr/src/ apt-get install wget gcc libssl-dev zlib1g-dev libcurl4-gnutls-dev libexpat-dev gettext wget https://www.kernel.org/pub/software/scm/git/git-2.4.6.tar.gz tar xf git-2.4.6.tar.gz cd git-2.4.6/ make -j4 # ~2mn make install prefix=/usr/local
The simplest way to configure LXC is to combine it with libvirt.
Here are instructions tested on a Debian 8 host:
apt-get install lxc debootstrap apt-get install libvirt-bin dnsmasq ebtables service dnsmasq stop update-rc.d dnsmasq remove virsh net-autostart default service libvirtd restart cat > /etc/lxc/default.conf <<'EOF' lxc.network.type = veth lxc.network.flags = up lxc.network.link = virbr0 EOF
You now can run the LXC containers instructions above.
This can be used in any environment to prepare a non-root user dedicated to builds.
# prepare build user apt-get install openssh-server useradd replicant --shell /bin/bash --create-home mkdir -p -m 700 ~replicant/.ssh cat <<EOF >> ~replicant/.ssh/authorized_keys your public key EOF chown -R replicant: ~replicant