part1-bring up

Placeholder Image

Note:Modifying or replacing your device’s software will void your device’s warranty, and can cause to damage to the device and to your computer or losing data(of device and computer), execute the following commands is entirely at your own risk.

Note:this guide try to apply the bringup of droid4 flowing Tony Lindgren blog. there still missing parts such as camera or connact to internet, that i hope that will fill up in the next time

requires:linux computer,Motorola Droid4(XT894),sdcard(more then 3G),usb cable.

optional-Debug UART

you need also a micro-USB-B breakout board and USB-TTL Adapter with 3.3V signal-A detailed explanation is available in Tony Lindgren blog Debug UART.

get started

go to the path that you want to create the project(replace “/path/to/project/” with the path):
pushd /path/to/project/
create directory hierarchy structure for boot components:
install -d boot/{linux/linux-stable.git,rootfs,archives/{stock_rom/droid4,kexecboot/droid4,ubuntu-base},mnt,images}
go into boot directory:
cd boot

update stock rom

this part is also describe in Sebastian Reichel blog in

first of all we need to update the stock rom to
for that we need fastboot, if you don’t have fastboot you can install it by:
sudo apt-get install android-tools-fastboot
you can download from
(you can find more site in
) extract it into droid4/archives/stock_rom
after download you can use the command(you can replace “~/Downloads” in your download path):
unzip ~/Downloads/ -d archives/stock_rom/droid4
download Tony Lindgren script for update the stock_rom:
wget -P archives/stock_rom/droid4 -c
turn on the device by press on Vol Down & Power buttons this will go into Fastboot mode(the first line in the screen is:”AP Fastboot Flash Mode (S)”)
connect the device to the computer via usb and make sure the bottom lines are “Transfer Mode: USB Connected”
make sure you see the device by the command:
fastboot devices
the output supposed to be something like:
0123456789ABCDEF fastboot
if you get this output:
permissions fastboot
sudo fastboot devices
if it solve the problem change the script to run “sudo fastboot” by the command:
sed -i 's/fastboot=fastboot/fastboot="sudo fastboot"/' archives/stock_rom/droid4/
go into VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml dir:
pushd archives/stock_rom/droid4/VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml
and run the script:
bash ../
return to base directory by:

install Kexecboot bootloader

if you don’t have git you can install it by:
sudo apt-get install git
clone Tony Lindgren repository for droid4 kexecboot by the command:
git clone archives/kexecboot/droid4/
install the Kexecboot by the commands(you can remove sudo keyword if you don’t need sudo for fastboot)[my current version is 2018-05-06]:
sudo fastboot flash mbm archives/stock_rom/droid4/VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml/allow-mbmloader-flashing-mbm.bin
sudo fastboot reboot bootloader
sudo fastboot flash bpsw archives/kexecboot/droid4/current/droid4-kexecboot.img
sudo fastboot flash utags archives/kexecboot/droid4/utags-mmcblk1p13.bin
sudo fastboot flash mbm archives/stock_rom/droid4/VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml/mbm.bin

you can poweroff the device for now by press Power button

create bootable image

create an bootable image for the first partition of the sdcard with 2G size:
dd if=/dev/zero of=images/dd if=/dev/zero of=images/droid4_01012019.img bs=1M count=0 seek=2000
add filesystem to the image:
mkfs.ext4 -F -L droid4_rootfs images/droid4_01012019.img
mount the image to rootfs:
sudo mount -o loop images/droid4_01012019.img rootfs
delete unused directory:

sudo rm -rf rootfs/lost+found

build rootfs

install qemu-user-static arm emulator:
sudo apt-get install qemu-user-static
download the ubuntu minimal rootfs archive:
wget -P archives/ubuntu-base -c
extract ubuntu minimal rootfs into the image:
sudo tar -xzf archives/ubuntu-base/ubuntu-base-16.04.4-base-armhf.tar.gz -C rootfs/
copy qemu-arm-static to the image:
sudo cp -a /usr/bin/qemu-arm-static rootfs/usr/bin/
run chroot to config the image on pc:
sudo chroot rootfs/
add new user and set password for root and user(you can replace “droid4_user” with your user name and “1234” with your user password):
passwd root
useradd -G sudo -m -s /bin/bash droid4_user
echo droid4_user:1234 | chpasswd

config network:
echo droid4 > /etc/hostname
echo " localhost.localdomain localhost" > /etc/hosts
echo " droid4" >> /etc/hosts
echo "nameserver" > /etc/resolv.conf

install useful packages:
apt-get update
apt-get upgrade
apt-get install apt-utils language-pack-en-base python-gobject-2 libqmi-utils lsof rsync psmisc modemmanager ifupdown udev vim openssh-server openssh-client net-tools ethtool wireless-tools network-manager iputils-ping rsyslog alsa-utils bash-completion resolvconf htop xinit xorg wpasupplicant tmux zsh eog evince sqlite3 bluez bluez-tools linux-firmware mpg123 sox libsox-fmt-all minicom ruby-full emacs maildrop pulseaudio pulseaudio-module-bluetooth Python-evdev fvwm --no-install-recommends

configure packages:
dpkg-reconfigure x11-common
dpkg-reconfigure resolvconf

add incoming sms dir:
mkdir /root/Maildir
maildirmake /root/Maildir/INBOX.sms

add gem install pdu_tools mail:
gem install pdu_tools mail
exit from chroot:
allow ssh to user root:
sudo sed -i 's/^PermitRootLogin prohibit-password/PermitRootLogin yes/' rootfs/etc/ssh/sshd_config
add mass storage dir:
sudo mkdir rootfs/root/user_data
clone bringup repository for droid4 overlays files patches and bin:
git clone archives/droid4_bringup
add overlay layer to the rootfs:
sudo rsync -a --chown=root:root archives/droid4_bringup/overlay/ rootfs/
build the source into the rootfs:
mkdir archives/droid4_bringup/bin
make -C archives/droid4_bringup/src/
sudo rsync -a archives/droid4_bringup/bin/ rootfs/usr/local/bin/

get pdu_tools:
wget -P archives/ruby/ -c
tar -Oxf archives/ruby/pdu_tools-0.0.13.gem data.tar.gz | sudo tar --wildcards -xz -C rootfs/usr/local/bin/ lib/*

get Tony Lindgren script for read and write sms:
git clone archives/ruby/droid4-sms-tools
sudo cp archives/ruby/droid4-sms-tools/droid4-sms-* rootfs/usr/local/bin/

patch ruby scripts:
sudo patch -p0 < archives/droid4_bringup/patches/ruby_pdu_tools.patch

build kernel

if you don’t have the following tools you can install it by:
sudo apt-get install libncurses5-dev make exuberant-ctags bc libssl-dev
and the arm cross compailer:
apt-get install gcc-arm-linux-gnueabihf
clone upstream repository:
git clone git:// linux/linux-stable
go into linux-stable:
pushd linux/linux-stable
checkout the latest stable kernel branch(you can see the tag via “git tag -l“)
git checkout -b local/v5.0.10 v5.0.10
fetch Tony Lindgren repository for voice calls and gnss serdev driver patches:
git remote add linux-omap git://
git fetch linux-omap

merge mdm branch:
git merge linux-omap/droid4-pending-v5.0 -m "Merge remote-tracking branch 'linux-omap/droid4-pending-v5.0' into local/v5.0.10"
setup your default kernel configuration:
make ARCH=arm omap2plus_defconfig
compaile the kernel:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap4-droid4-xt894.dtb bzImage modules -j9
install the modules in the rootfs:
sudo make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=../../rootfs
copy the kernel and the dtb to the image:
sudo cp arch/arm/boot/zImage ../../rootfs/boot/vmlinuz
sudo cp arch/arm/boot/dts/omap4-droid4-xt894.dtb ../../rootfs/boot/

return to base directory by:

copy image to sd

format the sdcard:

note:this part is very dangerous because you can erase your hard disk if you will not do it right

use this command to figure out your sdcard name, you need be sure it appear and disappear when you connect it and disconnect it otherwise you can erase important data:
when you are sure what the name of the sd replace the “mmcblk0” keyword with your name and run the following commands:
echo "1 : start= 2048, size= 5120000, type=83
2 : start= 5122048, size= $(($(cat /sys/block/$sdcard/size)-5122048)), type=83" | sudo sfdisk /dev/$sdcard
sudo mkfs.ext4 /dev/${sdcard}p1 -L droid4_rootfs
sudo mkfs.vfat /dev/${sdcard}p2 -n USER_DATA

mount the sdcard:
sudo mount /dev/${sdcard}p1 mnt
copy the rootfs to the sdcard:
sudo rsync --delete -av rootfs/ mnt/
save and umount the image and the sdcard:
sudo sync
sudo umount rootfs/
sudo umount mnt/

return to your original path:
that it, insert the sdcard to the phone and turn it on(you need to wait couple of minute.