{"id":81,"date":"2017-02-11T15:38:48","date_gmt":"2017-02-11T23:38:48","guid":{"rendered":"https:\/\/www.lucaswilliams.net\/?p=81"},"modified":"2017-03-28T10:56:56","modified_gmt":"2017-03-28T17:56:56","slug":"install-ubuntu-touch-on-bq-aquaris-m10-fhd","status":"publish","type":"post","link":"https:\/\/www.lucaswilliams.net\/index.php\/2017\/02\/11\/install-ubuntu-touch-on-bq-aquaris-m10-fhd\/","title":{"rendered":"Install Ubuntu-Touch on BQ Aquaris M10 FHD"},"content":{"rendered":"<p>Hello everyone! This blog entry is mostly for those of you that want to play with Ubuntu-Touch on the BQ Aquaris M10. You can actually purchase this tablet from <a href=\"https:\/\/store.bq.com\/en\/ubuntu-edition-aquaris-m10?utm_source=Ubuntu.com_devices&amp;utm_medium=Button&amp;utm_campaign=m10-ubuntu-edition-canonical&amp;\">BQ\u00a0directly<\/a>, but they have been sold out for a while, and I really wanted to have one.<\/p>\n<p>So, I bought the Android version, which isn&#8217;t too different in specs. However, it comes running Android Marshmallow. I played around with it for a day just because I haven&#8217;t played with Android in a while, and realized a lot has changed since Froyo, which was the last version I played with. After the nostalgia ran off, I decided to start trying to install Ubuntu on my device.<\/p>\n<p>First thing I did was go to\u00a0<a href=\"https:\/\/developer.ubuntu.com\/en\/phone\/devices\/installing-ubuntu-for-devices\/\">Installing Ubuntu on Devices<\/a> website. I found all the details of setting up my build machine to handle this.<\/p>\n<p>First thing I did was install the ppa for the Ubuntu SDK and for the phablet-tools package.<\/p>\n<p><code>sudo add-apt-repository ppa:ubuntu-sdk-team\/ppa<\/code><\/p>\n<p>Then run <code>sudo apt update<\/code>\u00a0to get my repo locations updated to use the ppa.<\/p>\n<p>It than install the ubuntu-device-flash which is what does all the heavy lifting and getting the image on the device. I also install adb, which is Android Debug Bridge application which is needed to manage the device and get access to the internal bits of the device, and fastboot which manages the device\u00a0when its in the\u00a0bootloader.<\/p>\n<p><code>sudo apt install ubuntu-device-flash phablet-tools<\/code><\/p>\n<p>After I had all the required tools on my laptop, I was ready to start. First thing I did was I had to put my M10 into Developer Mode. To do this, Click on System and go to About. Click the Build seven times. It will start a countdown on the screen saying &#8220;Press x time to enable Developer Mode.&#8221; Once done, go back and you will see Developer Options on the screen next to About. Select it and enabled OEM Unlock Bootloader, which it will bring up a prompt asking if you are sure since this does void the warranty, and it warms you every time you reboot the device saying it is in Orange State and can&#8217;t be protected and delays the boot by five seconds. Select Yes and then Enable USB Debug and turn off Protect ADB APK uploads. Probably isn&#8217;t necessary, but I did it anyways.<\/p>\n<p>Now, plug your USB cable into your laptop and your device, You will get a prompt on the tablet asking if you trust this device, click the check to always trust and say Yes. You can now use the adb command on the laptop to control the tablet.<\/p>\n<p>First, check that your laptop sees everything:<\/p>\n<p><code>adb devices<\/code><\/p>\n<p>You should get a return of the M10&#8217;s serial number and the word <code>device<\/code>\u00a0next to it. We are now ready to go into the Bootloader. Do this from adb:<\/p>\n<p><code>adb reboot bootloader<\/code><\/p>\n<p>The device will reboot, give you the warning that I mentioned above about being Unlocked and unprotected, and then a blank screen with Fastboot Loader on the bottom. This is the fastboot bootloader. We now have to unlock the device:<\/p>\n<p>Make sure you can communicate with the device with fastboot:<\/p>\n<p><code>fastboot devices<\/code><\/p>\n<p>You should get a return of the M10&#8217;s serial Number and <code>fastboot<\/code>\u00a0on the same line.<\/p>\n<p>You unlock the device by typing:<\/p>\n<p><code>fastboot oem unlock<\/code><\/p>\n<p>You will get a prompt on the device\u00a0saying Press Volume + to Unlock and Volume &#8211; to cancel. Press Volume + on the device and you will get a confirmation saying device unlocked and on your Laptop it will say OKAY and exit. Now we can reboot the device again.<\/p>\n<p><code>fastboot reboot<\/code><\/p>\n<p>Now, it will start back up in Android, after about 10 minutes. You will have to reconfigure the device, basically I skip everything until I can get to the point where I can turn the device off. I turn it off and then I turn it back on, but when I press the power button, I also hold down the Volume + button at the same time. This will cause the M10 to go into Recovery Mode. Once The Screen comes up saying Powered by Android and you get the Unlocked Warning again, you can release the power button, but keep pressing the Volume + button until you get the Fastboot screen. Verify you can communicate to the device:<\/p>\n<p><code>fastboot devices<\/code><\/p>\n<p>You should get the serial number and fastboot on the same line. Now we can install Ubuntu&#8230;.kind of.<\/p>\n<p>First, you need to download the recovery image from Ubuntu since the built in one on the device does not allow adb. Depending if you have the M10 FHD or just the M10, you need a specific image. Since I was using the FHD, I need the frieza image. You can download them by clicking the appropriate link from <a href=\"https:\/\/wiki.ubuntu.com\/Touch\/Devices\">this page<\/a>.<\/p>\n<p>Run the following to start the process:<\/p>\n<pre><code>ubuntu-device-flash -v touch \\\r\n--channel=ubuntu-touch\/stable\/bq-aquaris-pd.en \\\r\n--device=frieza --bootstrap \\\r\n--recovery-image=recovery-frieza.img<\/code><\/pre>\n<p>It will download and start copying all the required files for the device. Unfortunately, it will fail. The Android partition layout is\u00a0<em>way\u00a0<\/em>to small for Ubuntu recovery. So, after it fails, you can wipe the cache from the device. Next, you will use adb to manage the partitions.<\/p>\n<p>First, you need to download parted for Android. Luckly, I have a version <a href=\"https:\/\/www.lucaswilliams.net\/files\/parted-android-32.tgz\">here<\/a> you can use. Download this and untar it and then move it to the \/sbin directory on your device:<\/p>\n<pre><code>tar xf parted-android-32.tgz\r\nadb push parted \/sbin\r\nadb shell chmod +x \/sbin\/parted<\/code><\/pre>\n<p>Now we are ready to do some &#8220;damage&#8221; to the device.<\/p>\n<p><strong>NOTE:<\/strong> Word of caution here. We are going to delete and grow 3 file systems on the device. Please follow these directions closely and watch out for typos. You don&#8217;t want that otherwise we have to start all over again.<\/p>\n<p>First, run <code>adb shell<\/code>. You are now on the console of the device as root. If you run <code>df -h<\/code>\u00a0you&#8217;ll notice that \/cache is out of space, and it&#8217;s only a little over 400MB in size. No where near the size we need since we have a little over 870MB of files we need to upload before we can install Ubuntu. The other thing you&#8217;ll notice once we get into the partitioning, is that the \/system directory is only 1.5GB in size, and Ubuntu needs at least 4GB for the installation. However, the userdata partition is 15GB in size, so we are going to steal from there to repurpose to these other partitions.<\/p>\n<p>First thing to do is run <code>parted \/dev\/block\/mmcblk0<\/code><\/p>\n<p>Type <code>p<\/code>\u00a0to list the partitions, there are 24 partitions. We are only concerned with 21, 22, and 23. First change the unit to bytes, <code>unit b<\/code>\u00a0and then run <code>p<\/code>\u00a0again to get that readout:<\/p>\n<pre><code>p\r\nModel: MMC 016G70 (sd\/mmc)\r\nDisk \/dev\/block\/mmcblk0: 15758000128B\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\n\r\nNumber Start End Size File system Name Flags\r\n1 524288B 3670015B 3145728B proinfo\r\n2 3670016B 8912895B 5242880B nvram\r\n3 8912896B 19398655B 10485760B protect1\r\n4 19398656B 29884415B 10485760B protect2\r\n5 29884416B 80216063B 50331648B persist\r\n6 80216064B 80478207B 262144B seccfg\r\n7 80478208B 80871423B 393216B lk\r\n8 80871424B 97648639B 16777216B boot\r\n9 97648640B 114425855B 16777216B recovery\r\n10 114425856B 120717311B 6291456B secro\r\n11 120717312B 121241599B 524288B para\r\n12 121241600B 129630207B 8388608B logo\r\n13 129630208B 140115967B 10485760B expdb\r\n14 140115968B 141164543B 1048576B frp\r\n15 141164544B 146407423B 5242880B tee1\r\n16 146407424B 151650303B 5242880B tee2\r\n17 151650304B 153747455B 2097152B kb\r\n18 153747456B 155844607B 2097152B dkb\r\n19 155844608B 189399039B 33554432B metadata\r\n20 189399040B 201326591B 11927552B custram\r\n21 201326592B 1811939327B 1610612736B ext4 system\r\n22 1811939328B 2256535551B 444596224B ext4 cache\r\n23 2256535552B 15616966655B 13360431104B userdata\r\n24 15616966656B 15757983231B 141016576B flashinfo\r\n<\/code><\/pre>\n<p>Note the start and ends for the partitions 20 and 24. Partition 21 will start with 201326592 which is +1 from the end of the previous partition. We need to do this for each partition we are growing so that they are uniform and not overlapping and cause problems.<\/p>\n<p>First we need to delete the three partitions:<\/p>\n<pre><code>rm 21\r\nrm 22\r\nrm 23<\/code><\/pre>\n<p>Now we are ready to recreate them, only larger in size. Since we are using bytes, the numbers are quite large, and need to equal logical sizes. Basically, do the math of starting byte, add the amount of more space you want, make that the end byte, then the next partition starts on the +1 of the last end byte until you get to partition 23, which you will end -1 byte of where partition 24 starts. So partition 23 will end with 15616966655. If you use the values that I did, you will end up with a system partition of 4.3GB, cache of 1.07GB, and a userdata of 9.6GB:<\/p>\n<pre><code>mkpart primary 201326592 4496294399\r\nmkpart primary 4496294400 5570036224\r\nmkpart primary 5570036736 15616966655\r\nname 21 system\r\nname 22 cache\r\nname 23 userdata\r\nquit<\/code><\/pre>\n<p>We now need to format the volumes:<\/p>\n<pre><code>mke2fs -t ext4 \/dev\/block\/mmcblk0p21\r\nmke2fs -t ext4 \/dev\/block\/mmcblk0p22\r\nmke2fs -t ext4 \/dev\/block\/mmcblk0p23<\/code><\/pre>\n<p>Now, on the device, use the Volume &#8211; to select reboot into bootloader and press the Power button to select it. The device will reboot and you will be brought back to the screen where it just says FASTBOOT on the bottom.<\/p>\n<p>Now we can start the flash again, and this time it will work:<\/p>\n<pre><code>ubuntu-device-flash -v touch \\\r\n--channel=ubuntu-touch\/stable\/bq-aquaris-pd.en \\\r\n--device=frieza --bootloader \\\r\n--recovery-image=~\/frieza-recovery.img<\/code><\/pre>\n<p>Once the installation is done, you will have Ubuntu running on your device. It takes about 10 minutes to install, but after the reboot, the initial splash screen will have the BQ logo but say powered by Ubuntu and you won&#8217;t have the annoying Unlocked Device unprotected alert any more.<\/p>\n<p>Let me know in the comments if you have any issues! Happy Hacking!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone! This blog entry is mostly for those of you that want to play with Ubuntu-Touch on the BQ Aquaris M10. You can actually purchase this tablet from BQ&nbsp;directly, but they have been sold out for a while, and I really wanted to have one. So, I bought the Android version, which isn&rsquo;t too [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,10,35,36,6],"tags":[46,45,39,40,27,21,44,47,42,41,11,22,38,5,48,43],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-howto","category-phone-ubuntu","category-tablet","category-touch","category-ubuntu","tag-adb","tag-android","tag-aquaris","tag-bq","tag-canonical","tag-configure","tag-device","tag-fastboot","tag-fhd","tag-m10","tag-phone","tag-setup","tag-tablet","tag-ubuntu","tag-ubuntu-device-flash","tag-ubuntu-touch"],"_links":{"self":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":4,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucaswilliams.net\/index.php\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}