Project

General

Profile

BuildEnvironments » History » Version 4

Beuc Beuc, 07/26/2015 09:57 AM
Fixes following retest of "Trisquel 4.1 Taranis" from scratch

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 4 Beuc Beuc
lxc-start -n replicant -d
81
lxc-attach -n replicant
82
83
cd /usr/src/
84
apt-get install wget gcc libssl-dev zlib1g-dev libcurl4-gnutls-dev libexpat-dev gettext
85 2 Beuc Beuc
wget https://www.kernel.org/pub/software/scm/git/git-2.4.6.tar.gz
86 1 Beuc Beuc
tar xf git-2.4.6.tar.gz 
87 2 Beuc Beuc
cd git-2.4.6/
88 4 Beuc Beuc
make -j4  # ~2mn
89 2 Beuc Beuc
make install prefix=/usr/local
90 1 Beuc Beuc
</pre>
91
92
h2. Ubuntu 10.04 Lucid with LXC
93
94
<pre>
95
apt-get install ubuntu-archive-keyring
96
lxc-create -n replicant -t ubuntu -- -r lucid -a amd64
97
98
lxc-start -n replicant -d
99
lxc-attach -n replicant
100
101
# clean-up non-free sources
102
sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list
103
apt-get update
104
</pre>
105
106
h2. LXC host environment
107
108
The simplest way to configure LXC is to combine it with libvirt.
109
110
Here are instructions tested on a Debian 8 host:
111
112
<pre>
113
apt-get install lxc debootstrap
114
115
apt-get install libvirt-bin dnsmasq ebtables
116
service dnsmasq stop
117
update-rc.d dnsmasq remove
118
virsh net-autostart default
119
service libvirtd restart
120
cat > /etc/lxc/default.conf <<'EOF'
121
lxc.network.type = veth
122
lxc.network.flags = up
123
lxc.network.link = virbr0
124
EOF
125
</pre>
126
127
You now can run the LXC containers instructions above.
128
129
h2. Non-privileged user setup
130
131
This can be used in any environment to prepare a non-root user dedicated to builds.
132
<pre>
133
# prepare build user
134
apt-get install openssh-server
135
useradd replicant --shell /bin/bash --create-home
136
mkdir -p -m 700 ~replicant/.ssh
137
cat <<EOF >> ~replicant/.ssh/authorized_keys
138
your public key
139
EOF
140
chown -R replicant: ~replicant
141
</pre>