Android Variants, Hacks, Tricks and Resources presented at AnDevConII

Opersys inc.
Opersys inc.Training and Development at Opersys inc.
Android Hacks,
Variants, Tricks and
     Resources
       AnDevCon II

     Karim Yaghmour
     @karimyaghmour


                      1
About
●   Author of:




●   Introduced Linux Trace Toolkit in 1999
●   Originated Adeos and relayfs (kernel/relay.c)
●   Training, Custom Dev, Consulting, ...
                                              2
Agenda
●   AOSP's limitations
●   Tearing AOSP apart
●   Forks
●   Ports
●   Mods
●   Melding with “Classic” Linux Stack



                                         3
AOSP's limits
●   Rigid
●   Closed dev model
●   Fits Google's prerogatives
●   Excludes a lot of stuff
●   ... IOW, doesn't always fit what you need




                                          4
Tearing AOSP apart
●   Forks
●   Ports
●   Mods
●   Melds




                                 5
Forks
●   Cyanogenmod
●   Replicant
●   MIUI




                          6
Cyanogenmod
●   After-market handset firmware
●   Requires rooted phone
●   http://www.cyanogenmod.com
●   Advertized features:
    ●   Lockscreen Gestures
    ●   Phone Goggles
    ●   OpenVPN
    ●   Incognito mode
    ●   Themes support
    ●   DSP Equalizer
                                    7
8
●   More interestingly:
    ●   http://wiki.cyanogenmod.com/
    ●   https://github.com/CyanogenMod
    ●   Includes Busybox
    ●   Custom Launcher (ADWLauncher)
    ●   Lots of tiny tweaks and mods ... worth doing a “diff”




                                                  9
Replicant
●   Android distro that is 100% Free Software
●   http://replicant.us/
●   Includes FDroid free software app store




                                        10
MIUI
●   Closed-source fork with slick UI enhancements
●   Many translations
●   http://en.miui.com/
●   Advertized features:
    ●   Home screen
    ●   Dialer
    ●   SMS
    ●   Contacts
    ●   Themes
    ●   Camera
    ●   Gallery
    ●   Net disk, File manager, Traffic monitor, Backup, Notes, ...
                                                                 11
12
Ports
●   RIM Playbook
●   BlueStacks
●   Alien Dalvik




                           13
RIM Playbook




               14
BlueStacks




             15
Alien Dalvik (Myriad Group)




                       16
Mods
●   XDA Developers
●   ...




                            17
Melding with “Classic” Linux stack
1. Rationale
2. Roadblocks
3. Where do I start?
4. Coexistence Approaches
5. Been there done that
6. Unresolved / Uncharted
7. Tools
8. Embedded Linux Workspace
9. Basic Root Filesystem Structure
10. Libraries
11. Main System Applications
12. Demos
                                     18
1. 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
●   A whole GNU world
    ●   glibc vs. Bionic



                                                                       19
2. 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, ...
                                                    20
3. 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
                                                  21
4. 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?

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




                                           24
6. 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.”
                                                                     25
7. Tools
●   GNU cross-development toolchain:
    ●   gcc - compiler
    ●   as - assembler
    ●   ld - linker
    ●   gdb/gdbserver - debugger
    ●   etc.
●   C library: uClibc, eglibc or glibc


                                         26
8. Embedded Linux Workspace
●   Need to organize the components used during
    cross-platform development. Workspace layout:
      bootldr:       target bootloader (s)
      build-tools:   toolchain build packages and sources
      debug:         debugging tools
      doc:           project documentation
      images:        binary images ready to be used on target
      kernel:        sources and build directories for target kernels
      project:       your own custom code for the target
      rootfs:        root filesystem as seen on the target
      sysapps:       sources for target's system applications
      tmp:           temporary data and experiments
      tools:         toolchain and all other tools required to build
                     software for the target.

                                                           27
8.1. Workspace env. vars. script
●   Complete workspace script (devex)
    export PROJECT=emblinux
    export PRJROOT=/home/karim/${PROJECT}
    export TARGET=arm­none­linux­gnueabi
    export PATH=${PATH}:[CODESOURCERY_DIR]/bin
    cd $PRJROOT
●   To use this script:
     $ .⌴ devex
●   Possible values for $TARGET:
     ●   ARM:    arm-linux, arm-unknown-linux-gnueabi
     ●   MIPS:   mips-linux, mipsel-unknown-linux-gnu
     ●   I386:   i386-linux, i586-geode-linux-uclibc
                                                 28
9. Basic root filesystem structure
●   Unix FS structured for multi-user systems
●   Some directories not necessary for embedded
●   Filesystem Hierarchy Standard (FHS):
    ●   /bin    =>   Essential user binaries
    ●   /boot   =>   Bootloader and kernel images
    ●   /dev    =>   Device files
    ●   /etc    =>   System configuration
    ●   /home   =>   User home directories
    ●   /lib    =>   Essential shared libs and kernel modules
    ●   /mnt    =>   Temporary mount point
    ●   /opt    =>   Add-on software packages
    ●   /sbin   =>   Essential system binaries
    ●   /tmp    =>   Temporary files
    ●   /usr    =>   Secondary hierarchy (mostly user apps)
    ●   /var    =>   Variable data generated by daemons
                                                     29
●   Non-essential multi-user dirs:
    ●   /home, /mnt, /opt, /root
●   Depends on bootloader:
    ●   /boot
●   Traditionally “essential”:
    ●   /bin, /dev, /etc, /lib, /proc, /sbin, /usr, /tmp, /var
●   Careful with “/etc”, Android needs it to point to
    “/system/etc” for Dbus config ... Just hack it.
●   Contain their own hierarchy:
    ●   /usr, /var                                     30
●   What are all these binaries directories for?
    ●   /bin     =>   Essential binaries for user and admin
    ●   /sbin    =>   Essential binaries for admin
    ●   /usr/bin =>   Non-essential user and admin binaries
    ●   /usr/sbin=>   Non-essential admin binaries
●   What are all those libraries directories for?
    ●   /lib     =>   Essential system libraries
    ●   /usr/lib =>   Non-essential libraries
●   The kernel does not force FS layout. Layout is
    “universally” agree upon (i.e. FHS.)


                                                   31
●   To start working on rootfs:
    $ cd ${PRJROOT}/rootfs
●   Create core rootfs directories:
    $ mkdir bin lib sbin usr var
●   Create the /usr hierarchy:
    $ mkdir usr/{bin,lib,sbin}
●   Create the /var hierarchy:
    $ mkdir var/{lib,lock,log,run,tmp}
    $ chmod 1777 var/tmp




                                         32
10. Libraries
1.glibc
2.uClibc




                           33
10.1. glibc
●   glibc components:
    ●   Actual shared libraries:
        –   Format: libLIB_NAME-GLIBC_VER.so
        –   Examples: libm-2.3.2.so, libc-2.3.2.so
    ●   Major revision version symbolic links:
        –   Format: libLIB_NAME.so.MAJOR_REV_VER
        –   Examples: libdl.so.2, libc.so.6
    ●   Version-independent symbolic links to the major
        revision version symbolic links:
        –   Format: libLIB_NAME.so
        –   Examples: libdl.so, libm.so
    ●   Static library archives:
        –   Format: libLIB_NAME.a
        –   Examples: libdl.a, libm.a
                                                     34
●   For target, need:
    ●   The actual shared libs
    ●   The major revision version symbolic links
●   Also need dynamic linker:
    ●   Actual linker: ld-GLIBC_VER.so
    ●   Symbolic link to linker:
        –   x86, ARM, SH, m68k   => ld-linux.so.MAJOR_REV_VER
        –   MIPS, PPC            => ld.so.MAJOR_REV_VER
●   Must determine exact library components required.
●   BELS table 6.2 contains complete list


                                                  35
●   Most important components:
    ●   ld     =>   the dynamic linker
    ●   libc   =>   the C library
    ●   libm =>     the math library
    ●   libdl =>    the shared objects manipulation library
●   Must determine exact dependencies of your
    applications.
●   Native ldd is not cross-platform-capable
●   Can use readelf or uclibc­ldd:
                                                 36
●   Copying all libraries:
    $ cp ­d [CODESOURCERY_DIR]/arm­none­linux­gnueabi/libc/lib/* 
    > ${PRJROOT}/rootfs/lib

●   Stripping all target libraries for space efficiency:
    $ arm­none­linux­gnueabi­strip ${PRJROOT}/rootfs/lib/*.so*




                                                    37
10.2. uClibc
●   Same naming conventions as glibc
●   Implements most of the glibc components:
    ●   ld, libc, libcrypt, libdl, libm, libpthread, libresolv, libutil.
●   uClibc libraries can coexist with glibc libraries in
    target's /lib directory.
●   Copying all uClibc components:
    $ cd ${PREFIX}/uclibc/lib
    $ cp *­*.so ${PRJROOT}/rootfs/lib
    $ cp ­d *.so.[*0­9] ${PRJROOT}/rootfs/lib
●   No need to strip uClibc libraries, they are stripped
    by the uClibc build script

                                                        38
11. Main system applications
●   Unix systems rely on a common set of commands
●   Standard distros have one binary per command
●   May compile each relevant command one-by-one
    or use packages that provide many commands in
    a single binary:
    1.Busybox
    2.Distro




                                       39
11.1. BusyBox
●   Main package used in embedded Linux to provide
    core set of Unix commands: busybox.net
     [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev,
     bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt,
     chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt, delgroup, deluser,
     depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, dumpleases,
     echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat,
     fdisk, fgconsole, fgrep, find, findfs, flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt,
     getty, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown,
     ifenslave, ifplugd, ifup, inetd, init, insmod, install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel,
     kbd_mode, kill, killall, killall5, klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login,
     logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man,
     md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd,
     mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mt, mv, nameif, nbd-client, nc, netstat, nice,
     nmeter, nohup, nslookup, ntpd, od, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap,
     popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pwd, raidautorun, rdate, rdev, readahead, readlink, readprofile,
     realpath, reboot, reformime, remove-shell, renice, reset, resize, rev, rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-
     parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont, setkeycodes,
     setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach, sleep, smemcap, softlimit, sort,
     split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd,
     tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true, tty, ttysize,
     tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep,
     uudecode, uuencode, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, xargs, xz, xzcat,
     yes, zcat, zcip

                                                                                                           40
●   Download BusyBox (1.18.3) to your $
    {PRJROOT}/sysapps directory and extract it there.
●   Move to the directory for the rest of the setup:
    $ cd ${PRJROOT}/sysapps/busybox­1.18.3

●   Configuration of BusyBox's options:
    $ make menuconfig




                                             41
42
●   “Busybox Settings”:
    ●   “Build Options” -> Cross-compiler prefix:
               ${TARGET}­
    ●   “Installation Options” -> Installation prefix:
               ${PRJROOT}/rootfs
●   Build:
    $ make

●   Install:
    $ make install

                                                    43
12. 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!

                                        44
12.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




                                            45
12.2. Demo 2 – Client/Server




                        46
12.3. Demo 3 – LTTng
●   Patch kernel
●   Cross-build ltt-ctl
●   Modify AOSP to log to LTTng




                                  47
Thank you ...

karim.yaghmour@opersys.com

     @karimyaghmour




                         48
1 of 48

Recommended

Android Hacks, Variants, Tricks and Resources ESC SV 2012 by
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.
2.2K views58 slides
Android On Development Boards at AnDevCon3 by
Android On Development Boards at AnDevCon3Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Opersys inc.
1.1K views12 slides
Android Variants, Hacks, Tricks and Resources by
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesOpersys inc.
3.6K views47 slides
Headless Android by
Headless AndroidHeadless Android
Headless AndroidOpersys inc.
4.2K views26 slides
Leveraging Android's Linux Heritage at AnDevCon3 by
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Opersys inc.
1.2K views47 slides
Porting Android by
Porting AndroidPorting Android
Porting AndroidOpersys inc.
4K views42 slides

More Related Content

What's hot

Android Jumpstart ESC SV 2012 Part I by
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IOpersys inc.
3K views161 slides
Headless Android at AnDevCon3 by
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
1.5K views29 slides
Leveraging Android's Linux Heritage by
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux HeritageOpersys inc.
1.2K views29 slides
Embedded Android Workshop by
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
5.6K views159 slides
Embedded Android Workshop at ELC Europe by
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeOpersys inc.
3.7K views160 slides
Inside Android's UI by
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
7.6K views44 slides

What's hot(20)

Android Jumpstart ESC SV 2012 Part I by Opersys inc.
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
Opersys inc.3K views
Headless Android at AnDevCon3 by Opersys inc.
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
Opersys inc.1.5K views
Leveraging Android's Linux Heritage by Opersys inc.
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
Opersys inc.1.2K views
Embedded Android Workshop by Opersys inc.
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
Opersys inc.5.6K views
Embedded Android Workshop at ELC Europe by Opersys inc.
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC Europe
Opersys inc.3.7K views
Inside Android's UI by Opersys inc.
Inside Android's UIInside Android's UI
Inside Android's UI
Opersys inc.7.6K views
Android jumpstart at ESC Boston 2011 by Opersys inc.
Android jumpstart at ESC Boston 2011Android jumpstart at ESC Boston 2011
Android jumpstart at ESC Boston 2011
Opersys inc.1.7K views
Understanding the Android System Server by Opersys inc.
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
Opersys inc.53.5K views
Android Internals at Linaro Connect Asia 2013 by Opersys inc.
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.4.4K views
Working with the AOSP - Linaro Connect Asia 2013 by Opersys inc.
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.5.1K views
Leveraging Android's Linux Heritage at AnDevCon IV by Opersys inc.
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.361 views
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012) by Matthias Brugger
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
Matthias Brugger10.9K views
Using and Customizing the Android Framework / part 4 of Embedded Android Work... by Opersys inc.
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Opersys inc.10K views
Scheduling in Android by Opersys inc.
Scheduling in AndroidScheduling in Android
Scheduling in Android
Opersys inc.1.5K views
Embedded Android Workshop with Marshmallow by Opersys inc.
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
Opersys inc.4K views
Memory Management in Android by Opersys inc.
Memory Management in AndroidMemory Management in Android
Memory Management in Android
Opersys inc.1.3K views
Leveraging Android's Linux Heritage at ELC-E 2011 by Opersys inc.
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.722 views
Android on Intel Architecture: ROM Cooking Tutorial by Ron Munitz
Android on Intel Architecture: ROM Cooking TutorialAndroid on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking Tutorial
Ron Munitz598 views

Viewers also liked

Brillo/Weave Internals by
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave InternalsOpersys inc.
3.2K views29 slides
Embedded Android Workshop at AnDevConII by
Embedded Android Workshop at AnDevConIIEmbedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConIIOpersys inc.
793 views159 slides
Embedded Android Workshop by
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
1.1K views160 slides
Project Ara by
Project AraProject Ara
Project AraOpersys inc.
458 views41 slides
Brillo / Weave Internals by
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
861 views32 slides
Android Platform Debugging and Development by
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
1.1K views53 slides

Viewers also liked(18)

Brillo/Weave Internals by Opersys inc.
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave Internals
Opersys inc.3.2K views
Embedded Android Workshop at AnDevConII by Opersys inc.
Embedded Android Workshop at AnDevConIIEmbedded Android Workshop at AnDevConII
Embedded Android Workshop at AnDevConII
Opersys inc.793 views
Embedded Android Workshop by Opersys inc.
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
Opersys inc.1.1K views
Brillo / Weave Internals by Opersys inc.
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
Opersys inc.861 views
Android Platform Debugging and Development by Opersys inc.
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.1.1K views
Brillo / Weave Internals by Opersys inc.
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
Opersys inc.588 views
Embedded Android Workshop with Nougat by Opersys inc.
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.2.3K views
Accessing Hardware on Android by Gary Bisson
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
Gary Bisson18.4K views
Scheduling in Android by Opersys inc.
Scheduling in AndroidScheduling in Android
Scheduling in Android
Opersys inc.6.2K views
Android Things Internals by Opersys inc.
Android Things InternalsAndroid Things Internals
Android Things Internals
Opersys inc.3.1K views
Embedded Android Workshop with Nougat by Opersys inc.
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.1.1K views
Android Things: Android for IoT by Opersys inc.
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
Opersys inc.4.6K views
Corporate Image Consulting by robertsol
Corporate Image ConsultingCorporate Image Consulting
Corporate Image Consulting
robertsol747 views
International CES 2012 番外編 by shugo01
International CES 2012 番外編International CES 2012 番外編
International CES 2012 番外編
shugo01502 views
Sweet Couples Lovely Animals Pictures by Thilini
Sweet Couples   Lovely Animals PicturesSweet Couples   Lovely Animals Pictures
Sweet Couples Lovely Animals Pictures
Thilini2.9K views
An Eye On New Media 2013 by Ken Morrison
An Eye On New Media 2013An Eye On New Media 2013
An Eye On New Media 2013
Ken Morrison19.8K views

Similar to Android Variants, Hacks, Tricks and Resources presented at AnDevConII

Leveraging Android's Linux Heritage at AnDevCon V by
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VOpersys inc.
571 views39 slides
Leveraging Android's Linux Heritage at AnDevCon VI by
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VIOpersys inc.
629 views40 slides
Leveraging Android's Linux Heritage at Android Open 2011 by
Leveraging Android's Linux Heritage at Android Open 2011Leveraging Android's Linux Heritage at Android Open 2011
Leveraging Android's Linux Heritage at Android Open 2011Opersys inc.
1.1K views15 slides
Android for Embedded Linux Developers by
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
5.9K views60 slides
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn... by
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
6.8K views30 slides
Is Android the New Embedded Linux? at AnDevCon V by
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.
500 views44 slides

Similar to Android Variants, Hacks, Tricks and Resources presented at AnDevConII(20)

Leveraging Android's Linux Heritage at AnDevCon V by Opersys inc.
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.571 views
Leveraging Android's Linux Heritage at AnDevCon VI by Opersys inc.
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.629 views
Leveraging Android's Linux Heritage at Android Open 2011 by Opersys inc.
Leveraging Android's Linux Heritage at Android Open 2011Leveraging Android's Linux Heritage at Android Open 2011
Leveraging Android's Linux Heritage at Android Open 2011
Opersys inc.1.1K views
Android for Embedded Linux Developers by Opersys inc.
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
Opersys inc.5.9K views
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn... by Opersys inc.
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.6.8K views
Is Android the New Embedded Linux? at AnDevCon V by Opersys inc.
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
Opersys inc.500 views
Is Android the New Embedded Linux? at AnDevCon VI by Opersys inc.
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
Opersys inc.803 views
Is Android the New Embedded Linux? at AnDevCon IV by Opersys inc.
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
Opersys inc.724 views
Inside Android's UI / ABS 2013 by Opersys inc.
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
Opersys inc.1.1K views
Linux as a gaming platform, ideology aside by Leszek Godlewski
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
Leszek Godlewski24.4K views
Lightweight Virtualization with Linux Containers and Docker I YaC 2013 by Docker, Inc.
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.1.1K views
Lightweight Virtualization with Linux Containers and Docker | YaC 2013 by dotCloud
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud14.2K views
Linux Administration for Developers by Mahmoud Said
Linux Administration for DevelopersLinux Administration for Developers
Linux Administration for Developers
Mahmoud Said628 views
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo... by Yandex
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
Yandex20.1K views
BKK16-105 HALs for LITE by Linaro
BKK16-105 HALs for LITEBKK16-105 HALs for LITE
BKK16-105 HALs for LITE
Linaro390 views
embedded-linux-120203.pdf by twtester
embedded-linux-120203.pdfembedded-linux-120203.pdf
embedded-linux-120203.pdf
twtester37 views
Extending Android's Platform Toolsuite by Opersys inc.
Extending Android's Platform ToolsuiteExtending Android's Platform Toolsuite
Extending Android's Platform Toolsuite
Opersys inc.1.1K views
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework by egypt
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
egypt1.6K views
Embedded Android Workshop / ELC 2013 by Opersys inc.
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013
Opersys inc.947 views
Android Internals by Opersys inc.
Android InternalsAndroid Internals
Android Internals
Opersys inc.7.8K views

More from Opersys inc.

Android Automotive by
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
5.5K views44 slides
Android 10 Internals Update by
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
1.8K views29 slides
Android Security Internals by
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
1.9K views68 slides
Embedded Android Workshop with Pie by
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
2K views251 slides
Android's HIDL: Treble in the HAL by
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
14.9K views29 slides
Android Treble: Blessing or Trouble? by
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
3.4K views62 slides

More from Opersys inc.(17)

Android Automotive by Opersys inc.
Android AutomotiveAndroid Automotive
Android Automotive
Opersys inc.5.5K views
Android 10 Internals Update by Opersys inc.
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
Opersys inc.1.8K views
Android Security Internals by Opersys inc.
Android Security InternalsAndroid Security Internals
Android Security Internals
Opersys inc.1.9K views
Embedded Android Workshop with Pie by Opersys inc.
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
Opersys inc.2K views
Android's HIDL: Treble in the HAL by Opersys inc.
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
Opersys inc.14.9K views
Android Treble: Blessing or Trouble? by Opersys inc.
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
Opersys inc.3.4K views
Embedded Android Workshop with Oreo by Opersys inc.
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
Opersys inc.5.9K views
Android Things Internals by Opersys inc.
Android Things InternalsAndroid Things Internals
Android Things Internals
Opersys inc.740 views
Android Platform Debugging and Development by Opersys inc.
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.928 views
Embedded Android Workshop with Nougat by Opersys inc.
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.640 views
Android Platform Debugging and Development by Opersys inc.
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.1.1K views
Memory Management in Android by Opersys inc.
Memory Management in AndroidMemory Management in Android
Memory Management in Android
Opersys inc.594 views
Android Platform Debugging and Development by Opersys inc.
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.1.2K views
Embedded Android Workshop with Marshmallow by Opersys inc.
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
Opersys inc.1K views
Memory Management in Android by Opersys inc.
Memory Management in AndroidMemory Management in Android
Memory Management in Android
Opersys inc.1.9K views
Android Platform Debugging and Development by Opersys inc.
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.2.3K views

Recently uploaded

AMAZON PRODUCT RESEARCH.pdf by
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdfJerikkLaureta
26 views13 slides
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...Jasper Oosterveld
18 views49 slides
PharoJS - Zürich Smalltalk Group Meetup November 2023 by
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023Noury Bouraqadi
127 views17 slides
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
31 views35 slides
Transcript: The Details of Description Techniques tips and tangents on altern... by
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
136 views15 slides
Kyo - Functional Scala 2023.pdf by
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdfFlavio W. Brasil
368 views92 slides

Recently uploaded(20)

AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta26 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada136 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst478 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex22 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software263 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views

Android Variants, Hacks, Tricks and Resources presented at AnDevConII

  • 1. Android Hacks, Variants, Tricks and Resources AnDevCon II Karim Yaghmour @karimyaghmour 1
  • 2. About ● Author of: ● Introduced Linux Trace Toolkit in 1999 ● Originated Adeos and relayfs (kernel/relay.c) ● Training, Custom Dev, Consulting, ... 2
  • 3. Agenda ● AOSP's limitations ● Tearing AOSP apart ● Forks ● Ports ● Mods ● Melding with “Classic” Linux Stack 3
  • 4. AOSP's limits ● Rigid ● Closed dev model ● Fits Google's prerogatives ● Excludes a lot of stuff ● ... IOW, doesn't always fit what you need 4
  • 5. Tearing AOSP apart ● Forks ● Ports ● Mods ● Melds 5
  • 6. Forks ● Cyanogenmod ● Replicant ● MIUI 6
  • 7. Cyanogenmod ● After-market handset firmware ● Requires rooted phone ● http://www.cyanogenmod.com ● Advertized features: ● Lockscreen Gestures ● Phone Goggles ● OpenVPN ● Incognito mode ● Themes support ● DSP Equalizer 7
  • 8. 8
  • 9. More interestingly: ● http://wiki.cyanogenmod.com/ ● https://github.com/CyanogenMod ● Includes Busybox ● Custom Launcher (ADWLauncher) ● Lots of tiny tweaks and mods ... worth doing a “diff” 9
  • 10. Replicant ● Android distro that is 100% Free Software ● http://replicant.us/ ● Includes FDroid free software app store 10
  • 11. MIUI ● Closed-source fork with slick UI enhancements ● Many translations ● http://en.miui.com/ ● Advertized features: ● Home screen ● Dialer ● SMS ● Contacts ● Themes ● Camera ● Gallery ● Net disk, File manager, Traffic monitor, Backup, Notes, ... 11
  • 12. 12
  • 13. Ports ● RIM Playbook ● BlueStacks ● Alien Dalvik 13
  • 16. Alien Dalvik (Myriad Group) 16
  • 17. Mods ● XDA Developers ● ... 17
  • 18. Melding with “Classic” Linux stack 1. Rationale 2. Roadblocks 3. Where do I start? 4. Coexistence Approaches 5. Been there done that 6. Unresolved / Uncharted 7. Tools 8. Embedded Linux Workspace 9. Basic Root Filesystem Structure 10. Libraries 11. Main System Applications 12. Demos 18
  • 19. 1. 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 ● A whole GNU world ● glibc vs. Bionic 19
  • 20. 2. 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, ... 20
  • 21. 3. 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 21
  • 22. 4. 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? 22
  • 23. 23
  • 24. 5. Been there done that ● BusyBox in CyanogenMod ● Gstreamer vs. Stagefright ● Don't know how they do it: ● Alien Dalvik: Android on Meego ● ... 24
  • 25. 6. 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.” 25
  • 26. 7. Tools ● GNU cross-development toolchain: ● gcc - compiler ● as - assembler ● ld - linker ● gdb/gdbserver - debugger ● etc. ● C library: uClibc, eglibc or glibc 26
  • 27. 8. Embedded Linux Workspace ● Need to organize the components used during cross-platform development. Workspace layout: bootldr: target bootloader (s) build-tools: toolchain build packages and sources debug: debugging tools doc: project documentation images: binary images ready to be used on target kernel: sources and build directories for target kernels project: your own custom code for the target rootfs: root filesystem as seen on the target sysapps: sources for target's system applications tmp: temporary data and experiments tools: toolchain and all other tools required to build software for the target. 27
  • 28. 8.1. Workspace env. vars. script ● Complete workspace script (devex) export PROJECT=emblinux export PRJROOT=/home/karim/${PROJECT} export TARGET=arm­none­linux­gnueabi export PATH=${PATH}:[CODESOURCERY_DIR]/bin cd $PRJROOT ● To use this script: $ .⌴ devex ● Possible values for $TARGET: ● ARM: arm-linux, arm-unknown-linux-gnueabi ● MIPS: mips-linux, mipsel-unknown-linux-gnu ● I386: i386-linux, i586-geode-linux-uclibc 28
  • 29. 9. Basic root filesystem structure ● Unix FS structured for multi-user systems ● Some directories not necessary for embedded ● Filesystem Hierarchy Standard (FHS): ● /bin => Essential user binaries ● /boot => Bootloader and kernel images ● /dev => Device files ● /etc => System configuration ● /home => User home directories ● /lib => Essential shared libs and kernel modules ● /mnt => Temporary mount point ● /opt => Add-on software packages ● /sbin => Essential system binaries ● /tmp => Temporary files ● /usr => Secondary hierarchy (mostly user apps) ● /var => Variable data generated by daemons 29
  • 30. Non-essential multi-user dirs: ● /home, /mnt, /opt, /root ● Depends on bootloader: ● /boot ● Traditionally “essential”: ● /bin, /dev, /etc, /lib, /proc, /sbin, /usr, /tmp, /var ● Careful with “/etc”, Android needs it to point to “/system/etc” for Dbus config ... Just hack it. ● Contain their own hierarchy: ● /usr, /var 30
  • 31. What are all these binaries directories for? ● /bin => Essential binaries for user and admin ● /sbin => Essential binaries for admin ● /usr/bin => Non-essential user and admin binaries ● /usr/sbin=> Non-essential admin binaries ● What are all those libraries directories for? ● /lib => Essential system libraries ● /usr/lib => Non-essential libraries ● The kernel does not force FS layout. Layout is “universally” agree upon (i.e. FHS.) 31
  • 32. To start working on rootfs: $ cd ${PRJROOT}/rootfs ● Create core rootfs directories: $ mkdir bin lib sbin usr var ● Create the /usr hierarchy: $ mkdir usr/{bin,lib,sbin} ● Create the /var hierarchy: $ mkdir var/{lib,lock,log,run,tmp} $ chmod 1777 var/tmp 32
  • 34. 10.1. glibc ● glibc components: ● Actual shared libraries: – Format: libLIB_NAME-GLIBC_VER.so – Examples: libm-2.3.2.so, libc-2.3.2.so ● Major revision version symbolic links: – Format: libLIB_NAME.so.MAJOR_REV_VER – Examples: libdl.so.2, libc.so.6 ● Version-independent symbolic links to the major revision version symbolic links: – Format: libLIB_NAME.so – Examples: libdl.so, libm.so ● Static library archives: – Format: libLIB_NAME.a – Examples: libdl.a, libm.a 34
  • 35. For target, need: ● The actual shared libs ● The major revision version symbolic links ● Also need dynamic linker: ● Actual linker: ld-GLIBC_VER.so ● Symbolic link to linker: – x86, ARM, SH, m68k => ld-linux.so.MAJOR_REV_VER – MIPS, PPC => ld.so.MAJOR_REV_VER ● Must determine exact library components required. ● BELS table 6.2 contains complete list 35
  • 36. Most important components: ● ld => the dynamic linker ● libc => the C library ● libm => the math library ● libdl => the shared objects manipulation library ● Must determine exact dependencies of your applications. ● Native ldd is not cross-platform-capable ● Can use readelf or uclibc­ldd: 36
  • 37. Copying all libraries: $ cp ­d [CODESOURCERY_DIR]/arm­none­linux­gnueabi/libc/lib/*  > ${PRJROOT}/rootfs/lib ● Stripping all target libraries for space efficiency: $ arm­none­linux­gnueabi­strip ${PRJROOT}/rootfs/lib/*.so* 37
  • 38. 10.2. uClibc ● Same naming conventions as glibc ● Implements most of the glibc components: ● ld, libc, libcrypt, libdl, libm, libpthread, libresolv, libutil. ● uClibc libraries can coexist with glibc libraries in target's /lib directory. ● Copying all uClibc components: $ cd ${PREFIX}/uclibc/lib $ cp *­*.so ${PRJROOT}/rootfs/lib $ cp ­d *.so.[*0­9] ${PRJROOT}/rootfs/lib ● No need to strip uClibc libraries, they are stripped by the uClibc build script 38
  • 39. 11. Main system applications ● Unix systems rely on a common set of commands ● Standard distros have one binary per command ● May compile each relevant command one-by-one or use packages that provide many commands in a single binary: 1.Busybox 2.Distro 39
  • 40. 11.1. BusyBox ● Main package used in embedded Linux to provide core set of Unix commands: busybox.net [, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64, basename, beep, blkid, blockdev, bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs, flock, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, insmod, install, ionice, iostat, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mt, mv, nameif, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pwd, raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev, rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run- parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont, setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach, sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true, tty, ttysize, tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, xargs, xz, xzcat, yes, zcat, zcip 40
  • 41. Download BusyBox (1.18.3) to your $ {PRJROOT}/sysapps directory and extract it there. ● Move to the directory for the rest of the setup: $ cd ${PRJROOT}/sysapps/busybox­1.18.3 ● Configuration of BusyBox's options: $ make menuconfig 41
  • 42. 42
  • 43. “Busybox Settings”: ● “Build Options” -> Cross-compiler prefix: ${TARGET}­ ● “Installation Options” -> Installation prefix: ${PRJROOT}/rootfs ● Build: $ make ● Install: $ make install 43
  • 44. 12. 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! 44
  • 45. 12.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 45
  • 46. 12.2. Demo 2 – Client/Server 46
  • 47. 12.3. Demo 3 – LTTng ● Patch kernel ● Cross-build ltt-ctl ● Modify AOSP to log to LTTng 47