{"id":1268,"date":"2018-03-15T22:42:11","date_gmt":"2018-03-15T21:42:11","guid":{"rendered":"https:\/\/bergs.biz\/blog\/?p=1268"},"modified":"2018-03-18T12:21:12","modified_gmt":"2018-03-18T11:21:12","slug":"sony-xperia-x-compact-modding","status":"publish","type":"post","link":"https:\/\/bergs.biz\/blog\/2018\/03\/15\/sony-xperia-x-compact-modding\/","title":{"rendered":"Sony Xperia X Compact Modding"},"content":{"rendered":"<p>I decided to write this post since I couldn&#8217;t find any single page that lists all the &#8220;secrets&#8221; you need to know when modding your Sony Xperia X Compact (XC) <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sony_Xperia\" target=\"_blank\">codenamed &#8220;Kugo&#8221;<\/a> in a concise manner and in a single place. And after half a year when I last tinkered with my XC, I had forgotten about all the details again, so I had to research them again anyway&#8230;<\/p>\n<p>I give credit to the following XDA people (but not limited to them, I apologize to those who I might have forgotten):<\/p>\n<ul>\n<li><a href=\"https:\/\/forum.xda-developers.com\/showpost.php?p=74417152&amp;postcount=3\" target=\"_blank\">ondrejvaroscak<\/a> for how to boot into fastboot or bootloader modes<\/li>\n<li><a href=\"https:\/\/forum.xda-developers.com\/x-compact\/development\/recovery-twrp-3-1-1-xperia-x-compact-t3640914\" target=\"_blank\">eagleeyetom<\/a> for his port of TWRP 3.1.1-0<\/li>\n<li><a href=\"https:\/\/android.gadgethacks.com\/how-to\/know-your-android-tools-what-is-fastboot-do-you-use-it-0155640\/\" target=\"_blank\">GadgetHacks<\/a> for the explanation of fastboot<\/li>\n<li><a href=\"https:\/\/forum.xda-developers.com\/x-compact\/development\/twrp-3-2-1-decryption-t3751998\" target=\"_blank\">nialv7<\/a> for his port of TWRP 3.2.1 for Oreo<\/li>\n<\/ul>\n<h1>General Approach<\/h1>\n<p>The general approach when modding your phone is the following:<\/p>\n<ol>\n<li>Flash custom recovery<\/li>\n<li>Backup current installation\/data<\/li>\n<li>(Optionally: flash latest stock firmware)<\/li>\n<li>(Optionally: flash custom recovery that works with your new stock firmware)<\/li>\n<li>Root<\/li>\n<li>Flash other mods or use &#8220;root&#8221; apps<\/li>\n<\/ol>\n<h1>Custom Recovery<\/h1>\n<h2>Fastboot Mode<\/h2>\n<p>First let&#8217;s explain what &#8220;fastboot mode&#8221; is: Fastboot is both a tool and a protocol for writing data directly to your phone&#8217;s flash memory. In practical use, it is used to flash images such as recoveries, bootloaders, and kernels to your Android device.<\/p>\n<p>The &#8220;fastboot&#8221; tool (as well as &#8220;adb&#8221; which is also needed when tinkering with your Android smart phone) is part of the Android &#8220;platform tools,&#8221; which you can <a href=\"https:\/\/developer.android.com\/studio\/releases\/platform-tools.html\" target=\"_blank\">download directly from Google<\/a> (roughly 4M only).<\/p>\n<p>To bring your phone into fastboot mode, perform the following steps:<\/p>\n<ol>\n<li>Switch the phone off.<\/li>\n<li>Hold &#8220;Volume <strong>up<\/strong>&#8221; and connect your phone to the USB port of your PC. The notification LED should first light up in <span style=\"color: #ff0000;\">red<\/span>, then <span style=\"color: #0000ff;\">blue<\/span>, and provided you have correctly installed drivers, you will be able to use fastboot commands.<br \/>\nNote that the screen will remain black. You can check whether you are in fastboot mode with the following command:<\/p>\n<pre>$ fastboot devices\r\nBH901XXXXX\u00a0\u00a0 \u00a0fastboot<\/pre>\n<p>If you see output similar to the above, you have successfully put your phone in fastboot mode.<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<h2>Flash TWRP Recovery<\/h2>\n<p>You need a custom recovery to backup your phone, or to flash custom kernels or even custom Android distributions, or become root, e. g. using &#8220;SuperSU&#8221; or &#8220;Magisk.&#8221;<\/p>\n<p><a href=\"https:\/\/twrp.me\/FAQ\/\" target=\"_blank\">TWRP<\/a> is <em>the<\/em> custom recovery used everywhere in Android.<\/p>\n<p>Download TWRP for Kugo from the below locations:<\/p>\n<ul>\n<li>For Nougat (Android 7.x.x): from <a href=\"https:\/\/forum.xda-developers.com\/x-compact\/development\/recovery-twrp-3-1-1-xperia-x-compact-t3640914\" target=\"_blank\">this<\/a> place (supports <code>\/data<\/code> decryption!)<\/li>\n<li>For Oreo (Android 8.x): from <a href=\"https:\/\/forum.xda-developers.com\/x-compact\/development\/twrp-3-2-1-decryption-t3751998\" target=\"_blank\">here<\/a> (as of 2018-03-18, does <em>not<\/em> support <code>\/data<\/code> decryption even though it claims to do so!)<\/li>\n<\/ul>\n<p>To flash TWRP, put your device in fastboot mode as described in the corresponding section, then issue the following command:<\/p>\n<pre>$ fastboot flash recovery twrp-3.1.1-kugo-2017.08.22.img\r\ntarget reported max download size of 536870912 bytes\r\nsending 'recovery' (19740 KB)...\r\nOKAY [\u00a0 0.678s]\r\nwriting 'recovery'...\r\nOKAY [\u00a0 0.249s]\r\nfinished. total time: 0.928s\r\n<\/pre>\n<p>To boot into your freshly installed recovery, <strong>disconnect the USB cable<\/strong>, and then press &#8220;Volume down&#8221; and &#8220;Power&#8221; and keep both depressed until you feel the device vibrate. Then let go the &#8220;Power&#8221; keep, and still keep &#8220;Volume down&#8221; depressed. The notification LED should light up in <span style=\"color: #cc99ff;\">purple<\/span>, at which time you can let go also the &#8220;Volume down&#8221; key. After a couple of seconds, you should see the TWRP startup screen.<\/p>\n<h2>Backup your Device using TWRP<\/h2>\n<p>First thing you should do before you start experimenting is backup your device. Since TWRP 3.1.x.x you can directly backup to your PC, instead to the device itself, which is very convenient for safety and space reasons.<\/p>\n<p>To do so, boot into TWRP a described in the previous section, and then issue the following command:<\/p>\n<pre>$ adb backup -f sony_xc_20180315T2100Z.ab --twrp\r\nNow unlock your device and confirm the backup operation...\r\n<\/pre>\n<p>In TWRP you then select the filesystems to be backed up<\/p>\n<p><a href=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1278\" src=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07-576x1024.png\" alt=\"screenshot_2018-03-15-22-23-07\" width=\"474\" height=\"843\" srcset=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07-576x1024.png 576w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07-84x150.png 84w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07-169x300.png 169w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-07.png 720w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>and the options:<\/p>\n<p><a href=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1277\" src=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16-576x1024.png\" alt=\"screenshot_2018-03-15-22-23-16\" width=\"474\" height=\"843\" srcset=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16-576x1024.png 576w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16-84x150.png 84w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16-169x300.png 169w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-23-16.png 720w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>After you start the backup operation in TWRP, you see something similar to the following:<\/p>\n<p><a href=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1275\" src=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04-576x1024.png\" alt=\"screenshot_2018-03-15-22-11-04\" width=\"474\" height=\"843\" srcset=\"https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04-576x1024.png 576w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04-84x150.png 84w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04-169x300.png 169w, https:\/\/bergs.biz\/blog\/wp-content\/uploads\/2018\/03\/Screenshot_2018-03-15-22-11-04.png 720w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>To restore your backup, invoke the below command:<\/p>\n<pre>$ adb restore sony_xc_20180315T2100Z.ab\r\n<\/pre>\n<h1>Flashing Stock Firmware<\/h1>\n<p>If you as an adventurous user want to flash stock firmware (i. e. original firmware supplied by Sony), you usually use a tool called &#8220;<a href=\"http:\/\/www.flashtool.net\/downloads.php\" target=\"_blank\">Flashtool<\/a>&#8221; for maximum flexibility.<\/p>\n<p>This tool requires as an input for the actual flash operation so-called FTF files. These can be created by Flashtool itself, based upon the vendor flash files <code>FILE_*<\/code>. The vendor flash files can be downloaded with <a href=\"https:\/\/forum.xda-developers.com\/crossdevice-dev\/sony\/pc-xperifirm-xperia-firmware-downloader-t2834142\" target=\"_blank\">XperiFirm<\/a>.<\/p>\n<p>So the steps are:<\/p>\n<ol>\n<li>Find out firmware customization<\/li>\n<li>Download suitable vendor firmware flash files with XperiFirm. It will automatically decrypt the vendor flash files.<\/li>\n<li>Convert to FTF with Flashtool&#8217;s bundler<\/li>\n<li>Flash TFT with Flashtool. If you want to keep your current apps and data, be sure to untick &#8220;Data &amp; Cache&#8221; under &#8220;Wipe.&#8221;<\/li>\n<\/ol>\n<h2>Find out Firmware Customization<\/h2>\n<p>If you want to find out your current firmware&#8217;s customization, known as &#8220;CDA number,&#8221; follow the below steps:<\/p>\n<ol>\n<li>Enter <code>*#*#7378423#*#*<\/code> in the dialer<\/li>\n<li>Click &#8220;Service Info&#8221; -&gt; &#8220;Software Info&#8221; and look at &#8220;Customization Version&#8221;<\/li>\n<\/ol>\n<p>Now that you know your CDA number, you can use this to download a suitable firmware with XperiFirm. But you might also decide to intentionally download a different one, e. g. if you want to de-brand your current operator-branded firmware! An example would be to go from &#8220;Vodafone DE&#8221; to &#8220;Customized DE&#8221;, which is a vendor-neutral firmware.<\/p>\n<h2>Enter Flash Mode<\/h2>\n<p>To enter &#8220;Bootloader&#8221; or &#8220;Flash Mode&#8221; to be used with tools like Flashtool or Emma, use the following procedure:<\/p>\n<ol>\n<li>Switch the phone off.<\/li>\n<li>Hold &#8220;Volume <strong>down<\/strong>&#8221; and connect your phone to the USB port of your PC. The notification LED should light up first in <span style=\"color: #ff0000;\">red<\/span>, then in <span style=\"color: #99cc00;\">green<\/span>, and provided you have correctly installed the drivers for your phone, you will be able to use Flashtool or Emma to flash your device.<\/li>\n<\/ol>\n<h2>Flash Device with Flashtool<\/h2>\n<p>Recent versions of Flashtool now integrate XperiFirm, and the whole process described above is fully automatic. Just press the XperiFirm icon (the right-most one in the toolbar) to download or (if already installed) invoke XperiFirm, then select and download your vendor firmware, close XperiFirm, and then Flashtool will continue bundling and flashing your firmware.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to mod your Sony Xperia X Compact.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[276,59,122,1],"tags":[226,278,277],"class_list":["post-1268","post","type-post","status-publish","format-standard","hentry","category-android","category-cell-phones-communications","category-english","category-uncategorized","tag-hacking","tag-sony-xperia-x-compact","tag-twrp"],"_links":{"self":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/comments?post=1268"}],"version-history":[{"count":29,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1268\/revisions"}],"predecessor-version":[{"id":1300,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/posts\/1268\/revisions\/1300"}],"wp:attachment":[{"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/media?parent=1268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/categories?post=1268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bergs.biz\/blog\/wp-json\/wp\/v2\/tags?post=1268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}