BuildEnvironments » History » Revision 10
Revision 9 (Beuc Beuc, 09/23/2015 12:08 PM) → Revision 10/11 (Beuc Beuc, 09/23/2015 12:12 PM)
h1. BuildEnvironments
h2. Rationale
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.
h2. Recommended environment history
Ubuntu support:
<pre>
,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
</pre>
Java support:
<pre>
,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
</pre>
h2. Ubuntu 14.04 with LXC
<pre>
lxc-create -n replicant -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
</pre>
h2. Trisquel 6.0 Toutatis (based on Ubuntu 12.04 Precise) with LXC
<pre>
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/
</pre>
h2. Ubuntu 12.04 Precise with LXC
<pre>
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
</pre>
h2. Trisquel 4.1 Taranis (based on Ubuntu 10.04 Lucid) with LXC
<pre>
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
</pre>
You'll need git > 1.7.2 for @repo@:
<pre>
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
</pre>
h2. Ubuntu 10.04 Lucid with LXC
<pre>
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
</pre>
You'll need git > 1.7.2 for @repo@:
<pre>
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
</pre>
h2. LXC host environment
The simplest way to configure LXC is to combine it with libvirt.
Here are instructions tested on a Debian 8 host:
<pre>
apt-get install lxc debootstrap xz-utils ca-certificates
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
</pre>
You now can run the LXC containers instructions above.
h2. Non-privileged user setup
This can be used in any environment to prepare a non-root user dedicated to builds.
<pre>
# 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
</pre>