SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
Leveraging Android's
   Linux Heritage
Embedded Linux Conference Europe 2011

          Karim Yaghmour
          @karimyaghmour



                              1
About
●   Author of:




●   Introduced Linux Trace Toolkit in 1999
●   Originated Adeos and relayfs (kernel/relay.c)
                                          2
Survey
●   Anyone interested in mini- “Embedded Android
    Workshop”?




                                       3
Agenda
●   Goal
●   Rationale
●   Stack Comparison
●   Roadblocks
●   Where do I start?
●   Coexistence Approaches
●   Unresolved / Uncharted
●   Demo
                                 4
1. Goal
●   Opening as many cans of worms as possible
●   Can “Linux” and Android Coexist and Interact?




                                        5
2. Rationale
●   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



                                                                  6
3. Stack Comparison
●   Android Concepts Recap
●   Overall Architecture EL
●   Overall Architecture Android




                                   7
3.1. Android Concepts Recap
●   Components
●   Intents
●   Component lifecycle
●   Manifest file
●   Processes and threads
●   Remote procedure calls



                             8
3.1.1. Components
●   1 App = N Components
●   Apps can use components of other applications
●   App processes are automagically started whenever any part
    is needed
●   Ergo: N entry points, !1, and !main()
●   Components:
    ●   Activities
    ●   Services
    ●   Broadcast Receivers
    ●   Content Providers


                                                    9
3.1.2. Intents
●   Intent = asynchronous message w/ or w/o
    designated target
●   Like a polymorphic Unix signal, but w/o
    required target
●   Intents “payload” held in Intent Object
●   Intent Filters specified in Manifest file




                                                10
3.1.3. Component lifecycle
●   System automagically starts/stops/kills
    processes:
    ●   Entire system behaviour predicated on low memory
●   System triggers Lifecycle callbacks when
    relevant
●   Ergo: Must manage Component Lifecycle
●   Some Components are more complex to
    manage than others

                                             11
12
3.1.4. Manifest file
●   Informs system about app’s components
●   XML format
●   Always called AndroidManifest.xml
●   Activity = <activity> ... static
●   Service = <service> ... static
●   Broadcast Receiver:
    ●   Static = <receiver>
    ●   Dynamic = Context.registerReceiver()
●   Content Provider = <provider> ... static
                                               13
3.1.5. Processes and threads
●   Processes
    ●   Default: all callbacks to any app Component are issued to the main process thread
    ●   <activity>—<service>—<recipient>—<provider> have process attribute to override
        default
    ●   Do NOT perform blocking/long operations in main process thread:
        –   Spawn threads instead
    ●   Process termination/restart is at system’s discretion
    ●   Therefore:
        –   Must manage Component Lifecycle
●   Threads:
    ●   Create using the regular Java Thread Object
    ●   Android API provides thread helper classes:
        –   Looper: for running a message loop with a thread
        –   Handler: for processing messages
        –   HandlerThread: for setting up a thread with a message loop

                                                                         14
3.1.6. Remote procedure calls
●   Android RPCs = Binder mechanism
●   No Sys V IPC due to in-kernel resource leakage
●   Binder is a low-level functionality, not used as-is
●   Instead: must define interface using Interface
    Definition Language (IDL)
●   IDL fed to aidl Tool to generate Java interface
    definitions


                                           15
3.2. Overall Architecture - EL




                         16
3.3. Overall Architecture – Android




                            17
4. Roadblocks
●   Filesystem
    ●   Android is non-FHS-compliant
●   C library
    ●   Bionic vs. glibc
●   Interconnect fabric
    ●   Intents vs. DBUS
●   IPC
    ●   Binder vs. Sockets and other std Unix IPC
●   Display management
    ●   SurfaceFlinger vs. X
●   I/O
    ●   Framebuffer, keyboard, mouse, disk, ...
                                                    18
5. Where do I start?
●   Android-side:
    ●   AOSP
●   “Linux”-side:
    ●   Traditional distro
        –   Ubuntu, Fedora, Debian, Gentoo, ...
    ●   Embedded distro
        –   Yocto, Buildroot, LTIB, ...
    ●   Build Your Own
    ●   Cherry-picking
                                                  19
6. Coexistence Approaches
●   Single filesystem
    ●   Build system integration
    ●   Build-time aggregation
    ●   Image repackaging
●   chroot jails
    ●   Have a look at AlwaysInnovating Gregoire Gentil's ELC presentation
    ●   Patching to lots of pieces of the OS
    ●   Use of one FB for each OS or chvt
●   Virtualization / Paravirtualization
    ●   QEMU
    ●   XEN?

                                                            20
7. Been there done that
●   BusyBox in CyanogenMod
●   Gstreamer vs. Stagefright
●   Don't know how they do it:
    ●     Alien Dalvik: Android on Meego
●   ...




                                           21
8. Unresolved / Uncharted
●   Binder from glibc
●   Intent <-> DBUS bridge
●   Running Android apps in X
●   Running X apps in Android
      “The easier thing to do, which would work on just about all Android phones
      without having to modify the system software at all, would be to port an X
      server to the NDK, using a SurfaceFlinger Surface as its root window.
      You could do a generic "X11WrapperApp" that has you XSurfaceFlinger
      bundled and launches whatever X based app you want, and have it all play
      nice together.
      A bit more work would be to just do an implementation of xlib that sits on top of
      a native Android window (opengl ES 2 if you like) without any server in the
      middle, and again bundle this and the X based app of your choice and you
      have something that is a first class app on the phone without any need for
      modifying the OS.”
                                                                     22
9. Demos
●   All:
    ●   AOSP
    ●   BYO glibc-based rootfs
●   Demo 1: BusyBox
●   Demo 2: Client-Server app talking through socket
    ●   glibc client
    ●   bionic server
●   Demo 3: Surprise!

                                        23
9.1. Demo 1 - BusyBox
●   Configure, build and “install” BusyBox
●   Get it copied into final RAM disk image
●   Modify AOSP to:
    ●   Make sure /lib/* is executable
    ●   Path start with “/bin”
    ●   adb shell is BusyBox, not Toolbox




                                            24
9.2. Demo 2 - Architecture




                       25
26
9.3. Demo 3 – LTT, the revenge
●   Patch kernel
●   Cross-build ltt-ctl
●   Modify AOSP to log to LTT




                                27
Thank you ...

karim.yaghmour@opersys.com




                         28

Mais conteúdo relacionado

Mais procurados

Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeOpersys inc.
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IOpersys inc.
 
Embedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConIIEmbedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConIIOpersys inc.
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
 
Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Opersys inc.
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Opersys inc.
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform ToolsOpersys inc.
 
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIAndroid Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIOpersys inc.
 
Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Opersys inc.
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Opersys inc.
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Is Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VIs Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VOpersys inc.
 

Mais procurados (20)

Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC Europe
 
Headless Android
Headless AndroidHeadless Android
Headless Android
 
Cyborgstack
CyborgstackCyborgstack
Cyborgstack
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
 
Embedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConIIEmbedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConII
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and Resources
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform Tools
 
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIAndroid Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
 
Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Is Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VIs Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon V
 
Tdc2014 tizen common_20140603
Tdc2014 tizen common_20140603Tdc2014 tizen common_20140603
Tdc2014 tizen common_20140603
 

Semelhante a Leveraging Android's Linux Heritage at ELC-E 2011

Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVOpersys inc.
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIOpersys inc.
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VIOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VOpersys inc.
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopOpersys inc.
 
Is Android the New Embedded Linux? at AnDevCon IV
Is Android the New Embedded Linux? at AnDevCon IVIs Android the New Embedded Linux? at AnDevCon IV
Is Android the New Embedded Linux? at AnDevCon IVOpersys inc.
 
Electron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesElectron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesBethmi Gunasekara
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Opersys inc.
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Frameworkegypt
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopOpersys inc.
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFNiklas Heidloff
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump StartConFoo
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Opersys inc.
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowKarim Yaghmour
 

Semelhante a Leveraging Android's Linux Heritage at ELC-E 2011 (20)

Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VI
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with Lollipop
 
Is Android the New Embedded Linux? at AnDevCon IV
Is Android the New Embedded Linux? at AnDevCon IVIs Android the New Embedded Linux? at AnDevCon IV
Is Android the New Embedded Linux? at AnDevCon IV
 
Electron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesElectron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologies
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with Lollipop
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 

Mais de Opersys inc.

Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with OreoOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoTOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 

Mais de Opersys inc. (20)

Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Project Ara
Project AraProject Ara
Project Ara
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 

Último

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Último (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Leveraging Android's Linux Heritage at ELC-E 2011

  • 1. Leveraging Android's Linux Heritage Embedded Linux Conference Europe 2011 Karim Yaghmour @karimyaghmour 1
  • 2. About ● Author of: ● Introduced Linux Trace Toolkit in 1999 ● Originated Adeos and relayfs (kernel/relay.c) 2
  • 3. Survey ● Anyone interested in mini- “Embedded Android Workshop”? 3
  • 4. Agenda ● Goal ● Rationale ● Stack Comparison ● Roadblocks ● Where do I start? ● Coexistence Approaches ● Unresolved / Uncharted ● Demo 4
  • 5. 1. Goal ● Opening as many cans of worms as possible ● Can “Linux” and Android Coexist and Interact? 5
  • 6. 2. Rationale ● 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 6
  • 7. 3. Stack Comparison ● Android Concepts Recap ● Overall Architecture EL ● Overall Architecture Android 7
  • 8. 3.1. Android Concepts Recap ● Components ● Intents ● Component lifecycle ● Manifest file ● Processes and threads ● Remote procedure calls 8
  • 9. 3.1.1. Components ● 1 App = N Components ● Apps can use components of other applications ● App processes are automagically started whenever any part is needed ● Ergo: N entry points, !1, and !main() ● Components: ● Activities ● Services ● Broadcast Receivers ● Content Providers 9
  • 10. 3.1.2. Intents ● Intent = asynchronous message w/ or w/o designated target ● Like a polymorphic Unix signal, but w/o required target ● Intents “payload” held in Intent Object ● Intent Filters specified in Manifest file 10
  • 11. 3.1.3. Component lifecycle ● System automagically starts/stops/kills processes: ● Entire system behaviour predicated on low memory ● System triggers Lifecycle callbacks when relevant ● Ergo: Must manage Component Lifecycle ● Some Components are more complex to manage than others 11
  • 12. 12
  • 13. 3.1.4. Manifest file ● Informs system about app’s components ● XML format ● Always called AndroidManifest.xml ● Activity = <activity> ... static ● Service = <service> ... static ● Broadcast Receiver: ● Static = <receiver> ● Dynamic = Context.registerReceiver() ● Content Provider = <provider> ... static 13
  • 14. 3.1.5. Processes and threads ● Processes ● Default: all callbacks to any app Component are issued to the main process thread ● <activity>—<service>—<recipient>—<provider> have process attribute to override default ● Do NOT perform blocking/long operations in main process thread: – Spawn threads instead ● Process termination/restart is at system’s discretion ● Therefore: – Must manage Component Lifecycle ● Threads: ● Create using the regular Java Thread Object ● Android API provides thread helper classes: – Looper: for running a message loop with a thread – Handler: for processing messages – HandlerThread: for setting up a thread with a message loop 14
  • 15. 3.1.6. Remote procedure calls ● Android RPCs = Binder mechanism ● No Sys V IPC due to in-kernel resource leakage ● Binder is a low-level functionality, not used as-is ● Instead: must define interface using Interface Definition Language (IDL) ● IDL fed to aidl Tool to generate Java interface definitions 15
  • 17. 3.3. Overall Architecture – Android 17
  • 18. 4. Roadblocks ● Filesystem ● Android is non-FHS-compliant ● C library ● Bionic vs. glibc ● Interconnect fabric ● Intents vs. DBUS ● IPC ● Binder vs. Sockets and other std Unix IPC ● Display management ● SurfaceFlinger vs. X ● I/O ● Framebuffer, keyboard, mouse, disk, ... 18
  • 19. 5. Where do I start? ● Android-side: ● AOSP ● “Linux”-side: ● Traditional distro – Ubuntu, Fedora, Debian, Gentoo, ... ● Embedded distro – Yocto, Buildroot, LTIB, ... ● Build Your Own ● Cherry-picking 19
  • 20. 6. Coexistence Approaches ● Single filesystem ● Build system integration ● Build-time aggregation ● Image repackaging ● chroot jails ● Have a look at AlwaysInnovating Gregoire Gentil's ELC presentation ● Patching to lots of pieces of the OS ● Use of one FB for each OS or chvt ● Virtualization / Paravirtualization ● QEMU ● XEN? 20
  • 21. 7. Been there done that ● BusyBox in CyanogenMod ● Gstreamer vs. Stagefright ● Don't know how they do it: ● Alien Dalvik: Android on Meego ● ... 21
  • 22. 8. Unresolved / Uncharted ● Binder from glibc ● Intent <-> DBUS bridge ● Running Android apps in X ● Running X apps in Android “The easier thing to do, which would work on just about all Android phones without having to modify the system software at all, would be to port an X server to the NDK, using a SurfaceFlinger Surface as its root window. You could do a generic "X11WrapperApp" that has you XSurfaceFlinger bundled and launches whatever X based app you want, and have it all play nice together. A bit more work would be to just do an implementation of xlib that sits on top of a native Android window (opengl ES 2 if you like) without any server in the middle, and again bundle this and the X based app of your choice and you have something that is a first class app on the phone without any need for modifying the OS.” 22
  • 23. 9. Demos ● All: ● AOSP ● BYO glibc-based rootfs ● Demo 1: BusyBox ● Demo 2: Client-Server app talking through socket ● glibc client ● bionic server ● Demo 3: Surprise! 23
  • 24. 9.1. Demo 1 - BusyBox ● Configure, build and “install” BusyBox ● Get it copied into final RAM disk image ● Modify AOSP to: ● Make sure /lib/* is executable ● Path start with “/bin” ● adb shell is BusyBox, not Toolbox 24
  • 25. 9.2. Demo 2 - Architecture 25
  • 26. 26
  • 27. 9.3. Demo 3 – LTT, the revenge ● Patch kernel ● Cross-build ltt-ctl ● Modify AOSP to log to LTT 27