Tuesday, October 7, 2014

The Red Pill For Modern Phones


A sturdy, portable phone stand that suspends a large screen phone above the keyboard and at comfortable eye level as a home PC monitor exists, and is needed to use a large screen phone as a home PC. It has a US patent number.

Using Google Drawing in this PC phone with Sony Xperia Z Ultra 6.4 inch on the go is a bliss.

Instruction: Start out with installing Busybox Pro by stericson and Android market app XSDL by pelya to run the PC's desktop program set - the task bar, the main menu, the wallpaper, etc. The desktop program set in the above screenshot is the linux Mate' Desktop. You need a terminal emulator app.

Download the chroot package (size is about 2.4GB) https://drive.google.com/file/d/0B2NfHoyfFf1aNkZLUldNSVRiWk0 for Fedora 24. MD5 sum is ff0b47e8...

Fedora-Workstation-armhfp-24-101-chroot.tar.gz is the root filesystem from Fedora24’s ARM main release image plus chromebook chroot utilities from the "crouton" project. It is the bin and chroots branches of crouton layout when you extract the tar gz file. The tar.gz package is not easy to create because it needs unmount /proc to avoid zipping millions of files of the process info files of the entire phone's life processes while frequently mount /proc and others to modify the fedora system. A few other enhancements,
  1. sshd startup is added to chroot login /root/.bash_profile . You need to initiate the sshd system by running sshd-keygen to allow spresenting sh fingerprint of your unique Fedora installation, and set root password to allow login. Set your password with the command line command passwd. The sshd continues to run even after the X server is killed by android operating system or manually closed because sshd is not derived from the XSDL process, rather it is derived from your terminal emulator app that lives throughout the android system's boot life until android reboot. So, the sshd is a 24x7 file server. The file server can serve directories outside the chroot as discussed in another post about the internal machinery of this system.
  2. Installed @mate group software. And mate-session is invoked when entering the chroot with the tar.gz package's bin/android-enter-chroot-fedora.sh . Installed daemonize. Remember the chroot does not have a systemctl, you need to make daemons manually or run with the .bash_profile login script. These are for the everyday use of the system with GUI. The DISPLAY and PULSE_SERVER variables are set in .bash_profile, so that the GUI session as well as sound is delivered to the local phone's screen and speaker/headphone.
  3.  Installed icedtea-web java plugin for Firefox. Wildfly installed, which includes openjdk-devel and all jboss libraries. gcc-c++ installed. openssl-devel installed. These are for a developer's convenience.
  4. Installed gimp, wireshark-gnome, rdesktop, tcl, tk, xterm, liberation narrow fonts. gimp is the photoshop of the Linux world. The narrow fonts allow enlarged text word, like "Computer", to avoid line breaks in the middle of a word.
  5. and and DNS servers have been added to resolv.conf . 
  6. Changed GUI theme to have the thick edge of windows so that mouse cursor can hit the resizing edge in the small phone screen. 
  7. Removed bottom panel to expand desktop height for small phone screen. Moved bottom panel's applets to top panel. Changed top panel's main menu to a single icon menu to save space.
  8. Saved android-enter-chroot.sh and android-startx.sh to android’s /data/local/bin/ . Added the many paths of the android system, like busybox's /system/xbin/ and /system/bin/ to chroot environment variable in android-enter-chroot.sh so that the chroot action can succeed in most android systems where utilities reside in different locations.
  9. Cached whole fedora release software info. Then /etc/dnf/dnf.conf sets metadata_expire=never , so that cell phone internet connection does not poll the whole fedora software package info everytime you want to install or search software. /etc/yum.repo.d/fedora-update.repo set to disabled, so that the system is more stable without changing the base system when you install new software. 
  10.  Installed vncviewer , vncserver. vncserver is started via .bash_profile to serve local connections when the chroot starts. To enable in the server, enter your desired vnc password when you open Terminal Emulator because the vncserver startup is part of the chroot login process in /root/.bash_profile script. To use the local connection from remote client, you need to ssh to the phone with "ssh -L 5901:localhost:5901 root@phone-ip-address" , then vncviewer connect to localhost:1 from the remote host. You can not directly connect vncviewer to phone-ip-address due to Fedora24's default secure configuration of disallowing remote connections. Notice: once you enable the server, the server is very power intensive and drains battery. To disable the server, comment out the last line that starts vncserver in /root/.bash_profile.
All above points are included in tar.gz . So, just tar -xzf extract the downloaded tar.gz file when you are under the /data/local/ directory.

Release note: The Mate file manager caja has problem recognizing the android flash file system as write-able due to the said no-systemctl situation. So, copying files with caja fails with the local chroot system. To work around, use caja to ssh to the chroot itself at and copy files as a remove system in the local system in caja. Command line terminal is not affected by this caja problem.  

Disclaimer: I am not responsible for damaging your phone with this instruction. Removing the chroot has risks of damaging your phone. Before removing the chroot files, you need to temporarily disable entering chroot and reboot the phone so that the android system's /dev is not mounted when you remove chroot files. Removing /dev files, even if it is mounted to chroot, may damage the phone. 

The fedora chroot can be invoked from Terminal Emulator, which can be, in turn, started by android’s Startup app. The Terminal Emulator needs to have initial command
su -c /data/local/bin/android-startx.sh& sleep 15;
su -c /data/local/bin/android-enter-chroot-fedora.sh; 
, for startup to automatically enter fedora.
Now, restart your PC phone and it will boot directly into PC desktop.

This phone PC setup took me close to re-certify my CCIE using CCDE written the second attempt in year 2014. Also I studied for the Oracle EJB expert exam and researched Wildfly EJB and obtained the certification entirely on this chroot.

The internals of the tar.gz will be in another post. All the internals are included in my tar.gz and no need to read the other post if you just extract it.

1 comment: