Rooting a Minix

Index

Introduction

This article is about rooting a Minix set top box (a Neo X5 mini in my case), although it may be applicable to similar hardware, either from Minix or simply running on a Rockchip RK3066.

These devices are problematic simply because the default android tools won't detect them. Most solutions I've come across are reduced to "install Moborobo" or "run this fine one-click solution", which is of little help when you're running on a different OS or when something fails.

So this little guide is a lot more barebones, I've collected what steps should be followed and what ADB commands must be run instead of providing a script. Although it is written for Linux systems, most steps and all ADB commands will be the same on other systems.

Some of these steps might be unnecessary, but they will do no harm.

Setting up the device

By default the Minix won't even be visible by a computer, but that's easy to enable.

Just go into Settings → USB → Connect to PC.

Note this option will be re-disabled on each reboot.

You should also enable USB debugging:

Settings → Developer options → USB debugging

Now, plugging the device to the computer will make it detectable but ADB won't recognise it just yet.

ADB access

This section is tailored to Linux. Source: [1]

Enable normal users to access the device

Check that the device is detected:

$ lsusb
[...]
Bus 003 Device 025: ID 2207:0006
[...]

Devices like 2207:xxxx with no description are the ones this guide is about.

Add an udev rule to allow normal users to access the device:
Create a file in /etc/udev/rules.d/ named {SOMETHING}.rules with the contents:

SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"

And reload udev rules:

# udevadm trigger

Enable ADB to recognise the device

You'll need to add the vendor id to the list of known android devices.
Simply add a line containing 0x2207 to the file ~/.android/adb_usb.ini:

$ echo 0x2207 >> ~/.android/adb_usb.ini

And stop ADB:

$ adb kill-server

It should now be able to recognise the device:

$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
ABCDE12345      device

Rooting procedure

You'll need the following:
su and busybox binaries
SuperSu apk

You can download a handy archive containing them from this thread on xda (post #2, file X5 Mini v4.2.2 Root.rar).

You might try running the included BAT if you're on Windows or continue with this guide for the dissection of it. The BAT contains commands you can copy-paste directly in the command-line, what follows are equivalent commands.

Note that, at least on the Minix, you'll already have root shell access. What's lacking is allowing "scalation" of privileges outside the shell.

Stage 1

$ adb shell
android# mv /data/local/tmp /data/local/tmp.bak
android# ln -s /data /data/local/tmp
android# reboot

The device will reboot. You'll have to re-enable "Connect to PC" in settings.

Stage 2

$ adb shell
android# rm /data/local.prop
android# echo "ro.kernel.qemu=1" > /data/local.prop
android# reboot

The device will reboot. You'll have to re-enable "Connect to PC" in settings.

Stage 3

$ adb remount
$ adb push su /system/bin/su
$ adb push busybox /system/bin/busybox
$ adb push SuperSU.apk /system/app
$ adb shell
android# cd /system/bin
android# chown root.shell su
android# chmod 6755 su
android# chown root.shell busybox
android# chmod 0755 busybox
android# cd /system/app
android# chown root.root SuperSU.apk
android# chmod 0644 SuperSU.apk
android# cd /data
android# rm local.prop
android# rm tmp
android# mv tmp.bak tmp
android# reboot

The device will reboot and you should have root access.
Launch the SuperSU app to check. It will probably want to update the su binary, let it do so.

If SuperSU doesn't seem to find the su binary, check it's there and that it has the appropriate permissions:

$ adb shell
android# cd /system/bin
android# ls -l su
-rwxr-xr-x root     shell       91980 2012-06-27 21:50 su  # ← Incorrect permissions
android# chmod 6755 su
-rwsr-sr-x root     shell       91980 2012-06-27 21:50 su  # ← Correct permissions

And re-run SuperSU

Sources

  1. ADB shell with RK3066
  2. Minix Neo X5 Mini 4.2.2 root how to? – xda-developers