Gentoo Archives: gentoo-alt

From: heroxbd <heroxbd@×××××.com>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] Ideas for this year's Google Summer of Code
Date: Sun, 31 Mar 2013 06:28:50
Message-Id: 87hajs2icu.fsf@proton.in.awa.tohoku.ac.jp
1 Dear all,
2
3 I'd like to apply for Google SoC 2013 with a target of porting Gentoo
4 and Prefix to Android.
5
6 Here is my draft proposal. Please don't hesitate to give comments.
7
8 @redlizard, I am going to try out your newest prefix-libc again and
9 figure out how much work are left to be done :)
10
11 Cheers,
12 Benda
13
14 Gentoo On Android
15 =================
16
17 Author: heroxbd
18 Date: 2013-03-31 15:26:01 JST
19
20
21 Table of Contents
22 =================
23 1 Abstract
24 2 Libc in Gentoo Prefix
25 3 ARM keyword in Gentoo Prefix
26 4 Root privilege in Gentoo Prefix
27 5 GNU on Android
28 6 Deliverables
29 6.1 Libc of Gentoo Prefix
30 6.2 Optimize keywords in Prefix
31 6.3 Root privilege in Gentoo Prefix
32 6.4 Gentoo Prefix on Android
33 7 Reference
34
35
36 1 Abstract
37 ===========
38 This project is about running Gentoo natively on Android devices.
39
40 I am going to develop libc support and root permission handling in
41 Gentoo Prefix, and deploy the enhanced Gentoo Prefix in parallel to
42 Android userland in mobile devices, such as smart phone and
43 tablet. This will provide a full-featured native GNU userland to
44 Android system.
45
46 2 Libc in Gentoo Prefix
47 ========================
48 Gentoo Prefix is variant of Gentoo meta-distribution which installs
49 under normal user privilege a full Gentoo in a directory offset of
50 a Unix-like OS, such as HPUX, AIX, GNU/Linux, Interix, Mac OS X,
51 Solaris and Cygwin.
52
53 Traditionally, Gentoo Prefix uses kernel/libc and in some cases
54 compiler/linker from host OS. Problem arises in Linux/glibc based OS
55 when the version of glibc is too old, like RHEL/CentOS 5 and many
56 ancient GNU/Linux still in duty[1][2][3]. Therefore it has
57 been a dream of Gentoo Prefix community to have bleeding edge libc
58 to further reduce dependence on host while still being a Prefix (as
59 opposed to a virtual machine). It is technically accessible as
60 Debian multi-arch[4] and patchelf from nixOS[5] demonstrated
61 the use of /interp/ field of ELF to locate dynamic linker.
62
63 Around late 2012, Ruud Koolen (redlizard) made a first attempt to
64 have libc in Gentoo Prefix[6], and successfully made a functional
65 system[7]. It is, however, still calls for much work of
66 maintenance designs to co-exist with the present /rpath/ mechanism.
67
68 3 ARM keyword in Gentoo Prefix
69 ===============================
70 There has been discussions in Prefix team on how to treat Gentoo
71 Prefix on ARM Linux.
72
73 The most straight forward way is to introduce new keyword
74 "arm-linux" like before. The problem is that we have too many
75 keywords to look after in Prefix, adding a new one will make things
76 worse.
77
78 To save ourselves from too many keywords, we could interprete
79 keyword "arm" as both Prefix and vanilla Gentoo. Being a new
80 architecture, packages with "arm" keywords are recent and having a
81 higher probability to be trivially Prefix ready. The problem is that
82 there are corner cases, the keyword become vague when a package can
83 be used in vanilla Gentoo and not Prefix (though there is no such
84 example yet).
85
86 Provided we seamlessly support using glibc from Prefix on Linux
87 boxes, it is more favored to have "arm" representing both Prefix and
88 vanilla: under the same glibc, a package is less likely to break on
89 Prefix but not vanilla or vice versa.
90
91 Similarly, a package with has keyword "amd64 x86 amd64-linux", will
92 be almost certainly ready for "x86-linux". So we do have possibility
93 to reduce the keywords maintained by Prefix by digging out such
94 extrapolation after Prefix begins to use its own libc.
95
96 4 Root privilege in Gentoo Prefix
97 ==================================
98 One of the amazing feature of Gentoo Prefix is not needing root
99 privilege to use portage, the Gentoo package manager. However in
100 some cases, the user do have root privilege and still want to
101 install a Gentoo Prefix as normal user and give it root privilege
102 when necessary, such as setting suid root to some tools. At present
103 it is will result in a failure as portage run as a normal user will
104 refuse to do anything requiring root.
105
106 We want to add such a feature to portage: call sudo/su before
107 performing things requiring root. And such feature can be disabled
108 by configuration or USE flags.
109
110 5 GNU on Android
111 =================
112 Android is a Linux-based mobile operating system developed by
113 Google. It features a Java engine Dalvik as the central. The purpose
114 of Bionic, libc of Android, is to get Java engine compiled out.
115 Therefore Bionic is very thin and lacks of many features expected in
116 a GNU/Linux system. As a consequence, though Android has Linux
117 kernel, it is non-trivial to have a GNU environment along with it.
118
119 Mobile devices is getting more and more powerful. At the time of
120 writing (March 2013), dual/quadro-core Ghz-clocked ARM driven mobile
121 devices are widely available in the market. To unleash the full
122 potential, a complete GNU userland would be very useful and crucial
123 to provide desktop level user experience, with laptop docks
124 (Motorola Lapdock[8], ASUS Transformer[9]) and/or desktop
125 monitor via HDMI[10].
126
127 Several attempts exist and are surveyed as followed.
128
129 1. busybox. It uses static linked busybox to provide main tools
130 expected in a GNU environment[11]. It is straight forward to
131 deploy and accessible as App in Google Play[12]. But the
132 features provided is limited.
133
134 2. chrooted full distribution. We could install full GNU/Linux
135 distribution in a chroot environment, and even have a desktop
136 environment within a VNC server. We could access the local VNC
137 server with a VNC client from Android. It is well-received and
138 also available as App in Google Play[13][14]. The drawback of this
139 solution, however, is the overhead imposed by chroot and VNC
140 server. Furthermore, this approach will need root permission to
141 Android system.
142 3. native full distribution. Because Android system lies in /system
143 directory, top directories like /usr, /lib, /var, /etc required
144 by a typical GNU/Linux distribution are available. We can install
145 a full distribution to / in parallel to Android. This approach,
146 for example, Motorola Webtop and Debian[15][16], is not yet
147 wide spread yet, but it is at present the best solution we
148 have. It needs root permission to operate.
149
150 Gentoo Prefix, if powered with its own glibc, will give another
151 native solution here, and (surprise!) without the need of root
152 permission. It is also clean in the sense that all the GNU are
153 installed in a subdirectory.
154
155 It could be hard to bootstrap Gentoo Prefix on Android. One possible
156 way is to install a native full distribution and then bootstrap a
157 Gentoo Prefix with libc. We could distribute precompiled Gentoo
158 Prefix on Google Play for the general public.
159
160 6 Deliverables
161 ===============
162
163 6.1 Libc of Gentoo Prefix
164 --------------------------
165 1. Merge redlizard's work of libc into mainstream Gentoo Prefix,
166 and work with Gentoo Prefix community for anything left.
167 2. Give user an option to choose and switch between host libc and
168 Prefix libc on Linux.
169
170 6.2 Optimize keywords in Prefix
171 --------------------------------
172 1. New keyword scheme after libc inclusion
173 2. New prefix profiles for version 13.0
174
175 6.3 Root privilege in Gentoo Prefix
176 ------------------------------------
177 1. Patch of portage for the feature of being able to escalate
178 itself to root privilege.
179
180 6.4 Gentoo Prefix on Android
181 -----------------------------
182 1. Distribute a native Gentoo installer (requiring root) as App on
183 Google Play.
184 2. Distribute a Gentoo Prefix installer (not needing root) as App
185 on Google Play.
186
187 Both being able to use HDMI output of Android device to run
188 Xorg. For Gentoo Prefix, this feature will require root privilege.
189
190 7 Reference
191 ============
192 1. GenTop2 [http://forum.xda-developers.com/showthread.php?t=1617684]
193 2. linux-on-android: Port linux distributions to android-based phones [http://code.google.com/p/linux-on-android/]
194
195 [1] problems with bootstrapping in Gentoo-prefix [http://thread.gmane.org/gmane.linux.gentoo.alt/6459]
196
197
198 [2] emerge gcc 4.4.x/4.5.x fails on CentOS 5.5 [http://thread.gmane.org/gmane.linux.gentoo.alt/6110]
199
200
201 [3] >=sys-devel/gcc-4.3 fails with USE="-vanilla fortran" with some glibc's due to fortify patch [https://bugs.gentoo.org/289757]
202
203
204 [4] Multiarch [http://wiki.debian.org/Multiarch]
205
206
207 [5] PatchELF [http://nixos.org/patchelf.html]
208
209
210 [6] An expermental version of gentoo-prefix that uses a local libc [https://github.com/redlizard/gentoo-prefix-libc]
211
212
213 [7] glibc with prefix [http://article.gmane.org/gmane.linux.gentoo.alt/6543]
214
215
216 [8] Android Smart Phone Lapdock [http://www.motorola.com/us/consumers/Motorola-Lapdock-100/73945,en_US,pd.html]
217
218
219 [9] Transformer Pad Infinity [http://eee.asus.com/en/transformer-infinity/features]
220
221
222 [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/]
223
224
225 [11] A Busybox binary that is ready to be integrated into your Android project [https://github.com/Gnurou/busybox-android]
226
227
228 [12] BusyBox [https://play.google.com/store/apps/details?id=stericson.busybox]
229
230
231 [13] Linux Deploy [https://play.google.com/store/apps/details?id=ru.meefik.linuxdeploy]
232
233
234 [14] Linux on Android [http://linuxonandroid.org/]
235
236
237 [15] Debian Kit for Android [http://sven-ola.dyndns.org/repo/debian-kit-en.html]
238
239
240 [16] Debian Kit for Android [https://play.google.com/store/apps/details?id=org.dyndns.sven_ola.debian_kit]

Replies

Subject Author
[gentoo-alt] Re: Ideas for this year's Google Summer of Code heroxbd <heroxbd@×××××.com>