├── .gitignore ├── README.md ├── .gitattributes ├── scripts ├── adb │ ├── press-menu-button │ ├── screen │ ├── advanced-settings │ ├── broadcast-boot-completed │ ├── home │ ├── supersu │ ├── wifi-settings │ └── cacert └── moto-g │ ├── insert-bootlogo.sh │ ├── extract-bootlogo.sh │ ├── unlock-bootloader.sh │ └── flash-backup.sh ├── howto ├── mount-with-mtp.md ├── sign-and-zipalign.md ├── mount.md └── moto-g │ ├── bootlogo.md │ └── hide-carrier-label.md ├── src ├── moto-g-decompress.pl └── moto-g-compress.pl ├── flash └── p880.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | tmp/ 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | android-tools 2 | ============= 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.md text 4 | *.sh text 5 | *.pl text 6 | -------------------------------------------------------------------------------- /scripts/adb/press-menu-button: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell input keyevent 82 4 | -------------------------------------------------------------------------------- /scripts/adb/screen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell screencap -p | sed 's/\r$//' > screen.png 4 | -------------------------------------------------------------------------------- /scripts/adb/advanced-settings: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell am start -n com.android.settings/.Settings 4 | -------------------------------------------------------------------------------- /scripts/adb/broadcast-boot-completed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell am broadcast -a android.intent.action.BOOT_COMPLETED 4 | -------------------------------------------------------------------------------- /scripts/adb/home: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell am start -c android.intent.category.HOME -a android.intent.action.MAIN 4 | -------------------------------------------------------------------------------- /scripts/adb/supersu: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell am start -a android.intent.action.MAIN -n eu.chainfire.supersu/.MainActivity 4 | -------------------------------------------------------------------------------- /scripts/adb/wifi-settings: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings 4 | -------------------------------------------------------------------------------- /howto/mount-with-mtp.md: -------------------------------------------------------------------------------- 1 | # Mount device using the Media Transfer Protocol (MTP) 2 | 3 | *debian* | *motorola moto g* 4 | 5 | Install and set-up `mtpfs`\[1\]. 6 | 7 | $ sudo apt-get install mtpfs mtp-tools 8 | $ sudo adduser `id -un` fuse 9 | $ sudo mkdir -p -m 777 /media/moto-g 10 | $ sudo modprobe fuse 11 | 12 | Logout and login to activate the new group permissions. 13 | 14 | Now plugin and mount the Moto G. 15 | 16 | $ sudo mtpfs /media/moto-g 17 | 18 | Before unplugging, run 19 | 20 | $ sudo umount mtpfs 21 | 22 | \[1\] 23 | -------------------------------------------------------------------------------- /howto/sign-and-zipalign.md: -------------------------------------------------------------------------------- 1 | # Sign and zipalign an APK 2 | 3 | *debian* 4 | 5 | Create a private key if you do not have one yet. 6 | 7 | $ keytool -genkey -v -keystore keystore -alias android -keyalg RSA -keysize 2048 -validity 10000 8 | 9 | Sign and verify the package. 10 | 11 | $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystore Package.apk android 12 | $ jarsigner -verify Package.apk 13 | jar verified. 14 | 15 | Zipalign the package. 16 | 17 | $ zipalign -v 4 Package.apk Package-aligned.apk 18 | 19 | \[1\] 20 | 21 | -------------------------------------------------------------------------------- /howto/mount.md: -------------------------------------------------------------------------------- 1 | # Mount device 2 | 3 | *debian* | *motorola moto g* 4 | 5 | Connect your device and find its vendor id. 6 | 7 | $ lsusb | grep Motorola 8 | Bus 002 Device 003: ID 22b8:2e76 Motorola PCS 9 | 10 | Set-up `udev` and add an entry\[1\] with the vendor id corresponding to your device (`22b8`). 11 | 12 | $ sudo vim /etc/udev/rules.d/51-android.rules 13 | 14 | > `SUBSYSTEMS=="usb",ATTRS{idVendor}=="22b8",MODE="0666",GROUP="plugdev"` 15 | 16 | $ sudo chmod +x /etc/udev/rules.d/51-android.rules 17 | $ sudo service udev restart 18 | 19 | Enable debug mode on your device and reconnect it. 20 | 21 | \[1\] 22 | -------------------------------------------------------------------------------- /howto/moto-g/bootlogo.md: -------------------------------------------------------------------------------- 1 | # Change bootlogo 2 | 3 | *debian* | *motorola moto g* 4 | 5 | Extract `logo.bin` from the device. 6 | 7 | $ adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/by-name/logo of=/sdcard/logo.bin count=1 bs=634418" 8 | $ adb pull /sdcard/logo.bin . 9 | 10 | View the images wrapped in `logo.bin` 11 | 12 | $ ./extract-bootlogo.sh 13 | 14 | Create a custom logo `logo.png` and insert it into a copy of `logo.bin`. 15 | 16 | $ ./insert-bootlogo.sh logo.png 17 | 18 | Boot device into fastmode mode. 19 | 20 | $ fastboot flash logo logo-custom.bin 21 | 22 | \[1\] 23 | \[2\] 24 | -------------------------------------------------------------------------------- /scripts/moto-g/insert-bootlogo.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | W=`identify -format '%w' $1` 4 | H=`identify -format '%h' $1` 5 | if [ $W -ne 720 ] || [ $H -ne 1280 ]; then 6 | echo "Image must be 720x1280 pixels" 7 | exit 8 | fi 9 | convert -depth 8 $1 bgr:logo_boot.raw 10 | cp logo.bin log-custom.bin 11 | perl ../../src/moto-g-compress.pl logo_boot.raw 12 | rm logo_boot.raw 13 | LEN=`stat -c '%s' logo_boot.bin` 14 | if [ "$((LEN+12))" -gt 459169 ]; then 15 | echo "Compressed image is too large: $((LEN+12))/459169" 16 | rm logo-custom.bin 17 | exit 18 | fi 19 | dd if=logo_boot.bin conv=notrunc seek=524 bs=1 count=$LEN of=logo-custom.bin 20 | dd if=logo-custom.bin conv=notrunc skip=104 seek=40 bs=1 count=4 of=logo-custom.bin 21 | dd if=logo-custom.bin conv=notrunc skip=36 seek=100 bs=1 count=4 of=logo-custom.bin 22 | rm logo_boot.bin 23 | 24 | -------------------------------------------------------------------------------- /scripts/moto-g/extract-bootlogo.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | rm -f tmp_logo_*.png 4 | 5 | OFF1=`echo "ibase=16; 000200" | bc` 6 | LEN1=`echo "ibase=16; 0701A1" | bc` 7 | OFF2=`echo "ibase=16; 070400" | bc` 8 | LEN2=`echo "ibase=16; 003304" | bc` 9 | OFF3=`echo "ibase=16; 073800" | bc` 10 | LEN3=`echo "ibase=16; 025632" | bc` 11 | OFF4=`echo "ibase=16; 099000" | bc` 12 | LEN4=`echo "ibase=16; 0701A1" | bc` 13 | 14 | dd if=logo.bin skip=$OFF1 bs=1 count=$LEN1 of=tmp_logo_boot.bin 15 | dd if=logo.bin skip=$OFF2 bs=1 count=$LEN2 of=tmp_logo_battery.bin 16 | dd if=logo.bin skip=$OFF3 bs=1 count=$LEN3 of=tmp_logo_unlocked.bin 17 | dd if=logo.bin skip=$OFF4 bs=1 count=$LEN4 of=tmp_logo_charge.bin 18 | 19 | perl ../../src/moto-g-decompress.pl tmp_logo_boot.bin 20 | convert -depth 8 -size 720x1280 bgr:temp.raw logo_boot.png 21 | rm temp.raw tmp_logo_boot.bin 22 | 23 | perl ../../src/moto-g-decompress.pl tmp_logo_battery.bin 24 | convert -depth 8 -size 540x540 bgr:temp.raw logo_battery.png 25 | rm temp.raw tmp_logo_battery.bin 26 | 27 | perl ../../src/moto-g-decompress.pl tmp_logo_unlocked.bin 28 | convert -depth 8 -size 540x540 bgr:temp.raw logo_unlocked.png 29 | rm temp.raw tmp_logo_unlocked.bin 30 | 31 | perl ../../src/moto-g-decompress.pl tmp_logo_charge.bin 32 | convert -depth 8 -size 720x1280 bgr:temp.raw logo_charge.png 33 | rm temp.raw tmp_logo_charge.bin 34 | 35 | -------------------------------------------------------------------------------- /src/moto-g-decompress.pl: -------------------------------------------------------------------------------- 1 | # original script by carock 2 | # @see http://forum.xda-developers.com/showpost.php?p=48891456&postcount=140 3 | # 4 | # modified by gingerik 5 | # @see https://github.com/gingerik 6 | 7 | use strict; 8 | use warnings; 9 | 10 | my $file = $ARGV[0]; 11 | chomp($file); 12 | 13 | my $pfile = "temp.raw"; 14 | 15 | open(FH, "<", $file) or die "cannot open $file: $!"; 16 | open(pFH, ">>", $pfile) or die "cannot open $file: $!"; 17 | binmode(pFH); 18 | binmode(FH); 19 | 20 | $/ = \1; 21 | my $data; 22 | my $temp; 23 | my $id; 24 | my $nump; 25 | my $i; 26 | 27 | while () 28 | { 29 | $data = unpack 'H*', $_; 30 | $id = substr($data, 0, 1); 31 | 32 | if($id eq "8") 33 | { 34 | $temp = ; 35 | $temp = unpack 'H*', $temp; 36 | $nump = substr($data, 1, 1).$temp; 37 | $nump = hex($nump); 38 | $temp = ..; 39 | $data = unpack 'H*', $temp; 40 | $data = pack 'H*', $data; 41 | 42 | for ($i=0; $i < $nump; $i++) 43 | { 44 | print pFH $data; 45 | } 46 | } 47 | elsif($id eq "0") 48 | { 49 | $temp = ; 50 | $temp = unpack 'H*', $temp; 51 | $nump = substr($data, 1, 1).$temp; 52 | $nump = hex($nump); 53 | 54 | for ($i=0; $i < $nump; $i++) 55 | { 56 | $temp = ..; 57 | $data = unpack 'H*', $temp; 58 | $data = pack 'H*', $data; 59 | 60 | print pFH $data; 61 | } 62 | } 63 | } 64 | 65 | close(pFH); 66 | close(FH); 67 | 68 | -------------------------------------------------------------------------------- /scripts/moto-g/unlock-bootloader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | fastbootCheck=$(fastboot devices) 4 | 5 | if [ -z "$fastbootCheck" ]; then 6 | echo "Put your device in fastboot mode (i.e. power off, and then" 7 | echo "press the power and volume down buttons simultaneously)." 8 | exit 1 9 | fi 10 | 11 | unlockData=$(fastboot oem get_unlock_data 2>&1) 12 | unlockKey=$(echo ${unlockData} | sed "s/ (bootloader) //g" | sed "s/\.//g" | grep -o "^\S*") 13 | 14 | phoneSN=$(echo ${unlockKey} | awk -F'#' '{print $1}') 15 | phonePUID=$(echo ${unlockKey} | awk -F'#' '{print $4}') 16 | phoneHash=$(echo ${unlockKey} | awk -F'#' '{print $3}') 17 | 18 | url="https://motorola-global-portal.custhelp.com/cc/productRegistration/unlockPhone/$phoneSN/$phonePUID/$phoneHash/" 19 | 20 | echo "First log in at the Motorola website if you have not already:" 21 | echo "" 22 | echo " https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a" 23 | echo "" 24 | echo "Now visit:" 25 | echo "" 26 | echo " $url" 27 | echo "" 28 | echo "Or use the unlock key: $unlockKey" 29 | echo "" 30 | 31 | fastboot reboot-bootloader > /dev/null 2>&1 32 | 33 | echo "" 34 | echo -n "Enter the unlock code: " 35 | read unlockCode 36 | echo "" 37 | echo "About to run" 38 | echo "" 39 | echo " $ fastboot oem unlock $unlockCode" 40 | echo "" 41 | echo -n "Do you wish to continue? (y/n) " 42 | read confirm 43 | echo "" 44 | 45 | if [ "$confirm" != "y" ]; then 46 | echo "Aborted" 47 | exit 1 48 | fi 49 | 50 | fastbootCheck=$(fastboot devices) 51 | 52 | if [ -z "$fastbootCheck" ]; then 53 | echo "Your device is not in fastboot mode" 54 | exit 1 55 | fi 56 | 57 | echo "Wait for your device to fully reboot" 58 | echo "" 59 | 60 | fastboot oem unlock ${unlockCode} > /dev/null 2>&1 61 | -------------------------------------------------------------------------------- /howto/moto-g/hide-carrier-label.md: -------------------------------------------------------------------------------- 1 | # Hide carrier label 2 | 3 | *debian* | *motorola moto g* | *4.4.4 kitkat* 4 | 5 | Firstly, pull `SystemUI.apk` and the device-specific framework from your device. 6 | 7 | $ adb shell cp /system/priv-app/SystemUI.apk /sdcard/ 8 | $ adb shell cp /system/framework/framework-res.apk /sdcard/ 9 | $ adb pull /sdcard/SystemUI.apk . 10 | $ adb pull /sdcard/framework-res.apk . 11 | 12 | Next, download `apktool_2.0.0b8.jar` from \[1\], set the correct framework and decompile\[2\] `SystemUI.apk`. 13 | 14 | $ wget http://connortumbleson.com/apktool/test_versions/apktool_2.0.0b9.jar 15 | $ java -jar apktool_2.0.0b9.jar if framework-res.apk 16 | $ java -jar apktool_2.0.0b9.jar d SystemUI.apk 17 | 18 | Now modify the package\[3\]: search for `onsText` and update the `TextView`'s appropriate attribute to `android:maxLength="0"`. 19 | 20 | $ sed -i '/onsText/ s/maxLength="[0-9]\+"/maxLength="0"/' SystemUI/res/layout/status_bar.xml 21 | 22 | Recompile the modified version while preserving the signature (using `-c`), which will allow you to replace the APK later on. 23 | 24 | $ java -jar apktool_2.0.0b9.jar b SystemUI -c 25 | 26 | Finally, push the modified `SystemUI.apk` to the device and install it. 27 | 28 | $ adb push SystemUI/dist/SystemUI.apk /sdcard/SystemUI.apk 29 | $ adb shell 30 | $ su 31 | # mount -o remount,rw /system 32 | # cp /system/priv-app/SystemUI.apk /system/priv-app/SystemUI.apk.BAK 33 | # cp /system/priv-app/SystemUI.odex /system/priv-app/SystemUI.odex.BAK 34 | # cp /sdcard/SystemUI.apk /system/priv-app/SystemUI.apk 35 | # rm /system/priv-app/SystemUI.odex 36 | # chmod 644 /system/priv-app/SystemUI.apk 37 | # mount -o remount,ro /system 38 | # reboot 39 | 40 | \[1\] 41 | \[2\] 42 | \[3\] 43 | 44 | -------------------------------------------------------------------------------- /flash/p880.md: -------------------------------------------------------------------------------- 1 | # Optimus 4x -- P880 2 | 3 | For an overview, see the Q&A[1]. 4 | 5 | Specs as of July 12, 2014: 6 | 7 | > Android version: 4.1.2 8 | > Baseband version: L6260_MODEM_SIC_02.1233.00 9 | > Kernel version: 3.1.10 10 | > Build number: JZO54K 11 | > Software version: P88020b-EUR-XXX 12 | 13 | **NOTE**: The following steps should be performed under Linux. 14 | 15 | ## Unlock bootloader 16 | 17 | Unlock bootloader[2]: 18 | 19 | * Charge your phone to 100%; 20 | * Connect your phone in LG software mode 21 | (every mode with an activated adb should work, too); 22 | * Run `adb reboot oem-unlock` 23 | * **ATTENTION**: there is no further warning, your whole `/data/` partition will be formatted! 24 | Press the volume up button; 25 | * Wait for the unlocking to finish; 26 | * Pull out your usb cable and your battery, too; 27 | * Put your battery back in and boot; 28 | * Set up your system; 29 | * Now go to the hidden menu, dial `3845#*880#`; 30 | * Check your bootloader status (`Bootloader Unlock Check` --> `Bootloader Unlock Check` --> `Unlock`). 31 | 32 | If you did not succeed, try the alternative method in [2]. 33 | 34 | ## Flash recovery 35 | 36 | First, download the latest `TWRP_multirom_p880_*.img` in [3]. 37 | Now flash the recovery image you just downloaded: 38 | 39 | * Enable debugging on your device & connect via USB; 40 | * `adb reboot bootloader`; # see [8] FIXME 41 | * `fastboot devices` and make sure your device is listed; 42 | * `fastboot flash recovery TWRP_multirom_p880_*.img`; 43 | * Select recovery (using volume down); 44 | * Enter recovery (using volume up). 45 | * Reboot 46 | 47 | ## Flash ROM 48 | 49 | First, download the latest `omni-4.4.4-*-p880-NIGHTLY.zip` in [5]. 50 | Now flash the OmniROM[4]: 51 | 52 | * `adb push omni-4.4.4-*-p880-NIGHTLY.zip /sdcard/`; 53 | * `adb reboot recovery`; 54 | * Install zip -> `omni-4.4.4-*-p880-NIGHTLY.zip`; 55 | * Wipe data/factory reset; 56 | * Do **not** reboot yet. 57 | 58 | ## Flash Gapps 59 | 60 | Visit [7] and download Google Apps[6] Micro Package. 61 | Now flash the Micro Package (or extended packages): 62 | 63 | * Install zip -> `pa_gapps-modular-micro-4.4.4-20140804-signed.zip`; 64 | * Wipe data/factory reset; 65 | * Reboot. 66 | 67 | ## References 68 | 69 | [1] Q&A 70 | [2] Bootloader unlocking 71 | [3] TWRP recovery 72 | [4] OmniROM thread 73 | [5] OmniROM files 74 | [6] Gapps thread 75 | [7] Gapps file 76 | 77 | 78 | [8] http://forum.xda-developers.com/showthread.php?t=2296711 79 | -------------------------------------------------------------------------------- /scripts/adb/cacert: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Android CAcert Class 1 & 3 Root Certificate Pusher 4 | # Code by Erik Timmers 5 | # Version 1.0 - 2013/07/31 6 | # Usage: ./cacert.sh [] 7 | 8 | set -e 9 | 10 | ADB_BIN="adb" 11 | if [ $# -le 1 ]; then 12 | ADB_DEVICE=$($ADB_BIN devices | head -n2 | tail -n1 | awk '{print $1}') 13 | else 14 | ADB_DEVICE=$1 15 | fi 16 | 17 | if [ "$ADB_DEVICE" = "" ] || [ "$ADB_DEVICE" = "*" ]; then 18 | echo "No device present" 19 | exit 1 20 | fi 21 | 22 | ADB_ARGS="-s $ADB_DEVICE" 23 | ADB="$ADB_BIN $ADB_ARGS" 24 | 25 | ANDROID_VERSION=$($ADB shell getprop ro.build.version.release) 26 | for V in $(echo "$ANDROID_VERSION" | sed 's/\./\n/g'); do 27 | if [ $V -lt 4 ]; then 28 | echo "Your device must run Android 4.0.4+" 29 | exit 1 30 | fi 31 | break 32 | done 33 | 34 | echo "Using device '$ADB_DEVICE'" 35 | 36 | TEST_CMD=$($ADB shell "echo -n 'testing'") 37 | 38 | if [ "$TEST_CMD" != "testing" ]; then 39 | echo "Failed connecting to '$ADB_DEVICE'" 40 | exit 1 41 | fi 42 | 43 | CERT_ROOT="root.crt" 44 | CERT_CLASS3="class3.crt" 45 | 46 | wget -N -q https://www.cacert.org/certs/$CERT_ROOT 47 | wget -N -q https://www.cacert.org/certs/$CERT_CLASS3 48 | 49 | if [ -f "$CERT_ROOT" ] && [ -f "$CERT_CLASS3" ]; then 50 | 51 | echo "Please verify the following fingerprints match those on https://www.cacert.org/index.php?id=3 and type 'verified' to continue." 52 | echo "Class 1 PKI Key:" 53 | echo $(openssl x509 -in $CERT_ROOT -sha1 -noout -fingerprint) 54 | echo "Class 3 PKI Key:" 55 | echo $(openssl x509 -in $CERT_CLASS3 -sha1 -noout -fingerprint) 56 | echo -n "> " 57 | read VERIFIED 58 | 59 | if [ "$VERIFIED" = "verified" ]; then 60 | 61 | HASH_ROOT=$(openssl x509 -noout -subject_hash_old -in $CERT_ROOT) 62 | HASH_CLASS3=$(openssl x509 -noout -subject_hash_old -in $CERT_CLASS3) 63 | mv $CERT_ROOT $HASH_ROOT.0 64 | mv $CERT_CLASS3 $HASH_CLASS3.0 65 | CERT_ROOT=$HASH_ROOT.0 66 | CERT_CLASS3=$HASH_CLASS3.0 67 | 68 | REMOTE_DIR="/sdcard/" 69 | 70 | echo "Push certificates" 71 | $ADB push $CERT_ROOT $REMOTE_DIR 72 | $ADB push $CERT_CLASS3 $REMOTE_DIR 73 | 74 | echo "Add certificates to system files" 75 | $ADB shell su -c 'mount -o rw,remount /system > /dev/null' 76 | $ADB shell su -c 'cp '$REMOTE_DIR$CERT_ROOT' /etc/security/cacerts/' 77 | $ADB shell su -c 'cp '$REMOTE_DIR$CERT_CLASS3' /etc/security/cacerts/' 78 | $ADB shell su -c 'chmod 644 /etc/security/cacerts/'$CERT_ROOT 79 | $ADB shell su -c 'chmod 644 /etc/security/cacerts/'$CERT_CLASS3 80 | $ADB shell su -c 'mount -o ro,remount /system > /dev/null' 81 | $ADB shell 'rm '$REMOTE_DIR$CERT_ROOT 82 | $ADB shell 'rm '$REMOTE_DIR$CERT_CLASS3 83 | 84 | echo "Installed CAcert certificates" 85 | else 86 | echo "Aborted installing CAcert certificates" 87 | fi 88 | rm $CERT_ROOT $CERT_CLASS3 89 | else 90 | echo "Failed downloading CAcert certificates" 91 | fi 92 | 93 | -------------------------------------------------------------------------------- /scripts/moto-g/flash-backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | fastbootCheck=$(fastboot devices) 4 | 5 | if [ -z "$fastbootCheck" ]; then 6 | echo "Put your device in fastboot mode (i.e. power off, and then" 7 | echo "press the power and volume down buttons simultaneously)." 8 | exit 1 9 | fi 10 | 11 | fastbootBuildVersion=$(fastboot getvar ro.build.version.full 2>&1) 12 | buildVersion=$(echo $fastbootBuildVersion | sed 's/ /\n/g' | \ 13 | sed -n '/ro\.build.version.full\[[0-9]\+\]/{n;p}' | tr -d '\n') 14 | buildVersionRef="Blur_Version.210.12.40.falcon_umts.EURetail.en.EU" 15 | 16 | if [ "$buildVersion" != "$buildVersionRef" ]; then 17 | echo "Found build version: $buildVersion" 18 | echo "Expected build version: $buildVersionRef" 19 | exit 1 20 | fi 21 | 22 | echo "Flash recovery-clockwork-6.0.4.7-falcon.img" 23 | echo "" 24 | 25 | fastboot flash recovery recovery-clockwork-6.0.4.7-falcon.img > /dev/null 2>&1 26 | 27 | echo "Waiting for YOU to enter recovery..." 28 | echo "" 29 | 30 | adbDevice=1 31 | while [ $adbDevice -ne 0 ] 32 | do 33 | sleep 3 34 | adb devices | grep -q "recovery" 35 | adbDevice=$? 36 | done 37 | 38 | echo "Flash philz_touch_6.13.2-xt1032.zip" 39 | echo "Waiting for YOU to toggle sideload:" 40 | echo " * Install zip" 41 | echo " * Install zip from sideload" 42 | echo "" 43 | 44 | adbSideload=0 45 | while [ $adbSideload -eq 0 ] 46 | do 47 | sleep 3 48 | adb sideload philz_touch_6.13.2-xt1032.zip 2>&1 | grep -q "error: closed" 49 | adbSideload=$? 50 | done 51 | 52 | sleep 12 53 | 54 | echo "Flash supersu.motog.zip" 55 | echo "Waiting for YOU to toggle sideload:" 56 | echo " * Install zip" 57 | echo " * Install zip from sideload" 58 | echo "" 59 | 60 | adbSideload=0 61 | while [ $adbSideload -eq 0 ] 62 | do 63 | sleep 3 64 | adb sideload supersu.motog.zip 2>&1 | grep -q "error: closed" 65 | adbSideload=$? 66 | done 67 | 68 | sleep 20 69 | 70 | echo "Rebooting into recovery..." 71 | echo "" 72 | 73 | adb reboot recovery 74 | 75 | adbDevice=1 76 | while [ $adbDevice -ne 0 ] 77 | do 78 | sleep 3 79 | adb devices | grep -q "recovery" 80 | adbDevice=$? 81 | done 82 | 83 | echo "Entered recovery" 84 | echo "Hold on..." 85 | echo "" 86 | 87 | sleep 3 88 | 89 | echo "Copying backup data..." 90 | echo "This may take a while." 91 | 92 | adb shell mount /data 93 | adb push clockworkmod /sdcard/clockworkmod > /dev/null 2>&1 94 | adb shell umount /data 95 | 96 | echo "Done." 97 | echo "" 98 | 99 | sleep 1 100 | 101 | echo "Restore the backup:" 102 | echo " * Backup and Restore" 103 | echo " * Restore from /sdcard" 104 | echo " * 2014-03-27.21.32.17_KLB20.9-1.10-1.24-1.1" 105 | echo " * Yes - Restore" 106 | echo "" 107 | echo "I'll come back in 60 seconds..." 108 | echo "" 109 | 110 | sleep 60 111 | 112 | echo "Reboot to bootloader" 113 | echo "Waiting for YOU to reboot to bootloader:" 114 | echo " * Power Options" 115 | echo " * Reboot to Bootloader" 116 | 117 | sleep 3 118 | 119 | while [ -z "$(fastboot devices)" ] 120 | do 121 | sleep 3 122 | done 123 | 124 | echo "" 125 | echo "Flashing bootlogo..." 126 | 127 | fastboot flash logo logo-custom.bin > /dev/null 2>&1 128 | 129 | echo "" 130 | echo "Reboot..." 131 | 132 | fastboot reboot > /dev/null 2>&1 133 | 134 | echo "" 135 | echo "All done!" 136 | 137 | -------------------------------------------------------------------------------- /src/moto-g-compress.pl: -------------------------------------------------------------------------------- 1 | # original script by carock 2 | # @see http://forum.xda-developers.com/showpost.php?p=48891456&postcount=140 3 | # 4 | # modified by gingerik 5 | # @see https://github.com/gingerik 6 | 7 | use strict; 8 | use warnings; 9 | 10 | my $file = $ARGV[0]; 11 | my $pfile = "logo_boot.bin"; 12 | my $xres = 720; 13 | 14 | open(FH, "<", $file) or die "cannot open $file: $!"; 15 | binmode(FH); 16 | local $/; 17 | my @hex = unpack '(H6)*', ; 18 | close (FH); 19 | 20 | open(pFH, ">", $pfile) or die "cannot open $pfile: $!"; 21 | binmode(pFH); 22 | 23 | my $data; 24 | my $i; 25 | my $id = 0; 26 | my $max = 0; 27 | 28 | #compress raw 24bit BGR file in motorola boot logo format 29 | MAIN: for ($i=0; $i <= $#hex; $i++) 30 | { 31 | if(($hex[$i] eq $hex[$i+1]) && ($hex[$i+1] eq $hex[$i+2])) 32 | { 33 | $data = $hex[$i]; 34 | $id++; 35 | $max++; 36 | $i++; 37 | 38 | #edge case 39 | if(($max+1)>=$xres) 40 | { 41 | $id++; 42 | $id = sprintf("8%03x", $id); 43 | $id = pack 'H*', $id; 44 | print pFH $id; 45 | $id = 0; 46 | 47 | $data = pack 'H*', $data; 48 | print pFH $data; 49 | 50 | $max=0; 51 | next MAIN; 52 | } 53 | else 54 | { 55 | while($hex[$i] eq $hex[$i+1]) 56 | { 57 | $id++; 58 | $max++; 59 | $i++; 60 | 61 | if(($max+1)>=$xres) 62 | { 63 | $id++; 64 | $id = sprintf("8%03x", $id); 65 | $id = pack 'H*', $id; 66 | print pFH $id; 67 | $id = 0; 68 | 69 | $data = pack 'H*', $data; 70 | print pFH $data; 71 | 72 | $max=0; 73 | next MAIN; 74 | } 75 | } 76 | } 77 | 78 | $id++; 79 | $max++; 80 | 81 | if(($max+1)>=$xres) 82 | { 83 | $max=0; 84 | } 85 | 86 | $id = sprintf("8%03x", $id); 87 | $id = pack 'H*', $id; 88 | print pFH $id; 89 | $id = 0; 90 | } 91 | else 92 | { 93 | 94 | $data = $hex[$i]; 95 | $id++; 96 | $max++; 97 | #$i++; 98 | 99 | #edge case 100 | if($max==$xres) 101 | { 102 | $id = sprintf("8%03x", $id); 103 | $id = pack 'H*', $id; 104 | print pFH $id; 105 | $id = 0; 106 | 107 | $data = pack 'H*', $data; 108 | print pFH $data; 109 | 110 | $max=0; 111 | next MAIN; 112 | } 113 | else 114 | { 115 | while(($hex[$i+1] ne $hex[$i+2]) || ($hex[$i+2] ne $hex[$i+3])) 116 | { 117 | $id++; 118 | $max++; 119 | $i++; 120 | $data = $data.$hex[$i]; 121 | 122 | if($max==$xres) 123 | { 124 | $id = sprintf("%04x", $id); 125 | $id = pack 'H*', $id; 126 | print pFH $id; 127 | $id = 0; 128 | 129 | $data = pack 'H*', $data; 130 | print pFH $data; 131 | 132 | $max=0; 133 | next MAIN; 134 | } 135 | } 136 | } 137 | 138 | $id = sprintf("%04x", $id); 139 | $id = pack 'H*', $id; 140 | print pFH $id; 141 | $id = 0; 142 | } 143 | 144 | $data = pack 'H*', $data; 145 | print pFH $data; 146 | } 147 | 148 | close(pFH); 149 | 150 | 151 | #update file size in header of modified bin file 152 | open(FH, "; 156 | close (FH); 157 | 158 | open(pFH, ">logo-custom.bin") or die "cannot open logo-custom.bin: $!"; 159 | binmode(pFH); 160 | 161 | for ($i=0; $i <= 104; $i++) 162 | { 163 | print pFH (pack 'H*', $hex[$i]); 164 | } 165 | 166 | my $size = -s $pfile; 167 | $size = $size + 12; 168 | $size = sprintf("%06x",$size); 169 | $size = substr($size,4,2).substr($size,2,2).substr($size,0,2); 170 | print pFH (reverse pack 'H*', $size); 171 | 172 | for ($i=108; $i <= $#hex; $i++) 173 | { 174 | print pFH (pack 'H*', $hex[$i]); 175 | } 176 | 177 | close(pFH); 178 | 179 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 2013 server-s 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------