We're hiring!
*

Running Android and Wayland on embedded devices

Robert Foss avatar

Robert Foss
May 02, 2019

Share this post:

Let's get Android running next to Wayland on an i.MX6 based Nitrogen6_MAX board.

A previous post introduced the SPURV Android compatibility layer for Wayland based Linux environment.

In this post, we're going to dig into how you can run an Android application on the very common i.MX6 based Nitrogen6_MAX board from Boundary Devices.

Install dependencies

sudo apt install \
    apt-transport-https \
    bmap-tools \
    ca-certificates \
    curl \
    git \
    gnupg2 \
    repo \
    software-properties-common \
    u-boot-tools \
    qemu-kvm

Set up Docker container for building

Docker is needed for generating the Debian root filesystem later on.

# Install Docker
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce

# Set up privileges for Docker
sudo usermod -aG docker ${USER}
su - ${USER}

# Fetch Docker image
docker pull godebos/debos:latest

Build Android

For building Android we've chosen to target version  9.0.0_r10, but this is mostly in order to ensure that these instructions remain correct going forward. This work should all be viable for later versions of Android too.

mkdir android; cd android
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r10
git clone https://gitlab.collabora.com/spurv/android_manifest.git .repo/local_manifests/
repo sync -j15
. build/envsetup.sh
lunch spurv-eng
make -j12
cd ..

Build Linux Kernel

We're using a kernel branch which is very close to upstream modulo one or two patches. The kernel we're going to build will be targeting i.MX 6 & 7 series SOCs.

git clone https://gitlab.collabora.com/spurv/linux.git -b android-container_v5.1-rc5
cd linux
sh ../android/device/freedesktop/spurv/build-kernel.sh
cd ..

Create & flash root filesystem

Just a kernel does not make an OS, so we're using Debian as a base. The way we're going to create the root filesystem is using debos, which is a tool for creating Debian based OS images. You can learn more about it here.

Now we're ready to integrate all of the above into one coherent image. This is where the Nitrogen6_MAX devboard targeting comes in.

git clone https://gitlab.collabora.com/spurv/debos.git
sudo debos/build_image.sh -b /dev/mmcblk0

The platform specific parts are contained in uboot_nitrogen6qp-max.scr and build_image.sh.

Boot!

Pop the flashed SD-card into your device and restart it, and then log in as root/root.

In order to start Android, run one of these two commands:

# Launch Weston and an Android application
/home/aosp/run.sh

Starting the Android application might take a minute or two, but Weston should start immediately.

Acknowledgments

A lot of different contributors enabled this work, both directly and indirectly.

  • Boundary Devices
  • Pengutronix
  • Zodiac

 


Visit Robert's blog.

Comments (11)

  1. piec:
    May 05, 2019 at 12:14 PM

    Great work
    Typo: I think the git url should be "https://gitlab.collabora.com/spurv/debos/" in the "Create & flash root filesystem" paragraph

    Reply to this comment

    Reply to this comment

  2. Andy KIm:
    Jul 08, 2019 at 07:12 AM

    I want to know why 2 drm driver is needed?
    Does both imx-drm and etnaviv need for what?
    Eg. imx-drm is for Android and etnaviv is for weston.

    Reply to this comment

    Reply to this comment

  3. Andy Kim:
    Jul 10, 2019 at 03:33 AM

    I want to know why 2 drm drivers(imx-drm and etnaviv) is needed?
    Is only etnaviv not enough?

    Reply to this comment

    Reply to this comment

    1. Robert Foss:
      Jul 16, 2019 at 03:49 PM

      Hey Andy,

      Those are drivers for two different things. imx-drm is the display controller, and etnaviv the gpu.
      Those are different parts and are not always shipped together.

      Reply to this comment

      Reply to this comment

  4. Chris:
    Dec 01, 2019 at 11:47 AM

    What's the viability of running this on a Jetson nano. Se ems like that would be a good platform considering it's basically a slimmed down Nvidia shield.

    Also is opengl an option?

    Reply to this comment

    Reply to this comment

    1. Robert Foss:
      Dec 02, 2019 at 03:00 PM

      Hey Chris,

      I'm not an expert on the NVidia proprietary driver, but I would think that it's possible to run SPURV on top of a Jetson board.

      Thanks for the Question.

      /Rob.

      Reply to this comment

      Reply to this comment

      1. Chris:
        Dec 02, 2019 at 07:20 PM

        Thank you,

        The Jetson nano has decent support for wayland.
        The build instructions and sources you have provided seem very specific to the imx6 platform.

        Is there any way you could provide basic instructions on what would be required to add support for a different platform.
        For example kernel configuration setting's that are required. I know that with Anbox, Ashmem and binder need to be enabled in the kernel.

        Would the aosp build need to be modified in any way or does most of the platform specific configuration rest in the linux rootfs and the kernel.
        And Is it possible to only build aosp and the container on top of a standard stock arm64 based ubuntu / debian installation.

        a generic guide to port spurv to other arm/arm64 based platforms would be a lovely thing to have.

        Thanks for your help.

        Reply to this comment

        Reply to this comment

        1. Robert Foss:
          Dec 02, 2019 at 08:13 PM

          > The build instructions and sources you have provided seem very specific to the imx6 platform.
          Yeah, that's the platform we were targeting.

          > Is there any way you could provide basic instructions on what would be required to add support for a different platform.
          Not really at this point.

          > For example kernel configuration setting's that are required. I know that with Anbox, Ashmem and binder need to be enabled in the kernel.
          The kernel should probably use the android-base defconfig: https://source.android.com/devices/architecture/kernel/config

          >Would the aosp build need to be modified in any way or does most of the platform specific configuration rest in the linux rootfs and the kernel.
          The AOSP repos we've used and published in the posts have some modifications and need to be used.

          > And Is it possible to only build aosp and the container on top of a standard stock arm64 based ubuntu / debian installation.
          Yes, but it won't run. You need the appropriate kconfig options for the kernel, and AOSP from the repos we published to work around some issues.

          > a generic guide to port spurv to other arm/arm64 based platforms would be a lovely thing to have.
          I agree, at this moment it isn't something that we're working on.

          > Thanks for your help.
          You are welcome ;)

          Reply to this comment

          Reply to this comment

  5. Sachio Horie:
    Apr 11, 2020 at 02:53 AM

    Nitrogen6_MAX has a UART, Can this case use UART and other connectivity ports?, so my app uses UART.

    Reply to this comment

    Reply to this comment

    1. Daniel Stone:
      Apr 13, 2020 at 01:00 PM

      Yes, all the UARTs are available as userspace devices.

      Reply to this comment

      Reply to this comment


Add a Comment






Allowed tags: <b><i><br>Add a new comment:


Search the newsroom

Latest Blog Posts

Using syzkaller, part 4: Driver fuzzing

26/06/2020

Syzkaller is much needed tool for Linux kernel testing and debugging. With some work, it can also be enhanced to find bugs in specific drivers,…

Cross building Rust GStreamer plugins for the Raspberry Pi

23/06/2020

Previously, we discussed about how Rust can be a great language for embedded programming. In this article, we'll explain an easy setup to…

Generating MPEG-DASH streams for Open Source adaptive streaming with GStreamer

12/06/2020

Adaptive streaming is a technique to provide flexibility and scalability by offering variable bit-rate streams to the client. Here's a quick…

Bifrost meets GNOME: Onward & upward to zero graphics blobs

05/06/2020

With only free software, a Mali G31 chip can now run Wayland compositors with zero-copy graphics, including GNOME 3. We can run every scene…

Using regmaps to make Linux drivers more generic

27/05/2020

Device drivers can support more revisions and SoC platforms by abstracting away specific hardware interface layouts. Let's examine a specific…

Cross-compiling with gst-build and GStreamer

15/05/2020

gst-build is one of the main build systems used by the community to develop the GStreamer platform. In my last blog post, I presented gst-build…

Open Since 2005 logo

We use cookies on this website to ensure that you get the best experience. By continuing to use this website you are consenting to the use of these cookies. To find out more please follow this link.

Collabora Ltd © 2005-2020. All rights reserved. Privacy Notice. Sitemap.