In the previous articles I showed you how to install Tizen 2.3.1 on a Samsung RD-PQ developer device, enable WiFi connection, connect to a WiFi network and install SSH server so you can remotely connect to your phone via your favorite SSH client. In this article I’m going to show you how to customize your Tizen OS and rid it of unnecessary packages, runtime systemd scripts, Xorg UI and many more.

You don’t need an USB cable connection to your phone anymore, so fire up your SSH client and connect to your phone. Go to the /usr/lib/systemd/system directory and you’ll notice lots of systemd unit files that get launched automatically on every system restart. We’ll be removing about half of them, two ways to do that: from the SSH client console (Putty) or via a SCP software (WinSCP). Either way, below is the list of the unit files that are not needed on a development server and can be deleted safely.

ac.service
alarm-server.service
bluetooth-frwk.service
browser-provider.service
buxton.service
calendar-serviced.service
cbhm.service
central-key-manager-listener.service
central-key-manager.service
contacts-service.service
crash-manager.service
data-provider-master.service
deviced-auto-test.service
deviced-pre.service
deviced.service
download-provider.service
email-service.service
launchpad-preload.service
launchpad-process-pool.service
lbs-server.service
media-server.service
messageportd.service
msg-server.service
nfc-manager.service
pulseaudio.service
pushd.service
quickpanel.service
resourced.service
secure-storage.service
security-server.service
sensord.service
slp-pkgmgr.service
sound-server.service
starter.service
system-server.service
telephony-daemon.service
wm_ready.service
wrt-security-daemon.service
wrt_launchpad_daemon

Also, after removing those files, remove the Xorg server (the user interface):

sh-4.1# rpm -e xkb-data-2.9.1-1.1.noarch
sh-4.1# rpm -e xkeyboard-config-2.9.1-1.1.noarch --nodeps
sh-4.1# rpm -e $(rpm -qa 'xorg*')

Reboot the phone and it won’t boot into the Xorg server anymore, basically it will hang at the “Tizen” boot screen (won’t actually hang, you’ll still be able to connect to your phone via SSH or sdb.

An optional step is to set the CPU governor to performance, unless you need to run your server on phone’s battery for an extended period of time, which shouldn’t be the case, you can keep the usb cable plugged into your laptop/computer and phone, and it will be fully charged. If you want to run the phone in performance mode, open up /usr/bin/cpu_governor.sh and replace its contents with:

#!/bin/sh
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

For performance issues, you should enable swap, since the RD-PQ phone only has 1Gb of RAM (add a 1Gb swap file and you’ll have plenty).

sh-4.1# dd if=/dev/zero of=/opt/usr/swapfile bs=1024 count=1024000
sh-4.1# chown root:root /opt/usr/swapfile
sh-4.1# chmod 0600 /opt/usr/swapfile
sh-4.1# mkswap /opt/usr/swapfile
sh-4.1# swapon /opt/usr/swapfile

I added the swap file to the /opt/usr directory because that means it will be saved onto a 11Gb separate partition on the phone’s internal flash memory, for extra speed. You can activate the swap on the SD card, if you have a high-speed one, but I’m not sure it will be faster than the internal flash. If you want to add the swap file to the SD card, change all occurrences of /opt/usr/swapfile from the above text to /opt/storage/sdcard/swapfile. Also, if you want to enable the swap automatically on phone’s restart, append the line below to the /etc/fstab file.

/opt/usr/swapfile none swap sw 0 0

If you followed all the steps outline in this article and the previous ones, now you should have a slick, mean, ultra-fast machine powered by a Samsung Exynos 4412 Quad Core ARM cpu with 1Gb of RAM and 1Gb of swap file. In the next articles, I’ll show you how to install development tools onto your phone-server (Apache httpd, MySQL, PHP, PostgreSQL, gcc compiler, etc).