Newbies Guide of how to make your phone(droid 4) to linux phone

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 Sebastian Reichel and Tony Lindgren blog. there still missing parts such as dial or receive sms, that i hope that will fill up in the next chapters

requires:linux computer,Motorola Droid4(XT894),sdcard(more then 3G),usb cable,(optional)micro-USB-B breakout
board and USB-TTL Adapter with 3.3V signal.

get started

create directory hierarchy structure for boot components:
install -d boot/{linux/linux-stable.git,rootfs,archives/{stock_rom/droid4,kexecboot/droid4,ubuntu-base},images,scripts/droid4,overlays/droid4}
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_01012018.img bs=1M count=0 seek=2000
add filesystem to the image:
mkfs.ext4 -F -L droid4_rootfs images/droid4_01012018.img
mount the image to rootfs:
sudo mount -o loop images/droid4_01012018.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:
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 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-tools linux-firmware bluez --no-install-recommends

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

exit fron chroot:
allow ssh to user root:
sudo sed -i 's/^PermitRootLogin prohibit-password/PermitRootLogin yes/' rootfs/etc/ssh/sshd_config
override rc.local:
wget -P overlays/droid4/etc/
sudo cp overlays/droid4/etc/rc-local.doc rootfs/etc/rc.local

add omap.conf:
wget -P overlays/droid4/etc/modules-load.d/
sudo cp overlays/droid4/etc/modules-load.d/omap-conf.doc rootfs/etc/modules-load.d/omap.conf

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.git
go into linux-stable.git:
pushd linux/linux-stable.git
checkout the latest stable kernel branch(you can see the tag via “git tag -l”)
git checkout -b local/v4.17.9 v4.17.9
add patches:
i=1;for p in 67 63 66 65 62 61 60 57 58 59 ;do
wget -c${p}/1 -P ../patches/droid4/Keyboard_and_Display_Backlight_2018-03-30/$((i++));done
for i in $(seq 1 10) ; do
patch -p1 < ../patches/droid4/Keyboard_and_Display_Backlight_2018-03-30/${i}/1;done
i=1;for p in 54 53 52 50 51 49 47 48 ;do
wget -c${p}/1 -P ../patches/droid4/LCD_2018-03-30/$((i++));done
for i in $(seq 1 8) ; do
patch -p1 < ../patches/droid4/LCD_2018-03-30/${i}/1;done
i=1;for p in 318 317;do
wget -c${p}/1 -P ../patches/droid4/audio_codec/$((i++));done
for i in $(seq 1 2) ; do
patch -p1 < ../patches/droid4/audio_codec/${i}/1;done

setup your default kernel configuration:
make ARCH=arm omap2plus_defconfig
add modules:
CONFIG_USB_ETH=m" >> .config

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
return to base directory by:
copy the kernel and the dtb to the image:
sudo cp linux/linux-stable.git/arch/arm/boot/zImage rootfs/boot/vmlinuz
sudo cp linux/linux-stable.git/arch/arm/boot/dts/omap4-droid4-xt894.dtb rootfs/boot/

add boot.cfg

add omap.conf:
wget -P overlays/droid4/boot/

sudo cp overlays/droid4/boot/boot-cfg2.doc rootfs/boot/boot.cfg

save and umount the image:
sudo sync
sudo umount rootfs/

copy image to sd

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}p2 -L droid4
sudo dd if=images/droid4_01012018.img of=/dev/${sdcard}p1

that it insert the sdcard to the phone and turn it on.


2 thoughts on “Newbies Guide of how to make your phone(droid 4) to linux phone”

  1. Great guide, thanks, it helped. The only thing I did differently is that in the last part you get a bit confused with mmc partitions names it seems. The dd command goes to the first 5MB partition, and this seems weird. Was this intended?


    1. thanks, nice to hear that the guide helped you, about the partitions this was on purpose, i think this is a good practice to separate the uboot and the kernel from the main partition, of course you can do whatever you what.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s