[Tutorial] How to run Android projects from plain ARM linux, whitout installing Android (including startup scripts)

in #gridcoin7 years ago

While everything done can be perfectly done in a dev board, it will probably save headaches doing it on a x86 computer.

The first thing we will need for this is an android system suitable for our system. this will work just right :

https://www.odroid.in/mirror/dn.odroid.com/S905/Android/ODROID-C2/daily-odroidc2-eng-s905_6.0.1_master-92-v4.0.tar.gz .

We download it and extract it.

Now we need to uncompress the android system image. Fortunately, we have a tool for that, unfortunately, it is not on the repositories of many distributions. Ubuntu and Debian have one, Archlinux has it on the AUR, and for the rest of them you have this git repository : https://github.com/anestisb/android-simg2img

Once we have it ready we can apply it to our rootsystem.img, running it as : simg2img rootsystem.img rootsystem.ext4 . And now we can access it's data, as it's just a regular loop device.

So we create a directory : mkdir androidimg

And we mount it : mount -t ext4 -o loop rootsystem.ext4 androidimg

We do now need to copy these files to our dev board, so just plug any pen drive, sd and copy those files from the folder to it.

Assuming you have already copied that folder to your dev board and are now operating from it .

What it's now needed it's to create a chroot script.

So we create a file called setup-chroot.sh and we add these lines :

cd androidimg/
mount -o /etc/resolv.conf etc/resolv.conf
mount -t proc /proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/

and we move it to /usr/local/bin

Now we move on installing the android version of boinc. You could cross compile it yourself, but the easiest way its to download it from this link : https://boinc.berkeley.edu/dl/boinc_7.4.53.apk

And we extract it with unzip boinc_7.4.53.apk . And we pick the executables from arm64-v8a and we move them to androidimg/boinc .

We could now run it without problem, but it would be a lot more comfortable to automate it on boot.

So we go to /usr/lib/systemd/system/

and we create the file chroot-boinc.service

[Unit]
Description=chroot boinc service

[Service]
RootDirectory=/androidimg
ExecStartPre=/usr/local/bin/setup-chroot.sh
ExecStart=/boinc/boinc
RootDirectoryStartOnly=yes

So it will chroot into it every time it boots, and starts the boinc client.

To control the boinc client we will need to use boinccmd in the directory. So we do

chroot /androidimg

cd boinc

and now we can run boinccmd to pass the commands that we wish.

What most people will want is to synchronize with grcpool.

boinccmd --join_acct_mgr grcpool.com username password

(add the projects in grcpool.com)

boinccmd --quit_acct_mgr

boinccmd --join_acct_mgr grcpool.com username password

for not having to wait for it to synchronize.

Ask me any question you have.

Sort:  

Wow, don't even need to mess with app_info files!

You can solo you know , guides that seem to push people to use grcpool do not exist nor get created I guess..

Yes im aware, but you have to understand that if someone doesnt know how to use boinccmd, they dont know how to solo crunch.

Hi, I vanviso very interesting tutorial. Although, I think you are assuming that anyone how follows it is very familiar with Linux systems. But, what about those new people who want to get into mining and do not know anything about Linux or android. There are some parts where you use the word "files" and you do not mention the name of the files. In the fifth paragraph you say "Now we need to uncompress the android system image. Fortunately, we have a tool for that" it would be very helpful to have the names of the tools and the commands to retrieve and the commands to use the tool. Always remember when you are doing a tutorial that not everyone is an advance user. Especially if you are the first person writing a tutorial on the topic, you want to give as much information as possible.

Yea. Honestly, i didn't expect it to get this level of attention, just wanted to infodump and go away. Will work on it harder with better formating, photos and possibly a direct link to a android tarball, skips a few steps.

awesome. good info.