[code] [blog] [VNC] [E-Mail me] [GPS Tracker]

VR headset linux desktopMay 12 2021 00:22:40

A VR headset as a linux desktop


I've recently gotten around to installing linux on my pico goblin VR headset to make a useable Linux desktop. In this blog post I'll describe how I did that. If you want to skip to the firmware - scroll to the bottom of the page.


To understand how this VR headset works - and how to run linux on it - we must first understand how android works.



- An android phone typically starts with the EBL ( qualcomm ) which verifies the boot loader
- Aboot starts - when you reboot to the bootloader using "adb reboot bootloader" or the recovery image - this is what you boot into
- The kernel starts and loads it's ramdisk
- The kernel starts /init
- The /init process starts android
- With /init surfaceflinger and 2DToVR
- This starts the launcher, from which you can start other applications



Android also has some security measures in place. First off - you need to be able to unlock the bootloader. On PICO this is done by "fastboot oem pico unlock". After this you need a modified kernel - that allows root access to the filesystem. After you have root access you cannot modify system packages yet - because with the initialisation of every android app "framework.jar" verifies the signature of the application - and if it's not the manufacturers it rejects it as a privileged app. Thus we need to patch our framework.jar file with smali-patcher link. After framework.jar is patched we can install system apps. However - if we modify Pico's own apps they will simply get replaced by the automatic updater service. In order to prevent this we need to remove anything related to updates - namely the folders /system/priv-app/SystemUpdate2,/system/priv-app/VersionManager and /system/priv-app/PicoAppCheckPrebuild, /system/priv-app/PVRVerify With these removed we can proceed to modify our OS for desktop use. In order to use this headset I wanted to achieve the following things:



- Keep most of Pico's software intact
- Remove the annoying pico cursor in controller-less mode in full-screen apps ( line linux )
- Run Linux with Audio and X11 support
- Remove any features that might remove our root access
- Remove bloatware
- Automatically start Linux on boot
- Add the open-source apps neccesary for this all to the system image
- Remove the Favorites from the pico launcher and add our Linux install instead
- Replace the store shortcut from the launcher with FDroid


The first point should speak for itself - in my previous image I ended up breaking a lot of Pico software. This is now fixed. The second point is simple - I want to be able to use this device as a linux computer and monitor without having to handle a pico controller or having an annoying dot in the middle of my screen. This was fixed by replacing the file crosshair.png in /system/media/images/ with an entirely transparent crosshair.


In order to run linux we need a few things. First - it helps that this is a pico goblin and not any other device - this means we both have root and we have extended storage. Our first step is to create a linux image - for this I used "linux deploy" for android. In order to have an useable system you need quite a large image - which cannot be stored on the typical Android SD card ( because they're formatted in FAT - max 4G file size ). So to be able to do this I wrote a small script that if there's an ext2 formatted sd card mounts it to /mnt/external - so we can place our linux images there. This script is automatically started on boot with magisk. The files to include this script into the Android kernel are included with the firmware. After mounting an ext-2 formatted SD card we can mount our linux image and start xorg. To enable XOrg rendering, I've installed this app x.org.server .



At the bottom of this page you can find the system image that includes linux support - a terminal on the home screen and root. You can install it with the old "adb reboot bootloader && fastboot oem pico unlock && fastboot flash boot boot.img && fastboot flash system system.img && fastboot flash vendor vendor.img".



One thing I noticed while dissasembling the pico software: the software on the pico seems to be based on this which seems to be based on google cardboard.


File pico_v2.zip
Size 2.46GB
crc32 4179212464
md5 0e98c55ce517995f452546fbdac872a6
sha512 f036317446dc7edbcdb1ded48a77be9c6e36b27ecf0c079a0e4e4581aca3a142e874ac3f7923ad2c26dc1f750ed4d4dee2a851c1bffb55d66456e3ada69045b7