[Nexus 5 Q&A, Help & Troubleshooting] Javacow:
Hello all

I have been attempting to enable a framebuffer console on the LG Nexus 5 device for debugging purposes while enabling extra kernel features, and also ideally to be able to boot Debian with Xorg directly on the phone. I am currently using rooted Android 4.4.2-based custom ROM with a kernel I have built from the unmodified source of "android-msm-hammerhead-3.4-kitkat-mr2" branch.

For testing X and framebuffer console, I have enabled framebuffer console options (kernel config here). With this kernel, I only get the standard Google boot logo and boot animation, no framebuffer console. The kernel command line arguments include "console=tty0,115200 fbcon=font:VGA8x8", which I can confirm are not overridden by the bootloader by checking /proc/cmdline after bootup.

While running the same kernel, a Debian chroot with LXDE/Xorg installed with a shell access via SSH, I can run "FRAMEBUFFER=/dev/graphics/fb0 startx". If the Android UI is currently active, the display is filled with random pixels and stops responding. I can kill X via the SSH session, but there is no difference, although after about 5 minutes the display resets and returns to normal android screen. I have tested using the default charger app (located at /charger on standard image), and it produces the same effect if UI is running at the same time.

If I disable the Android UI through ADB shell command "setprop vold.decrypt trigger_shutdown_framework" (this disables all android services except for ADB, including zygote and surfaceflinger), I am able to run /charger successfully (which results in the charging icon appearing on-screen when the power button is pressed - this is the same program that is run when the phone is plugged into a power source while powered off).

Using the Debian chroot, running the startx command results in a blank screen except for a brief flash of an inverted-colour LXDE desktop when X is shutting down (CTRL+C in shell used to run startx) before the display goes blank. This is as close as I have got to getting X working on the Nexus 5 with the default xfree86-video-fbdev driver.

Another thing to note, running the command

cat /dev/urandom > /dev/graphics/fb0

with or without the Android UI running has no effect on the display.

According to this thread and some amazing work by Tasssadar, framebuffer console can be enabled with MSM chipsets, however LG Optimus One uses the older MDP3 framebuffer video driver instead of the Nexus 5's MDSS framebuffer driver. It seems like the MDSS framebuffer implementation (in drivers/video/msm/mdss/mdss_fb.c) has some differences that make it incompatible with standard framebuffer devices. I would attempt to modify the driver in the kernel source so that it would function as a standard framebuffer device and ideally be compatible with framebuffer console and Xorg. I have little experience in kernel development and have no idea where to start with regards to fixing the issues with this particular driver.

The dmesg log when I run /charger with Android UI running is available here. Charger app is started at system time 80.140298, and the errors start immediately after. At the end you can see when the kernel resets the driver and this is when the display resumes normal function.

I would like to know if anyone has tried this before, and if they have been able to get any further than me with regards to a framebuffer console or running Xorg either in a chroot or natively on a Nexus 5.

Also I would like to know if there is anyone who would be interested in trying to develop a working framebuffer driver for this device.

Thanks to everyone who can help with this :D