Project

General

Profile

BuildEnvironments » History » Version 9

Beuc Beuc, 09/23/2015 12:08 PM
xz-utils required to install Ubuntu LXC container

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