OnePlus 6 (oneplus-enchilada)

The OnePlus 6 is an incredibly powerful and efficient mobile device, well regarded and (bar the notch) an excellent portable work horse, getting mainline Linux working means not only freedom from proprietary software, but also continual security patches and the ability to boot any mobile or desktop Linux distro.

After the OnePlus 6 reached End-of-Life by OnePlus in December 2021, running newer Linux kernel versions is the only way to ensure that the device can continue to be safe and usable for years to come. The Snapdragon 845 is still an incredibly capable SoC, likewise the OnePlus 6 is a well-built and perfectly adequate device. That the millions of sold units have been dropped, destined for Landfill (or at best recycling) by OnePlus is abhorrant, join us in doing our best to continue to make devices like the OnePlus 6 safe and usable.

The phone is currently capable of booting modern Linux with only a few patches, check the table on the right (or above on mobile) for the hardware support checklist.

Despite being able to run an up to date kernel, we are still dependant on the now aging firmware for features like the bootloader, modem, wifi and bluetooth to function, whilst it is relatively unlikely that a vulnerability is discovered in this firmware, it is absolutely a possibility. Until OnePlus release the signing keys used to sign new versions of the firmware - allowing us to potentially make use of future security patches - we're stuck with what we've got.

How to enter flash mode
Unplug from USB and hold and  until you see a screen showing the word   and information about the device.

For the OnePlus 6T, hold and both volume buttons.

Prerequisites
To install prebuilt images, you will need:

1. A computer with fastboot

This can be obtained by installed the  package on Linux or by installing the Android SDK Platform-Tools on Windows, Mac (or Linux).

Upgrade
Before installing postmarketOS, it's recommended that you upgrade your device to the latest release of OxygenOS (OnePlus's version of Android). This is not a requirement but is heavily recommended. Try this first if you encounter issues with fastboot.

Unlock the bootloader
Before installing postmarketOS you have to unlock your bootloader. For the T-Mobile version of the device in the US, refer to Google for guides on obtaining an unlock code. If your device is not carrier locked, the following is all that's needed to unlock the bootloader:

1. Open setting, go to "About" and tap on the "Build number" box ~10 times until the "You are now a developer" toast message appears.

2. Go back to the main settings page, go to "System" and then "Developer options" (it might be hiding behind a dropdown menu). Toggle the switch to "Enable OEM unlocking"

3. Refer to "How to enter flash mode" above to get into fastboot mode, then re-attach your USB cable. Run the following command on your host:

fastboot oem unlock

If you see, try running as   and restart your device into fastboot mode again by selecting "Restart Bootloader" on the device.

4. Read the message displayed on your device screen. Once read, confirm the unlock if you're willing to proceed. THIS WILL ERASE YOUR DEVICE'S INTERNAL STORAGE.

All done! You can now continue with this guide.

Pre-built images
Follow the installation article to download image files, note that the device code-names are  for the OnePlus 6 and   for the 6T.

Once downloaded, decompress the files with. On Windows you can use a tool like 7zip.

Finally, use fastboot to flash:

fastboot erase dtbo fastboot flash boot [the file that ends in -boot.img] fastboot flash userdata [the other file]

If you see, try running as   and restart your device into fastboot mode again.

It can be effective to select "Restart Bootloader" on the phone's bootloader after each command succeeds, to avoid above "waiting for device" connection problem.

Manual build
The vendor is OnePlus, the codename is "enchilada" for the OnePlus 6 and "fajita" for the OnePlus 6T.

Follow the pmbootstrap article, until you have done the install action (note that `--fde` stands for full-disk-encryption - this can also be left out). pmbootstrap install --fde

Reboot back into flash mode as explained above. (If you encounter weird behaviour like the command getting stuck before the flashing starts, reboot into flash mode or select "Restart Bootloader" on the phone itself)

By default the rootfs will be flashed to system, this doesn't leave much free space for your applications / data, if you don't mind factory resetting the device you can instead flash to userdata by specifying the partition like below. fastboot erase dtbo pmbootstrap flasher flash_rootfs --partition userdata pmbootstrap flasher flash_kernel

Reboot and you're good to go!

If you have flashing or booting issues, try first flashing the latest OxygenOS to the slot you want to install postmarketOS to (ie, flash in TWRP from your other slot). If you still have no luck, try flashing OxygenOS 9 as the bootloader can be more forgiving.

Dual booting
(See OnePlus_6_(oneplus-enchilada)/Dual_Booting_and_Custom_Partitioning)

Fastboot bugs
If you encounter "weird" errors from fastboot, such as "device does not support slots":

Once the device is in fastboot mode unplug it, run your fastboot / flasher command and wait for the " " message, now choose "reboot bootloader" on the device and press the power button to select, plug in the device while it reboots.

Upgrading
Upgrading can be done through Alpines package manager "apk", to upgrade everything simply open a terminal and run. This includes kernel upgrades.

Building
Feel like helping? Want to learn kernel development?

Check out the mainlining guide SDM845 Mainlining for detailed SDM845 specific instructions on initial device porting and building.

Feel free to contact @caleb (or anyone) in the #postmarketos-mainline matrix channel if you're stuck.

Hacking
See Hacking for details.

Partition map
total 0 drwxr-xr-x   2 root     root        2.0K Jan  7  1970. drwxr-xr-x   8 root     root         160 Jan  7  1970 .. lrwxrwxrwx   1 root     root          10 Jan  7  1970 ALIGN_TO_128K_1 -> ../../sdd1 lrwxrwxrwx   1 root     root          10 Jan  7  1970 ALIGN_TO_128K_2 -> ../../sdf1 lrwxrwxrwx   1 root     root          11 Jan  7  1970 ImageFv -> ../../sde72 lrwxrwxrwx   1 root     root          11 Jan  7  1970 LOGO_a -> ../../sde20 lrwxrwxrwx   1 root     root          11 Jan  7  1970 LOGO_b -> ../../sde48 lrwxrwxrwx   1 root     root          10 Jan  7  1970 abl_a -> ../../sde8 lrwxrwxrwx   1 root     root          11 Jan  7  1970 abl_b -> ../../sde36 lrwxrwxrwx   1 root     root          10 Jan  7  1970 aop_a -> ../../sde1 lrwxrwxrwx   1 root     root          11 Jan  7  1970 aop_b -> ../../sde29 lrwxrwxrwx   1 root     root          11 Jan  7  1970 apdp -> ../../sde63 lrwxrwxrwx   1 root     root          10 Jan  7  1970 bluetooth_a -> ../../sde5 lrwxrwxrwx   1 root     root          11 Jan  7  1970 bluetooth_b -> ../../sde33 lrwxrwxrwx   1 root     root          11 Jan  7  1970 boot_a -> ../../sde11 lrwxrwxrwx   1 root     root          11 Jan  7  1970 boot_aging -> ../../sde58 lrwxrwxrwx   1 root     root          11 Jan  7  1970 boot_b -> ../../sde39 lrwxrwxrwx   1 root     root          10 Jan  7  1970 cdt -> ../../sdd2 lrwxrwxrwx   1 root     root          11 Jan  7  1970 cmnlib64_a -> ../../sde13 lrwxrwxrwx   1 root     root          11 Jan  7  1970 cmnlib64_b -> ../../sde41 lrwxrwxrwx   1 root     root          11 Jan  7  1970 cmnlib_a -> ../../sde12 lrwxrwxrwx   1 root     root          11 Jan  7  1970 cmnlib_b -> ../../sde40 lrwxrwxrwx   1 root     root          11 Jan  7  1970 config -> ../../sda12 lrwxrwxrwx   1 root     root          10 Jan  7  1970 ddr -> ../../sdd3 lrwxrwxrwx   1 root     root          11 Jan  7  1970 devcfg_a -> ../../sde14 lrwxrwxrwx   1 root     root          11 Jan  7  1970 devcfg_b -> ../../sde42 lrwxrwxrwx   1 root     root          11 Jan  7  1970 devinfo -> ../../sde61 lrwxrwxrwx   1 root     root          11 Jan  7  1970 dip -> ../../sde62 lrwxrwxrwx   1 root     root          10 Jan  7  1970 dsp_a -> ../../sde9 lrwxrwxrwx   1 root     root          11 Jan  7  1970 dsp_b -> ../../sde37 lrwxrwxrwx   1 root     root          11 Jan  7  1970 dtbo_a -> ../../sde18 lrwxrwxrwx   1 root     root          11 Jan  7  1970 dtbo_b -> ../../sde46 lrwxrwxrwx   1 root     root          10 Jan  7  1970 frp -> ../../sda6 lrwxrwxrwx   1 root     root          10 Jan  7  1970 fsc -> ../../sdf5 lrwxrwxrwx   1 root     root          10 Jan  7  1970 fsg -> ../../sdf4 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_4j1ed_a -> ../../sde21 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_4j1ed_b -> ../../sde49 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_4u1ea_a -> ../../sde22 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_4u1ea_b -> ../../sde50 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs3_a -> ../../sde23 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs3_b -> ../../sde51 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs4_a -> ../../sde24 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs4_b -> ../../sde52 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs5_a -> ../../sde25 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs5_b -> ../../sde53 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs6_a -> ../../sde26 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs6_b -> ../../sde54 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs7_a -> ../../sde27 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs7_b -> ../../sde55 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs8_a -> ../../sde28 lrwxrwxrwx   1 root     root          11 Jan  7  1970 fw_ufs8_b -> ../../sde56 lrwxrwxrwx   1 root     root          10 Jan  7  1970 hyp_a -> ../../sde3 lrwxrwxrwx   1 root     root          11 Jan  7  1970 hyp_b -> ../../sde31 lrwxrwxrwx   1 root     root          11 Jan  7  1970 keymaster_a -> ../../sde10 lrwxrwxrwx   1 root     root          11 Jan  7  1970 keymaster_b -> ../../sde38 lrwxrwxrwx   1 root     root          10 Jan  7  1970 keystore -> ../../sda5 lrwxrwxrwx   1 root     root          11 Jan  7  1970 limits -> ../../sde67 lrwxrwxrwx   1 root     root          11 Jan  7  1970 logdump -> ../../sde71 lrwxrwxrwx   1 root     root          11 Jan  7  1970 logfs -> ../../sde69 lrwxrwxrwx   1 root     root          10 Jan  7  1970 mdtp_a -> ../../sde7 lrwxrwxrwx   1 root     root          11 Jan  7  1970 mdtp_b -> ../../sde35 lrwxrwxrwx   1 root     root          10 Jan  7  1970 mdtpsecapp_a -> ../../sde6 lrwxrwxrwx   1 root     root          11 Jan  7  1970 mdtpsecapp_b -> ../../sde34 lrwxrwxrwx   1 root     root          11 Jan  7  1970 minidump -> ../../sde57 lrwxrwxrwx   1 root     root          10 Jan  7  1970 misc -> ../../sda3 lrwxrwxrwx   1 root     root          10 Jan  7  1970 modem_a -> ../../sde4 lrwxrwxrwx   1 root     root          11 Jan  7  1970 modem_b -> ../../sde32 lrwxrwxrwx   1 root     root          10 Jan  7  1970 modemst1 -> ../../sdf2 lrwxrwxrwx   1 root     root          10 Jan  7  1970 modemst2 -> ../../sdf3 lrwxrwxrwx   1 root     root          11 Jan  7  1970 msadp -> ../../sde64 lrwxrwxrwx   1 root     root          11 Jan  7  1970 odm_a -> ../../sda15 lrwxrwxrwx   1 root     root          11 Jan  7  1970 odm_b -> ../../sda16 lrwxrwxrwx   1 root     root          10 Jan  7  1970 oem_dycnvbk -> ../../sda8 lrwxrwxrwx   1 root     root          10 Jan  7  1970 oem_stanvbk -> ../../sda9 lrwxrwxrwx   1 root     root          11 Jan  7  1970 op1 -> ../../sde59 lrwxrwxrwx   1 root     root          10 Jan  7  1970 op2 -> ../../sda7 lrwxrwxrwx   1 root     root          10 Jan  7  1970 param -> ../../sda4 lrwxrwxrwx   1 root     root          10 Jan  7  1970 persist -> ../../sda2 lrwxrwxrwx   1 root     root          11 Jan  7  1970 qupfw_a -> ../../sde15 lrwxrwxrwx   1 root     root          11 Jan  7  1970 qupfw_b -> ../../sde43 lrwxrwxrwx   1 root     root          11 Jan  7  1970 reserve1 -> ../../sda10 lrwxrwxrwx   1 root     root          11 Jan  7  1970 reserve2 -> ../../sda11 lrwxrwxrwx   1 root     root          11 Jan  7  1970 sec -> ../../sde60 lrwxrwxrwx   1 root     root          11 Jan  7  1970 splash -> ../../sde66 lrwxrwxrwx   1 root     root          11 Jan  7  1970 spunvm -> ../../sde65 lrwxrwxrwx   1 root     root          10 Jan  7  1970 ssd -> ../../sda1 lrwxrwxrwx   1 root     root          11 Jan  7  1970 sti -> ../../sde70 lrwxrwxrwx   1 root     root          11 Jan  7  1970 storsec_a -> ../../sde19 lrwxrwxrwx   1 root     root          11 Jan  7  1970 storsec_b -> ../../sde47 lrwxrwxrwx   1 root     root          11 Jan  7  1970 system_a -> ../../sda13 lrwxrwxrwx   1 root     root          11 Jan  7  1970 system_b -> ../../sda14 lrwxrwxrwx   1 root     root          11 Jan  7  1970 toolsfv -> ../../sde68 lrwxrwxrwx   1 root     root          10 Jan  7  1970 tz_a -> ../../sde2 lrwxrwxrwx   1 root     root          11 Jan  7  1970 tz_b -> ../../sde30 lrwxrwxrwx   1 root     root          11 Jan  7  1970 userdata -> ../../sda17 lrwxrwxrwx   1 root     root          11 Jan  7  1970 vbmeta_a -> ../../sde17 lrwxrwxrwx   1 root     root          11 Jan  7  1970 vbmeta_b -> ../../sde45 lrwxrwxrwx   1 root     root          11 Jan  7  1970 vendor_a -> ../../sde16 lrwxrwxrwx   1 root     root          11 Jan  7  1970 vendor_b -> ../../sde44 lrwxrwxrwx   1 root     root          10 Jan  7  1970 xbl_a -> ../../sdb1 lrwxrwxrwx   1 root     root          10 Jan  7  1970 xbl_b -> ../../sdc1 lrwxrwxrwx   1 root     root          10 Jan  7  1970 xbl_config_a -> ../../sdb2 lrwxrwxrwx   1 root     root          10 Jan  7  1970 xbl_config_b -> ../../sdc2

Upgrading firmware without Android installed
When you install postmarketOS and all you get is just blank screen after a reboot or you have some other problems it is possible that firmware was not upgraded. Follow these steps to upgrade firmware.

fastboot flashing unlock_critical fastboot flash abl abl.img fastboot flash aop aop.img fastboot flash bluetooth bluetooth.img fastboot flash cmnlib cmnlib.img fastboot flash cmnlib64 cmnlib64.img fastboot flash devcfg devcfg.img fastboot flash dsp dsp.img fastboot flash fw_4j1ed fw_4j1ed.img fastboot flash fw_4u1ea fw_4u1ea.img fastboot flash hyp hyp.img fastboot flash keymaster keymaster.img fastboot flash LOGO LOGO.img fastboot flash --slot=all modem modem.img fastboot flash oem_stanvbk oem_stanvbk.img fastboot flash qupfw qupfw.img fastboot flash storsec storsec.img fastboot flash tz tz.img fastboot flash xbl xbl.img fastboot flash xbl_config xbl_config.img
 * Download newest firmware from here
 * Extract payload.bin file from zip you downloaded in a previous step
 * Extract firmware with payload-dumper-go or payload_dumper
 * Run command: payload-dumper-go payload.bin
 * Enter fastboot mode
 * Unlock partitions for flashing
 * Run below commands to update firmware

The big list of issues
In no particular order...

Tri-state key support
First support was in userspace: https://github.com/michele-perrone/postmarketos-oneplus6-tristatekey

A kernel device driver for the tri-state key has now been developed, and it emits EV_SW with codes 17/18/19 for the top/middle/bottom states.

It has been suggested that the kernel driver is converted to using the ABS_MISC codes rather than introduce more "generic" input events.

The next step is to write hkdm configs for it but this may need to wait for the driver to get upstreamed. hkdm itself needs support for EV_SW devices added.

Phosh clock hidden by notch
One can get around this quirk by tweaking the file  with something such as:

.phosh-topbar-clock { padding-left: 130px; }

to move the clock slightly to the right of the notch.

The rounded corners on the 6T can be annoying as well.

OTG doesn't work
"OTG" (USB-C role switching to host mode) is blocked on USB-C power delivery support in the charger driver. Host mode can be forced by modifying the DTS when building a kernel, but it isn't clear what this fixes or may break (e.g. charging).

See this matrix post by User:Kalube: no, OTG isn't really a thing anymore anyway - it's technically specific to micro USB, usb-c has role-switching where a device can either be a host device or a peripheral device. Right now we force peripheral mode always. Once support for the full USB-C power delivery system is implemented in the charger driver, we can negotiate a role with the other device, e.g. if it's a powered dock we want to charge but also be the host device.

Once that's done we can implement DP alt mode on top which requires talking to the dwc3 driver I think, and configuring some external orientation switch for the USB SBU pins which are directional and required by displayport

that's all the missing pieces, that will give us displayport on the SHIFT6mq, neither the pocophone F1 nor OnePlus 6 support DP alt mode

Host mode can be enabled by changing the dtb, to do this install dtc and decompile the appropriate file for you device like so:
 * 1) apk add dtc
 * 2) cd /boot/dtbs/qcom
 * 3) dtc sdm845-oneplus- .dtb -o temp.dts

Now edit the temp.dts file and change dr_mode from "peripheral" to "host", recompile it and run mkinitfs to regenerate and flash the boot image: To revert the changes just do the same thing again but change the line back to peripheral, kernel updates will also revert it.
 * 1) dtc temp.dts -o sdm845-oneplus- .dtb
 * 2) mkinitfs
 * 3) reboot

The phone won't supply its own power, so you need either a powered hub or an extension cable wired up to 5v. Some hubs may refuse to work without power being supplied from the port however.

Third party displays and touch panel issues
Some manufacturer realised they could cheap out on touch controllers, so 3rd party touch panels don't actually implement the synaptics rmi4 spec properly. The rmi4 driver will need some hacks to deal with this.

My regular 6 with a display replacement also seems to fail to init the display after its been reset.

RMI4 attempting to probe on a fake touch IC will look something like the following: [   3.502580] rmi4_i2c 12-0020: registering I2C-connected sensor [   6.081770] rmi4_f01 rmi4-00.fn01: found RMI device, manufacturer: unknown, product:, fw id: 0 [   6.094861] rmi4_f12 rmi4-00.fn12: Behavior of F12 without register descriptors is undefined.

GPS
Depending on the carrier config, GPS with ModemManager can work:  followed by   returns NMEA phrases. Keep in mind that modem only works when a sim card is inserted.

Normally, information about which satellites are where to expect (satellite almanac of orbit) is retrieved from the GPS satellites themselves and that can take at least roughly 12 min with a good signal, however here is were A-GPS (assisted GPS) steps in by providing internet services to augment GPS with those generic data.

The carrier config selected by ModemManager also contains configuration for A-GPS. Whether the config is complete in that regard can be checked with  as it should contain assistance servers. If not, you might experience not continuous and only infrequent GPS fixes and other problems regarding GPS.

See this comment thread for more details.

Camera
Have to dump sensor init sequence from downstream and pray, need more time for tweaking this but it should be possible to make it work

Sensors
Initial sensor support is/will be added in

TrustZone
Drivers to communicate with the QSEE (Qualcomm Secure Execution Environment) are not on mainline and you can't flash OP-TEE because XBL_SEC checks the signature. Those drivers are called QSEECOM in the CAF kernel but there is the need to standardize them using the generic interface defined in. You can use the OP-TEE implementation as an example. More documentation here https://www.kernel.org/doc/html/latest/staging/tee.html.

Having a TrustZone is useful to do a lot of things related to security, but mainly fingerprint management, secure encryption involved in NFC, useful to emulate contactless smart cards, and Widevine L1 to watch premium streaming services with the best resolution!

Regarding DRMs and userland, on Waydroid or Android mainline you need to develop  with the support of the standard API for the TEE; manufacturers implement it with their custom interfaces. Look at this https://source.android.com/devices/drm#drm-plugins.

On GNU/Linux, you need to implement/enable Widevine L1 on players. For example on Firefox, if you want to watch Netflix or other in-browser streaming services, but you might also want to use an extension like https://github.com/lkmvip/netflix-4K-DDplus to spoof the device and so make Netflix give you the encrypted stream. Another good implementation opportunity is on FFMPEG/VLC, it would be cool to make VLC able to stream Netflix and also having the possibility to save decrypted streams.

Fastboot flashing issues
The fastboot implementation leaves some to be desired... If you encounter issues flashing with fastboot getting stuck or displaying weird errors like, prepare the fastboot flash command in your terminal, on the device choose the "reboot bootloader" option from fastboot, press the power button to confirm and then run the command while the device reboots.

You'll see a "waiting for device" message in your terminal, the flashing should start as soon as the device gets back into fastboot mode.

Modem bugs
The recent enablement of ModemManager enables SMS and mobile data to work on supported SDM845 devices including the OnePlus 6 and 6T. It isn't possible to test these extensively due to the number of region specific and carrier specific issues that could arise.

If you're encountering modem issues, perform the following steps to collect logs and submit them so that I or someone else can review:

On your device with SIM card inserted: sudo service modemmanager stop sudo service msm-modem-uim-selection restart sudo ModemManager --debug 2>&1 | tee mm.log

If your device requires SIM unlocking, perform that in Phosh settings, wait for a few seconds and then stop modemmanager again.

Create a new issue in ModemManager here to explain your issue, include a link to a pastebin containing the logs you captured (they're in mm.log in your home directory on device). At the bottom of your issue add  so that I'll be notified.

Please also include the output of  and   in your issue.

Sim not appearing
Some SIM cards or modem firmwares might take longer to initialize. If the SIM card does not appear, but  shows that the card is present, one possible solution is to increase the wait time for the SIM card to appear after starting the modem. Edit the file:  and change:   to   and reboot.

Dual Sim
Some users have reported issues with dual SIM causing modemmanager issues, whilst modemmanager should automatically select the first SIM, it lacks proper dual SIM support and sometimes can get confused. Currently the best workaround is to make sure you only have one SIM card inserted.

Renegade Project
Has support in main tree, can boot PostmarketOS.

See also OnePlus 6 (oneplus-enchilada)/Dual Booting and Custom Partitioning and Oneplus 6/6T Renegade Project Page

Maintainers

 * Caleb

Internal pages

 * OnePlus 6T (oneplus-fajita)