Project

General

Profile

BuildEnvironments » History » Version 5

Beuc Beuc, 07/26/2015 10:17 AM
Let the LXC template install 'lxcguest' to fix TTY and proc-messing issues for taranis.

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 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
</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 1 Beuc Beuc
83 5 Beuc Beuc
# 'lxcguest' fixes a number of issues but seem to disable init..
84
dhclient
85
/etc/init.d/ssh restart
86
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 5 Beuc Beuc
# 'lxcguest' fixes a number of issues but seem to disable init..
106
dhclient
107
/etc/init.d/ssh restart
108
109 1 Beuc Beuc
# clean-up non-free sources
110
sed -i -e 's/ restricted//' -e 's/ multiverse//' /etc/apt/sources.list
111
apt-get update
112 5 Beuc Beuc
113
cd /usr/src/
114
apt-get install wget gcc libssl-dev zlib1g-dev libcurl4-gnutls-dev libexpat-dev gettext
115
wget https://www.kernel.org/pub/software/scm/git/git-2.4.6.tar.gz
116
tar xf git-2.4.6.tar.gz 
117
cd git-2.4.6/
118
make -j4  # ~2mn
119
make install prefix=/usr/local
120 1 Beuc Beuc
</pre>
121
122
h2. LXC host environment
123
124
The simplest way to configure LXC is to combine it with libvirt.
125
126
Here are instructions tested on a Debian 8 host:
127
128
<pre>
129
apt-get install lxc debootstrap
130
131
apt-get install libvirt-bin dnsmasq ebtables
132
service dnsmasq stop
133
update-rc.d dnsmasq remove
134
virsh net-autostart default
135
service libvirtd restart
136
cat > /etc/lxc/default.conf <<'EOF'
137
lxc.network.type = veth
138
lxc.network.flags = up
139
lxc.network.link = virbr0
140
EOF
141
</pre>
142
143
You now can run the LXC containers instructions above.
144
145
h2. Non-privileged user setup
146
147
This can be used in any environment to prepare a non-root user dedicated to builds.
148
<pre>
149
# prepare build user
150
apt-get install openssh-server
151
useradd replicant --shell /bin/bash --create-home
152
mkdir -p -m 700 ~replicant/.ssh
153
cat <<EOF >> ~replicant/.ssh/authorized_keys
154
your public key
155
EOF
156
chown -R replicant: ~replicant
157
</pre>