It wasn’t long after having my MB508 Motorolla Flipside that I wanted to upgrade it with Linux. At this time I will not get into why someone might want to do this, as I feel that will distract us from the task at hand. Let’s just say that I wanted Linux on my phone, because I can.
The first step was rooting my phone. A little research revealed that my phone was Android version 2.2 and a good tool to root it was z4root. (Since upgrading my phone to 2.3, I have had to use root genius instead. So if you have 2.3+, try that instead.) So I downloaded it from the internet and installed it:
#adb install com.z4mod.z4root-1.3.0-free-1679-www.apkhere.com.apk
After it was installed, I opened the app on my phone and selected the “permanent root” button. A few minutes later it rebooted and my phone was rooted.
I then needed a few tools and downloaded “BusyBox Installer” and “Terminal” apps from the Market/Google Playstore app. Upon opening the BusyBox Installer app, I tried to install the latest version, 1.22, but it failed. Undaunted, I simply selected an older version, 1.20, and it installed correctly. This gives me the command busybox in the terminal app, so I can have some barebones Linux commands that run through the Android OS.
Now I did not want a Linux emulator, because that gets really slow, especially on my older phone. I also did not want a completely separate instance of Linux, such as installing Linux and using chroot to change to it, because I wanted access to the entire phone, including all hardware so I could use the internet, gps, etc. from Linux. So I found Sven Ola’s Debian Kit, which can be found here http://sourceforge.net/projects/debian-kit/ which allows us to bind-mount the Linux filesystem to your Android filesystem, so the two are running in parallel with complete control over each other, and root access for both. This works because Android, while using a Linux Kernel, does not utilize the stereotypical Linux filesystem hierarchy. It is absolutely brilliant, and I tip my hat to Sven.
A note from Sven about his kit:
“This kit does 2 things differently: firstly, it installs a Debian file system side-by-side to the Android file system. In order to access anything that’s accessible from Android also from the Debian side. And secondly, the Debian bootstrap is executed on the Device itself without any help of a larger PC, Android debugging bridge or similar.”
So I then installed the debian kit app, which is very small:
#adb install org.dyndns.sven_ola.debian_kit.apk
And opened it on my phone. It actually is a checklist of things that you need to make this work, which it then checks off if your system can handle it. Unfortunately, my then Android 2.2 phone was lacking support for ext2 or ext3 filesystems. This is where things got tricky. At the time, I went the route of finding the kernel module for that kernel, and it worked. Later, however, I upgraded the phone to Android 2.3, which included a new kernel which supported ext3 filesystems already. If you run into this problem, I recommend updating your Android first, as that turned out to be harder to do, but quicker to find.
In my case, I had to track down the ext2.ko or ext3.ko module for my kernel 2.6.29-Omap. This became incredibly difficult, as it not only had to be the right ko module for the kernel, but it had to be digitally signed for the phone to use it. I tried several from various sources, until I eventually found one that worked, via email from a guy who was doing something similar. That is why I recommend you upgrade the OS instead.
With the newfound ext2.ko module, on the Android phone I could now use the terminal app to insmod it:
[Granting Terminal app Super User permissions]
#busybox insmod /sdcard/installed/insmod/ext2.ko
Now, when I run the Debian Kit app, it shows that I have support for ext2 filesystems. The problem was, however, that when I turn the phone off, then back on, that support goes away. I solved this with the BusyBox Installer app, which also has a scripts button at the top of the app, allowing me to create custom scripts and have them run automatically when Android boots. That is super sweet! My script:
busybox insmod /sdcard/installed/insmod/ext2.ko
I then named the script “1 insmod ext2.ko” and set it to autorun on Andriod bootup. Now I didn’t have to worry about starting it manually ever again.
Now it was time to get the pertinent file onto the phone. The Debian Kit .shar file, which the app will show you where to download, or you can get it on the above sourceforge page. So on the computer:
#adb push debian-kit-1-6.shar /sdcard/installed/scripts/
Once it downloaded from the computer to the phone, an odd thing happened, which Sven said could happen: the file changed from .shar to .jpg, making it seem like a picture which you cannot view. That’s okay, because the command still worked on the Android terminal.
[Granting Terminal app Super User permissions]
Which launches the debian kit installer. Sven’s website does not appear to be up, which explained this portion in more detail, so I will create another post in the next day or so to outline the next steps as well.
Sven’s website: http://sven-ola.dyndns.org/repo/debian-kit-en.html
Linux – keep it simple.