Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

For Developers

ameer1234567890 edited this page Jan 25, 2013 · 39 revisions

Update Functions & Patch File URLs:

  • Update Check URL: https://raw.github.com/ameer1234567890/OnlineNandroid/master/version
  • Download URL: https://raw.github.com/ameer1234567890/OnlineNandroid/master/onandroid
  • Changelog URL: https://raw.github.com/ameer1234567890/OnlineNandroid/master/changelog
  • Partition Layout File List URL: https://raw.github.com/ameer1234567890/OnlineNandroid/master/part_layouts/codenames
  • Patch files in raw format: https://raw.github.com/ameer1234567890/OnlineNandroid/master/part_layouts/raw/partlayout4nandriod.codename, where codename is the codename for the specific device.
  • Patch files in flashable zip format: https://raw.github.com/ameer1234567890/OnlineNandroid/master/part_layouts/zip/part_detect_tool.codename.zip, where codename is the codename for the specific device.


Command Line Flags:

  • v6 introduces a new command line flag mechanism with totally revamped code. Each command line flag also has a long version which is more descriptive and preferred by some.
  -h, --help                    display this help message and exit
  -ah, --advanced-help          display help for advanced backup mode
  -v, --version                 display version number and exit
  -p, --phone                   generate backup name with phone timezone
  -u, --utc                     generate backup name with UTC time (default)
  -i, --incremental             CWM6 style incremental backup mode
  -a, --advanced PARTITIONS     advanced / selective backup mode
  -w, --twrp                    TWRP backup mode
  -l, --split                   split backup mode (CWM 6+ only)
  -o, --old                     good old backup mode (default)
  -gc, --garbage-collect        run garbage collect mode
  -w, --twrp                    TWRP backup mode
  -me, --md5-enable             enable md5 generation (for TWRP only)
  -md, --md5-disable            disable md5 generation (for TWRP only)
  -ce, --compression-enable     enable compression (for TWRP only)
  -cd, --compression-disable    disable compression (for TWRP only)
  -c, --custom NAME             specify a custom backup name
  -s, --storage MEDIA           specify an alternate storage media to backup
  -e, --sd-ext-path PATH        specify path to sd-ext partition
  -r, --replace                 replace backup with same name


Specifying Custom Backup Name:

  • While specifying custom backup names, characters not allowed in folder/directory names should not be used. The script does not do any filtering for such characters and thus any error spitted would be from the shell itself. If you are developing an android app or any other GUI for the script, you can optionally include filtering for disallowed characters. Spaces are not allowed as well.


Specifying Alternate Backup Media:

  • Since some people are having issues where the script detects internal sd card for backing up, but people want the external sd card to be selected (there is instances of vice versa too), there is a command line flag to set the sdcard / base folder. You could also use this for cryptonite volumes or any other folders for that matter. Here is an example:

  • For sd card selection: (This would force Online Nandroid to backup to /sdcard/external_sd/clockworkmod/backup/...)

onandroid -s /sdcard/external_sd
OR
onandroid --storage /sdcard/external_sd
  • For your cryptonite volume: (This would force Online Nandroid to backup to /sdcard/mnt/cryptonite/clockworkmod/backup/...)
onandroid -s /sdcard/mnt/cryptonite
OR
onandroid --storage /sdcard/mnt/cryptonite


Specifying sd-ext Path / Mountpoint:

  • Since it is almost impossible for the script to detect all the various flavors of sd-ext usages (such as app2sd, link2sd, data2sd, etc...), I have added a command line flag to manually specify sd-ext path / mountpoint. Here is an example:
onandroid -e /data/sdext2
OR
onandroid --sd-ext-path /data/sdext2


Advanced / Selective Backup Mode:

  • Using this backup mode you can backup only specific partitions.
Usage: onandroid -a <partitions>

<partitions>
  m: mmcblk0_start (for Acer devices)
  b: boot
  r: recovery
  w: wimax (for Samsung devices)
  l: appslog (for HTC and Sony (Ericsson) devices)
  s: system
  d: data
  c: cache
  t: datadata (for some Samsung devices)
  e: efs (for Samsung devices)
  o: preload (for Samsung devices)
  u: .cust_backup (for Huawei devices)
  f: flexrom (for Acer devices)
  p: boot (for HP Touchpad)
  i: (cp)uid (for Acer devices)
  a: android_secure
  x: sd-ext
  • Note: This help screen can be accessed by entering:
onandroid -ah
OR
onandroid --advanced-help
  • Example (backup boot, system and data partitions only):
onandroid -a bsd
OR
onandroid --advanced bsd


Specifying Progress Indicator Type:

  • There are two progress indicator types available. Using dots (as in versions prior to v6), and using percentages. By default, the second indicator type is used. If, for some reason (for instance some apps may not be able to properly display the percentage progress indicator), you want to choose a specific indicator type, it can be set via the below flags.
  • Setting dot indicator:
onandroid -pd
OR
onandroid --progress-dot
  • Setting percentage indicator:
onandroid -pp
OR
onandroid --progress-percent


Disabling Notifications:

  • If the app / tool you are developing has a method of notifying the user when backup is done, and / or if you do not require the notifications done by Online Nandroid script itself (currently led and vibrate notifications), you can disable notifications. Here is an example:
onandroid -nd
OR
onandroid --notification-disable


Backup Format Indicators:

  • Online Nandroid adheres to backup format indicator set in .default_backup_format file, by ClockWorkMod (CWM) recovery. This file could have 2 different strings, dup or tar, where dup means incremental backup mode and tar means split backup mode. The file is normally in the below location, as set by CWM. The sd card mount point may vary.
/mnt/sdcard/clockworkmod/.default_backup_format
  • In addition, Online Nandroid introduces its own file (.advanced_backup_partitions) for specifying backup partitions for advanced / selective backup. This file should be populated with the partition letters in the same way as doing an advanced / selective backup. The file should be in the below location. The sd card mount point may vary.
/mnt/sdcard/clockworkmod/.advanced_backup_partitions


Workaround for busybox in /sbin:

  • Some kernels include busybox in the ramdisk, in /sbin/busybox. This is mostly done to accommodate busybox calls in recovery mode. In the default setup of Terminal Emulator, /sbin is given preference over /system/bin and /system/xbin. Thus, Online Nandroid uses /sbin/busybox over any other busybox installations. The issue arises when the busybox binary in /sbin/busybox is out of date. This sometimes causes undesired affects for Online Nandroid. To overcome this situation, you can use the below command line flag.
onandroid -t
OR
onandroid --sbin-last


Yaffs2 override:

  • CWM has an old method of backing-up yaffs2 partitions as yaffs2 images, instead of tar balls. Since Online Nandroid follows the same formats used by CWM, it follows the same method as well. This has a side affect in some cases (specially if internal sdcard lives in /data/media or if an sd-ext setup is used). To overcome this, Online Nandroid can do tar backups for yaffs2 partitions as well. The override flag is:
onandroid -y
OR
onandroid --yaffs-override


Exit Codes:

  • Online Nandroid returns specific exit codes based on the status of the script run. Below is the list of error codes and their respective descriptions.
0 : Success
65 : Could not acquire root permissions
66 : Sufficient battery not available
67 : Error: BusyBox version less than 1.20 found
68 : SD card not found
69 : Killed by exit/kill signal
70 : mkyaffs2image not found in path
71 : dedupe not found in path
72 : md5sum not found in path
73 : tar not found in path
74 : dd not found in path
80 : Could not change to backup path
81 : Cannot create backup directory
82 : Cannot delete backup directory
83 : Backup name already exists
84 : Cannot write to backup directory
85 : Cannot write to blobs directory
86 : Not enough disk space
87 : Could not change to backup directory
Clone this wiki locally