Jump to content

OnePlus 5 (oneplus-cheeseburger)

From postmarketOS Wiki
Revision as of 08:33, 4 March 2020 by Deathmist (talk | contribs) (OnePlus 5:: Add R0551 as mainlining contributor)
OnePlus 5
Manufacturer OnePlus
Name 5
Codename oneplus-cheeseburger
Released 2017
Hardware
Chipset Qualcomm MSM8998 Snapdragon 835
CPU 4x 2.45 GHz Cortex-A73 + 4x 1.90 GHz Cortex-A53
GPU Adreno 540
Display 1080x1920 Optic AMOLED
Storage 64 or 128 GB UFS 2.1
Memory 6 or 8 GB LPDDR4X RAM
Architecture aarch64
Software
Original software Android 7.1.1 (up to Android 9) on Linux 4.4
postmarketOS
Category testing
Pre-built images no
Mainline partial
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Broken
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Broken
Audio
Broken
Camera
Broken
Camera Flash
No data
Connectivity
WiFi
Broken
Bluetooth
Broken
GPS
No data
NFC
No data
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
Broken
USB OTG
Works
HDMI/DP
No data
Sensors
Accelerometer
No data
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data


Contributors

  • deathmist
  • R0551 (mainlining)

Maintainer(s)

deathmist

Users owning this device

Fastboot mode

The OnePlus 5 uses fastboot as its flashing protocol.

To enter fastboot mode, hold Volume Up while powering on the device. Release the button when FastBoot Mode can be seen on the display.

Installation

Unlocking the bootloader

If your bootloader is still locked at this point, you need to unlock it to proceed.

WARNING: Doing this WILL delete all your data on the device as a security precaution, so backup all your data before continuing!

There are plenty of guides online describing how to do this, but the run-down should be as follows:

  1. Enable Developer options by tapping the build number 7 times in Settings > About
  2. Go back and enter Developer options to enable both USB Debugging and OEM Unlocking
  3. Install the android-tools-fastboot or android-tools package depending on your machine's distro
  4. Power down your OnePlus 5 & enter fastboot mode using the instructions above this section
  5. Open a terminal window and verify your phone is displayed under fastboot devices to continue
  6. Run fastboot oem unlock and follow the instructions on screen. Navigate menus with Volume Up/Down and select an option with the Power button.
  7. Congrats, you should now have an unlocked bootloader on your device!

Setup build env & create flashables

Install pmbootstrap on your build machine and start following the steps below:

pmbootstrap init
pmbootstrap install

NOTICE: Both phosh and plasma-mobile are NOT working at all currently; this should be solved later by mainlining and using the freedreno DRM driver for graphics & mesa 3D acceleration.

Flashing the device

To begin the flashing process, boot your device to fastboot mode (if you haven't already). The standard flashing process goes as follows:

pmbootstrap flasher flash_rootfs
pmbootstrap flasher flash_kernel
sudo fastboot reboot

If you instead want to install the pmOS root filesystem on userdata partition (around 56 or 120 GB) instead of the system partition (3 GB), run the following instead as the flash_rootfs command:

pmbootstrap flasher flash_rootfs --partition userdata

During e.g. rapid kernel development you can simply boot the new image instead of always flashing to the device boot partition like so:

pmbootstrap flasher boot

LEDs

Currently you can control a whole bunch of the LEDs present on the device via sysfs by writing values to their brightness control files as root:

Screen brightness (0-255) can be adjusted: echo 255 > /sys/class/leds/lcd-backlight/brightness

The backlight for physical buttons can be enabled (1) or disabled (0): echo 1 > /sys/class/leds/button-backlight/brightness

Notification light color & brightness (0-255) are controllable:

  • Red: echo 255 > /sys/class/leds/red/brightness
  • Green: echo 255 > /sys/class/leds/green/brightness
  • Blue: echo 255 > /sys/class/leds/blue/brightness

Control of the rear camera flashlight (/sys/class/leds/torch-light*/brightness) seems to be broken via sysfs anyway right now.

Partition layout

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sda

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sdb

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sdc

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sdd

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sde

oneplus5:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/sdf


Mainline kernel

This is heavily W.I.P currently but it does at least boot to the pmOS initramfs with functional simplefb graphics! UFS storage also seems to work after enabling CONFIG_PHY_QCOM_UFS.

Next up would be USB as I've been doing this blind and don't exactly have a great setup to debug stuff :p

Check the links below for source code.

Links