Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Monday

Introduction to Android OS (Must Read)

Introduction to Modding: Rooting and Custom ROMs
credits to The_ERROR of xda for compiling this


1. Basics of Unix-like system
  • su, root, rooting - what is it, why we need it
  • sh, bash, busybox - what BusyBox is, basic list of commands from BusyBox, bash, sh


    su

    Also referred to as substitute user - a command for changing the account in the current terminal (usually black screen with blinking cursor). Default account is root account. So if you insert into terminal 'su' and hit enter, you will become root user.

    root

    Root alias superuser or poweruser is special user account for system administration. Similar to windows having its administrator account, unix-like systems have a root account. With this, you can do anything and if you run a command to delete the whole system, unix will just do it! No asking, no confirming. So, watch your steps!

    rooting

    Rooting is just enabling power of root for applications and other purposes.

    Superuser app

    After rooting is done, you will see a new app called superuser in app drawer. This app can delegate applications to use su (root) feature. When an app asks this from first use, a popup window will appear asking if the application should be allowed to use root permission.

    sh, bash

    is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. So simply, it is some interface, which can execute command(s), which you have entered. Many shells exist, but in scope of android you can (as far as I know) use only sh (standard - Bourne-shell) or bash (compiled in BusyBox or separately on XDA). Both are basically same, but bash has much more features and it is more comfortable.

    user/root shell

    How do I know if I'm root or normal user? It's simple. Root's shell is ended with # (usually it's shell looks like "bash-3.2# _&quot and user's ends with $ (usually bash-3.2$ _). In terminal emulator you also can have only [path]($|#) (for root for example "/etc # _&quot

    BusyBox

    also called "The Swiss Army Knife of Embedded Linux" is a tool which brings into Android basic tools known from unix system, but is much more smaller than standard tools is. But this "packing" has limited functions in comparison to standard tools in unix-system (missing special modes of tool, color output and so on). Many application use this. For example busybox grep (filtering of text) is needed for application called Market enabler.

    BusyBox commands

    list of commands is really wide, so it's not possible explain all, so I pickup only top few. (hint: if you want what some command do, just search on google for "man <command_name>" for example man mv or enter command here

    1. cd - change directory - same like in windows. You can switch directory. example: cd /sdcard
    2. ls - list of files in actual directory (have few switches like for example: ls -l /sdcard/*.png (detailed listing)
    3. cat - print file into standard output (like more in windows) Example: cat /sdcard/data.txt
    4. vi - editing of file. But on limited phone keyboard (no keyboard) it is little harder Read more about vi
    5. cp - copy of one or more file. Example: cp /sdcard/bike.jpg /sdcard/media/bike-wallpaper.jpg
    6. mv - moving/rename files, Example: mv /sdcard/bike.jpg /sdcard/media/renamed-moved-bike.jpg
    7. rm - delete file (rm -R for recursive, or for delete whole folder), Example: rm -R /sdcard/wallpaper-bad/*
    8. find - search for files, Example find / -name "best-chopper-ever.avi"
    9. mkdir - make directory - creates directory, Example: mkdir mynewdir
    10. chmod - changes access of files
    11. less - similar like cat, but you can scroll in it and it doesn't produce any output. Example: less /sdcard/funnytext.txt


    Please, take due note that main pages are documentation of unix tools. For BusyBox's tool help, just enter BusyBox <command_name> -h.

    2. Android platform and its specifics
  • adb shell
  • Android SDK
  • Tools for Android adb shell - Terminal Emulator, ADB shell from Android SDK and how to use it



    ADB (shell)

    ADB - Android Debug Bridge is a versatile tool that lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components:
  • A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
  • A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
  • A daemon, which runs as a background process on each emulator or device instance.


    Generally, it can be compared with standard cmd prompt in windows (you can write commands which will be executed locally, for example in Terminal Emulator) or it can be just like SSH in unix-like system (you connect to terminal through adb client (in Android SDK) and commands will be run remotely.

    Android SDK

    Android software development kit is a complex set of tools for developing apps on Android. It includes a fully usable emulator of Android OS on your PC, where you can do everything. You can install/delete apps, browse web page in embedded web browser, play games or make your own application in Eclipse (widely used IDE for development). Of course, with emulator you can use also GPS or camera.

    Android SDK tools

    • Fully emulated Android device
    • Android Development Tools Plugin (Eclipse IDE)
    • Android Virtual Devices (AVDs)
    • Hierarchy Viewer
    • layoutopt
    • Draw 9-patch
    • Dalvik Debug Monitor Service (ddms)
    • Android Debug Bridge (adb)
    • Android Asset Packaging Tool (aapt)
    • Android Interface Description Language (aidl)
    • sqlite3
    • Traceview
    • mksdcard
    • dx
    • UI/Application Exerciser Monkey
    • monkeyrunner
    • Android
    • zipalign



    Tools for work with Android adb shell
    You have two ways to connect into ADB service - locally and remotely.

    Locally - for local access you will need some application which can connect to local adb shell.

    Terminal Emulator (free) - probably most commonly used app from market, which works and looks like standard unix shell.
    ConnectBot (free) - same as Terminal Emulator, but it can be also used for connecting via SSH or telnet

    Remotely- For remote connection you need phone configuration adjustment:

    Home desktop -> [menu button] -> Settings -> Applications -> Development -> USB debugging [ON].
    Also you need connect your phone via USB (or finds on market some widget/app, witch enable using ADB also via wi-fi)


  • adb tool from Android SDK
    After downloading Android SDK, extract the archive anywhere (in example I extracted it in c:/AndroidSDK). Then follow instructions on developer.android.com for installation of SDK Platform-tools (contains adb). After installation click on start menu and in Run... (in Windows7 in search bar) enter 'cmd' and press Ok or [enter]. Then write in cmd line:
    Code:

    cd c:\AndroidSDK\android-sdk-windows\tools [enter]

    now you can enter following command to connect to phone's adb shell if you don't have more connected device (virtual or real-one)
    Code:

    adb shell

    If you have more then one, you need explicitly say which one should be used for connection. So list connected devices with
    Code:

    adb devices

    which shows you serial number of connected devices. Than use
    Code:

    adb -s <serial-number> shell

    3. Custom recovery
  • What is custom recovery
  • Tools which custom recovery provide - NAND backup/restore, formatting of SDcard, partitioning (ext1,ext2, ext3), wiping, flashing of Custom ROM, ...
  • Is it safe to install? - potential problems, backup/restore of original recovery
  • How this whole thing works - installation description (not how-to install, just explanation of what is done during installation)



    What is custom recovery

    Recovery is an image (binary data) stored in internal memory. This image contains something like a "program" or "tool", which can boot-up independently from the Android system. This tool is part of phone system, and in PC terminology recovery can by compared to BIOS with some added features. This recovery state can be reached on all phones, but if you don't have a custom recovery, it will do a so-called HW reset and automatically restart itself into standard boot mode.

    Tools which custom recovery provides
  • USB-MS Toggle :mounts sdcard as mass storage

    It just mounts your phone as USB-mass storage (USB disk) so you can access it through your PC
  • Backup/Restore:

    Absolutely GREAT feature. With NAND you can copy an image of your actual system (phone's memory). It means that you can backup the whole system with all configuration, customization, wallpapers, system's tweaks... just everything. This image will be written to your SD card which you are then free to copy around and back up on your computer
  • Flash Zip From Sdcard

    This tool is designed for installation of custom ROMs or tweaks. If you are instructed to install via custom recovery, then you should use this menu. Never unzip the file because it contains meta-information about itself with some validate-checks so if you edit it, or unpack and pack back, it won't work. And remember to place the file in the root (main folder) of your sdcard.
  • Wipe Menu:

    Wipe data/factory reset: wipes data & cache
    - wipes user data (contacts, apps, configuration, ...) and cache (caches of applications)
    Wipe cache
    - wipes cache only
    Wipe Dalvik cache : Wipes Dalvik cache in all possible locations if moved by apps2sd
    - wipes Dalvik cache
    Wipe SD:ext : Wipes Apps2sd ext partition
    - if you used Partition SDcard option, you can wipe it here
    Wipe Battery Stats (remember to fully charge your phone before doing this)
    - If you think, that your battery life is too short, you can try delete battery stats. Than let phone fully charge. (more)
    Wipe rotate settings
    - wipe sensor settings (acceleration, ...)
    Wipe .android secure : Wipes froyo native .android_secure on sdcard
    - wipe information about moved apps
  • Partition Sdcard:

    Partition SD: Partitions sdcard for apps2sd (this formats card so all data will be lost)
    - will create ext2 partition (you will be asked for size of ext2 and cache)
    Repair Sd:ext
    SD:ext2 to ext3 : converts apps2sd ext2 partition to ext3 (requires kernel support for ext3)
    SD:ext3 to ext4 : same as above but ext3 to ext4 (requires kernel support for ext4)


    ext2 - file system for the Linux kernel (no journal, fast but not recovery of I/O error)
    ext3 - file system for the Linux kernel (journal, slower than ext2 because of journal, but provides recovery on I/O error)
    ext4 - file system for the Linux kernel (journal, enhanced version of ext3)

  • Mounts:

    Gui automatically mounts folders

    4. Custom ROM (generally)
  • What is a Custom ROM?
  • Is it safe to install custom ROMs? - potential problems
  • What do I need to install?
  • What can custom ROM provide - kernel, update, performance, customization, theme, ....
  • what is ...

    o deodexed, zipaglined, png-optimized
    o JIT, HW:acceleration, VM.Heap Size, stagefright
    o apps2sd + dalvik2sd
    o custom kernel (recompiled, ...)

    What is a Custom ROM?

    Custom ROM is a modification of the manufacturer's ROM or ROM compiled from Android sources. "Change/s" ranges from adding/removing default applications up to including kernels, cpu over/under-clocking, enable/disable features (ROOT, HW acceleration, ...), themes (frameworks, color, ...), keyboards and many other features.
    A Custom ROM is usually distributed as a signed ZIP package that includes an installation script for custom recovery. This ZIP is flashed via custom recovery tool.

    Is it safe to install a custom ROM?

    Yes, it is. If you are not satisfied, you can just restore your old ROM using a NAND backup. And yes, you can also use backup tools like Astro or Titanium Backup to backup your apps and restore these in your new ROM (NOTE: In this case it's strongly recommended that both ROM should have same or very similar source/base ROM).

    What do I need to install one?

    1) Rooted phone
    2) Installed custom recovery
    3) Signed .ZIP file of ROM compatible with recovery
    #) RECOMMENDED: NAND backup of your actual ROM

    What does custom ROM bring

    Custom ROM brings almost every feature you can imagine.
    ex:
    OS optimization for games, long battery life, calling, texting, playing videos,...
    awesome look - changed icons, colors, animations, wallpapers, menu, ....
    reconstructed framework - restart button, reorganized menu, shorts, gestures, etc
    allow tweaking - overclok/underclok your device, ROOT, ....

    It's really not possible describe here every possibility what you can do/get with custom ROM.

    what is ...

    png-optimized -

    png files takes less memory, are loads faster

    JIT -

    just-in-time compilation also known as dynamic translation, is a method to improve the runtime performance of computer programs, but it takes some time to convert into it on start.

    HW:acceleration -

    using of HW acceleration for rendering GUI. Increases battery consumption.

    VM.Heap Size -

    maximum memory an application can consume

    stagefright -

    In Android 2.2 new media framework that supports local file playback and HTTP progressive streaming




    1. Terms and Definitions
      credits to TechCredo, samdroid, xda-developers, cyanogen

      A2SD+

      A2SD+ is an extension of Android 2.2 Froyo’s native support for installing apps on the SD card, but it virtually installs every app to the external storage. You can more or less expand your internal storage with the size of the partition you create on your memory card — because you need to partition your SD card to use A2SD+. It’s great if your Android phone has a limited amount of internal storage space. Most Android ROMs have built-in support for A2SD+.

      ADB

      Android Debug Bridge is a tool that comes with the Android SDK that allows you to control and interface with your Android device. It is located in the tools folder when you unpack the SDK. Visit http://wiki.cyanogenmod.com/index.php?title=ADB for a list of commands

      AOSP

      AOSP is short for Android Open Source Project, and when the term is used in ROM descriptions, it usually indicates that the ROM in question is based on the Android source code provided by Google itself, and not on some other ROM project or a company’s firmware.

      apk (file extension)

      The file type for Apps used by Android, you can rename it to .zip and open them.

      ARM

      A type of processor architecture http://en.wikipedia.org/wiki/ARM_architecture

      BFS

      Brain Fuck Scheduler
      It has been reported to improve responsiveness on light-NUMA (non-uniform memory access) Linux mobile devices and desktop computers with fewer than 16 cores.

      Bloatware

      Software or 'apps' that you don't need, but come preinstalled to a device's /system partition, meaning that you cannot remove them unless the device has been rooted.

      Bootloader

      The bootloader executes code before any operating system is launched. On Android devices, the bootloader is usually locked because manufacturers want you to use the version of Android they’ve provided. With a locked bootloader on Android phones, custom ROMs cannot be flashed.

      Brick

      When your device is rendered unusable from improper flashing or physically damage such that it becomes like a useless piece of brick.

      BusyBox

      BusyBox is an app on your phone that will give you access to additional Linux/Unix based commands. You may need BusyBox installed to perform some root level tasks, and some other apps that require root access may need BusyBox installed as well. BusyBox is self-dubbed “The Swiss Army Knife of Embedded Linux.”

      CFS

      Completely Fair Scheduler
      It handles CPU resource allocation for executing processes, and aims to maximize overall CPU utilization while maximizing interactive performance.

      Compcache (compressed caching)

      virtual swap, setting aside a certain percentage (usually 25%) of your RAM as 'compressed' swap. Compcache compresses the data that would normally go to swap, then moves it back into RAM, and reverses the process when moving it out of the 'compressed' swap.

      CyanogenMod or CM

      CyanogenMod, often abbreviated CM, is a custom version of vanilla (more or less unmodified) Android. It’s the most popular custom ROM for Android – a community effort, and many other ROMs are based on CyanogenMod. Among other things, it adds a bunch of extra customization features and options.

      Dalvik & Dalvik cache

      Dalvik is the cryptic name of the virtual machine (VM) in Android, and it’s the basis for running apps (with the .apk filename extension) on the platform. Before Android apps are launched, they’re converted into the compact Dalvik Executable (.dex) format, which is designed to be suitable for systems that are constrained in terms of memory and processor speed.

      The Dalvik cache is a simply the cache used by Dalvik, and it’s the result of Dalvik doing optimizations of running apps. Some Android ROMs allow you to move the Dalvik cache to your SD card, in order to free up internal storage.

      Data2SD / D2EXT / D2SD

      If a ROM supports data2SD, D2EXT, or simply D2SD, it means that the /data folder on your Android phone’s internal storage can be moved to your memory card instead. That’s a good thing, because it will free up precious internal megabytes and leave more room for apps and games. Some say that having the data stored on your SD card is slightly slower, though.

      D2ext is a short way of saying “data to the extended file system”. It requires that you have created a partition on your SD card.

      Deodexed

      When a ROM has been deodexed, it means that its apps have been prepared so they can be modified. Deodexed ROMs feature apps that have been repackaged in a certain way. Android applications, .APKs, contain .odex files that devs supposedly use to save space. These .odex files are extracted from the application packages and put in the /system/ folder on your phone, to speed up boot processes and to allow parts of applications to be preloaded.

      However, this makes hacking and modifying those apps difficult because parts of the apps have been extracted to another location. Deodexing means that all pieces of an application package are put back together into one file, and it makes sure that a modified .APK won’t conflict with some separate odexed parts located somewhere else. Developers of custom ROMs choose to deodex their ROM packages, since it lets them modify various .APKs, and it also makes theming possible after the ROMs have been installed.

      DSPManager

      This is an equalizer app that Android devs like to include in their ROMs.

      DVM

      Dalvik Virtual Machinehttp://en.wikipedia.org/wiki/Dalvik_(software)

      EXT2/3/4

      This refers to ext2, ext3, and ext4 partitions on your SD card. They’re extended file systems for Linux that can be used by Android, usually in order to preserve internal storage space. Many custom Android ROMs require that you have an ext2, ext3 or ext4 partition on your memory card. Ext2 is the oldest type of extended file system, and ext4 is the newest. Some say that ext4 will put an unnecessary strain on your memory card, because it writes to it so much, and I think the ext3 file system currently is most common.

      So what exactly is a partition? It’s a part of a hard disk, or a SD card in this case, that’s separated from the other parts. Think of partitioning as dividing your SD card into two sections that have different purposes.

      Fastboot

      Fastboot is essentially a boot menu that you can do stuff from before Android is launched. “Fastboot is a protocol used to directly update the flash file system in Android devices from a host over USB.”

      Firmware

      A phone’s firmware is basically its operating system. A “firmware update” means that the operating system, the software that controls the phone, is updated. “Stock firmware” means that the firmware is unmodified: it’s the version of the operating system the phone’s manufacturer delivers.

      Flash and flashing

      To flash a custom ROM, or a firmware, simply means that you install it. So, flashing is the process of installing a new version of the Android operating system, or just parts of it, like the radio. Flashing new ROMs is done via the Recovery Mode, usually with ClockworkMod Recovery.

      GPU

      A graphics processing unit is a specialized microprocessor that offloads and accelerates graphics rendering from the central (micro-)processor.

      HBoot

      HBoot is loaded immediately when your phone is switched on, and it’s mainly responsible for checking and initializing the hardware and starting the phone’s software. It can also be used for flashing official software releases, as well as a few other things. HBoot can be compared to the BIOS on a computer.

      I/O Scheduling

      Input / Output Scheduling is a term used to describe the method computer operating systems decide the order that block I/O operations will be submitted to storage volumes. I/O Scheduling is sometimes called 'disk scheduling'.

      JIT

      Just-in-time compiler http://en.wikipedia.org/wiki/Just-in-time_compilation

      Kernel

      The kernel is the central component of most operating systems: it’s a bridge between applications and the actual data processing done at the hardware level. The Linux kernel was initially created by legendary Finnish computer science student Linus Torvalds in 1991. Android kernels are often customized, optimized and modified for different purposes, such as over-clocking the processor or extending the battery life. Custom ROMs usually include a new kernel.

      logcat

      An Android built-in debugging log

      mount

      It is to link(mount) a partition/filesystem to any location.

      NANDroid & NANDroid backups

      NANDroid will let anyone with root access make a complete system backup. It lets you create a backup of every piece of information on your phone, and it can be restored later whenever you want. NANDroid backups are usually performed before flashing a new ROM, in case anything goes wrong, or if you want to return to your previous setup later. NANDroid backups are created from the Recovery Mode, often with ClockworkMod Recovery.

      port (porting)

      The process of making a certain application/mod/software compatible with another device/version

      Radio

      It’s the radio on your phone that handles communication, the radio that sends and receives voice and data. Flashing (installing) a new radio can improve your reception, and bring other benefits. A radio is flashed via Recovery Mode, just as a full Android ROM.

      Radio interface layer (RIL)

      Android provides a Radio Interface Layer (RIL) between Android’s telephony services and the radio hardware. Developers and enthusiasts enjoy messing around with every part of Android, and some of them modify the RIL, just like Android itself, the kernel and the radio, to make it better.
      RC1, RC2 et cetera

      When it comes to Android ROMs, RC means Release Candidate. It’s a candidate for the final release of a ROM, and they can be considered ROM betas.

      RAM

      Random Access Memory (RAM) is temporary data storage that the CPU uses during calculations. The more RAM a device has, the more calculated results the CPU can store - which means less time the CPU has to do the same thing over and over again. In other words, the CPU can check RAM to see if it has already made a particular calculation in the recent past. If it has, it can use the pre-computed results instead of wasting processing time recomputing the same calculation. In short, more RAM means a more efficient (and faster) device.

      Recovery

      You can think of the Recovery Mode as Android’s equivalent of the BIOS on your computer. Not quite, since Hboot may be more similar to your PC’s BIOS. It’s a boot menu that is shown without Android being loaded, and it gives you access to certain features such as doing complete backups of your phone (Nandroid backups) and installing custom ROMs. ClockworkMod is the most popular Recovery Mode, and it’s installed with the app ROM Manager.

      Root

      When someone mentions root, it usually just refers to having root access on an Android phone – also called being a root user, or a superuser. Root access is explained under superuser, and in the introduction to this dictionary.

      S-OFF (security off)

      On the HTC Desire and several other HTC Android phones, the company has implemented a form of “security.” It’s called @secuflag, and it controls whether your phone has its NAND or flash unlocked. S-ON (security on) will read-lock your /system and /recovery partitions, blocking you from performing certain root level actions directly from Android.

      You can disable this security measure with S-OFF (security off), although you risk bricking your phone in the process (worst case scenario).

      SDK

      Software Development Kit. You can find the Android SDK at http://developer.android.com/sdk

      SuperUser

      Android is a Linux-based operating system, and in Linux, there is something called root access. When you root your Android phone, you will get superuser access. The superuser, or root user, is sort of a special user account for system administration. SuperUser is also the name of an app, which lets you grant or deny superuser privileges to other apps.

      ]Swap

      virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM.

      Terminal and Terminal Emulator

      Terminal Emulator, sometimes just referred to as Terminal, is an app that lets users access Android’s built-in Linux command line shell. The application emulates a Digital Equipment Corporation VT-100 terminal, and it’s mostly useful for programmers and for those with root access.

      Tethering

      Using a wireless device (e.g. an Android phone) to share it's wireless data connection to another device (e.g. laptop). With an Android device, the wireless data connection can usually be shared via WiFi, Bluetooth or USB connection.

      Tweak

      an optional application or script that alters the behavior of the hardware and/or software

      [bUV / Undervolt / Undervolting[/b]

      reducing the stock CPU voltage to run at less voltage

      Vanilla/Stock

      A clean, unmodified version of something. In the context of Android ROMs, vanilla refers to the stock ROM that came pre-installed on the device.

      Widget

      An application that lives (in other words, is always running) on the homescreen instead of being 'run' like a regular app. Common examples are calenders and weather widgets.

      Wipe

      Usually refers to wiping data and cache partitions of the device.

      Zipaligned

      Zipalign is a tool that optimizes the way an Android app (.APK) is packaged. It enables Android to interact with the application more efficiently, and in doing so, it has the potential to make the app and the entire Android system much faster. Zipaligned applications are launched more quickly, and they use less amounts of RAM. So, thumbs up for zipaligned Android ROMs.




    0 comments:

    Post a Comment

    Related Posts Plugin for WordPress, Blogger...
     

    visit count

    Extension Factory Builder
    free web site traffic and promotion
    PageRank

    Total Pageviews