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? :)

Saturday, December 21, 2013

How to do a backup (no root required)

Accidents happens all the time...

Who among us didn't have a time when using their device, deleted a file or an app that you installed and 2 minutes regretted that? sometime our devices decides to be "crazy" and they show some error messages that won't let you use your device.

For that - a backup solution could always help.

In Android world, there are tons of applications for the purpose of backup and restore. If your device is rooted, you can use apps like Titanium backup which lets you backup and restore, but also remove unwanted apps (yeah, the kind that some vendors like to stick into devices, specially the phone companies), doing a scheduled backup, and even sync your backup with Dropbox/Google Drive and Box. Personally I used it on almost all my Android based devices, and I recommend it. Another backup solution is ROM Manager and TWRP, they're both different from Titanium backup, as they let you backup your entire device including recovery and other partitions.

If your devices is not rooted (like in the case of Slate 21, my device that I love), there is a backup solution which is called "ADB Backup". If you're the type who don't like to use command line, there is a Windows and Linux app called "Holo Backup", it's easy to use and self explanatory. If you do like command line (I like you ;) ) - read on...

First, you'll need to install ADB and become "Developer". If you used Android before and used the adb command, then you know what I'm talking about. If not, you'll need to install the "Naked" drivers (if you're using Windows) and the Android SDK (you can use the minimal version should suffice, and can be downloaded from here. Install both (don't forget to add to your path the android SDK path) and then open a command line and type: adb devices. If you're device is connected to your PC, with Debug enabled (on your Slate press Settings, scroll to the bottom, click on About, click 7 times on the build and you should see on the left a new option "Developer". Click it, select USB Debugging (your Slate will reboot, don't know why HP did this)) - then you should see a number with the word "device" - you're good to go!

Unlock your device, and open a command line on your PC (where you typed the adb devices command).

We need to decide where to put the file. I suggest a temp directory, so if you don't have one, create one (for example: c:\temp on Windows or ~/tmp on Linux/Mac).

Now lets do a full backup: run the command adb backup -all -f c:\temp\mybackup.ab

On your Slate screen, you'll see that an app has been launched and it asks your for password (if you want to encrypt your backup. You should use a password, but you don't have to), press the lower right button to start the backup and wait. The GUI is not very intuitive but you'll see on the screen that it process some weird package names, thats ok.

When it finishes, the app will close. Wait few more seconds and on your PC you should get your prompt back.

Congratulations - you have your backup. If you're a developer (or someone who like to write scripts), you can automate this, type adb help to see the commands you can use for backup and what to backup).

Take this backup, and put it somewhere safe, you might need it in the future. You can upload it to your Dropbox account or Google Drive, or SkyDrive or anywhere.

Need to restore? piece of cake: open the command line, and make sure you have the backup available locally, and type adb restore -f filename.ab (where filename.ab is your backup name). You'll see on your slate that the backup/restore app comes and asks for your password. If you didn't use a password, click on the lower right button to start restore and after few moments your apps and your settings would be back!

Here is a tip: Make sure you do a periodic backup. A backup from a year ago won't be much help if you lost some pictures that you took/moved few weeks ago.

Good luck.

Friday, December 20, 2013

Security Alert (remove Android lock)

There is new Android exploit which lets the user disable any lock (not boot lock but face look/pattern lock, etc)

The exploit is detailed here.

The danger stuff: if your device is set to accept APK's from unknown sources, a potential attacker (anyone who uses your phone/tablet) can use this exploit to disable any lock you set on your device, and then the attacker can do whatever he wants to.

Here is a demo apk which, upon installing and running, will simply disable any lock you've set on your device. It can unlock immediately or upon a time you set it.

Affected devices: All devices with Android versions up to 4.4 (4.4 has this bug fixed).

Thursday, December 19, 2013

HP Slate 21 - some tips

When you look at the Slate 21, and you look at the tech specs, it's hard to avoid the thought about the small specs of the machine when it comes to RAM and Storage: 1GB of RAM, 8GB of Storage.. what the engineers were thinking??

Nevertheless, I'm a proud owner of such a slate, and I want to share with you some tips that could help you with the Slate 21. Some of those tips will require root privileges.

Please note: So far, it seems that HP is doing their best to block any rooting attempts. Their latest update includes security patches from Android 4.3 and 4.4 which prevents all known rooting methods from working (and I tried all of them so far). However, when it comes to a chase between HP and Android "hackers" - those "hackers" will win (there's not a single Android device that hasn't been rooted so far, other then this Slate). Remember - if you root it (or unlock it), your warranty is lost.

So here are my tips, some of them requires root, and when such a tip requires these privileges, it will be marked with root:
  • Do you plan to do some serious typing and you're a fast typist? switch keyboards from the bundled one to a more professional one (Logitech and Microsoft got some serious keyboards). As a person who types 80+ WPM (Words Per Minute), I find the bundled keyboard useless for my needs.
  • Want to use another keyboard and you're missing the Android shortcuts? you'll need a new app for that. You can try "external keyboard" (which is free), and if that doesn't suit you, try the External Keyboard Helper Pro (which costs around $3) - the latter will give you tons of options to configure any key to any Android action, it also let you select which keys to use to switch Layout and other nice features.
  • root The Tegra 4 in the Slate 21 is clocked at 1.66 GHz, which is really slow (compare that to the Asus TF701 which is also a Tegra 4 based device and it's clocked at 1.9 GHz). There are some "mods" which envolve kernel modifications and recompile to achieve a serious speed boost (the nVidia Shield users/hackers at XDA reached 2.55 GHz!), but be careful with that! The nVidia shield got a fan, the Slate-21 doesn't, so you could easily fry your Tegra 4 (although you'll probably won't fry it, you'll get a very unstable machine).
  • root 8GB Space is really, really a small place when you're installing games, downloading videos etc. Although it's not possible to completely move apps to any external storage to SD, you can move the apps+data with some apps that will do it for you. Check this video how it can be done (although this video is talking about Galaxy S4, it's the same app and same method with Slate 21). This will give you the space that you need so much. Before doing that, remember to get a Class 10 SD Card (and don't format it as exFAT or NTFS, the Slate's kernel doesn't support those file systems fully, only FAT32).
  • USB ports are different! Don't ask me why, but it seems that the USB ports in the Slate 21 are working differently compared to other devices. Examples: if you plug a keyboard or a mouse to the USB port on the left, it won't recognize it, so if you're plugging any USB device and you don't see it being recognized, try to connect it to the ports behind the slate. (update: thanks to "COWA" from the HP support forum, this behavior happens when you enable USB debugging. Disable USB debugging and the side port should work as the other 2).
  • Sluggish performance? sometimes when you switch between tons of apps, you'll get a slow performance (that's what happens when the vendors only install 1 GB of RAM). A simple solution would be to press the multi-box (on the bottom of the screen, the right button), and swipe down any app that you're not using. Android is doing it's best to manage the memory, but Android is not magic...
  • root Hackers - Be careful with the Slate's boot loader! since HP rewrote the boot loader, you can easily damage the boot loader if you install wrong 3rd party recovery image (currently there aren't any, neither CWM or TWRP for the Slate 21). If you'll damage the boot loader, you'll be stuck in whats called "APX mode", which is a low level and it's being used to flash firmware to the nvflash. This is very tricky if you don't know what you're doing and could easily leave you in a hard-brick situation!
Enjoy :)

Friday, December 13, 2013

Unlocking your HP Slate 21

HP started selling few months ago the HP Slate 21, an Android based AIO (All In One) device which is a 21" IPS monitor which got an Android 4.2.2 inside.

The Slate 21 device is quite good, although it's really low on specs. Only 1GB of RAM and only 8GB Space inside (although you can stick a full size SD card inside).

You can read some reviews about the device here, here and few people wrote about it on Amazon and you can read their reviews here.

Technically, this machines IMHO begs to be modified. You don't have the issues of tablet heat, so you might want to overclock it, and maybe do some other software modifications..

In order to modify anything on it (that means: changing firmware, recovery, boot loader etc) you'll need to unlock it first, and here are the instructions how to unlock it. After unlocking it you'll need to root the Slate, and so far I failed to find a way to root it (I tried several methods, including the nVidia Shield way and the TN7 way - it doesn't work), but if you want to try it, go ahead and if you manage to root it, I'll be happy to hear about it and publish it here (with credits to you).

So without further ado, lets get started.

Warning: The following steps WILL VOID YOUR WARRANTY! I'm not taking responsibility if your device will brick, explode or anything else, you've been warned!

  • In order to actually get access to the machine, you'll need a Male to Male USB Cable, like this one, which you can order from that page or simply buy from your local tech store such a cable. Connect it from the Slate's side USB port to your PC. Your Windows (or Mac or Linux) will recognize the device as MTP.
  • Make sure you have the latest updates for your Slate. Unlocking the device will not let you receive automatic updates, so click on the Settings, scroll to the bottom, click on the "About tablet" and then click on System updates, and then click on the "Check Now". If your device has updates, you'll see it there.
  • Now we'll un-hide the Developer options. Click on the "About tablet", and then click 7 times on the "Build Number", and after clicking 7 times, you'll see on the left side "Developer options" - click on it, and click on the "USB Debugging". In my Slate, the device rebooting after clicking on it, so if it's rebooting on your slate, let it reboot.
  • Install ADB and fastboot On your Windows machine (instructions are here) and after installing ADB and fastboot, connect your Slate to your Windows/Mac/Linux. In Windows, you'll see a new device, and ADB device. If you get an "unknown device", or don't get anything, then follow the instructions here
  • Open a command line prompt and run the adb devices command. It should show you your slate as a number with the word "device". If not, check the instructions on the link above and make sure you don't have "unknown device" - or else ADB won't know how to talk to your device.
  • The next part is critical if you have any data that is important to you, make a full backup before going any further! unlocking your slate will erase everything you installed or uploaded to your slate. I recommend using the Holo backup app if you're a Windows or Linux user. Later you can restore all your apps and content with a single click :)
  • Run the command: adb reboot bootloader
    This will reboot your slate and will give you a simple menu. don't select anything.
  • Run the command: fastboot oem unlock
    This will show you a simple menu to select if you want to keep it locked or unlock the device. Use the Volume buttons to choose your option (select: unlock) and then press brightness up key (the button below the volume keys).
    Here comes the "scary" part - you won't see anything on the screen after selecting to unlock. Thats OK. Wait for a minute or two (patience, friend) and if your slate still doesn't show anything, then press the power button for 10 seconds (don't let go), and if you still don't see anything, press it again for 10 seconds, your slate will reboot and you'll have to setup everything from scratch (entering your gmail user, pass etc...)
  • Congratulations, your device is unlocked. If you want to re-lock it (and again, this will erase everything on your device!), follow the steps above and select "lock". I don't know if the slate "phones home" to report if it's locked or not, so I don't know if you warranty will be restored (probably not).
The next steps which are still unknown are rooting the slate, and installing a new recovery. While finding a way to permanently root the slate will be a matter of short time, recovery is another thing and requires to create a new image with modifications for the slate.

I'll keep you posted for any progress that I'll make, so subscribe to this post :)