Android 9 on Raspberry Pi

Lineage OS is an Android 9 OS you can run on the Raspberry Pi 3 B. You can use it with a keyboard and mouse, and the UI behaves very similar to the mobile Android OS 9.

Useful keys are F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, F5 = Power, F11 = Volume down, and F12 = Volume up.

Grab the build available from here. After flashing and booting up, click Settings -> About tablet -> Click ‘Build number’  seven times to enable dev options.

Enable root access and the terminal in Settings -> System -> Developer options. Then the terminal app is in the tray (drag up from the bottom). In the terminal be sure to enable full screen in the settings and scroll up/wake up the menu bar to prevent weird scrolling behavior while typing in the terminal.

su root, to become root, no password.

You can compile c++ code on a separate Ubuntu machine and run it in the Android terminal like so:

On Ubuntu 18.04 Install (source):

sudo apt-get install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc

and

apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi

Normally you would compile with:

g++ helloworld.c -o helloworld_local

Now you can compile ​as shown here wit​h

arm-linux-gnueabi-g++ -static -march=armv7-a helloworld.c -o helloworld_arm

And to run it, you can throw the program on a usb stick, on the Raspberry Pi Android USB drives are visible once you’re root. You can copy files to /data/local/tmp/, change permissions with chmod ugo+x , and just execute it like ./helloworld_arm.

Surprisingly, if the architecture isn’t right, the error you can get on the Pi is sh: ./executable: not found even if file executable works!  The file response of a working executable is

ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0

Running `readelf​ -A helloworld_arm` shows:

Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_CPU_unaligned_access: v6

 

 

Published by ilzmaster

See www.ilyakavalerov.com .

One thought on “Android 9 on Raspberry Pi

Leave a comment