Motorola Droid 4 (motorola-maserati)

From postmarketOS
Jump to: navigation, search
Motorola Droid 4
Motorola Droid 4
Motorola Droid 4
Manufacturer Motorola
Name Droid 4
Codename motorola-maserati
Released 2012
Original software Android 2.3 on Linux 2.6
Hardware
Chipset TI OMAP 4430
CPU Dual-core 1.2 GHz Cortex-A9
GPU PowerVR SGX540
Display 540 x 960 TFT
Storage 16 GB
Memory 1 GB
Architecture armhf
Features
USB Networking
Works
Flashing
Touchscreen
Works
Display
Works
WiFi
Works
Xwayland
FDE
Mainline
Battery
3D Acceleration
Accelerometer
Audio
Bluetooth
Camera
GPS
Mobile data
SMS
Calls



Contributors

  • TheKit
  • Hexarei
  • MartijnBraam

Rooting

The Droid 4 doesn't have an unlockable bootloader, so rooting the device requires an exploit.

The easiest exploit is called "Saferoot", which was originally intended for Samsung devices, but also works for many others, including the Droid 4. You can find a saferoot .zip file in this XDA-Developers thread:

https://forum.xda-developers.com/showthread.php?t=2565758

Download saferoot.zip, extract it somewhere, then enable USB debugging on the Droid 4 and connect it to your computer. With it connected, open a command line, cd to where you extracted the files, then run install.sh if you're on a Linux machine, or install.bat if you're on a Windows machine.

Following the on-screen instructions, you should eventually have a rooted device!

Custom Recovery: Safestrap

While there's no official version of TWRP for the maserati, there is a custom recovery based on early versions: SafeStrap!

YOU MUST ROOT AS LISTED ABOVE, FIRST!

You can download that here (make sure to get the one with maserati in the name!):

Download Safestrap

It's an APK file, so enable untrusted sources on your Droid 4 and install it. Once installed, if you're properly rooted, launching it should give you three options: Install recovery, uninstall recovery, and reboot to recovery.

Tapping "install recovery" should install the SafeStrap recovery! If it's successful, tapping "Reboot to recovery" should take you to the custom SafeStrap recovery.

Additional Info

Safestrap recovery has support for what it calls "ROM slots." At the time of this writing, you must select a non-stock slot in order to flash anything besides Android.

To repeat: DO NOT TRY TO INSTALL pmOS TO THE STOCK SLOT! IT COULD BRICK YOUR DEVICE!.

Installation

$ pmbootstrap.py init
$ pmbootstrap.py install --no-fde
$ pmbootstrap.py export

Create ROM slot with minimal possible space for system, data, and cache partitions.

First flash CyanogenMod 11 to install files needed by SafeStrap for kexec. Then connect the phone via USB in SafeStrap and do the following (android-platform-tools need to be installed):

$ cd /tmp/postmarketOS-export
$ adb shell mount /system
# FIXME: you really want to backup original ramdisk.img and kernel here. At least for me Cyanogen no longer boots with modified ramdisk/kernel
$ adb push initramfs-motorola-maserati /system/etc/kexec/ramdisk.img
$ adb push vmlinuz-motorola-maserati /system/etc/kexec/kernel
$ adb shell

# In ADB shell (needed to make sure files are written before reboot):
$ umount /cache
$ umount /system
$ umount /data
$ losetup -d /dev/block/loop-cache 
$ losetup -d /dev/block/loop-userdata 
$ losetup -d /dev/block/loop-system
$ umount /ss

Now you can either flash motorola-maserati.img to sdcard or resize the image on host to desired size and replace userdata.img of ROM slot you created:

# FIXME: at least my resize2fs does not know about -s option; plus .img file contains partitions, not ext4 filesystem
$ resize2fs -s 2G motorola-maserati.img
$ adb shell mount /ss
$ export slot_number=1 # Number of SafeStrap slot used
$ adb push motorola-maserati.img /ss/safestrap/rom-slot${slot_number}/userdata.img
$ adb shell umount /ss

I have a brick! Help! (DANGEROUS)

So you accidentally overwrote the stock slot in SafeStrap. What should you do?

  • Use Fastboot to write stock image back. Press the two volume buttons while pressing power to enter the factory bootloader. Find the files in VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml.zip and rewrite system.img, boot.img, recovery.img, etc.
  • Install kexecboot to mbm partition to avoid SafeStrap altogether and boot from SD card see droid4-kexecboot in the additional information.

Fastboot won't work due to too low a battery

  • Charge battery with external LiPo charger - B+ and B- are clearly marked.
  • Remove the battery, and insert pins into relevant battery terminals and give appropriate power from lab bench supply. Increasing current past a threshold (but be VERY careful) should fool the bootloader into thinking it has a well-charged battery.
  • It may also be possible to charge via the rear 4-pin connector, which goes through the charging circuitry: https://forum.xda-developers.com/showthread.php?t=1887365
  • Build a "factory cable" that bridges ID (micro-USB type-B pin 4) with 5V VCC (pin 1), which is how the factory flashes the devices without any battery at all.

See also