Gentoo Archives: gentoo-soc

From: heroxbd <heroxbd@×××××.com>
To: gentoo-soc@l.g.o
Subject: [gentoo-soc] Project Idea: Gentoo On Android
Date: Sat, 30 Mar 2013 14:51:09
Message-Id: 871uax3pro.fsf@proton.in.awa.tohoku.ac.jp
1 Dear all,
2
3 I am trying to form a project idea to make Gentoo Available on Android.
4
5 The thoughts collected so far are as follows. I am not sure if it is
6 good to mix too much android things here in the second half. Maybe it is
7 better only to do the first half with a couple of other more Gentoo
8 related work?
9
10 Cheers,
11 Benda
12
13 Gentoo On Android
14 =================
15
16 Author: heroxbd
17 Date: 2013-03-30 23:49:33 JST
18
19
20 Table of Contents
21 =================
22 1 Abstract
23 2 Libc in Gentoo Prefix
24 3 Root privilege in Gentoo Prefix
25 4 GNU on Android
26 5 Display sharing
27 6 Integration of GNU and Android
28 7 Deliverables
29 7.1 Until Mid-Term
30 7.1.1 Libc of Gentoo Prefix
31 7.1.2 Root privilege in Gentoo Prefix
32 7.1.3 Gentoo Prefix on Android
33 7.1.4 Timeline
34 7.2 Until Final
35 7.2.1 Display sharing
36 7.2.2 Integration of GNU and Android
37 7.2.3 Timeline
38 8 Reference
39
40
41 1 Abstract
42 ===========
43 This project is about running Gentoo natively on Android devices.
44
45 I am going to develop libc support and root permission handling in
46 Gentoo Prefix, and deploy the enhanced Gentoo Prefix in parallel to
47 Android userland in mobile devices, such as smart phone and
48 tablet. This will provide a full-featured native GNU userland to
49 Android system.
50
51 A framebuffer switch mechanism will be developed to share the
52 display between GNU and Android userland. This will be very useful
53 to dockable tablets like ASUS transformer to run native X and
54 SurfaceFlinger.
55
56 Optionally, data exchange between Gentoo and Android userland will
57 also be investigated and provided as an integration between the two.
58
59 2 Libc in Gentoo Prefix
60 ========================
61 Gentoo Prefix is variant of Gentoo meta-distribution which installs
62 under normal user privilege a full Gentoo in a directory offset of
63 a Unix-like OS, such as HPUX, AIX, GNU/Linux, Interix, Mac OS X,
64 Solaris and Cygwin.
65
66 Traditionally, Gentoo Prefix uses kernel/libc and in some cases
67 compiler/linker from host OS. Problem arises in Linux/glibc based OS
68 when the version of glibc is too old, like RHEL/CentOS 5 and many
69 ancient GNU/Linux still in duty[1][2][3]. Therefore it has
70 been a dream of Gentoo Prefix community to have bleeding edge libc
71 to further reduce dependence on host while still being a Prefix (as
72 opposed to a virtual machine). It is technically accessible as
73 Debian multi-arch[4] and patchelf from nixOS[5] demonstrated
74 the use of /interp/ field of ELF to locate dynamic linker.
75
76 Around late 2012, Ruud Koolen (redlizard) made a first attempt to
77 have libc in Gentoo Prefix[6], and successfully made a functional
78 system[7]. It is, however, still calls for much work of
79 maintenance designs to co-exist with the present /rpath/ mechanism.
80
81
82 3 Root privilege in Gentoo Prefix
83 ==================================
84 One of the amazing feature of Gentoo Prefix is not needing root
85 privilege to use portage, the Gentoo package manager. However in
86 some cases, the user do have root privilege and still want to
87 install a Gentoo Prefix as normal user and give it root privilege
88 when necessary, such as setting suid root to some tools. At present
89 it is will result in a failure as portage run as a normal user will
90 refuse to do anything requiring root.
91
92 We want to add such a feature to portage: call sudo/su before
93 performing things requiring root. And such feature can be disabled
94 by configuration or USE flags.
95
96 4 GNU on Android
97 =================
98 Android is a Linux-based mobile operating system developed by
99 Google. It features a Java engine Dalvik as the central. The purpose
100 of Bionic, libc of Android, is to get Java engine compiled out.
101 Therefore Bionic is very thin and lacks of many features expected in
102 a GNU/Linux system. As a consequence, though Android has Linux
103 kernel, it is non-trivial to have a GNU environment along with it.
104
105 Mobile devices is getting more and more powerful. At the time of
106 writing (March 2013), dual/quadro-core Ghz-clocked ARM driven mobile
107 devices are widely available in the market. To unleash the full
108 potential, a complete GNU userland would be very useful and crucial
109 to provide desktop level user experience, with laptop docks
110 (Motorola Lapdock[8], ASUS Transformer[9]) and/or desktop
111 monitor via HDMI[10].
112
113 Several attempts exist and are surveyed as followed.
114
115 1. busybox. It uses static linked busybox to provide main tools
116 expected in a GNU environment[11]. It is straight forward to
117 deploy and accessible as App in Google Play[12]. But the
118 features provided is limited.
119
120 2. chrooted full distribution. We could install full GNU/Linux
121 distribution in a chroot environment, and even have a desktop
122 environment within a VNC server. We could access the local VNC
123 server with a VNC client from Android. It is well-received and
124 also available as App in Google Play[13][14]. The drawback of this
125 solution, however, is the overhead imposed by chroot and VNC
126 server. Furthermore, this approach will need root permission to
127 Android system.
128 3. native full distribution. Because Android system lies in /system
129 directory, top directories like /usr, /lib, /var, /etc required
130 by a typical GNU/Linux distribution are available. We can install
131 a full distribution to / in parallel to Android. This approach,
132 for example, Motorola Webtop and Debian[15][16], is not yet
133 wide spread yet, but it is at present the best solution we
134 have. It needs root permission to operate.
135
136 Gentoo Prefix, if powered with its own glibc, will give another
137 native solution here, and (surprise!) without the need of root
138 permission. It is also clean in the sense that all the GNU are
139 installed in a subdirectory.
140
141 It could be hard to bootstrap Gentoo Prefix on Android. One possible
142 way is to install a native full distribution and then bootstrap a
143 Gentoo Prefix with libc. We could distribute precompiled Gentoo
144 Prefix on Google Play for the general public.
145
146 5 Display sharing
147 ==================
148 Webtop 2.0 and prospective /Ubuntu for Android/, makes use of the
149 HDMI output for its X server. In such system SurfaceFlinger of
150 Android and X independently use two framebuffers, which in turn,
151 relies on two independent graphics outputs, namely local display and
152 HDMI.
153
154 It, however, would very helpful to have local display shared between
155 SurfaceFlinger and X. HDMI output with an external monitor is not
156 always available, and X on local display becomes killer application
157 on a Android tablet.
158
159 The feature can be realized by hacking framebuffer in kernel. Write
160 a void framebuffer driver, which can either drop the data written
161 into it or forward the data to another framebuffer. Controlling this
162 void framebuffer device via sysfs will allow userland to select real
163 source of framebuffer.
164
165 6 Integration of GNU and Android
166 =================================
167 Motorola has demonstrated a revolutional concept to have GNU and
168 Android integrated together. Its Webtop product, until version 2.0,
169 features a Ubuntu running aside Android and introduced a
170 data-exchange mechanism. In Webtop, user is presented with a Ubuntu
171 environment and have access to Android system as the same time.
172
173 Canonical claimed to carry on this concept further under the project
174 /Ubuntu for Android/[17] after Motorola has abandoned the
175 idea. Canonical does not give any technical details except
176 advertising. (The advertisement by Canaical itself is nice because
177 it presents the concept in a easy to understand way.) The author
178 personally suspect it would be only available on some special smart
179 phone models.
180
181 The Webtop 2.0 system, has several closed-source components to carry
182 out data-exchange between GNU and Android[18]. It would very nice
183 to have tools with the same purpose and available as free software.
184
185 7 Deliverables
186 ===============
187
188 7.1 Until Mid-Term
189 -------------------
190
191 7.1.1 Libc of Gentoo Prefix
192 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193 1. Merge redlizard's work of libc into mainstream Gentoo Prefix,
194 and work with Gentoo Prefix community for anything left.
195 2. Give user an option to choose and switch between host libc and
196 Prefix libc on Linux.
197
198 7.1.2 Root privilege in Gentoo Prefix
199 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200 1. Patch of portage for the feature of being able to escalate
201 itself to root privilege.
202
203 7.1.3 Gentoo Prefix on Android
204 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205 1. Distribute a native Gentoo installer (requiring root) as App on
206 Google Play.
207 2. Distribute a Gentoo Prefix installer (not needing root) as App
208 on Google Play.
209
210 Both being able to use HDMI output of Android device to run
211 Xorg. For Gentoo Prefix, this feature will require root privilege.
212
213 7.1.4 Timeline
214 ~~~~~~~~~~~~~~~
215 TBD
216
217 7.2 Until Final
218 ----------------
219
220 7.2.1 Display sharing
221 ~~~~~~~~~~~~~~~~~~~~~~
222 1. A void kernel framebuffer driver either drop the data written
223 into it or forward the data to another framebuffer.
224 - Document how to use it on a bootloader unlocked Android device.
225 2. Tools for both Android and GNU to switch which to display.
226 - Include the tools in Gentoo distributions at Google Play.
227 3. Clients to read the void framebuffer and display it as a stream
228 of video.
229
230 7.2.2 Integration of GNU and Android
231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232 This part is uncertain. We have no idea if Motorola or Canonical
233 would help. If not, reverse engineer the closed-source components
234 in Webtop 2.0. No estimation of time needed though.
235
236 7.2.3 Timeline
237 ~~~~~~~~~~~~~~~
238 TBD
239
240 8 Reference
241 ============
242 1. GenTop2 [http://forum.xda-developers.com/showthread.php?t=1617684]
243 2. linux-on-android: Port linux distributions to android-based phones [http://code.google.com/p/linux-on-android/]
244
245 [1] problems with bootstrapping in Gentoo-prefix [http://thread.gmane.org/gmane.linux.gentoo.alt/6459]
246
247
248 [2] emerge gcc 4.4.x/4.5.x fails on CentOS 5.5 [http://thread.gmane.org/gmane.linux.gentoo.alt/6110]
249
250
251 [3] >=sys-devel/gcc-4.3 fails with USE="-vanilla fortran" with some glibc's due to fortify patch [https://bugs.gentoo.org/289757]
252
253
254 [4] Multiarch [http://wiki.debian.org/Multiarch]
255
256
257 [5] PatchELF [http://nixos.org/patchelf.html]
258
259
260 [6] An expermental version of gentoo-prefix that uses a local libc [https://github.com/redlizard/gentoo-prefix-libc]
261
262
263 [7] glibc with prefix [http://article.gmane.org/gmane.linux.gentoo.alt/6543]
264
265
266 [8] Android Smart Phone Lapdock [http://www.motorola.com/us/consumers/Motorola-Lapdock-100/73945,en_US,pd.html]
267
268
269 [9] Transformer Pad Infinity [http://eee.asus.com/en/transformer-infinity/features]
270
271
272 [10] Webtop Achieved On Atrix Via HDMI Without A Dock [http://www.xda-developers.com/android/webtop-achieved-on-atrix-via-hdmi-without-a-dock/]
273
274
275 [11] A Busybox binary that is ready to be integrated into your Android project [https://github.com/Gnurou/busybox-android]
276
277
278 [12] BusyBox [https://play.google.com/store/apps/details?id=stericson.busybox]
279
280
281 [13] Linux Deploy [https://play.google.com/store/apps/details?id=ru.meefik.linuxdeploy]
282
283
284 [14] Linux on Android [http://linuxonandroid.org/]
285
286
287 [15] Debian Kit for Android [http://sven-ola.dyndns.org/repo/debian-kit-en.html]
288
289
290 [16] Debian Kit for Android [https://play.google.com/store/apps/details?id=org.dyndns.sven_ola.debian_kit]
291
292
293 [17] Ubuntu for Android [http://www.ubuntu.com/devices/android]
294
295
296 [18] analysis of webtop [https://sites.google.com/site/androidnothize/nebtop/webtop]

Replies

Subject Author
Re: [gentoo-soc] Project Idea: Gentoo On Android Rich Freeman <rich0@g.o>