maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Fremantle] Android inside chroot (https://talk.maemo.org/showthread.php?t=92898)

lexik 2014-03-18 19:10

[Fremantle] Android inside chroot
 
This thread is continuation from brainstorming about chrooted-Android in this thread. So:

what?: the idea is the same (well, maybe a little different but still quite simmilar :)) as what easy-debian is doing with Debian, just with Android.
tl;dr: Android apps on Maemo!

why?: in order to run Android apps (.APKs) in the same way easy-debian is "emulating" (this is not emulation at all) apps from it's repos.
tl;dr: Because of Android apps?

how?: first of all we need chrooted (or "LXCded") Android (NITDroid probably, or some "cropped" version of it). Steps (aka TODO):
  • Patch Maemo kernel with Android features / modules. [WIP]
  • Compile LXC for Fremantle.
  • Make Android run inside LXC.
  • Modify pakesson's ParallelDroid, so it will render Android apps to the Maemo window.
  • Profit!
<- tl;dr version for this not avaible..

So far, everything up to here, was done by thp. Also, liar has made some progress in this area (on Harmattan, as thp).

Chroid is simmilar project for WebOS.
Most promising is ParallelDroid by pakesson. -- GitHub.
(Thanks Hurrian for mentioning this!)

Progress:
  • I'm trying to contact alex from N900 NITDroid dev team, because the N15 link provided by him is down. I recommend to wait, as N15 is really interesting, and seem to provide many interesting features, bugfixes etc. <- there were bugs inside N15. Let's use N14 for now, later upgrade to N15 will probably not broke anything.

I will update continually this thread / post with more info. Expect lot of problems, bugs & glitches soon! :)
Also feel free to ask, answer and share your thoughts.

(If you want to test - there is nothing to test as of now, but if you want to develop, install scratchbox & grab a copy of NITDroid. And Go!)

reinob 2014-03-19 09:57

Re: [Fremantle] Android inside chroot
 
doesn't android require a not-really-linux kernel? (or am I still living in the past?)

if so, this would require adapting fremantle first to run on android kernels.

Half-Life_4_Life 2014-03-19 10:41

Re: [Fremantle] Android inside chroot
 
Wow, how much I've missed NITDroid... If this will work it will be really cool! :)

lexik 2014-03-19 11:09

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by reinob (Post 1417631)
doesn't android require a not-really-linux kernel? (or am I still living in the past?)

if so, this would require adapting fremantle first to run on android kernels.

Well, as we are not trying to "run" Android itself, just chroot inside him, so it will look like Android for it's apps & services, is some kernel-work really needed?

In easy-debian, the Maemo kernel is still used & so is in chrooted-BackTrack etc. Also thp's procedure isn't saying anything about kernel-moding.

Is Dalvik somehow connected to specific features of Android kernel?

reinob 2014-03-19 11:39

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by lexik (Post 1417644)
Well, as we are not trying to "run" Android itself, just chroot inside him, so it will look like Android for it's apps & services, is some kernel-work really needed?

Well, look at it this way: why does Android use a non-Linux kernel? If it wasn't really necessary, why do they do it?

(hint: power management in Android is so FUBAR that they actually need this kernel "tweaks").

Quote:

In easy-debian, the Maemo kernel is still used & so is in chrooted-BackTrack etc. Also thp's procedure isn't saying anything about kernel-moding.
Well thank $DEITY Maemo is, contrary to Android, still good-old Linux. It may not be upstream, but Maemo runs on Linux (as in "kernel") and Linux (as in "distribution") runs on Maemo-kernel.

Android is not a Linux distribution.

Quote:

Is Dalvik somehow connected to specific features of Android kernel?
I don't know (nor do I care, just I don't care for crippling a phone with Android).

But if you're initiating this project, perhaps you should investigate this :)

DDark 2014-03-19 11:52

Re: [Fremantle] Android inside chroot
 
Maybe it's better to run it inside VM. I heard that Xen got ARM support.

lexik 2014-03-19 12:06

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by DDark (Post 1417650)
Maybe it's better to run it inside VM. I heard that Xen got ARM support.

If we are talking about N900, VM with Android is sci-fi because of performance.

Hurrian 2014-03-19 12:15

Re: [Fremantle] Android inside chroot
 
This is exactly what you want to do.

Some talking points:
  • There is already an Android kernel adaptation for N900
  • Fremantle uses GTK
  • You can do exactly what he did, on ARM

lexik 2014-03-19 12:30

Re: [Fremantle] Android inside chroot
 
Yes!

I've seen a comment about paralleldroid by thp on his blog.
Thanks!

reinob 2014-03-19 12:59

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by Hurrian (Post 1417658)
This is exactly what you want to do.

Some talking points:
  • There is already an Android kernel adaptation for N900
  • Fremantle uses GTK
  • You can do exactly what he did, on ARM

Quote from the linked page: "You’ll need a kernel with the Android patches (binder, ashmem, logger etc.)"

You say there is an "Android kernel adaptation for N900". I take that to mean you can run Android on the N900 natively (Nitdroid, I guess).

However the goal of this project is Android running inside Fremantle.
Neither Fremantle will run on Android kernel nor Android will run on Fremantle kernel.

I think that sorta sums it up good enough.

reinob 2014-03-19 13:01

Re: [Fremantle] Android inside chroot
 
Note:

This (http://whiteboard.ping.se/Android/Debian) = running Android system on a Debian chroot itself running on Android kernel might be something cool to do on our N900s (or a laptop, or whatever).

lexik 2014-03-19 13:25

Re: [Fremantle] Android inside chroot
 
http://logs.nslu2-linux.org/livelogs...o.20131109.txt

< list of Android drivers needed anyone / anywhere?

Including them in kernel-power is no-go, but what about hybrid of nitdroid-kernel and kp.
nitdroid-kernel is on Gitorious.

From here: binder, ashmem, pmem, logger, wakelocks, oom handling?

marmistrz 2014-03-19 13:53

Re: [Fremantle] Android inside chroot
 
If you need an Android-kernel on which no Linux will run, then how can you run Android apps on Jolla?

wicket 2014-03-19 17:44

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by reinob (Post 1417648)
doesn't android require a not-really-linux kernel? (or am I still living in the past?)

Android uses a fork of the Linux kernel. It's still very much a Linux kernel and many of their changes have been accepted upstream so things have improved in this regard. Of course the N900 kernel (stock and power) are too old and do not include these upstream changes but freemangordon, pali and others have recent kernels booting on the N900 (not yet complete) so this would be a good starting point for running Android and should require fewer patches.

Quote:

Originally Posted by DDark (Post 1417650)
Maybe it's better to run it inside VM. I heard that Xen got ARM support.

Xen on ARM is still experimental but you can forget about running a Xen VM of Android on the N900 with only 256MB RAM.

Quote:

Originally Posted by lexik (Post 1417513)
how?: first of all we need chrooted Android (NITDroid probably, or some "cropped" version of it) and running Dalvik. Then?

A more elegant option than your bog-standard chroot would be to use LXC (which has been described as a "chroot on steroids"). LXC "boots" the OS inside the chroot so you're more likely to have an environment that resembles a normal Android system. Your normal chroot would require many hacks to provide host OS (Maemo) components in the Android chroot. LXC already has ways of taking care of this. There has already been some success in running Android under LXC, but as the blog post says, "it really depends on what you want to do with it".

Quote:

Originally Posted by Hurrian (Post 1417658)
This is exactly what you want to do.

Some talking points:
  • There is already an Android kernel adaptation for N900
  • Fremantle uses GTK
  • You can do exactly what he did, on ARM

This is an interesting possibility. Perhaps this can be used in combination with LXC to display the Android container in a Maemo window.

Quote:

Originally Posted by marmistrz (Post 1417679)
If you need an Android-kernel on which no Linux will run, then how can you run Android apps on Jolla?

The Jolla device uses an Android kernel which is why it suffers from crippled static power management.

marmistrz 2014-03-19 19:27

Re: [Fremantle] Android inside chroot
 
Supposed there is static pm missing, what would happen while trying to run an Android app? //edit: Can't our Linux kernel take care of whole power management and our Dalvik app just let be controlled?

taixzo 2014-03-19 19:50

Re: [Fremantle] Android inside chroot
 
Is it possible to give access to hardware components (e.g. accelerometer, GPU, etc) to something in a LXC container? If so, could the nested Android have hardware acceleration? It makes Android apps so much more usable on the N900.

lexik 2014-03-19 20:04

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by taixzo (Post 1417722)
Is it possible to give access to hardware components (e.g. accelerometer, GPU, etc) to something in a LXC container? If so, could the nested Android have hardware acceleration? It makes Android apps so much more usable on the N900.

Correct me if I'm wrong, but yes, as we are not emulating anything. Drivers are still needed inside (and outside) the LXC, because chrooted system has no knowledge about it's HW.

Here is some stuff about direct rendering (simillar).

Alecsandru 2014-03-19 20:23

Re: [Fremantle] Android inside chroot
 
So basically we need to load android drivers in maemo chroot and use the maemo for chroot ,easy to tell , hard to do.
But how do you start the android kernel in chroot?
Asumed you have done that do you need to bind maemo to the android kernel&dalvik vm for installing and running the apps ? or do you need to use the full chroot , run full android and apps in that chroot?

Android_808 2014-03-19 22:15

Re: [Fremantle] Android inside chroot
 
AIUI, LXC containers share the same kernel still - see Oracle documentation on LXC

In that case your now looking at patching host kernel to enable Android, which I dare say is going to break a few things a long the way. If that's the case I'd start looking at a Sailfish approach by running libhybris, if only for the possibility of detaching MCE and co from N900 specifics to allow porting to other devices. Problem is how much RAM and performance loss your going to see.

taixzo 2014-03-19 22:23

Re: [Fremantle] Android inside chroot
 
If the container has the same kernel, does that mean it has to load two sets of drivers for everything? Or are the android drivers only loaded inside the LXC container?

Alecsandru 2014-03-19 22:31

Re: [Fremantle] Android inside chroot
 
and why the drivers (the camera one and others ) were patched to work in android(jolla) if they share the same kernel , i don°t think they share the same drivers , the layer + adaptation between them we need , there are more chances to make that available to n900 than to run maemo on other hardware , by the way why alien dalvik won°t run on kernels prior to 3.x.x (jolla , leaving qualcomm s**t aside) , from what I remember it was demoed on n900 , that phone was with a updated kernel? or our kernel was patched?

PrisonPlanet 2014-03-20 00:22

Re: [Fremantle] Android inside chroot
 
This is very cool - looking forward to this hack! :D

I'll be glad to test something if you will need more people.

wicket 2014-03-20 02:38

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by marmistrz (Post 1417718)
Can't our Linux kernel take care of whole power management and our Dalvik app just let be controlled?

That's a possibility but I wouldn't worry about that right now. Just get something working first.

Quote:

Originally Posted by lexik (Post 1417725)
Correct me if I'm wrong, but yes, as we are not emulating anything. Drivers are still needed inside (and outside) the LXC, because chrooted system has no knowledge about it's HW.

Spot on.

Quote:

Originally Posted by Android_808 (Post 1417734)
AIUI, LXC containers share the same kernel still - see Oracle documentation on LXC

Correct.

Quote:

Originally Posted by Android_808 (Post 1417734)
In that case your now looking at patching host kernel to enable Android, which I dare say is going to break a few things a long the way.

That was always going to be the situation, even with a normal chroot. It's not possible to run multiple kernels without a hypervisor.

Quote:

Originally Posted by Android_808 (Post 1417734)
If that's the case I'd start looking at a Sailfish approach by running libhybris, if only for the possibility of detaching MCE and co from N900 specifics to allow porting to other devices.

libhybris shouldn't be needed. The kernel and drivers will be running under Maemo with glibc and will continue to talk to the hardware as normal.

Quote:

Originally Posted by Android_808 (Post 1417734)
Problem is how much RAM and performance loss your going to see.

The big advantage of OS-level virtualisation is that there is little or no overhead. It will only use whatever is normally used by Android.

Quote:

Originally Posted by taixzo (Post 1417735)
If the container has the same kernel, does that mean it has to load two sets of drivers for everything? Or are the android drivers only loaded inside the LXC container?

Drivers (kernel modules) are an extension to the kernel hence they will be provided (shared) by the host OS. If there are any userspace drivers they would have to be loaded inside the container.

Quote:

Originally Posted by Alecsandru (Post 1417738)
and why the drivers (the camera one and others ) were patched to work in android(jolla) if they share the same kernel , i don°t think they share the same drivers

I'm not familiar with Android/Jolla patches and without knowing the details I can only speculate but it's possible that they were userspace drivers.

Quote:

Originally Posted by Alecsandru (Post 1417738)
by the way why alien dalvik won°t run on kernels prior to 3.x.x (jolla , leaving qualcomm s**t aside) , from what I remember it was demoed on n900 , that phone was with a updated kernel? or our kernel was patched?

That demo was a long time ago so it would have been based on an older version of Android running a 2.6 kernel, most likely patched.

Hurrian 2014-03-20 05:59

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by reinob (Post 1417667)
Quote from the linked page: "You’ll need a kernel with the Android patches (binder, ashmem, logger etc.)"

[...]

Neither Fremantle will run on Android kernel nor Android will run on Fremantle kernel.

I think that sorta sums it up good enough.

As on Harmattan, the systems runs okay enough even with Android drivers enabled and loaded - no app uses them, so they're left well alone ;)

And the same situation in reverse - on my Android device, I can stop Zygote, take control of the framebuffer, and start Xorg with the GNU Userland from a terminal.

Quote:

Originally Posted by marmistrz (Post 1417718)
Supposed there is static pm missing, what would happen while trying to run an Android app? //edit: Can't our Linux kernel take care of whole power management and our Dalvik app just let be controlled?

Assuming that Android runs inside Maemo via ParallelDroid, and static PM support isn't available, Maemo's (IMO superior) dynamic power control will reign supreme.

Alecsandru 2014-03-20 06:26

Re: [Fremantle] Android inside chroot
 
so , let"s start with kernel , what patches and how to compile them without breaking maemo?

taixzo 2014-03-20 06:41

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by Alecsandru (Post 1417764)
so , let"s start with kernel , what patches and how to compile them without breaking maemo?

Can't Maemo run on the Nitdroid kernel? If so, that would be a good place to look.

foobar 2014-03-20 17:22

Re: [Fremantle] Android inside chroot
 
I'd say help freemangordon, pali, et al. to run maemo on 3.x kernels, then go from there.
Win-win for everyone.

lexik 2014-03-20 18:43

Re: [Fremantle] Android inside chroot
 
Well, I was trying to compile LXC and when generating configure by running ./autogen.sh I'm getting:

aclocal: configure.ac: 205: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 219: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 234: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 252: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 269: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 304: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 315: macro `AM_COND_IF' not found in library
aclocal: configure.ac: 377: macro `AM_COND_IF' not found in library


That's probably related to old version of autoconf used in scratchox. Will update & report.

<- solved by downloading .tar.gz tarball & running configure directly.

Another error log, when running make:

In file included from lxc_attach.c:37:
utils.h:56: error: static declaration of 'setns' follows non-static declaration
/usr/include/bits/sched.h:91: error: previous declaration of 'setns' was here

Ideas? <- caused by broken version of libc6 from previous projects. Reinstalling whole scratchbox, will let you know soon :)

#lexik

marmistrz 2014-03-20 19:35

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by Hurrian (Post 1417761)
Assuming that Android runs inside Maemo via ParallelDroid, and static PM support isn't available, Maemo's (IMO superior) dynamic power control will reign supreme.

So what's this whole kernel discussion for? This would mean we don't need those static PM patches... And lexik, don't get scared by any "It won't work" posts. The same was said about Harmattan, that Harmattan apps won't work on Fremantle (hard/soft float)

Alecsandru 2014-03-20 19:52

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by foobar (Post 1417867)
I'd say help freemangordon, pali, et al. to run maemo on 3.x kernels, then go from there.
Win-win for everyone.

that it°s a longshoot , it should be more easy to apply to our kernel instead of the 3.x.x one due to missing drivers in the last one

lexik 2014-03-22 12:46

Re: [Fremantle] Android inside chroot
 
The first thing you’ll need if you want to do this is get your machine to run an Android kernel, you’ll need to have any modules needed by Android built and loaded before you can start the container.

The Android kernel, is not necessary, if we will have the kernel modules (.ko) compiled & loaded, I guess. I'm going to test it first on my x86 machine.

Alecsandru 2014-03-22 14:43

Re: [Fremantle] Android inside chroot
 
the nitdroid modules need to be recompiled(or the maemo kernel) , you can°t load maemo modules in nitdroid kernel (tried that) , loading nitdroid modules in maemo i didn°t try yet

lexik 2014-03-22 14:51

Re: [Fremantle] Android inside chroot
 
loading nitdroid modules in maemo i didn°t try yet

That's what I want to try :)
What's the specific problem in loading fremantle modules & drivers into Nitdroid?

Alecsandru 2014-03-22 15:06

Re: [Fremantle] Android inside chroot
 
i didn°t remember the output , that was long time ago, install nitdroid and try to load modules , replacing or renaming them

marmistrz 2014-03-22 17:16

Re: [Fremantle] Android inside chroot
 
Why do we need those Android kernel modules, if our dynamic pm can rule supreme?

Alecsandru 2014-03-22 18:04

Re: [Fremantle] Android inside chroot
 
we need that for dalvik , not all of them , pm-power management?
or maybe libdvm.so for maemo + other changes ?:confused:

marmistrz 2014-03-22 18:06

Re: [Fremantle] Android inside chroot
 
Quote:

Originally Posted by Alecsandru (Post 1418076)
we need that for dalvik , not all of them , pm-power management?

Dalvik links against kernel modules? So how would have thp launched a Dalvik hello world without Android kernel modules?

Yes, pm = power management.

Alecsandru 2014-03-22 18:08

Re: [Fremantle] Android inside chroot
 
if you show-me a complex app runed by thp I will agree with you

marmistrz 2014-03-22 18:11

Re: [Fremantle] Android inside chroot
 
I can't point such an app :)
Won't an error message be shown if a kernel module is missing?

Alecsandru 2014-03-22 18:14

Re: [Fremantle] Android inside chroot
 
compiling a module for each app isn°t the road ,and the games runned by apkenv aren°t dalvik apps , even those are using nitdroid modules , not maemo ones


All times are GMT. The time now is 12:49.

vBulletin® Version 3.8.8