is android the new embedded linux? at andevcon iv

33
1 Is Android the new Embedded Linux? ADC IV Karim Yaghmour [email protected]

Upload: opersys-inc

Post on 17-May-2015

222 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Is Android the New Embedded Linux? at AnDevCon IV

1

Is Android thenew Embedded Linux?

ADC IV

Karim [email protected]

Page 2: Is Android the New Embedded Linux? at AnDevCon IV

2

These slides are made available to you under a Creative Commons Share-Alike 3.0 license. The full terms of this license are here: https://creativecommons.org/licenses/by-sa/3.0/

Attribution requirements and misc., PLEASE READ:● This slide must remain as-is in this specific location (slide #2), everything

else you are free to change; including the logo :-)● Use of figures in other documents must feature the below “Originals at”

URL immediately under that figure and the below copyright notice where appropriate.

● You are free to fill in the “Delivered and/or customized by” space on the right as you see fit.

● You are FORBIDEN from using the default “About” slide as-is or any of its contents.

● You are FORBIDEN from using any content provided by 3rd parties without the EXPLICIT consent from those parties.

(C) Copyright 2012, Opersys inc.

These slides created by: Karim Yaghmour

Originals at: www.opersys.com/community/docs

Delivered and/or customized by

Page 3: Is Android the New Embedded Linux? at AnDevCon IV

3

About

● Author of:

● Introduced Linux Trace Toolkit in 1999● Originated Adeos and relayfs (kernel/relay.c)● Training, Custom Dev, Consulting, ...

Page 4: Is Android the New Embedded Linux? at AnDevCon IV

4

1. Embedded, before Linux

● pSOS● VRTX / VxWorks● QNX● LynxOS● MS-DOS● GNU toolchain

Page 5: Is Android the New Embedded Linux? at AnDevCon IV

5

2. Embedded Linux, a look back

Projects Conferences:Linux kernel 1991 ... OLS 1999

1996 CELF ELC 20041998 ABS 20111999

RTAI 1999 Books1999 E. Anderson

U-Boot 1999 Karim Yaghmour2000 E. Anderson2001

Preemption patches 20052009 Debian2010 LF / Intel Companies:

Matchbox

RTLinux V. Yodaiken / M. BarabanovuClinux / uCDimm J. Dionne / Motorola Dragonball

BusyBox B. Perens ('96) / Debian, then E. AndersonP. Mantegazza

Buildroot Craig HollabaughW. Denk

uClibc Chris HallinanI-pipe / Adeos P. Gerum (K. Yaghmour)

S.-Thorsten Dietrich / I. Molnar / T. GleixnereglibcYocto

LineoAttempts at Linux mobile GUIs MontaVista

Maemo / MeeGo TimeSys

Qtopia

Page 6: Is Android the New Embedded Linux? at AnDevCon IV

6

3. Android, whereth comest thou?● 2002:

● Sergey Brin and Larry Page started using Sidekick smartphone● Sidekick one of 1st smartphones integrating web, IM, mail, etc.● Sidekick was made by Danger inc., co-founded by Andy Rubin (CEO)● Brin/Page met Rubin at Stanford talk he gave on Sidekick’s development● Google was default search engine on Sidekick

● 2004:● Despite cult following, Sidekick wasn’t making $● Danger inc. board decided to replace Rubin● Rubin left. Got seed $. Started Android inc. Started looking for VCs.● Goal: Open mobile hand-set platform

● 2005 - July:● Got bought by Google for undisclosed sum :)

● 2007 - November:● Open Handset Alliance announced along with Android

Page 7: Is Android the New Embedded Linux? at AnDevCon IV

7

4. What's Embedded Linux?

● A set of ad-hoc methods to package the Linux kernel with a (minimal) filesystem.

● FS content “to be determined” case-by-case● APIs are specific to each device/build● “Core software”:

● BusyBox● U-Boot● GNU Toolchain

● Your flavor of:● glibc or uClibc or eglibc● yocto or buildroot or eldk or ltib or ptxdist or ...

● No serious UX framework

Page 8: Is Android the New Embedded Linux? at AnDevCon IV

8

Page 9: Is Android the New Embedded Linux? at AnDevCon IV

9

5. What's Android?

● ... apart from its increasingly well known UX ...● Fully-integrated Eclipse IDE● SDK/NDK● ADB● Fastboot● Published, well-known, and very rich APIs● A large and growing developer community● And still we can use the usual suspects:

● GNU toolchain, BusyBox, u- boot, glibc, ...

An actual standardized dev. env. across all product lines

Page 10: Is Android the New Embedded Linux? at AnDevCon IV

10

Page 11: Is Android the New Embedded Linux? at AnDevCon IV

11

6. Licensing differences

● Kernel:● GNU General Public License (a.k.a. GPL)

● AOSP:● Mostly Apache License 2.0 (a.k.a. ASL)● Having GPL-free user-space was a design goal● A few GPL and LGPL parts: mainly BlueZ and DBUS● Some key components in BSD: Bionic and Toolbox ● “external/” directory contains a mixed bag of licenses, incl. lots of GPL

● Android Robot:● Very much like the Linux penguin

● Android name:● As descriptor only: “for Android”● Use for labelling device requires talking to Google

Page 12: Is Android the New Embedded Linux? at AnDevCon IV

12

7. Why did Embedded Linux's rise?

● EETimes 2005 survey ...http://www.embedded.com/electronics-blogs/-include/4025539/Embedded-systems-survey-Operating-systems-up-for-grabs

● EETImes 2012 surveyhttp://www.embedded.com/design/embedded/4372666/Shifting-sands--Trends-in-embedded-systems-design

Page 13: Is Android the New Embedded Linux? at AnDevCon IV

13

8. Current Trends

● On the embedded side● On the consumer side

Page 14: Is Android the New Embedded Linux? at AnDevCon IV

14

8.1. Embedded trends

● Rise of cheap 32-bit CPUs● Rise of inexpensive storage● Rise of inexpensive eval boards

● BeagleBoards● BeagleBone● RaspberryPi● For all practical purposes, this hardware is disposable

● Arduino / Maker / DIY trend● ...

Page 15: Is Android the New Embedded Linux? at AnDevCon IV

15

8.2. Consumer trends

● Rise of touch-based devices● Race with Apple on features / price● Mobile devices outselling PCs since 2010● Increasingly inexpensive low-end touch-based

devices

Page 16: Is Android the New Embedded Linux? at AnDevCon IV

16

Source:“From Altair to iPad: 35 years of personal computer market share”, Jeremy Reimer,Ars Technica, August 2012http://arstechnica.com/business/2012/08/from-altair-to-ipad-35-years-of-personal-computer-market-share/This material is (C) 2012, Ars Technica and is NOT CC-BY-SA.

Page 17: Is Android the New Embedded Linux? at AnDevCon IV

17

Source: “From Altair to iPad: 35 years of personal computer market share”, Jeremy Reimer,Ars Technica, August 2012http://arstechnica.com/business/2012/08/from-altair-to-ipad-35-years-of-personal-computer-market-share/This material is (C) 2012, Ars Technica and is NOT CC-BY-SA.

Page 18: Is Android the New Embedded Linux? at AnDevCon IV

18

Source: “From Altair to iPad: 35 years of personal computer market share”, Jeremy Reimer,Ars Technica, August 2012http://arstechnica.com/business/2012/08/from-altair-to-ipad-35-years-of-personal-computer-market-share/This material is (C) 2012, Ars Technica and is NOT CC-BY-SA.

Page 19: Is Android the New Embedded Linux? at AnDevCon IV

19

9. Embedded Android? Why?

● Feature set● API● Developer community● Built on Linux● Examples:

● Consumer electronics● Medical● Defence● Space

Page 20: Is Android the New Embedded Linux? at AnDevCon IV

20

10. Android meets Embedded Linux

● Why did Android use Linux?

“The Linux vs BSD decision was made before Google acquired Android.

While starting with NetBSD's kernel was tempting, the Linux kernel wasn't that much larger (one of the concerns), had quite a lot of support from silicon vendors and OEMs, and a larger developer community (easier to find folks with Linux kernel expertise).

The bright line between the kernel and userspace drawn by the statement at the top of the Linux COPYING file was certainly helpful in making this decision. Explaining that the kernel is GPLv2 and userspace is Apache2/BSD/MIT is something easily understood by OEMs, and most OEMs don't have a problem with the general idea that the kernel is not where you differentiate your products.”

Brian Swetland, LWN, March 2011

Page 21: Is Android the New Embedded Linux? at AnDevCon IV

21

10.1. Rationale

“Android took GNU out the back door, shot him in the head, and ran away with the penguin” -- Surely from Tarantino's next flick

● A ton of mature user-space packages available● Linux has been around for 20 years● Linux's user-space has been developed in the open

● A ton of “Linux”-centric stacks have been developed through the years● “Porting” to Android not always possible/desirable/realistic

● Android doesn't provide everything● Touch-based, consumer-oriented● Linux is very strong on backend/server side

● Android exhibits symptoms of “my way or the highway” design● A whole GNU world

● glibc vs. Bionic

Page 22: Is Android the New Embedded Linux? at AnDevCon IV

22

Page 23: Is Android the New Embedded Linux? at AnDevCon IV

23

Page 24: Is Android the New Embedded Linux? at AnDevCon IV

24

11. Headless Android

+ =

“And then GNU came back for revenge ...” -- Tarantino's sequel

Page 25: Is Android the New Embedded Linux? at AnDevCon IV

25

11.1. Why?

● Took me a long time to wrap my head around● “Why don't you just use embedded Linux?”

● What's “Embedded Linux” anyway?

● NEW: Nexus Q

Page 26: Is Android the New Embedded Linux? at AnDevCon IV

26

11.2. Possibilities

● No Java:● TinyAndroid:

$ BUILD_TINY_ANDROID=true make ­j4

● AOSP w/ custom products .mk file

● The full-blown stack without:● SurfaceFlinger● WindowManager● WallpaperService● InputMethodManager

Page 27: Is Android the New Embedded Linux? at AnDevCon IV

27

11.3. Tiny Android

● 3MB filesystem● Minimal root fs● init● toolbox + shell● adb● bionic + utility libs● No “system/framework/”● No “system/app”

Page 28: Is Android the New Embedded Linux? at AnDevCon IV

28

11.4. AOSP w/ custom product .mk

● Have a look at:● build/target/product/*.mk

● Create your own device under “/device” and have fun

● Disable zygote at startup● Remove all apks● ...

Page 29: Is Android the New Embedded Linux? at AnDevCon IV

29

11.5 Full stack?

Page 30: Is Android the New Embedded Linux? at AnDevCon IV

30

11.5.1. How?

● Disable:● SurfaceFlinger● WindowManager● WallpaperService● InputMethodManager● SystemUI

● Don't let SurfaceFlinger Client try to open binder to SurfaceFlinger● Feed bogus values back from SurfaceFlinger Client● Disable qemud (emulator artefact)● Tweak internals by disabling key calls:

● In ActivityStack.java:– startHomeActivityLocked()– setAppStartingWindow()

● wm.detectSafeMode()● wm.systemReady()● wm.reclaimSuraceMemoryLocked()

Page 31: Is Android the New Embedded Linux? at AnDevCon IV

31

11.5.2 What's in there anyway?

● Most everything Android gives you:● No UX● Fully-integrated Eclipse IDE● SDK/NDK● ADB● Fastboot● Published, well-known, and very rich APIs● A large and growing developer community● And still we can use the usual suspects:

– GNU toolchain, BusyBox, u- boot, glibc, ...

● Caveat -- “Activity” no longer works● You have:

● Services● ContentProviders● BroadcastReceivers

Page 32: Is Android the New Embedded Linux? at AnDevCon IV

32

12. Where do we go from here?

● ...● ro.config.headless

Slide 41 - 42 of UBM “2012 Embedded Market Study”

Page 33: Is Android the New Embedded Linux? at AnDevCon IV

33

Thank you ...

[email protected]

And then he said ...

“As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my GNU or Linux heritage as a negative is... I collect your fucking head. Just like this fucker here. Now, if any of you sons of bitches got anything else to say, now's the fucking time!”