maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Running x86 programs on the n900. (https://talk.maemo.org/showthread.php?t=96170)

liar 2015-11-17 07:28

Running x86 programs on the n900.
 
Hi, i have managed to run maple on the n900 using qemu-i386 and native OpenJDK.

https://www.youtube.com/watch?v=MbtAgc1RU-4

Why? Because it was fun to try and i wanted to test the power of the n900.
I actually did this a few years ago while studying maths but just recently got another n900 so i thought i would try it again and share it with you. It is very easy to do :).


Which x86 apps would you like to see on the n900?

// HOWTO (in maemo SDK):
// in this howto i assume that MyDocs is ext3. if it is not either convert it or use different paths!
// this is independant of the app you want to run
// i had issues with qemu-kvm, therefore i built qemu myself

// install python2.7 and set up update-alternatives

$ git clone https://github.com/GNOME/glib
$ cd glib
$ git checkout glib-2-46
$ ./configure --enable-static
$ make -j4
$ make install
$ cd ..
$ git clone https://github.com/krnlyng/qemu
$ cd qemu
$ git checkout n900hacks
// system currently fails, i will look into it later
// static is because i am working with i386 chroots too
$ ./configure --static --prefix=/usr --disable-system
// if you only need i386 add --target-list=i386-linux-user to speed up the build
$ make -j4
$ make DESTDIR=~/qemuinstall install
$ cd ..
$ cd qemuinstall
$ tar czvf ../qemu_git.tar.gz usr/
// upload the resulting tar gz file to your phone
$ scp ../qemu_git.tar.gz user@phone:~/MyDocs

// on phone
$ sudo gainroot
# tar xzvf /home/user/MyDocs/qemu_git.tar.gz -C /
# using your favourite editor edit /usr/bin/binfmt_i386_init
// copy and paste:
Code:

#!/bin/sh
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register

// exit your editor
# binfmt_i386_init
# exit
// now you can run i386 applications

// IF YOU REBOOT
you have to execute binfmt_i386_init as root before you can start i386 applications

// OPTIONAL (but you most probably want to do this because without it there is not much use of qemu-i386)
// download an x86 chroot (choose your favourite distribution)
// or you can create one: https://wiki.debian.org/de/Debootstrap
// or for arch linux users like me: https://wiki.archlinux.org/index.php...existing_Linux
// (effectively: curl -O http://mirrors.kernel.org/archlinux/...-x86_64.tar.gz)
// tar it up (if not already), copy it to your n900 and untar (i used ~/MyDocs/root.i686)

// MAPLE
// this is maple specific
// for this the optional part from before is not optional ;)
// on your phone
// follow the instructions here: https://wiki.maemo.org/OpenJDK_6.0_0..._Labs)_on_N900
// note: the first two links are dead, use the third.
// on your desktop
// install maple 13 on an x86 machine, activate it.
// tar it up, copy it to your n900 and untar (i used ~/MyDocs/maple13_i386)
$ cd ~/MyDocs/maple13_i386/bin
// edit activation, maple, mint, xmaple
// in everyone of those files look for MAPLE=foo, replace it with MAPLE=/home/user/MyDocs/maple13_i386
// or use some fancy sed command ;)
// edit maple look for "bin.IBM_INTEL_LINUX")
// change MAPLE_JRE_BIN=foo to MAPLE_JRE_BIN="/opt/OpenJDK-camswl/jre/bin/"
// change JRE_ROOT=foo to JRE_ROOT="/opt/OpenJDK-camswl/jre/lib"
// change JRE_LIB3=foo to JRE_LIB3="$JRE_ROOT/arm/native_threads"
// edit maple13.desktop and replace Exec=foo with this:
Exec=/home/user/MyDocs/maple13_i386/bin/start_maple.sh
// create a new file in the current directory: start_maple.sh
// copy and paste this into the file (you have to replace root.i686 with your chroots name!):
Code:

#!/bin/sh

LD_LIBRARY_PATH=/home/user/MyDocs/root.i686/lib /home/user/MyDocs/maple13_i386/bin/xmaple

$ sudo gainroot
# cp maple13.desktop /usr/share/applications/hildon
# exit
// goto the app launcher and try it out :)

// IF YOU REBOOT
you have to execute binfmt_i386_init as root before you can start maple

aka_makaveli 2015-11-17 13:53

Re: Running x86 programs on the n900.
 
do you have any apps which you want to see on your N900? :)

Halftux 2015-11-17 17:14

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by liar (Post 1488327)
Hi, i have managed to run maple on the n900 using qemu-i386 and native OpenJDK.

Thats really nice could you make a tutorial or more precise steps?


Quote:

Originally Posted by liar (Post 1488327)
Which x86 apps would you like to see on the n900?

I would like to see matlab.

jellyroll 2015-11-17 17:59

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by liar (Post 1488327)
Which x86 apps would you like to see on the n900?

I would like to see NetworkMiner on the N900.

zerox 2015-11-17 18:02

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by liar (Post 1488327)
It is very easy to do :).

Great demo! Did you do something like this?

liar 2015-11-17 19:00

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by Halftux (Post 1488387)
Thats really nice could you make a tutorial or more precise steps?

i have updated my original post.

i will probably make deb packages or at least provide downloads... soon

Quote:

Originally Posted by Halftux (Post 1488387)
I would like to see matlab.

i will look into matlab :)

Quote:

Originally Posted by zerox (Post 1488394)
Great demo! Did you do something like this?

yes, that was my inspiration

Macros 2015-11-18 15:09

Re: Running x86 programs on the n900.
 
Thank you so much for posting this!

My favourite programming language only compiles on x86 and x64 and I so wanted to program on the way using my N900. Also I can adapt it for my raspberry.

Speed isn't of concern for the finished software, I am just curious how much it will influence the IDE experience.

I will try your guide next weekend.

liar 2015-11-20 07:28

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by jellyroll (Post 1488393)
I would like to see NetworkMiner on the N900.

as far as i can tell NetworkMiner is a windows application. getting x86 wine to work is a different story... but maybe i will try eventually :)

Brodyga 2015-11-20 14:15

Re: Running x86 programs on the n900.
 
Quote:

Originally Posted by liar (Post 1488673)
as far as i can tell NetworkMiner is a windows application. getting x86 wine to work is a different story... but maybe i will try eventually :)

It's very interesting. I'm looking forward


All times are GMT. The time now is 20:06.

vBulletin® Version 3.8.8