android paper

Upload: nikhil-hosur

Post on 14-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Android Paper

    1/12

    DebianRunner: Running Desktop Applications on Android

    Smartphones

    Abhishek Gupta, Alejandro Rodriguez and Kurt PrestonDepartment of Computer Science

    University of Illinois at Urbana-Champaign

    Urbana, IL 61801, USA

    Email: {gupta59, arodri30, kpresto3}@illinois.edu

    Abstract

    The Android operating system runs atop the Linuxkernel, yet lacks the ability to natively execute stan-

    dard Linux desktop applications. Though efforts havebeen made to enable this functionality, all approachesto date require a user to switch to a separate desktopenvironment, resulting in a substantial loss of interfaceconsistency and usability.

    This paper describes DebianRunner, an Androidapplication designed to execute in a custom, root-enabled Android build. It unlocks desktop Linux ca-pabilities by mounting the full Debian Linux distribu-tion into the file system, and provides a tool to sim-plify the installation and execution of Linux programsfrom within Android.

    Though functional, DebianRunner suffered from

    poor performance as a result of limited RAM in theHTC Dream used for testing. However, more power-ful phones should be better able to exploit Debian-Runners functionality, and the most of techniquesexplored in this paper would be applicable to otherrooted Android phones.

    1 Introduction

    1.1 Background

    Since Androids release in October 2008, the op-

    erating system has attracted much developer atten-tion, currently supporting over 25,000 publicly re-leased applications [4]. Android has proved a pow-erful, though insulating programming environment;even though Android runs on top of the Linux kerneland Java runtime environment, the platform prohibitsapplications from interacting directly with the kernelor Java VM [26]. While these restrictions help presentan integrated and secure environment, they also tram-mel the power of the underlying technologies.

    Developers are forbidden from directly accessinghardware (preventing features like tethering), compil-ing to assembly (limiting performance optimizations),or utilizing the many libraries supported by Linux

    (preventing things like the execution of Blackberryapps). Furthermore, users are prevented from access-ing the rich ecosystem of software already developedfor the Linux kernel. The Ubuntu public repositoriesalone contain over 27,000 packages [22], constitutinghundreds of millions of lines of code, refined by tensof thousands of developers over multiple decades, noneof which can be directly used in Android [21]. To beused, these applications have to go through the com-plicated process of porting, often needing to be com-pletely re-written, despite the fact that the technologyrequired to run them exists natively on the device.

    1.2 Previous Approaches

    Attempts have been made to overcome these short-comings. To address the performance limitations in-herent to Java programs, Google has provided theNDK [3], a toolkit to enable developers to run op-timized C/C++ code for performance gains. To sim-plify the porting of embedded applications, MapuSofthas released a code porting utility [20]. Most no-tably, some custom Android builds have enabled sys-tem calls [27], and have been utilized to install andrun alternate desktop environments in parallel withAndroid [12]. All these approaches are useful, and ad-

    dress some of concerns itemized above; however, noneprovide users with a simple way to seamlessly inte-grate external applications.

    Although Linux applications can now be run fromwithin a parallel desktop environment, the utility ofthis feature is lost by its inconvenience: users mustswitch to an entirely different environment to installor run software. These desktop environments were cre-ated for a completely different form factor than a cellphone, and translate poorly onto such a small screen,

    1

  • 7/27/2019 Android Paper

    2/12

    forcing users to pan and zoom through an oversizeddesktop to interact with the software. No approachesto date enable non-Android software to behave like anormal part of the system.

    1.3 DebianRunner

    A number of hardware and software barriers must beovercome to support the execution of non-Androidsoftware. Importantly, a customized operating systemis required that enables system calls. Furthermore,Android provides no built-in capability for commu-nicating with external processes, requiring all incom-ing data to be transmitted over network connectionsusing protocols like VNC. Multiple nodes of integra-tion must be addressed: Linux applications shouldbe installed and removed from within Android; theuser should be not forced to interact with a differ-ent desktop environment when using external applica-

    tions; windows should be reformatted to fit the smallerdisplay. Ideally, the user is prevented from acciden-tally corrupting their install. All this must also bedone with a minimal memory footprint due to the lim-ited RAM available on smartphones.

    With all this in mind, we have developed Debian-Runner, an Android application running on top of acustom Android environment that enables improvedintegration of externally-executed applications intothe Android system. Linux desktop applications arelaunched and interacted with from within an Androidapplication, without requiring a user to switch to aforeign desktop environment. Selecting an application

    within DebianRunner causes the application to launchin the background, and start streaming graphic dataover a remote VNC connection. Though the user isactually operating on a VNC client, the impression ofworking directly on an application is maintained.

    This approach enables broad flexibility, enabling thepresentation of any application that can be invokedfrom system calls. Furthermore, it hides the abstrac-tions from the user, enabling them to treat the exter-nal application more like a part of their native environ-ment. In effect, it dramatically expands the numberof applications that an Android user can run.

    Though currently hindered by the memory lim-

    itations of our test hardware, our implementationdemonstrates the execution of simple graphical Linuxapplications. Applications such as gCalculator andgEdit can operate without any modification, and withthe larger RAM capacity of modern phones, morecomplicated applications should be possible.

    Much work is still required to provide the user acompletely transparent experience; however, we be-lieve that DebianRunner represents an important stepforward in the use of Android phones as a platform

    to execute the thousands of useful legacy applicationsoriginally intended for other environments.

    The rest of the paper is organized as follows: Sec-tion 2 describes the design decisions we have madeand the alternatives we have considered; Section 3 de-scribes the results we obtained; Section 4 discusses

    limitations and potential extensions of our work; Sec-tion 5 discusses related work; Section 6 concludes.

    2 Design and Implementation

    2.1 Design Overview

    The integration of Linux desktop applications into An-droid requires work across a variety of areas: customAndroid firmware must be built, system calls must bewrapped, Linux display configuration modified, and anumber of user interaction particularities must be ad-

    dressed. However, our implementation can be dividedinto four key areas:

    1. Enable Android applications to execute privilegedLinux commands: Custom Android firmware wasused to allow Android applications to make sys-tem calls with root privileges (discussed in sec-tion 2.3).

    2. Restore full Linux capabilities: A Debian Linuximage was mounted to provide functionality thatwas stripped from Androids Linux install (dis-cussed in section 2.4).

    3. Provide a mechanism for graphically interactingwith applications: Linuxs display settings wereoptimized for the small screen, and graphics werestreamed via VNC (discussed in section 2.5).

    4. Integrate all user-facing components into an An-droid application: The DebianRunner applica-tion was created to allow a user to run and in-stall Linux applications from within Android (dis-cussed in section 2.6).

    These components are all deployed on the samesystem, as illustrated in figure 1.

    To execute applications, DebianRunner performsthe following main steps (indicated by the numbersin figure 1):

    1. A user selects an application to launch or installfrom the DebianRunner Android application.

    2. A JNI call is made through the NDK, invoking ascript to install or run the application.

    2

  • 7/27/2019 Android Paper

    3/12

    Figure 1: Deployment View

    3. The script will execute the desired commandwithin Debians context (rather than AndroidsLinux).

    4. A VNC server is started in Debian, formatted tofit the phones screen.

    5. The application is launched in Debian.

    6. A VNC client is started by DebianRunner, andthe Debian applications graphics are streamedto the user.

    The technical details of this process are described infurther detail in the following sections.

    2.2 Target Platform: HTC Dream(T-Mobile G1)

    Although the Android operating system is relativelyunified project, there remain notable differences be-tween release versions, and a variety of functional in-

    consistencies in the firmware. Simply put, Android isa little bit different from phone to phone, version toversion, and consequently, a more focused approachwas required.

    We attempted modifications to the Motorola Droid,as well as configuration of system images loaded bythe Android SDKs emulator, but ultimately decidedto perform our implementation on the HTC Dream(branded in the United States as the T-Mobile G2).Though it provides the most flexibility, the emulated

    environment proved extremely slow in booting cus-tom images, and seemed to have enough inconsisten-cies with phones native capabilities that our imple-mentation might be difficult to port to actual hard-ware. For example, the emulator by default lacks someextremely basic system utilities such as the Linuxcd and pwd commands, requiring a modificationof the image to perform even the most rudimentarytasks. We also explored development on the MotorolaDroid, but documentation was vastly inferior to the

    3

  • 7/27/2019 Android Paper

    4/12

    Dream/G1.Due to the volume of available documentation on

    the Dream/G1 by the Android hacking community,the size of the phones user base, and our ability toacquire the phone for testing purposes, our implemen-tation was targeted specifically for that phone. How-

    ever, it is our hope that our methodology could ul-timately be generalized, enabling any phone to runLinux desktop applications.

    2.3 CyanogenMod: Enabling Systemcalls

    Although it runs on top of Linux, Android is de-signed to be an insular environment [26]. Applica-tions run within a custom Java VM called Dalvik,and are strictly controlled in their access of system re-sources [6]. Execution of native system code is limitedto controlled libraries compiled using the Android Na-

    tive Development Kit (NDK) [3]. However, the NDKforbids access to resources outside of Android.

    Launching Linux applications thus requires a mod-ification of the Android operating system, and its un-derlying firmware. This itself is problematic, as mostAndroid phones restrict the user in modifying thesesystem files [9]. However, a security hole was foundin the RC29 Android release enabling users to start atelnet daemon as root. By exploiting this vulnerabil-ity, users could override the phones protection mech-anisms and flash a custom system image [14]. Customimages were created that enabled users to execute sys-tem calls within Android applications, thus potentiallyenabling users to execute Linux applications.

    Our implementation is built atop one of these cus-tom Android images called CyanogenMod [7] since itcurrently maintains the largest user base of all root-enabled custom Android builds.

    2.4 Mounting Debian: restoring fullLinux capabilities

    By default, Android is deployed on top of a heav-ily stripped-down Linux install, lacking a desktop en-vironment and many basic Linux commands [15].

    Graphical Linux applications require a variety of de-pendencies which must be installed in order to oper-ate. These required packages were loaded by meansof installing and mounting an unpacked image of theDebian Linux distribution.

    Running Debian on Android has been done beforeon various firmware versions of the G1 since late 2008.The most popular method was to mount a Debian im-age file onto Androids Linux file system as a loop-back device. A user by the name Ghostwalker from

    the androidfanatic.com forum, created a set of scriptsthat automated the installation and mounting processof Debian onto the G1. However, this only workedon the RC33 firmware version of the G1. Severaldifferent instructions for different firmware versionswere posted throughout Internet forums in an attemptto describe a procedure that successfully worked onthe latest CyanogenMod build. Using as a referencethe directions posted by user ChrisDos from the xda-developers.com forum, we were able to successfully in-stall and mount Debian onto a G1 phone having theCyanogenMod 4.2.15.1 firmware version.

    Since the 4.2.1.15 firmware had issues mount-ing loopback devices, we circumvented this limita-tion by copying the contents of the Debian im-age onto a 2 GB ext2 partition of the sd card.We modified Ghostwalkers scripts to take into ac-count this workaround, and copied them to the /sd-card/debian/ directory of the sd cards FAT32 parti-

    tion. Running the bootdeb script with the commandsu

  • 7/27/2019 Android Paper

    5/12

    streamed over X11, or the application should be max-imized when streamed over VNC. Because Devils Pieprovides the capability to remove windows bordersand menu bar upon launch, maximizing the windowswas a viable approach; the windows minimizing andmaximizing controls could be concealed, giving theimpression of a single, full-screen application. Thus,VNC was selected, assisted by a Devils Pie processrunning in the background.

    The actual execution of the VNC server is done bya script, /usr/local/bin/vncstart 480x320, that auto-matically starts a VNC session at port 5900 usingthe G1s screen resolution of 480x320. Since thisscript resides within Debians filesystem, we createdthe script, /sdcard/debian/vncstart 480x320, whichcalls /usr/local/bin/vncstart 480x320 and allows An-droid applications to run Debian programs. The /sd-card/debian/vncstart 480x320 script is as follows:

    export USER=root

    export HOME=/root

    chroot /data/local/mnt/usr/local/bin/vncstart 480x320

    In addition, the X11s hosts file had to be config-ured to allow remote execution of graphical appli-cations from the terminal. For the VNC client, weused the open source androidVNC project, but hadto make minor modifications to the program to betterintegrate it. In particular, the client had to be mod-

    ified to support the portrait layout used by mostAndroid applications (by default, the client assumeda landscape orientation). Also, some minor modifica-tions had to be made to allow it to be invoked fromwithin DebianRunner.

    This approach was largely successful, but doespresent some minor inconsistencies for the user. Forexample, since all Linux applications are viewed in asingle VNC client instance, separate applications willnot appear as separate tasks on Androids task man-ager. To switch between Linux applications, a usermust select the application in DebianRunner. How-ever, it should still be possible to create desktop short-

    cuts for specific applications by enhancing Debian-Runner with Androids shortcut API.

    The resulting layout for the Linux calculator appli-cation gCalculator is shown in figure 3.

    The LXDE taskbar is shown on the bottom so wecould monitor CPU use during testing. This taskbarcan ultimately be removed, to present a true single-application view. Font size also appears a bit small,as a result of resizing the application to unusual di-mensions. This could be counteracted by changing

    Debians text appearance options, although each ap-plication may require different ideal sizes, complicat-ing this.

    2.6 DebianRunner: Tying the piecestogether

    With all the back-end components set-up and config-ured, an Android application was required to providethe user a central source to perform all necessary op-erations. These include:

    1. Mounting the Debian image

    2. Starting the VNC server and Devils Pie

    3. Installing applications

    4. Uninstalling applications

    5. Running/viewing applications

    DebianRunner is a simple Android application de-signed to present a front-end to all these capabilities,and looks as shown in figure 2.

    To install applications, a user must simply typethe applications name, and press the OK button.This will make a system call to execute the installscript, passing the application name as a parame-ter into the apt-get package manager. The applica-tion is then added to the list of installed applications.Similarly, applications can be uninstalled by invokingthe installed applications context menu, and selectinguninstall.

    Running the application is done by selecting the ap-plication from the list of installed applications. Click-ing an item invokes the run script, and then launchesthe VNC client so that the application can be viewed.Two buttons on the bottom execute scripts to set-upthe system. Boot Debian mounts the Debian parti-tion, and Launch VNC starts the VNC server andDevils Pie.

    These scripts are executed via the Android NDK,which we used to create a C++ shared library thatmakes system calls on behalf of DebianRunner, us-ing the JNI interface. This would ultimately allow usto mount Debian, start the VNC server, and install

    and run Debian programs. The following is the list ofscripts we created along with their function:

    1. /sdcard/debian/bootdeb - Mounts Debian fi-leystem onto Androids Linux filesystem; enablesIP4 forwarding

    2. /sdcard/debian/vncstart 480x320 - Calls/usr/local/bin/vncstart 480x320, which re-sides within Debians fileystem, to start the VNCserver

    5

  • 7/27/2019 Android Paper

    6/12

    Figure 2: DebianRunner

    3. /sdcard/debian/install app - Installs a Debian ap-plication

    4. /sdcard/debian/run app - Runs a Debian appli-cation

    5. /sdcard/debian/uninstall app - Uninstalls a De-

    bian application

    DebianRunner currently only provides basic func-tionality. For example, it does not track running ap-plications, nor does it provide a mechanism for ter-minating them. Furthermore, the mouse cursor iscurrently controlled by the trackball, rather than thetouch screen, which is abnormal behavior for an An-droid application. These shortcomings, and other po-tential extensions to DebianRunner are discussed insection 4.

    3 ResultsIn its current state, DebianRunner has been demon-strated as functional, but suffers from performanceand feature limitations. It succeeds in its primary goalof enabling applications to be installed and run fromwithin Android, and provides a solid foundation for fu-ture work in the integration of desktop applications.However, the test hardware (HTC Dream) is not suffi-ciently powerful to provide a truly usable experience.

    Figure 3: Layout for the Linux calculator application:gCalculator

    The primary issue is that of memory. The HTCDream offers only 192 MB of RAM [16], with 96MB reserved for non-system purposes (GPU, radiofirmware, etc.) [13]. That leaves Android only 96 MBof space to work with, almost all of which is used byAndroid itself. In our tests, a fresh reboot of Android

    leaves only 2.3MB to run Debian and its applications.Once Debian is launched, Android frees some memoryto make room for the new processes, but there remainsonly 1.6 MB unclaimed. Android is effective in dy-namically adjusting to the amount of memory it hasavailable, but its performance declines as its availableRAM is reduced. Given that a comparable Debian in-stall consumed approximately 105 MB on our desktoptests, it is a bit surprising that it even ran at all onour test hardware.

    As a rough benchmark, gCalculator takes approxi-mately 0.5s to respond to clicks, and approximately5 minutes to install. Many larger programs could

    not even install due to lack of memory. For exam-ple, the instant messaging client Pidgin failed to com-plete installation in our tests the system simply be-came unresponsive. Because memory was such a bot-tleneck, we didnt perform any formal performancebenchmarks; the numbers would come out radicallydifferently on a device with more memory. In short, webelieve that the lackluster performance DebianRunnerisnt a software limitation, but a hardware one.

    That said, the hardware specifications of Android

    6

  • 7/27/2019 Android Paper

    7/12

    phones are increasingly rapidly. For example, theNexus One phone, released only 15 months after theHTC Dream, comes with 512 MB of RAM 320 MBmore than the HTC Dream. This provides more thanenough space to hold Debians 105 MB footprint. Fur-thermore, Nexus Ones CPU is clocked at almost twicethe speed (1 GHz, compared to Dreams 528 MHz) al-lowing for further speed increases.

    4 Potential Extensions

    Though our implementation was functional, there re-main a number of enhancements we did not have theopportunity to implement. These can be divided intotwo primary categories: opportunities for improvedintegration, and supplemental features.

    4.1 Integration Enhancements

    There remain a number of areas in which Debian ap-plications could be more fully integrated with the An-droid user experience. Below are listed some of thekey areas for improvement we perceive:

    Touch screen support: Currently, the VNCclient does not support touchpad usage for themouse cursor. The code exists in the client, butis not active due to the way the client is invoked.This can be fixed by enhancements to the VNCclient launch procedure.

    Sound support: Linux system sounds are notcurrently streamed to Android. This can besolved by configuring Debian to use a stream-ing audio server like IceCast [17] and adding codeto DebianRunner to receive and play the audiostream.

    Desktop shortcuts: Standard Android appli-cations can always be launched by clicking onicon on the desktop or in the programs menu.Though it is not currently done, shortcuts to De-bian applications could be created on the desktopby utilizing Androids CREATE SHORTCUT in-

    tent; however, icons cannot be added to the pro-grams menu without creating a separate An-droid application (which Android programs lackthe permissions to do).

    4.2 Feature Enhancements

    In addition to integration improvements, there remaina number of capabilities which can be built off of De-bianRunner, but are not currently implemented.

    Windows emulation: Linux has relatively ro-bust Windows emulation support, notably in theWine project [25]. If scripts were created toexecute custom Wine calls, then Windows ap-plications could be launched much in the sameway Linux applications currently are. This woulddramatically expand the scope of programs sup-ported by the Android platform to encompassmuch of the worlds most used software.

    BlackBerry/Symbian emulation: Together,BlackBerry and Symbian constitute 42% of thecurrent smartphone market [1]. Emulation couldbe extended to either of these platforms, utilizinggnupoc [23] in the case of Symbian, and usingWine to run BlackBerry simulators.

    Task listing and termination: DebianRunnerdoes not currently provide a mechanism for killingtasks. If launched program ids were to be trackedby DebianRunner, it could conceivably send killcommands in response to a user request to quit.Without this feature, DebianRunner runs the riskof consuming too much of the systems memorywith long-term use.

    5 Related Work

    As discussed in section 1, much effort has been madeto modify and expand the capability of the Androidoperating system, but no work was found that at-

    tempts to tie non-Android applications directly intothe Android environment.

    A technology consultant, Jay Freeman (publishingunder the name saurik), wrote the first well-knownarticle named Debian and Android Together on G1[8] in late 2008 for installing and running Debian ontothe G1. But his method relied on a security hole inthe RC 29 firmware version where key-presses werebeing routed to a Linux console that was running aroot terminal. This method became obsolete once theRC30 version patched the bug.

    In January 2009, a user by the name Ghostwalkerfrom the http://www.androidfanatic.com website

    created instructions for installing Debian on the G1using a custom firmware version created by a usernamed JesusFreke from Android-Roms google project[18]. However, Ghostwalkers instructions only workwith this specific firmware version, and are not com-patible with other Android-build communities such asCyanogenmod.

    Installation of Debian on the Droid was apparentlyaccomplished a few months ago by a user namedFresh-Meat [11]. However, this required a customized

    7

  • 7/27/2019 Android Paper

    8/12

    version of the ext2.ko kernel module that is no longerprovided by this user.

    These efforts have served as a foundation for ourresearch, but have different points of focus. We hopeto expand upon their work by the creation of an An-droid application and custom environment capable of

    running standard Linux desktop applications, withoutrequiring a user to ever exit Android itself.

    6 Conclusion

    We believe that DebianRunner represents a significantstep forward in the execution of desktop applicationson Android smartphones. Though our test hardwaresuffered from poor performance, we anticipate thatthese issues will disappear as phones become morepowerful, perhaps even on the current generation ofAndroid devices. DebianRunner has the potential to

    dramatically expand the number of applications exe-cutable on the Android platform, encompassing mostapplications that Linux can run or emulate.

    We are optimistic that these capabilities will expandas hardware becomes more sophisticated. Ultimately,Android smartphones phones will have sufficient hard-ware to run sophisticated spreadsheet applications orimage manipulation programs. DebianRunner unlockssome of Android phones significant hidden capabili-ties, bringing us one step closer to pocket Starcraft.

    References

    [1] Admob Mobile Metrics Report. http://metrics.admob.com/wp-content/uploads/

    2010/03/AdMob-Mobile-Metrics-Feb-10.pdf.

    [2] An Introduction to X by the Linux Informa-tion Project (LINFO). http://www.linfo.org/x.html.

    [3] Android 1.6 Ndk, Release 1. http://developer.android.com/sdk/ndk/1.6_r1/index.html.

    [4] Android Market Statistics. http://www.

    androlib.com/appstats.aspx.

    [5] Android-vnc-viewer. http://code.google.com/p/android-vnc-viewer/.

    [6] Application Fundamentals Android Develop-ers. http://developer.android.com/guide/topics/fundamentals.html.

    [7] CyanogenMod Android Rom. http://www.cyanogenmod.com/.

    [8] Debian and Android Together on G1. http://www.saurik.com/id/10.

    [9] Developing on a Device Android Develop-ers. http://developer.android.com/guide/developing/device.html.

    [10] Devils Pie. http://burtonini.com/blog/computers/devilspie/.

    [11] Fully working Debian on your stock 2.0.1Droid. http://alldroid.org/threads/14749-Fully-working-Debian-on-your-stock-2.

    0.1-Droid!

    [12] Gnome, Kde, IceWM or LXDE on your An-droid! http://www.androidfanatic.com/cms/community-forums.html?func=view&catid=9.

    [13] How much memory should we actually be see-ing ? http://forum.xda-developers.com/showthread.php?t=613205.

    [14] How to Root, Hack and Flash yourG1. http://forum.xda-developers.com/showthread.php?t=442480.

    [15] HOWTO: Unpack, Edit, and Re-Pack BootImages. http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,

    _and_Re-Pack_Boot_Images.

    [16] HTC - Products - HTC Dream - Speci-fication. http://www.htc.com/www/product/

    dream/specification.html.

    [17] Icecast.org. http://www.icecast.org/.

    [18] Installing the Latest Custom ROM.http://code.google.com/p/android-roms/

    wiki/Install_Custom_ROM.

    [19] Java X11 Library. http://sourceforge.net/projects/escher/.

    [20] Mapusoft Extends Support to Android, En-abling Legacy Code Reuse. http://www10.edacafe.com/nbc/articles/view_article.

    php?section=ICNews&articleid=779297.

    [21] Sloccount Web for Debian Lenny. http://libresoft.es/debian-counting/lenny/

    index.php?menu=Statistics.

    [22] Software Packages in karmic. http://packages.ubuntu.com/karmic/allpackages.

    [23] Symbian development on Linux and OS X . http://www.martin.st/symbian/.

    8

  • 7/27/2019 Android Paper

    9/12

    [24] WeirdX - Pure Java X Window System Serverunder GPL. http://www.jcraft.com/weirdx/.

    [25] WineHQ - Run Windows applications on Linux,BSD, Solaris and Mac OS X. http://www.winehq.org/.

    [26] L. Batyuk, A.-D. Schmidt, H.-G. Schmidt,A. Camtepe, and S. Albayrak. Developing andBenchmarking Native Linux Applications on An-droid. In MobileWireless Middleware, OperatingSystems, and Applications, pages 381392, 2009.

    [27] A.-D. Schmidt, H.-G. Schmidt, L. Batyuk, J. H.Clausen, S. A. Camtepe, S. Albayrak, andC. Yildizli. Smartphone Malware Evolution Re-visited: Android Next Target? In Proceedingsof the 4th International Conference on Maliciousand Unwanted Software (Malware 2009), pages39. IEEE, 2009.

    A Set-Up Instructions

    1. Create an ext2 filesystem partition on the phonesSD card. Step-by-step instructions can be foundat http://androidandme.com/2009/08/news/how-to-manually-partition-your-sd-card-

    for-android-apps2sd/. Using an 8 GB sdhccard with 4 partitions, here is a suggested strat-egy:

    Partition 1: 5 GB FAT32 - For the /sdcardmount

    Partition 2: 512 MB Ext2 - For the apps2sd

    Partition 3: 512 MB Swap - For improvingphone response & usability

    Partition 4: 2 GB Ext2 - For Debian

    2. Follow the instructions for downloading the de-bian image file and installation scripts at http://www.androidfanatic.com/community-forums.

    html?func=view\&catid=9\&id=2248. Makesure to just download the files and not follow theother steps listed since theyre out-of-date.

    3. Connect and mount the phone onto a Linux sys-tem. Make note of the block device that theDebian ext2 partition represents. For example,/dev/sdb4.

    4. Copy the debian image file, debian.img, to the/tmp directory of the Linux system.

    5. Execute these commands:

    mkdir /tmp/debloop

    mkdir /tmp/debpart

    mount -o loop /tmp/debian.img/tmp/debloop

    mount /dev/sdb4 /tmp/debpart (Substitute/dev/sdb4 for the actual block device if nec-essary)

    rsync -av progress

    /tmp/debloop/* /tmp/debpart

    unmount /tmp/debloop

    unmount /tmp/debpart

    6. Create the /sdcard/debian directory on thephone, and copy the downloaded files from step 2to this directory.

    7. Update the installer.sh file as shown be-low, and execute this script using the com-mand su

  • 7/27/2019 Android Paper

    10/12

    echo Custom Debian Bootloader is now in-stalled!;

    echo This process does NO damage to yourAndroid OS!;

    echo ;

    echo Courtesy of http://www.myhangoutonline.com;

    echo Installer by WhiteMonster84;

    echo ;

    echo To enter the Debian Linux console justtype sh bootdeb;

    echo PS: Be sure to run sh/scripts/onetime.sh as root from theshell after your FIRST boot.;

    8. Update the bootdeb script as shown below,and execute this script using the command

    su

  • 7/27/2019 Android Paper

    11/12

    local

    localhost

    17. Create the script/usr/local/bin/vncstart 480x320 with thecontents shown below, and run it. This will starta VNC session :0. Test it by downloading aVNC viewer from the Android Marketplace andconnecting to the VNC server. The IP Addressshould be localhost and the port number shouldbe 5900.

    #!/bin/bash

    vncserver -kill :0

    sleep 2

    sshagent pid=ps -ef|grep ssh-agent |grep -vgrep |awk print $3

    kill -9 $sshagent pid

    sleep 2

    xstartup pid=ps -ef |grep xstartup grep -vgrep |awk print $2

    kill -9 $xstartup pid

    sleep 2

    Xtightvnc pid=ps -ef |grep Xtightvnc |grep-v grep |awk print $2

    kill -9 $Xtightvnc pid

    sleep 2

    rm -fr /tmp

    mkdir /tmp

    chmod 777 /tmpvncserver :0 -geometry 480x320

    18. Exit out of the Debian filesystem context, createthe script /sdcard/debian/vncstart 480x320 withthe contents below, and run it using the commandsu

  • 7/27/2019 Android Paper

    12/12

    ( maximize )

    ( shade )

    ( println match )

    )

    )

    23. Add the line devilspie to the/usr/local/bin/vncstart 480x320 script torun devilspie as part of the VNC server startup.

    24. Using the Android NDK, create a C++shared library that can make system callsto run the /sdcard/debian/install app,/sdcard/debian/uninstall app, and /sd-card/debian/uninstall app scripts.

    25. Create a regular Android application that canmake native function calls to the C++ shared li-brary via JNI, in order run the scripts created in

    the previous steps. These include:

    - su