maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   ApkEnv support module development (https://talk.maemo.org/showthread.php?t=88250)

Akkumaru 2013-05-19 04:35

liar,can you do a video? ;) hope you are not what your username is..

thedead1440 2013-05-19 05:26

Re: ApkEnv support module development
 
Quote:

Originally Posted by Akkumaru (Post 1344727)
liar,can you do a video? ;) hope you are not what your username is..

He has contributed previously as well as developing the N64 emulator for us so just be patient for him to push his changes to thp ;)

liar 2013-05-23 20:13

Re: ApkEnv support module development
 
I've sent in a pull request. i hope there isn't much i need to change before it goes in :)

liar 2013-05-27 22:49

Re: ApkEnv support module development
 
EDIT:
i have managed to launch dalvikvm on my nokia n9 using a few hacks here and there, but most importantly: i can do this without openmode (i am running inception, but it should be possible in a standard installation too)
i am able to execute basic jar files now, and i've managed to initialize some internal stuff, like preloading classes:
...preloaded 2297 classes in 5637ms.

i still cannot launch activities though because i am lacking the knowledge on how to use some of the internal android classes.

what i can do so far is:
load the dalvikvm
initialize native methods (located in libandroid_runtime.so) and redirect then to harmattan native calls (all functions which apkenv supports until now and a few more)
preload some android classes
> until here everything is going the way it's supposed to be but thats it
i've tried manually loading activities from an apk file using dalvik.system.PathClassLoader and it works, i can call methods, but most of them fail (java exceptions) because this is not the way activities are supposed to be loaded

if somebody knows how it works please let me know
i am currently experimenting with ActivityThread

Ta76eem 2013-06-01 08:06

Re: ApkEnv support module development
 
I wrote this command :
Code:

apkenv --install /home/user/MyDocs/Apkenv/wogoo.apk
how to uninstall the game ?

Just486 2013-06-01 14:11

Re: ApkEnv support module development
 
Liar, can you please share further information about how to get Plants vs. Zombies work?
It uses an external data folder on Android. Where should we copy it?
Do we need anything else to launch the game?
Also, which version of the game are you able to execute?
(Or is the Humble Bundle version of PvZ completely different from other versions?)
Please give us, users some hint about it :)

liar 2013-06-01 15:39

Re: ApkEnv support module development
 
Quote:

Originally Posted by Just486 (Post 1348629)
Liar, can you please share further information about how to get Plants vs. Zombies work?
It uses an external data folder on Android. Where should we copy it?
Do we need anything else to launch the game?
Also, which version of the game are you able to execute?
(Or is the Humble Bundle version of PvZ completely different from other versions?)
Please give us, users some hint about it :)

files go to: /home/user/.apkenv/<pvzapkfilename>
i've used version 1.3.16 iirc

Just486 2013-06-01 17:10

Re: ApkEnv support module development
 
Thanky.
I tried various versions however, all of them skipping marmalade.apkenv.so and using the generic module instead.
I have
- marmalade.apkenv.so in /opt/apkenv/modules
- "files" folder in /home/user/.apkenv/pvz-test.apk
- pvz-test.apk (version 1.3.16, and others) in /MyDocs/Apkenv

and launching with code:

apkenv /home/user/MyDocs/Apkenv/pvz-test.apk

All I get is a "screenshot" of the last launched page (the terminal), and the log in terminal, claiming marmalade.apkenv.so (2) is loaded, but generic.apkenv.so (2) is being used.

Do you have any idea what am I doing wrong? (I also have the openframeworks.apkenv.so for Super Hexagon in /modules folder, if that counts.)

EDIT: If I remove generic.apkenv.so, it loads marmalade and gives the following info:
late-intializing errorcheck mutex (x3)
Segmentation fault

liar 2013-06-01 18:19

Re: ApkEnv support module development
 
that probably means you're missing the data files
if pvz-test.apk is your apkfilename then they have to be in:
/home/user/.apkenv/pvz-test.apk/
(don't forget the dot)

bandora 2013-06-01 18:24

Re: ApkEnv support module development
 
liar I suggeat PMing thp and collaborate with him.. He's the one to ask about this stuff.. Also this is exciting news.. Very exciting news!!! I am willing to donate some money for this to succeed.. I'm sure a lot of other people would do the same too! Best of luck..

Just486 2013-06-01 18:54

Re: ApkEnv support module development
 
Yes, my apk is pvz-test.apk
I tried the following pathes for data placement, none of them worked (all of them wrote "late-initializing errorcheck mutex" three times before "Segmentation fault")
/home/user/.apkenv/pvz-test.apk/com.popcap.pvz_na/files/
/home/user/.apkenv/pvz-test.apk/com.popcap.pvz/files/
/home/user/.apkenv/pvz-test.apk/files/
/home/user/.apkenv/pvz-test.apk/

after the last / all the folders contained:
music, userdata, video, AssetInfo.indicate, Downloaded.indicate, Downloaded2.indicate, PvZ.dz.

Am I doing something wrong?


EDIT: We can just dump the whole thing if I got too annoying :)

liar 2013-06-01 20:32

Re: ApkEnv support module development
 
Quote:

Originally Posted by Just486 (Post 1348713)
Yes, my apk is pvz-test.apk
I tried the following pathes for data placement, none of them worked (all of them wrote "late-initializing errorcheck mutex" three times before "Segmentation fault")
/home/user/.apkenv/pvz-test.apk/com.popcap.pvz_na/files/
/home/user/.apkenv/pvz-test.apk/com.popcap.pvz/files/
/home/user/.apkenv/pvz-test.apk/files/
/home/user/.apkenv/pvz-test.apk/

after the last / all the folders contained:
music, userdata, video, AssetInfo.indicate, Downloaded.indicate, Downloaded2.indicate, PvZ.dz.

Am I doing something wrong?


EDIT: We can just dump the whole thing if I got too annoying :)

i am not sure right now whats missing i haven't played it in a while
you might need to unpack PvZ.dz

liar 2013-06-01 20:59

Re: ApkEnv support module development
 
Quote:

Originally Posted by bandora (Post 1348705)
liar I suggeat PMing thp and collaborate with him.. He's the one to ask about this stuff.. Also this is exciting news.. Very exciting news!!! I am willing to donate some money for this to succeed.. I'm sure a lot of other people would do the same too! Best of luck..


you can always donate on my N64 thread, but i cannot guarantee that this'll ever be usable...
i've made some progress though, i've hooked a few methods in the dalvikvm to be more flexible, i've even been able to use the android package parser to get information out of an apk file, and i've been able initiate the launch process of an activity (ActivityThread, performActivityLaunch...) the next thing i need to fiddle with is surfaceflinger to get a window which the activity can render into

EDIT: binder is very annoying, don't know what i should do with that. i found some android sources: https://android.googlesource.com/ker...taging/android

EDIT: does anyone know where i can find the exact sources nitroid alpha 4 for n9 is based on?

liar 2013-06-05 23:11

Re: ApkEnv support module development
 
this just happened (java code trying to load a library):

Trying to load lib /home/user/apkenv/libdstfree.so 0x3b99b718
linker/linker.c:716| WARNING: `/home/user/apkenv/libdstfree.so` is not a prelinked library
0 mapped library 'libdstfree.so' to 40d15000 via kernel allocator.
Added shared lib /home/user/apkenv/libdstfree.so 0x3b99b718

but it's still crashing shortly afterwards ;), but there is at least a little bit of hope :)

Hariainm 2013-06-05 23:54

Re: ApkEnv support module development
 
liar, NITDroid is based on patched-AOSP sources i think. Maybe you may ask e-yes aka drunkdebugger here, in NITDroid forums or via twitter for tecnical information.

liar 2013-06-06 21:58

Re: ApkEnv support module development
 
i fear for now there is no way around binder. so either we have to stick with openmode or inception to get this going until we have some sort of userspace replacement for binder.

i've been able to "insmod" an adapted version of binder and it seems like it might work but i am still experimenting

thp 2013-06-07 15:26

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1350102)
i fear for now there is no way around binder. so either we have to stick with openmode or inception to get this going until we have some sort of userspace replacement for binder.

i've been able to "insmod" an adapted version of binder and it seems like it might work but i am still experimenting

What about using the Nitdroid PR1.3 kernel (I guess you have tried that already)? It does have all the Android features like /dev/binder and /dev/ashmem that are also accessible from Harmattan.

liar 2013-06-07 15:53

Re: ApkEnv support module development
 
Quote:

Originally Posted by thp (Post 1350287)
What about using the Nitdroid PR1.3 kernel (I guess you have tried that already)? It does have all the Android features like /dev/binder and /dev/ashmem that are also accessible from Harmattan.

oh i wasn't aware of that, i'm still gonna try with the stock kernel a little bit but...
with that it should be possible to launch zygote & system server and ultimatively launch activities without too much effort i think

EDIT: the kernel module seems to be working fine. but i couldn't figure out why system-server is crashing

thp 2013-06-08 10:47

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1350298)
oh i wasn't aware of that, i'm still gonna try with the stock kernel a little bit but...
with that it should be possible to launch zygote & system server and ultimatively launch activities without too much effort i think

EDIT: the kernel module seems to be working fine. but i couldn't figure out why system-server is crashing

The way I'd approach this is to first install Nitdroid in parallel with Harmattan, then after making sure that Nitdroid runs on its own, boot into Harmattan (where at that point you already have a working Android kernel, as it's needed for Nitdroid) and chroot into the Nitdroid directory and get it running (see this old blog post on how to run a simple "hello world").

The only other problem I see is that Android accesses /dev/fbX directly (similar for input events, etc..), whereas if we run it inside Harmattan, we probably want to redirect everything into a window. There's some work in this direction in the ParallelDroid project, maybe some things can be re-used from there.

liar 2013-06-08 13:24

Re: ApkEnv support module development
 
Quote:

Originally Posted by thp (Post 1350486)
The way I'd approach this is to first install Nitdroid in parallel with Harmattan, then after making sure that Nitdroid runs on its own, boot into Harmattan (where at that point you already have a working Android kernel, as it's needed for Nitdroid) and chroot into the Nitdroid directory and get it running (see this old blog post on how to run a simple "hello world").

The only other problem I see is that Android accesses /dev/fbX directly (similar for input events, etc..), whereas if we run it inside Harmattan, we probably want to redirect everything into a window. There's some work in this direction in the ParallelDroid project, maybe some things can be re-used from there.

with a modified apkenv i've been able to initialize zygote and system server process to the point where SurfaceFlinger is started and tries to initialize the graphics hardware. i thought it might be possible to hook up the surfaceflinger functions and simulate them (the same for other android services)

http://pastebin.com/y3v3cwkP
http://pastebin.com/UjAa6jF1
http://pastebin.com/8hDzTJFL

EDIT: i've been able to patch up surfaceflinger such that instead of accessing the hardware a X11 window is created and it uses that together with egl to draw to the screen
but the binder module fails, so i'm probably gonna try the nitdroid kernel next

liar 2013-06-11 10:30

Re: ApkEnv support module development
 
i've managed to get all the ipc stuff going, services like netd, installd, servicemanager work fine, i couldn't test my patched surfaceflinger yet, but there are many cases where it could fail. Zygote starts up fine, SystemManager initializes all the services until ConnectivityService which segfaults somewhere during initialisation and i am unable to figure out why

EDIT: i know that the crash is inside libnativehelper at address 0x20e58 (function start is at 0x20e34) (nitdroid alpha 4) which is actually inside libcore (i suspect), but unfortunately there seem to be no symbol names so i don't know what function that is and where it is called from
EDIT: found it, sockaddrToInetAddress
EDIT: the reason was a difference between bionic and glibc's addinfo
EDIT: so i got the main loop going, but rendering does not work yet

Just486 2013-06-14 10:25

Re: ApkEnv support module development
 
Just noticed that Plants Vs. Zombies only registers screen taps and as a result kinetic scrolling and drag&drop (for plants) does not work. This is something that should be fixed if possible. Liar, are you still interested in upgrading the marmalade, or you are now only focusing on this much bigger project with the Dalvik VM?

liar 2013-06-14 10:36

Re: ApkEnv support module development
 
Quote:

Originally Posted by Just486 (Post 1351944)
Just noticed that Plants Vs. Zombies only registers screen taps and as a result kinetic scrolling and drag&drop (for plants) does not work. This is something that should be fixed if possible. Liar, are you still interested in upgrading the marmalade, or you are now only focusing on this much bigger project with the Dalvik VM?

i've tried implementing it but my version failed for every game but DrawSomething, it seems to be obfuscated code, and i haven't had the motivation to figure it out. i'm still gonna work on apkenv because it works so smooth. running dalvikvm + the android services causes a lot of overhead, and i don't think it will ever run 100% flawless.

nokiabot 2013-06-14 11:45

Re: ApkEnv support module development
 
Are you guys working on getting dalvik vm working to some extent:eek:

liar 2013-06-14 13:19

Re: ApkEnv support module development
 
Quote:

Originally Posted by nokiabot (Post 1351962)
Are you guys working on getting dalvik vm working to some extent:eek:

just experimenting

nokiabot 2013-06-14 14:15

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1351985)
just experimenting

keep on experimenting :) who knows you guys devlop one on your own :)

liar 2013-06-19 00:55

Re: ApkEnv support module development
 
surfaceflinger & egl mess (emulator strings are just because i used code from there)

http://pastebin.com/pxyuk9Jb

liar 2013-06-28 15:33

Re: ApkEnv support module development
 
http://www.youtube.com/watch?v=5i9JVherUlk

does somebody know how to contact the author of this?

Hariainm 2013-06-28 16:21

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1355374)
http://www.youtube.com/watch?v=5i9JVherUlk

does somebody know how to contact the author of this?

Is that a chroot? the name suggests so. (chroid)

liar 2013-06-28 18:24

Re: ApkEnv support module development
 
i suppose it's a chroot, propably a similar approach as paralleldroid

coderus 2013-06-28 19:34

Re: ApkEnv support module development
 
@liar youtube link to weibo.com/chomper
check it with translator :) (its chinesse, i suppose)

bandora 2013-06-28 21:06

Re: ApkEnv support module development
 
I have a question, and I'm sorry if it's off-topic, but I was wondering if it's possible to create a module for Netflix? And what do one need to get it to work?

coderus 2013-06-29 12:32

Re: ApkEnv support module development
 
@bandora dalvik apps and system api not supported. only opengl and multimedia stuff.

nokiabot 2013-06-29 17:41

Re: ApkEnv support module development
 
Quote:

Originally Posted by coderus (Post 1355551)
@bandora dalvik apps and system api not supported. only opengl and multimedia stuff.

thanx for the simple explanation:) its just like webos games manager:)
btw in future do we have chances to see more? Someone is already testing dalvik though:)

coderus 2013-06-29 19:57

Re: ApkEnv support module development
 
I think there is no Vangas.

liar 2013-07-12 07:18

Re: ApkEnv support module development
 
i actually got it to render something, but currently it is limited to a 32x32 window size, because there is an issue with glTexImage2D

amr.fayz 2013-07-13 10:22

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1358418)
i actually got it to render something, but currently it is limited to a 32x32 window size, because there is an issue with glTexImage2D

see this

http://talk.maemo.org/showthread.php?p=1233116


http://www.opengl.org/wiki/Common_Mistakes#Texture_Unit

michaelmhk 2013-07-13 11:37

Re: ApkEnv support module development
 
Quote:

Originally Posted by liar (Post 1355374)
http://www.youtube.com/watch?v=5i9JVherUlk

does somebody know how to contact the author of this?

https://github.com/ChomperT

Hope this helps

It seems not yet release on WebOS

edit: Found the release thread(Chinese)
http://www.treo8.com/bbs/thread-264215-1-1.html
possible download link, don't know fake or not:
http://www.imsearchfile.com/info-abo.../515b934fh32i0

liar 2013-09-18 22:02

Re: ApkEnv support module development
 
for anybody who wants to experiment:

a simple way to use nitdroid binaries (kind of):

* fetch a copy of nitdroid, unpack it on your n9
* setup an android build environment (preferably matching the nitdroid version)
* cd into the folder where the android source code is of the binary you want to use
* rename the "main" function to something else (eg. app_process_main)
* setup a makefile to compile the project into a so library
* then you can load that library using android_dlopen inside an harmattan application and load the renamed "main" function using android_dlsym, also change the android linker you're using to find the libraries inside your nitdroid environment, so that the project you're trying to use gets properly linked against it's dependencies

EDIT: the reason you need to rename the main function is that gcc treats functions differently if they are named main.

i hope this is helpful

liar 2014-01-19 08:32

Re: ApkEnv support module development
 
i've been working on running android in a chroot similar to what chompers chroid does but i could use some help...

running android in a chroot on the n9:
1) you need a kernel which has these settings enabled:
Code:

CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ASHMEM=y

also fbearlysuspend should either be included in the kernel or this patch http://linux-arm.org/git?p=armdroid....ac2a0cb8dfc52e should be applied to surfaceflinger

the nitdroid dual boot kernel has all of this included and is probably the best starting point if you don't want to recompile a kernel or patch android stuff :)

2) download a copy of nitdroid, i used alpha4
3) extract it somewhere on your device
4) delete these files in the root directory of nitdroid
Code:

cd /path/to/nitdroid
rm init.nokiarm-680board.rc
rm init.nokiarm-696board.rc
rm ueventd.nokiarm-680board.rc
rm ueventd.nokiarm-696board.rc

5) a few more files need to be deleted in the /system/lib/hw/ directory
Code:

cd /path/to/nitdroid/system/lib/hw
rm *.sgx.so
rm *.omap3.so

6) then chroot into nitdroid
Code:

chroot /path/to/nitdroid
7) run init and watch what happens
Code:

/init


All times are GMT. The time now is 08:10.

vBulletin® Version 3.8.8