44
[email protected] These slides at http://insymbols.com/misc/android-atop-linux-ee2014.pdf Ryan Kuester Independent Consultant Running Android atop a proper embedded Linux

Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

[email protected] !

These slides at http://insymbols.com/misc/android-atop-linux-ee2014.pdf

Ryan Kuester Independent Consultant

Running Android atop a proper embedded Linux

Page 2: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Motivate Android atop Linux

Linux atop the Nexus 7

Android atop Linux

Integrating the two worlds

Page 3: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Contribute to discussion of Android’s suitability for embedded work

!

Demonstrate one way of using Android in an embedded system

Page 4: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Motivation: Why Android?

Page 5: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Enormously successful !

Productive and enjoyable environment for writing applications

Java has great tools

Page 6: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,
Page 7: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,
Page 8: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Application framework excellent, e.g., modularity of activities and intents

Users are familiar with Android GUIs

Framework services address common needs: network, power, audio,

management

Page 9: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Biggest Weakness

Android couples the operating system choice to the GUI choice

Build System

Package Management

Library and program availability

Page 10: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Issues with Android as OS

Software availability with build system Software compatibility with libc

Page 11: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Software compatibility with libc

see bionic/libc/CAVEATS

not complete POSIX, only what Android needs, e.g.:

no C++ exceptions

no locales or wide chars

missing functions like getpwd()

Page 12: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Issues with Android as OS

Package management

Field upgrades

Build system

SCM scheme

Page 13: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Issues with Android as OS

Limited and less-than-open community of platform developers

Page 14: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

You need to partition your solution in any case

Running within Android framework is not suitable for some time-

sensitive code

Can run code outside of framework, but not well-supported, and library

challenges remain

Page 15: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Motivation: So what’s the problem?

Page 16: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

OS libraries

OS Services

OS utilities, runtime, etc.

App.

Bootloader

Linux Kernel

Page 17: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Page 18: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Page 19: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Page 20: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Page 21: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Page 22: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Bootloader

Linux kernel

Misc.

Application framework

Init

Ideally we could just use the application framework

Page 23: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Bootloader

Linux kernel

Misc.

Application framework

Init

but Android is architected and delivered as a tightly-coupled combination

Page 24: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

forcing us to keep it intact and put other software alongside it

Bootloader

Linux kernel

Libraries

Application framework

Init

EmbeddedLinux OS

Page 25: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Why Linux, again?

software availability

package management

build system

tools

EmbeddedLinux OS

Page 26: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

How? Some suggest injecting pre-built Embedded OS into Android build process

EmbeddedLinux OS

Page 27: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Backwards!—this leaves Android in charge of build process, package management, etc.

EmbeddedLinux OS

Page 28: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Proposal—treat Android as package within the Embedded Linux OS

Linux kernel

Libraries

Application framework

Init

EmbeddedLinux OS

Embedded Linux Init

Page 29: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Demonstration of this concept

applied to the Nexus 7

Page 30: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Pragmatux

A community-developed Linux distribution for embedded systems

!

http://pragmatux.org

Linux atop the Nexus 7

Page 31: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Pragmatux

Workstation environment

Target device operating system

Deployment management system

Developer ecosystem

Page 32: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Pragmatux

Utilizes tools, concepts from the Debian Project

Isn’t “Debian”, but has a similar look and feel

Page 33: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Pragmatux

package management and repository tools

cross-toolchains

minimized packages

keeps binary compatibility

Page 34: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

Normally don’t touch this

# fastboot flash $IMAGE

How Android device storage is partitioned

Page 35: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

# fastboot flash $IMAGE

boot.img

How Android device storage is partitioned

Page 36: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

# fastboot flash $IMAGE

system.img

How Android device storage is partitioned

Page 37: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Bootloader

Linux kernel

Misc.

Application framework

Init

# fastboot flash $IMAGE

New kernel, new system image (now in userdata partition)

Page 38: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Demo: Building and loading images

Page 39: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Nexus 7 kernel source: https://github.com/pragmatux/linux-

n7-2013 !

Originates from AOSP’s Qualcomm kernel: https://android.googlesource.com/kernel/msm.git

Page 40: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Android package source: https://github.com/rkuester/android-

n7-2013-wifi-aosp !

Originates with the binary output of an AOSP build for the Nexus 7, see:

http://source.android.com/source/building.html

Page 41: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Android filesystem in chroot

Embedded OSAndroid

Page 42: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Demo: Integrating and Android app and a Linux daemon

Page 43: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

Communication via kernel still works as always

Linux kernel

Libraries

Application framework

Init

EmbeddedLinux OS

Embedded Linux Init

Page 44: Running Android atop ainsymbols.com/misc/android-atop-linux-ee2014.pdf · Android atop Linux Integrating the two worlds. Contribute to discussion of Android’s ... needs: network,

[email protected] !

These slides at http://insymbols.com/misc/android-atop-linux-ee2014.pdf

Ryan Kuester Independent Consultant

Running Android atop a proper embedded Linux