Jump to content

OnePlus 6 (oneplus-enchilada)

From postmarketOS Wiki
Revision as of 16:55, 15 May 2022 by Caleb (talk | contribs)
OnePlus 6
Running Phosh
Running Phosh
Manufacturer OnePlus
Name 6
Codename oneplus-enchilada
Released 2018
Hardware
Chipset Qualcomm SDM845 Snapdragon 845
CPU Octa-core (4x 2.8 GHz Kryo 385 Gold & 4x 1.7 GHz Kryo 385 Silver)
GPU Adreno 630
Display 1080 x 2280 AMOLED
Storage 64/128/256 GB
Memory 6/8 GB
Architecture aarch64
Software
Original software Android 8.0 (Up to Android 11) on Linux 4.9
postmarketOS
Category community
Pre-built images yes
postmarketOS kernel Mainline
Unixbench Whet/Dhry score 6029.9
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Partial
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Partial
Camera
Broken
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
Works
GPS
Broken
NFC
No data
Modem
Calls
Broken
SMS
Works
Mobile data
Works
Miscellaneous
FDE
Works
USB OTG
Partial
HDMI/DP
No data
Sensors
Accelerometer
Broken
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
Works
Barometer
No data


This page documents the status of mainline Linux on the OnePlus 6!

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, and security updates at OnePlus' discretion, but also the ability to boot any mobile or desktop distro as long as the required software is packaged.

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.

How to enter flash mode

Unplug from USB, hold Power and Volume Up until you see "Fastboot Mode" text.

For the OnePlus 6T, hold Power and both Volume Up and Volume Down to get in Fastboot Mode.

Installing

Note For dual booting with Android, see "Dual booting" below.

Prerequisites

Upgrade

Note The bootloader is the only firmware that postmarketOS doesn't install itself, all other firmware (devicetree, gpu, modem etc) is supplied by postmarketOS

Before installing postmarketOS, it's recommended that you upgrade your device to the latest release of OOS, whilst this is not a hard requirement, there have been issues with fastboot misbehaving on older firmware versions.

There is no hard requirement that your device is running a specific Android version, as unlike other (Halium based) distributions, postmarketOS doesn't depend on re-using hardware support provided by proprietary userspace blobs.

Fastboot

Install fastboot on your host, refer to Google for instructions.

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 you get a message saying you are now a developer.

2. Go back to the main settings page, go to system and then developer options (it might be hiding behind a drop down). 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

4. Read the message displayed on your device screen, once you're happy confirm the unlock. THIS WILL ERASE YOUR DEVICE.


All done! You can now continue with this guide.

Prebuilt images

Choose an image for your device from the download page.

Download the files ending in .img, you may also want to download the hashes for verification. On Windows you can use a tool like 7zip to decompress the files, on Linux use unxz. Then use fastboot to flash with the following:

fastboot erase dtbo
fastboot flash boot <date>-<time>-postmarketOS-edge-phosh-6-oneplus-[enchilada|fajita]-boot.img
fastboot flash userdata <date>-<time>-postmarketOS-edge-phosh-6-oneplus-[enchilada|fajita].img

For prebuilt images, the default username is user and the default password is 147147. It isn't possible to set up full disk encryption with prebuilt images yet.

Manual build

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

Follow the general installation guide, return here when told to (at the "installation and flashing section").

Now run the following, pick a password when prompted.

pmbootstrap install

Reboot back into flash mode (explained above) after each of the following commands (if you encounter weird behaviour like the command getting stuck before the flashing starts).

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 OOS 9 as the bootloader can be more forgiving.

Dual booting

Flashing to system

It is possible to dual boot with Android when flashing postmarketOS to the system partition, although this severely limits the space available.

In fastboot mode run fastboot getvar current-slot to get the currently active slot (where Android is installed). For this example we'll use a as the slot with Android, if your current slot is b then simply switch "a" with "b" and vice versa. To install postmarketOS to the inactive slot, run

fastboot set_active b

before following the flashing steps above, as well as replacing userdata in the flashing commands with system so as to preserve your Android userdata partition.

You can now switch back to Android by entering fastboot mode and running

fastboot set_active a

Note: Substituting system for vendor is also fine. This setup also allows for a recovery pmOS install, since all partitions are accessible on any booted OS, so long as there is root access.

Sharing userdata with Android

It's possible to share the userdata partition with Android, using it as the postmarketOS rootfs as well as the Android data partition at the same time. This may come with unintended side effects but initial testing shows that it works well enough.

The postmarketOS rootfs image is not actually an ext4 image, it's actually a full disk image containing two partitions, Android obviously doesn't know how to handle this so we have to split it up. You can do this manually with a prebuilt but that is left as an exercise to the reader...

This method will erase your userdata partition, it is also non-trivial to "uninstall" postmarketOS.

Before continuing, flash your Android ROM of choice and ensure that it boots. Don't go through setup as these steps will erase userdata.

Run through pmbootstrap init like explained above, but instead of running pmbootstrap install run

pmbootstrap install --split
# And then
pmbootstrap export

You can now manually flash the boot and root partitions, note that the "boot" partition here isn't the Android boot partition, it's the postmarketOS boot partition which is used to keep the kernel, initramfs etc. We can place the boot image on vendor on the slot with postmarketOS. Make sure not to run this on your Android slot.

fastboot flash userdata /tmp/postmarketOS-export/oneplus-[enchilada|fajita]-root.img
fastboot flash vendor /tmp/postmarketOS-export/oneplus-[enchilada|fajita]-boot.img

The postmarketOS initramfs will automatically detect these during boot. You can now flash the boot partition, erase dtbo and boot postmarketOS as usual! You must boot postmarketOS so that it can resize the userdata partition before you boot Android. Once pmos first boot is done you can reboot and use fastboot to switch slots.

If pmOS does not resize the partition properly, run the following on pmOS

sudo resize2fs /dev/sda17

Advanced Partitioning

Warning WARNING: This is a dangerous process that may hard-brick your phone, requiring the use of poorly documented EDL-mode recovery tools to fix

More information on partitioning userdata available at OnePlus 6 (oneplus-enchilada)/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 "<waiting for device>" 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 sudo apk upgrade -a. This includes kernel upgrades.

Device won't boot properly after upgrade

On postmarketOS edge at least, there have been some issues with the kernel upgrade script, it's possible that the kernel will upgrade but the new one won't be flashed, this leads to having an old kernel but with new kernel modules. This will result in one of the following: Your device gets stuck on the postmarketOS logo, your device gets stuck on a blinking cursor, your device boots properly but wifi, bluetooth, battery and haptics are all broken.

If you're able to get a shell on your device (either with ssh or locally) you can simply run the following:

sudo pmos-update-kernel postmarketos-qcom-sdm845

Alternative, you can fix this by manually flashing the upgraded kernel as follows, you will need fastboot installed on your host.

Note These steps won't work if you are dual booting by sharing userdata, the postmarketOS boot partition won't be handled by Jumpdrive

1. Download JumpDrive for the OnePlus 6 from here (pick your model): https://github.com/dreemurrs-embedded/Jumpdrive/releases

2. Run fastboot boot boot-oneplus-[enchilada|fajita].img and wait until you see the graphics on screen.

3. Open your file explorer, you should see two new drives called pmOS_boot and pmOS_root, open pmOS_boot.

4. Copy the file boot.img-postmarketos-qcom-sdm845 to your computer.

5. Eject the drives and reboot your device into fastboot again using the button combination (see "How to enter flash mode" above).

6. Run fastboot flash boot /path/to/the/boot.img/you/copied

7. Reboot your device with fastboot reboot

You should now boot into postmarketOS with everything working again!

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.

Info

Hacking

See Hacking for details.

Partition map

oneplus-enchilada:~$ ls -lah /dev/disk/by-partlabel/

The big list of issues

In no particular order...

Stuck in fastboot after rebooting

This happens because of Android/qcom A/B slot switching, fix it with the following:

Get the current slot

fastboot getvar current-slot

Switch to the inactive slot and back again to reset to slot retry count:

# Assuming the current slot is "a"
fastboot set_active b set_active a
# If the current slot is b
fastboot set_active a set_active b

In short, when you do an upgrade in Android, it installs to the other slot, and then switches to that slot, to handle the case where the upgrade is bad and doesn't boot anymore A/B implements a kind of dead mans switch, after booting Android is meant to set a flag to "mark boot successful", if that flag isn't set then it's meant to boot into recovery instead, after ~7 reboots the bootloader gives up and refuses to boot, leaving you in fastboot. Because postmarketOS doesn't implement a "recovery" it just boots normally.

So after ~7 boots you'll end up in this state and have to run the above.

The research done in https://gitlab.com/sdm845-mainline/qbootctl and https://gitlab.com/sdm845-mainline/abootctl will eventually resolve this by implementing the bootctrl features in mainline.

Charging

Charging is for some reason extremely slow on the OnePlus 6, I haven't yet figured out quite why. If your device is refusing to charge properly, turn it off and plug it into the charger whilst holding volume up. This will put the device into EDL mode which uses the minimum amount of power and will charge it properly. A full charge will take around 2-3 hours.

This will be fixed by proper smb2 / charger driver support in the kernel.

Tri-state key support

Being worked on! Might also end up with a kernel driver at some point to simplify the daemon. Hopefully it gets merged soon.

https://github.com/michele-perrone/postmarketos-oneplus6-tristatekey

A kernel device driver for the tri-state key could use the EV_MSC event codes : https://www.kernel.org/doc/Documentation/input/event-codes.txt, these are used for misc devices to report some arbitrary input event, this can then be handled by the user daemon!

Phosh clock hidden by notch

One can get around this quirk by tweaking the file ~/.config/gtk-3.0/gtk.css 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.

HW Video decoding is broken

Venus works, gstreamer has support for it but the colours are all wrong. Firefox doesn't seem to support it properly.

3rd party displays / touch panels don't work

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

GPSd should work, mostly untested. Requires a patch to add QMI support which won't be merged due to missing docs. I will try and produce some documentation to allow this to be merged.

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

The SLPI is partially documented, yet to successfully talk to it on mainline. DTS and driver compatibles are missing too (need to submit support). https://github.com/calebccff/sensordaemon-re

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 include/uapi/linux/tee.h. 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 oemcrypto.so 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.

I really like this project, but first I want to devote myself to whatever is needed to make this device usable. Have fun!

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 device does not support slots, 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 | 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 Cc: @calebccff so that I'll be notified.

Please also include the output of uname -a and sudo qmicli -d qrtr://0 --uim-get-card-status in your issue.

Call audio

Call audio is missing because the q6voice driver hasn't yet been ported from downstream. It is required to handle routing audio to the earpiece speaker during calls. [relevant pmaports issue]

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.

Community Info

postmarketOS users that own the device

  • Aa13q
  • Aleksander (Notes: WWAN stack tinkering)
  • Antonok
  • AppleCross (Notes: PostmarketOS Gnome)
  • BenTheTechGuy (Notes: On loan)
  • Blacklight
  • BotchedRPR (Notes: dead (crashdump mode))
  • Breakfastisready (Notes: 128GB)
  • CalcProgrammer1
  • Caleb (Notes: 256GB postmarketOS daily driver)
  • Caleb (Notes: 3rd party touch screen to be fixed)
  • Caleb (Notes: lab rat)
  • Chainbits (Notes: daily driver, available for testing)
  • Chayleaf (Notes: 8/128; runs NixOS)
  • Clygro (Notes: 8GB/128GB, current main pmOS)
  • Craftyguy
  • DanSman (Notes: pmOS (v24.12 + FDE) UI: plasma-mobile)
  • Deathmist (Notes: 8/128 GB model)
  • DevelLevel
  • DrGit (Notes: 256GB)
  • DylanVanAssche (Notes: LineageOS)
  • E-v (Notes: [available for testing] 128 GB, dual boot with DivestOS, userdata partition split in two)
  • Earboxer (Notes: formerly sxmo-sway on pmOS edge. current daily driver(2023). Still using pulseaudio, custom alsa UCM to fix thing. using Hyprland)
  • Elagost (Notes: family device running Android, can't wipe)
  • Emacsevangelist (Notes: Runs pmOS with a custom EXWM-based UI)
  • EnderNightLord
  • EspiDev (Notes: 8/128 GB Plasma Mobile)
  • Fossdd (Notes: edge, systemd, gnome mobile: experimental device for testing purposes)
  • Frankwalter (Notes: [6GB/128GB] I bought it to experiment with Linux mobile, so I can help mainlining it and learn about drivers development in the process! (fajita))
  • FuchtelJockel (Notes: daily driver (DivestOS))
  • Gbhdrew (Notes: About to start testing for daily use)
  • Giannidunk (Notes: 128 GB)
  • Hacker420 (Notes: Daily driver, dualbooted with Android and pmOS on the other slot. (8/128))
  • Hastalavista (Notes: LineageOS)
  • Haui2 (Notes: Running pmOS stable and phosh)
  • Iramosu (Notes: 8/128GB GNOME)
  • Jrg
  • Juliaff7 (Notes: Testing pmOS)
  • JuniorJPDJ
  • Kbingham
  • Ksqeib (Notes: Using as Minecraft Server)
  • Langfingaz (Notes: Running PostmarketOS edge)
  • Linmob (Notes: Kupfer with Phosh)
  • Lolgzs (Notes: 128GB, PMOS daily driver)
  • Manut (Notes: edge, phosh)
  • Mattdaha (Notes: 1x pmos, 1x lineageos daily driver)
  • Memoryfile (Notes: spare phone running GNOME mobile)
  • Naproxen (Notes: Daily Driver)
  • NekoCWD (Notes: 6/64GB postmarketOS daily driver)
  • No112 (Notes: currently non-functional with a dangerous looking battery)
  • Okias (Notes: 8G/128G)
  • Operachi (Notes: Android + PostmarketOS (Main PostmarketOS Phone))
  • PanzerSajt
  • Plata (Notes: Plasma Mobile)
  • Proycon (Notes: daily driver with sxmo)
  • QC8086
  • R00t (Notes: running ubuntu touch, screen blacks out randomly)
  • Rabbit (Notes: Daily driver, GNOME mobile, 128GB)
  • Retourmy (Notes: Powerfull indeed, but no VoLTE. Reinstalled "from" OOS 9.0.8 to have GPS working with all cariiers)
  • Robert.mader (Notes: Development / Testing)
  • Russanandres (Notes: PMOS)
  • Sado1 (Notes: x4, one with screen replacement)
  • SevralT (Notes: My second phone for Linux ;p)
  • Some Chinese Guy (Notes: daily driver)
  • StephanieBread (Notes: pmOS edge with Gnome-Mobile, daily driver)
  • Sulu
  • Susurrus (Notes: Broken front camera)
  • Syboxez (Notes: (128G/8G) Daily driver on one slot, kupfer on the other)
  • Techwizz (Notes: Running postmarketOS)
  • ThatGeekZen (Notes: PMOS Daily Driver)
  • Thenightterrorx (Notes: Now running lineageOS,pmOS used as daily driver for a while, but call audio kept breaking)
  • TQMatvey (Notes: Third-party Touchscreen, dualboot linux and CrDroid)
  • Usia (Notes: running e/os/)
  • Usia (Notes: running PostmarketOS)
  • WhyNotHugo (Notes: Running postmarketOS. Mostly for experimentation.)
  • Wjtje (Notes: Second phone for running PostmarketOS edge)
  • Xanadul (Notes: 128 GB)


Maintainers

See also

Internal pages

External links