Friday, January 3, 2014

Dissecting Slate 21 partitions

If you want to learn the internal structure of the HP Slate 21 (or any other Android based tablet, for that matter), you'll need to learn about something which might be familiar to you from the PC disks - Disk partitions.

Although the Slate doesn't have any physical disk, it has a flash chip which is called eMMC. This is basically a chip which stores everything you have on your device, whether it's the OS, your content and any other thing you download.

eMMC is divided to many partitions. Some partitions can be erased (to clean up your data and restore the machine to a "brand new" state, also called "factory reset"), and some partitions needs a very special attention, or else your device will just freeze when you power it on.

Here is a picture of the partition table on the Slate 21 (and most other Tegra-4 based devices):


The picture above shows a table which is divided to 3 parts:

  • The first part (where it mentioned /recovery, /boot etc..) is the mounting point, where the OS can access the files. 
  • The 2nd part (emmc, ext4) tells the system what type is the partition. ext4 for example is a Linux based file system (Android is after all, a Linux). emmc is a simplistic special purpose file system which holds small number of files for one app (for example, the /boot holds the file related to the bootloader)
  • The 3rd part tells the system which block number holds the partition. Tegra 3 and 4 is more convenient since it gives the developer more "human" readable names instead of cryptic name (which could confuse). Each name is a partition, so LNX for example represents the Linux bootloader.

On Android, the partition layout is different on each mode it's booted. For example, if you'll open a terminal and try to do: cd /recovery, it will output an error, since there is no such mount point. The picture above is taken from another Tegra 4 based device. The partitions name's is always consistent, but the mount points (/data etc...) are different, depending on the device mode.

When do we touch those partitions? when we want to fix or update some parts or the whole system. The HP updated image that download automatically to your device, has specific instructions which parts to update and what data to put in those partitions.

Most rooted Android based devices are replacing the recovery partition's content with another recovery app. There are 2 major alternatives: CWM and TWRP. Those are recovery apps which do much more then a simple recovery, they both allow you to do, among other things:

  • Full backup of your entire Android device, including the OS, recovery, etc.
  • Full restore of the backups
  • Easy install of images with special purposes that some developers release
  • Easy wipe of the system
  • Easy upload of images to the device from the PC to the device without the need of SD Card (it's also called "sideload")
  • Easy update to 3rd party firmwares (Like Cyanogenmod, which still is not available to Tegra-4 based devices) so you can continue to enjoy the latest Android features even if the hardware vendor no longer sells/supports/update your device.
As you can see, the 3rd party recovery apps are much better then what the vendor gives to the user (the reason that the vendor don't give some improved recovery is to limit hacking of the device).

Right now, the Slate 21 hasn't been rooted yet (quite amazingly. It's other "brothers" like Slate 7 and Slate 8 Pro have been rooted already), but once this challenge will be met, we could do some really nice things:
  • Full backup and full restore, so you can restore your device in 2 minutes and enjoy it just as the last time you did a backup.
  • The bootloader could be replaced to something like Cyanoboot, so you can boot from SD Card, try other firmwares before you install them or use other OS's on your device (like Ubuntu Linux or Fedora)
  • Use other firmwares that developers will offer. Kit Kat for your Slate 21? it could be. After all, the Slate 21 is just another Tegra-4 based device.
As you can see, there are few advantages of a rooted device. Your Slate 21 could be used more years and still have (thanks to developers) few more years of usage.

So, could someone root it please? :)