RPI: Android 9 Pie on Raspberry Pi 3B & 3B+

Raspberry Pi 3B+ can also run Android Pie now!

  • Update 2019-04-25 Upload system image and How to video to github.com

Any one can download image from github.com: https://github.com/brobwind/pie-device-brobwind-rpi3-binary

A video about how to flash and extend userdata partition also included.

  • Update 2019-03-03 Update kernel image and upload all source code

Download link: 2019_03_02_rpi3_13fa200.bin.gz

The u-boot, kernel, OpenGL driver has been upload to github.com, you can download code by executing following command:

$ pushd device/brobwind/rpi3 && git pull && popd
$ repo sync -c

Antutu benchmark on Raspberry Pi 3 Model B+:

And Geekbench 4 on Raspbery Pi 3 Model B+:

  • Update 2019-02-17 Antutu benchmark

Today, I try to run Antutu benchmark app to check the RPi 3B & 3B+ performance, then discover the sores are almost the same. There must be something wrong, then I decided to check the CPU frequency from /sys/devices/system/cpu/, but there is not cpufreq related items. The next step is rebuild the bcm2835 cpufreq module and figure out the actual running frequency. Finally it turns out  both RPi 3B & 3B+ CPU frequency at 600MHz x 4。

  • Update 2019-01-26

GUI: OpenGL based on mesa3d and hardware composer based on drm

Audio: support a2dp and on-board audio jack

Knowing issue:

1. Enable `Debug GPU overdraw’ in system settings will make app crash

2. Enable `Debug non-retangular clip operations’ in system settings will make app crash

3. Do not disable `Disable HW overlays’ in system settings

4. Audio over HDMI not support

5. Can not play video

Download link:  2019_01_25_rpi3_a586f2b.bin.gz

  • Feature:

1. Bootloader: u-boot as AndroidThings on RPi 3B v.1.0.4, run on 64-bit mode

2. Kernel: v.4.14.71 run on 64-bit mode

3. Display: 720p(1280×720) @ 60Hz through on board HDMI port

4. Audio:  analog, 2 channel through on board audio jack

5. WiFi: 2.4G (RPi 3B & 3B+), 5G (RPi 3B+)

6. Bluetooth: HCI over UART(ttyAMA0), RPi 3B: 921600bps no flow control; RPi 3B+: 3000000bps with flow control

7. Ethernet: both work, and IP from DHCP

8. OpenGL render:  Skia GL, swiftshader

2018_12_02_launcher3 2018_12_02_settings 2018_12_02_settings_about

  • Knowing issue:

1. External storage (sdcard) no function due to not kernel sdcardfs driver support

2. Bluetooth: Can bind device, ble gatt profile works, pan profile do not work due to not permission to create bt-pan device

3. Network: RPi 3B+: while Ethernet online, WiFi network can not connect; The eth0 device can not auto down while eject the cable

4. Bitmap: The hardware bitmap will miss draw both on Skia GL and OpenGL

5. The device can not go to sleep mode or the Wifi driver will run with error

  • Partition
Disk rpi3b.bin: 8388608 sectors, 4.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9884F86F-891D-4DD9-B2C8-6277BC24DC26
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 8388574
Partitions will be aligned on 8-sector boundaries
Total free space is 1504957 sectors (734.8 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          131111   64.0 MiB    FFFF  rpiboot
   2          131112          133159   1024.0 KiB  FFFF  uboot_a
   3          133160          135207   1024.0 KiB  FFFF  uboot_b
   4          135208          200743   32.0 MiB    FFFF  boot_a
   5          200744          266279   32.0 MiB    FFFF  boot_b
   6          266280         1597479   650.0 MiB   FFFF  system_a
   7         1597480         2928679   650.0 MiB   FFFF  system_b
   8         2928680         2928807   64.0 KiB    FFFF  vbmeta_a
   9         2928808         2928935   64.0 KiB    FFFF  vbmeta_b
  10         2928936         2930983   1024.0 KiB  FFFF  misc
  11         2930984         3455271   256.0 MiB   FFFF  vendor_a
  12         3455272         3979559   256.0 MiB   FFFF  vendor_b
  13         3979560         3987751   4.0 MiB     FFFF  oem_bootloader_a
  14         3987752         3995943   4.0 MiB     FFFF  oem_bootloader_b
  15         3995944         4000039   2.0 MiB     FFFF  frp
  16         4000040         4786471   384.0 MiB   FFFF  swap
  17         4786472         6883623   1024.0 MiB  FFFF  userdata
  • Source code

Source(partial) has been uploaded to github: https://github.com/brobwind/pie-device-brobwind-rpi3

You can build your own OS now.

  • Download

1. 2018_12_02_rpi3b_4117784.zip

2. 2019_01_25_rpi3_a586f2b.bin.gz (With hardware acceleration)

3. 2019_03_02_rpi3_13fa200.bin.gz (With hardware acceleration CPU @ 1.4GHz for Raspbery Pi 3 Model B+)

  • Flash image
$ sudo dd if=rpi3b_4117784.img of=/dev/to/flash bs=4MiB


《RPI: Android 9 Pie on Raspberry Pi 3B & 3B+》有33个想法

    1. The aosp_arm target should have built-in support swiftshader. Due to bad UI performance in rpi3b & b+, I am trying porting GPU acceleration stuff (based on mesa3d) and it almost work.

      1. Hi Hzak,

        It’s good to hear Android 9.0 is working in RPI 3B. I have downloaded ANDROID PIE(9.0.0_R8).
        Could you please share your modification to us. I will append your modifications and I will start building.


  1. Once generated the IMGs how to make them a bin to flash or an img to flash? Thank you for your code.

    PS: I have applied all the patches to enable the video playback on CPU and I want to test it out, thanks!

    1. You can get the instructions from https://github.com/brobwind/pie-device-brobwind-rpi3-u-boot/blob/master/README.md
      or flash the images directly to the partition(ex. uses dd command on ubuntu: dd if=rpiboot.img of=/dev/sda1 bs=4MiB):
      rpiboot.img -> 1st partition
      boot.img -> 4th partition
      system.img -> 6th partition
      vendor.img -> 11th partition

      Nice work, making the video playback on it!


      1. Hi,
        some questions about write the new build image:
        after execute create_partition_table.sh the partitions are fine.
        dd if=out/target/product/rpi3/system.img of=/dev/sdb6
        give me following error:
        [ 3.298934] No filesystem could mount root, tried:
        [ 3.298943] ext4
        [ 3.303940]
        [ 3.307444] Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(179,6)
        [ 3.316016] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.61-v8+ #4
        [ 3.322465] Hardware name: Raspberry Pi 3 Model B Plus Rev 1.3 (DT)
        [ 3.328826] Call trace:
        [ 3.331323] [] dump_backtrace+0x0/0x274
        [ 3.336808] [] show_stack+0x20/0x28
        [ 3.341938] [] dump_stack+0xa4/0xdc
        [ 3.347071] [] panic+0x14c/0x2a4
        [ 3.351941] [] mount_block_root+0x2b8/0x2e8
        [ 3.357775] [] mount_root+0x7c/0x8c
        [ 3.362907] [] prepare_namespace+0x17c/0x1c4
        [ 3.368832] [] kernel_init_freeable+0x234/0x26c
        [ 3.375020] [] kernel_init+0x18/0x148
        [ 3.380327] [] ret_from_fork+0x10/0x18
        [ 3.385726] SMP: stopping secondary CPUs
        [ 3.389716] Kernel Offset: 0x1b40400000 from 0xffffff8008000000
        [ 3.395725] CPU features: 0x0802004
        [ 3.399264] Memory Limit: none
        [ 3.402379] Rebooting in 5 seconds..

        Any tips for me ??

        1. I think you TF card can not work in the kernel boot up phase.
          Since The TF card clock will be over clocked from 50MHz to 84MHz, you have to choose a better TF card.
          Or just remove the “dtoverlay=sdtweak,overclock_50=84” in the config.txt at the rpiboot (1st) partition.

          1. Hi,

            Thanks for your good work. I wonder how 2019_03_02_rpi3_13fa200.bin was created? Did you use a script for that? Where is it in that case?

          2. Thank you! It’s very interesting to make it work.
            Following steps make the binary:
            $ dd if=/dev/zero of=rpi3_4g.bin bs=$((1024*1024*1024)) count=4 # create 4GiB bin
            $ device/brobwind/rpi3/boot/create_partition_table.sh rpi3_4g.bin # create partition table and bundle images
            $ dd if=/rpi3_4g.bin of=rpi3_4g_trunc.bin bs=512 count=4786480 # reserved 4KiB userdata partition, it will be formated to ext4 filesystem while system bootup

  2. Patches for Raspberry Pi 3 Android:

    Patch frameworks/native/opengl/libs/EGL/eglApi.cpp
    – format = HAL_PIXEL_FORMAT_RGBA_8888;
    + format = HAL_PIXEL_FORMAT_BGRA_8888;

    Patch frameworks/base/opengl/java/android/opengl/GLSurfaceView.java
    – super(8, 8, 8, 0, withDepthBuffer ? 16 : 0, 0);
    + super(8, 8, 8, 8, withDepthBuffer ? 24 : 0, 0);

    and enable software video decoder patch with:


    case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
    – halFormat = HAL_PIXEL_FORMAT_YV12;
    – bufWidth = (mCropWidth + 1) & ~1;
    – bufHeight = (mCropHeight + 1) & ~1;

  3. A more generalistic guide on compiling the sources, it uses less space and it is fast:

    sudo apt-get install git-core gnupg flex bison gperf build-essential curl gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip openjdk-8-jdk android-tools-adb bc g++-multilib gcc-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc yasm zip zlib1g-dev python python-mako

    mkdir -p ~/bin
    wget ‘https://storage.googleapis.com/git-repo-downloads/repo’ -P ~/bin
    chmod a+x ~/bin/repo

    git config –global user.name yourname
    git config –global user.email youremail

    cd bin

    repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r33 –depth=1

    mkdir -pv device/brobwind
    git clone git://github.com/brobwind/pie-device-brobwind-rpi3 device/brobwind/rpi3

    mkdir -p .repo/local_manifests
    ln -sv ../../device/brobwind/rpi3/local_manifest.xml .repo/local_manifests/

    repo sync -j$(nproc)

    export USE_CCACHE=1

    source build/envsetup.sh
    lunch rpi3-eng
    make -j$(nproc)

    1. 1. Change the system image size in the BoardConfig.mk https://github.com/brobwind/pie-device-brobwind-rpi3/blob/7c8f7fefd3d7c8bea80ce8b1b042457457cf8c54/BoardConfig.mk#L39
      2. Modify the create partion table script: https://github.com/brobwind/pie-device-brobwind-rpi3/blob/7c8f7fefd3d7c8bea80ce8b1b042457457cf8c54/boot/create_partition_table.sh#L65

  4. hzak,

    I wonder if I can distribute my version of your work as long as I give you full credit for it? I will then of course refer to your software sources. Your work is Open Source, right?

    I have successfully compiled your sources and then added a few apps, which I find essential.

    What shall I call you in my description? “Hzak Brobwind a Chinese IT engineer”? Or?

    1. You can do any thing you like. I just make it work.
      Actually, the hzak is just random characters combination.
      Hope it get better and better.
      Thank you!

      1. “hzak is just random characters combination” you say. But what shall I call you then? I want to tell everybody that my (small) work is totally dependent on yours. Or do you mean that is is sufficient to refer to your various web sites?

  5. Ok, thanks. Well, I wrote this:

    You can find my sources for RaspAnd Pie at brobwind.com. From there you can also download the“original” image from 190302, which was compiled by the man behind brobwind.com. He calls himself hazak – a Chinese IT engineer. Following hazak’s instructions you can compile your own Android Pie 9 system for Raspberry Pi 3 Model B and Raspberry Pi 3 Model B+.

    Is that ok?


  6. Hello!

    Anyone knows if we can have google play services working here? And which versión exactly? I have tried some versions but all of them crash continuously. I need push messages.

    Thanks in advance!

    1. GPIO应该是没有问题了,我已经将kernel的代码上传到github的,如果不能正常工作的话,你可以自己改一下。

    1. 当前,系统不支持WiFi display, sink & source模式都不支持。
      并且不确定做WiFi display 是否需要WiFi模块硬件支持。

  7. 你好,我在做一个project需要在Pi上运行Oculus的移动端App,最终是为了让Oculus Go能够stream到Pi上。我现在可以安装Oculus,也能运行其中的功能。但是当我开始从Oculus cast到Pi的时候,Pi就一直黑屏, logcat显示是Oculus的cast module有error但是没有更多细节。请问这个OS有没有啥已知的问题可能会和我遇到的这个相关的?或者可能是Pi的一些硬件limit?。。。。。感激不尽。。