Project

General

Profile

BuildEnvironments » History » Version 3

Beuc Beuc, 07/25/2015 02:35 PM
Typo 12.04 = Precise

1 1 Beuc Beuc
h1. BuildEnvironments
2
3
h2. Rationale
4
5
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.
6
Building with different environments often yields build errors due to untested dependencies versions.
7
So we document here how to recreate these recommended build environments.
8
9
h2. Recommended environment history
10
11
Ubuntu support:
12
<pre>
13
          ,2013-10-15 - Lucid   (10.04)
14
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
15
2015-03-16,           - Trusty  (14.04) https://web.archive.org/web/20150316053136/https://source.android.com/source/initializing.html
16
</pre>
17
18
Java support:
19
<pre>
20
          ,2014-03-31 - Sun JDK 5/6
21
2014-03-31,           - OpenJDK 7 - https://web.archive.org/web/20140331004436/https://source.android.com/source/initializing.html
22
</pre>
23
24
h2. Ubuntu 14.04 with LXC
25
26
<pre>
27
lxc-create -n android -t download -- -d ubuntu -r trusty -a amd64
28
29
lxc-start -n replicant -d
30
lxc-attach -n replicant
31
32
# clean-up non-free sources
33
sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list
34
apt-get update
35
</pre>
36
37 3 Beuc Beuc
h2. Trisquel 6.0 Toutatis (based on Ubuntu 12.04 Precise) with LXC
38 2 Beuc Beuc
39
<pre>
40
wget http://archive.trisquel.info/trisquel/pool/main/d/debootstrap/debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz
41
tar xzf debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz 
42
cp -a debootstrap-1.0.59ubuntu0.3+7.0trisquel1/scripts/{toutatis,trisquel} /usr/share/debootstrap/scripts/
43
cp -a /usr/share/lxc/templates/lxc-ubuntu /usr/share/lxc/templates/lxc-trisquel
44
sed -i -e 's/main restricted universe multiverse/main/' \
45
       -e 's/.*lxcguest/#&/' /usr/share/lxc/templates/lxc-trisquel
46
47
lxc-create -n replicant -t trisquel --  -r toutatis -a amd64 --mirror http://archive.trisquel.info/trisquel/ \
48
  --security-mirror http://archive.trisquel.info/trisquel/
49
</pre>
50
51 1 Beuc Beuc
h2. Ubuntu 12.04 Precise with LXC
52
53
<pre>
54
lxc-create -n replicant -t download -- -d ubuntu -r precise -a amd64
55
56
lxc-start -n replicant -d
57
lxc-attach -n replicant
58
59
# clean-up non-free sources
60
sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list
61
apt-get update
62
</pre>
63
64
h2. Trisquel 4.1 Taranis (based on Ubuntu 10.04 Lucid) with LXC
65
66
<pre>
67
wget http://archive.trisquel.info/trisquel/pool/main/d/debootstrap/debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz
68
tar xzf debootstrap_1.0.59ubuntu0.3+7.0trisquel1.tar.gz 
69
cp -a debootstrap-1.0.59ubuntu0.3+7.0trisquel1/scripts/{taranis,trisquel} /usr/share/debootstrap/scripts/
70
cp -a /usr/share/lxc/templates/lxc-ubuntu /usr/share/lxc/templates/lxc-trisquel
71
sed -i -e 's/main restricted universe multiverse/main/' \
72
       -e 's/.*lxcguest/#&/' /usr/share/lxc/templates/lxc-trisquel
73 2 Beuc Beuc
74
lxc-create -n replicant -t trisquel --  -r taranis -a amd64 --mirror http://archive.trisquel.info/trisquel/ \
75 1 Beuc Beuc
  --security-mirror http://archive.trisquel.info/trisquel/
76 2 Beuc Beuc
</pre>
77
78
You'll need git > 1.7.2 for @repo@:
79
<pre>
80
apt-get install libssl-dev zlib1g-dev libcurl4-gnutls-dev libexpat-dev gettext
81
wget https://www.kernel.org/pub/software/scm/git/git-2.4.6.tar.gz
82
tar xf git-2.4.6.tar.gz 
83
cd git-2.4.6/
84
make -j4
85
make install prefix=/usr/local
86 1 Beuc Beuc
</pre>
87
88
h2. Ubuntu 10.04 Lucid with LXC
89
90
<pre>
91
apt-get install ubuntu-archive-keyring
92
lxc-create -n replicant -t ubuntu -- -r lucid -a amd64
93
94
lxc-start -n replicant -d
95
lxc-attach -n replicant
96
97
# clean-up non-free sources
98
sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list
99
apt-get update
100
</pre>
101
102
h2. LXC host environment
103
104
The simplest way to configure LXC is to combine it with libvirt.
105
106
Here are instructions tested on a Debian 8 host:
107
108
<pre>
109
apt-get install lxc debootstrap
110
111
apt-get install libvirt-bin dnsmasq ebtables
112
service dnsmasq stop
113
update-rc.d dnsmasq remove
114
virsh net-autostart default
115
service libvirtd restart
116
cat > /etc/lxc/default.conf <<'EOF'
117
lxc.network.type = veth
118
lxc.network.flags = up
119
lxc.network.link = virbr0
120
EOF
121
</pre>
122
123
You now can run the LXC containers instructions above.
124
125
h2. Non-privileged user setup
126
127
This can be used in any environment to prepare a non-root user dedicated to builds.
128
<pre>
129
# prepare build user
130
apt-get install openssh-server
131
useradd replicant --shell /bin/bash --create-home
132
mkdir -p -m 700 ~replicant/.ssh
133
cat <<EOF >> ~replicant/.ssh/authorized_keys
134
your public key
135
EOF
136
chown -R replicant: ~replicant
137
</pre>