Karam Assany

To summarize it up, I'm more a PC-person than a smartphone one. My reasons are clear: PCs offer multiple levels of hardware and software freedom, even the most restrictive PCs (those of Apple, maybe) are way "freer" than %95 of smartphones available today. Smartphones are not only restricted, they also have very limited hardware (well, to be clear, by "limited" I mean restrictive by design, powerfulness doesn't count here). As non-average computer user, I don't feel comfortable dealing with these small computers, especially using the default setting (virtual keyboard, touch input, small monitor, etc). However, these days (early 2020) I've become more attracted to smartphones than any moment in the past. So I'm going to tell you a story about me dealing with the first modern smartphone I ever owned.

In reality, the first "smartphone" I owned was a Nokia C5-03, running Symbian OS, that is, proprietary and very limited. It was back in 2011, and I used this phone for about 8 years (till mid-2019). In this span of time, my whole technological focus was on PCs (desktops and laptops) and I didn't pay much attention for my smartphone as its support was discontinued by the manufacturer and the development kits for Symbian OS were not available anymore. Lately, in the time of the Android revolution, I sat down and was just an observer, actually an interested one.

Anyways, a half-year ago (late 2019), I finally managed to get a modern, Android-running smartphone. It wasn't the smartphone of my dreams, but honestly very close to. It's X-BO S87, a typical obscure Chinese smartphone. My sister used it for about two years, then threw it in the trash (metaphorically). I had to pick that smarty up from the trash, factory reset it, and then being frustrated because I have no control over it (i.e. I don't have root access to the operating system).

That moment, Android world was still foreign to me, actually I have used Android since 2015, but I didn't own an Android-running smartphone to tamper with and tweak its operating system. I primarily wanted root access, because that is what I have on all systems I use (i.e. GNU).

I asked an Android-savvy college friend about the ability to get root access in my phone's operating system and the answers were mere facts: "Your mobile is obscure" and "You are a noob." And to be quite honest, most of so-called Android "powerusers" are actually just a lazy users waiting developers to release stuff for their specific, widely popular smartphone. It is a reality that I actually hate.

One day, while wanderly browsing my system's settings, I realized that I have a "Enable OEM Unlock" option in the developer settings. I wondered what that means so I searched it and began entering the Android underground world. Unfortunately, in that time there was no PC available around me, so I was unable to apply most of what I'm researching in reality. In the day I got a PC around me, I disabled the OEM lock by simply issuing "fastboot oem unlock". Honestly, I didn't expect that to be so easy! My fear was some unlock code is required, which is something I'll never obtain from an obscure OEM. Anyways, after wiping my data (mandated but stupid), I didn't know how to progress to the next step: Installing an advanced recovery system. The pre-installed recovery system cannot do much, advanced recovery systems like TWRP or CWM at least give you an ADB shell with root access (and busybox installed). So, as usual, I searched for TWRP or CWM for my phone, and as usual, my phone is not supported (or known to start with).

A useful yet unconfirmed piece of information is that my phone is a clone of an Oppo phone, so I was triggered when I saw "Oppo" in the supported device list of TWRP. I downloaded an miscellaneous image from there and flashed it via fastboot. And the result was a so-called bootloop, I didn't know where is the problem (and still don't know), if "recovery" partition is corrupt, "boot" should work, right? Maybe something corrupted another thing under the hood, who knows.

To get out of trouble, I downloaded an unofficial "stock ROM" for my phone (I wonder how I found something for my phone!), extracted it and flashed every partition available one by one. Some partitions like "preload" and "secro" didn't allowed to be overwritten. Other partitions like "userdata", "system" and "cache" were too larger than the allowed download size, so I cannot copy them in the usual way (using tools like img2simg didn't help). Anyways, what I did was good enough to get things back to work. I re-installed the default recovery system (didn't have another choice).

After doing more research, I realized that Magisk does not install itself in "system" partition, but in "boot". That was nice, 'cause I can someway modify the "boot" image I got from the "stock ROM" to install Magisk on it, and then install it back via fastboot. And luckily, Magisk Installer app can do patch the "boot" image for me, so I did all those things, and badabing! Now I got root access. But that was not the whole story.

When I got root access, I planned to do many things, but the first thing that came on my mind was to remove all system apps that I don't use. Accidentally, I moved the dialer/phone app into normal apps. After that, telephony as whole stopped to work, I tried to fix that by moving those apps back to system apps, but nah, the same issue happened.

Given the technical limitation I'm surrounded with, I decided to copy the "system" image from the "stock ROM" by using "dd" in Android, but unfortunately that won't work 'cause the "system" partition cannot be unmounted after booting Android, and it is frequently used (read) by the operating system so my "dd" will most likely be corrupted. So what did I do? I mounted the "system" image in some directory and then copy-pasted everything to the system partition, during that, there happened a soft reboot, I tried to make things good again by doing a full reboot, but worse what happened. My phone failed to boot from Android, and it directed me to recovery menu.

As I said, pre-installed recovery systems cannot do much more than wiping data and cache partition, doing a sideload (approved by OEM), and other minimal functionalities. In this moment, I did more research for ways to flash large partitions, but it didn't help, fastboot fails to flash "system". I tried using stupid tools like "SP Flash Tools", but stupid tools do stupid things, and "SP Flash Tools" did the most stupid thing; they didn't work. I realized how much I'm limited by being stuck with a smartphone with corrupted operating system (Android) and a limited one (recovery).

But I had hope! I managed somehow, following a rarely-to-see sophisticated guide I found on XDA Forums, to port TWRP to my phone. Although the partition table was improper, I managed, by using the root shell access, to "dd"ing the system image into the system partition. It was a bit easy, I had to "fdisk -l /dev/block/mmcblk0" to detect where is the system partition. I read logs generated by the default recovery to detect where is the external sdcard (I was noob enough to not guess it's in /dev/block/mmcblk1p1). Anyways, I finally managed to recovery my system! Yay!

My story will not stop here, all these things above happened in a week or two. My ambition is to port a sophisticated operating system for my phone. I don't know why I'm wasting my time on an obscure phone, but sometimes self-dependence makes the impossible. Even when my smartphone's hardware (SoC, touch screen, battery, ...) is laggy, even when my smartphone's manufacturer is located on Mars, I still love how that phone is following the standards (for a good extent), and making it easy for me to live with it as a user and as a developer.