Jump to content

OnePlus 6 (oneplus-enchilada): Difference between revisions

From postmarketOS Wiki
Mint (talk | contribs)
Reword "Unlock the bootloader" section.
Susurrus (talk | contribs)
Add specific model numbers
 
(146 intermediate revisions by 41 users not shown)
Line 7: Line 7:
| releaseyear = 2018
| releaseyear = 2018
| category = community
| category = community
| originalsoftware = Android
| originalsoftware = Android (OxygenOS/HydrogenOS)
| originalversion = 8.0
| originalversion = 8.0
| extendedversion = 11 on Linux 4.9
| extendedversion = 11 on Linux 4.9 (OxygenOS 11.1.2.2)
| chipset = Qualcomm Snapdragon 845 (SDM845)
| chipset = Qualcomm Snapdragon 845 (SDM845)
| cpu = Octa-core (4x 2.8 GHz Kryo 385 Gold & 4x 1.7 GHz Kryo 385 Silver)
| cpu = Octa-core (4x 2.8 GHz Kryo 385 Gold & 4x 1.7 GHz Kryo 385 Silver)
Line 17: Line 17:
| memory = 6/8 GB
| memory = 6/8 GB
| architecture = aarch64
| architecture = aarch64
| type = handset
| model = A6000, A6003
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
| status_emmc = Y
| status_sdcard = -
| status_touch = Y
| status_touch = Y
| status_screen = Y
| status_screen = Y
| status_wifi = Y
| status_wifi = P
| status_xwayland = Y
| status_xwayland = Y
| status_fde = Y
| status_fde = Y
Line 28: Line 32:
| status_battery = Y
| status_battery = Y
| status_3d = Y
| status_3d = Y
| status_accel = N
| status_accel = Y
| status_haptics = Y
| status_haptics = Y
| status_audio = Y
| status_audio = Y
| status_bluetooth = Y
| status_bluetooth = Y
| status_camera = N
| status_camera = P
| status_gps = N
| status_gps = P
| status_trustzone = N
| status_trustzone = N
| status_mobiledata = Y
| status_mobiledata = P
| status_sms = Y
| status_sms = P
| status_calls = Y
| status_calls = P
| status = Maintained, supported and upstream!
| status = Maintained, supported and upstream!
| booting = yes
| booting = yes
Line 43: Line 47:
| whet_dhry = 6029.9
| whet_dhry = 6029.9
| status_otg = P
| status_otg = P
}}
| status_nfc = P
{{Based on SoC|Qualcomm_Snapdragon_845_(SDM845)|Snapdragon 845}}
| status_cameraflash = Y
| status_dvb = -
| status_fossbootloader = N
| status_irtx = -
| status_irrx = -
| status_stylus = -
| status_ethernet = -
| status_hdmidp = -
| status_usba = -
| status_touchpad = -
| status_keyboard = -
| status_light = Y
| status_proximity = Y
| status_magnet = Y
| status_hall = N
| genericdevice=Qualcomm SDM845 (qualcomm-sdm845)
| optionalgenericdevice = yes
}}<!--
-->{{Based on SoC|Qualcomm_Snapdragon_845_(SDM845)|Snapdragon 845}}


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.
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.


Now that the OnePlus 6 is determined 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 (and will continue to be) and 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.
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.
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.
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. While it is relatively unlikely that a vulnerability is discovered in this firmware, it is absolutely a possibility. Until OnePlus releases 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 ==
== How to enter flash mode ==


Unplug from USB and power off the phone, hold {{Button|Power}} and {{Button|Volume Up}} until you see "Fastboot Mode" text followed by a simple text menu.
Unplug from USB and hold {{Button|Power}} and {{Button|Volume Up}} until you see a screen showing the word <code>START</code> and information about the device.
 
For the [[OnePlus 6T (oneplus-fajita)|OnePlus 6T]], hold {{Button|Power}} and <b>both</b> volume buttons.


For the [[OnePlus 6T (oneplus-fajita)|OnePlus 6T]], hold {{Button|Power}} and both {{Button|Volume Up}} and {{Button|Volume Down}} to get in Fastboot Mode.
{{notice|If you're struggling to enter fastboot, ensure that you have unplugged the USB cable and do not release the button combination until after the <code>START</code> text appears on screen}}


== Installing ==
== Installing ==


{{Notice|The bootloader is the only firmware that postmarketOS doesn't install itself, all other firmware (devicetree, gpu, modem etc) is supplied by postmarketOS. In contrast to custom Android ROMs, it is <strong>incredibly unlikely</strong> that any bugs or issues you encounter other than the ones mentioned below are caused by whatever OS you previously had installed.}}
{{Notice|The bootloader is the only firmware that postmarketOS doesn't install itself, all other firmware (devicetree, GPU, modem etc.) is supplied by postmarketOS. In contrast to custom Android ROMs, it is <strong>incredibly unlikely</strong> that any bugs or issues you encounter are caused by whatever OS you previously had installed on the device.}}


=== Prerequisites ===
=== Prerequisites ===
Line 70: Line 94:
1. A computer with fastboot
1. A computer with fastboot


This can be obtained by installed the <code>android-tools</code> package on Linux or by installing the [https://developer.android.com/studio/releases/platform-tools Android SDK Platform-Tools] on Windows, Mac (or Linux).
This can be obtained by installing the <code>android-tools</code> package on Linux or by installing the [https://developer.android.com/studio/releases/platform-tools Android SDK Platform-Tools] on Windows, Mac (or Linux).


==== Upgrade ====
==== 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.
Before installing postmarketOS, it's recommended that you upgrade your device to the latest release of OxygenOS (OnePlus's version of Android) on both slots. This is not a requirement but is heavily recommended to get GPS working. Try this first if you encounter issues with fastboot.
 
{{Notice|If you have a very old version of OxygenOS (for example after using the "MSM Download tool" for android 10), you probably need to [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1825#note_1223990136 update twice], because the device uses A/B partitioning ([[Android_AB_Slots|read this page if you're not sure what that means]]). First do a normal update, then find the latest version of OxygenOS OTA signed zip, upload it to the phone, go to the updater in the settings and do a local update of the latest version again ([https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1825#note_1224052491 source]). OnePlus' [https://www.oneplus.com/us/support/softwareupgrade support/softwareupgrade] page seems to be inaccessible at this moment, so look at [https://forum.xda-developers.com/t/oneplus-6-rom-ota-oxygen-os-mirrors-for-official-oxygen-os-roms-and-ota-updates.3792244/ this XDA thread for 6] and [https://forum.xda-developers.com/t/oneplus-6t-global-rom-ota-oxygen-os-repo-of-oxygen-os-builds.3865396/ this one for 6T]}}


==== Unlock the bootloader ====
==== Unlock the bootloader ====
Line 80: Line 106:
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:
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.
1. Open Settings, 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"
2. Go back to the main settings page, go to "System" and then "Developer options" (it might be hidden 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:
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:
Line 89: Line 115:
fastboot oem unlock
fastboot oem unlock
</pre>
</pre>
If you see <code>< waiting for any device ></code>, try running as <code>sudo</code> 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. <b>THIS WILL ERASE YOUR DEVICE'S INTERNAL STORAGE</b>.
4. Read the message displayed on your device screen. Once read, confirm the unlock if you're willing to proceed. <b>THIS WILL ERASE YOUR DEVICE'S INTERNAL STORAGE</b>.


All done! You can now continue with this guide.
All done! You can now continue with this guide.


=== Prebuilt images ===
=== Pre-built images ===


Choose an image for your device from the [https://postmarketos.org/download/ download] page, <code>oneplus-enchilada</code> for the OnePlus 6 and <code>oneplus-fajita</code> for the 6T.
Follow the [[installation]] article to download image files, note that the device code-names are <code>oneplus-enchilada</code> for the OnePlus 6 and <code>oneplus-fajita</code> for the 6T.


Download both files, one is the rootfs and is larger, the file ending in <code>-boot.img.xz</code> is the Android boot image containing the kernel and ramdisk, you may also want to download the hashes for verification.
Once downloaded, decompress the files with <code>unxz</code>. On Windows you can use a tool like 7zip.


Once downloaded, decompress the files. On Windows you can use a tool like 7zip, on Linux use <code>unxz</code>.
Finally, use fastboot to flash:


Finally, use fastboot to flash.
{{Notice|Erasing the dtbo partition will make Android (and <b>ALL</b> Android-based software like Ubuntu Touch or TWRP recovery) unbootable on the current slot ([[Android_AB_Slots|read this page if you're not sure what that means]]). You can re-flash an Android ROM via fastboot by extracting the payload.bin from the OTA zip and using a tool like [https://github.com/tobyxdd/android-ota-payload-extractor android-ota-payload-extractor] to get the individual partition images. It is almost never necessary to resort to extreme measures like "MSM Download tool" to reflash the device via EDL.}}


{{notice|erasing the dtbo partition will make Android unbootable on that [[Android_AB_Slots|slot]], take a backup if you intend to restore your Android installation.}}
{{Hint|If you are using Arch Linux and getting errors like <code>std::out_of_range</code>. Uninstall [https://archlinux.org/packages/extra/x86_64/android-tools android-tools] and install [https://aur.archlinux.org/packages/android-sdk-platform-tools android-sdk-platform-tools] from the AUR<ref>https://xdaforums.com/t/some-std-out_of_range-error-with-fastboot-on-linux.4626285/</ref><ref>https://gitlab.archlinux.org/archlinux/packaging/packages/android-tools/-/issues/4</ref> or build and flash your own build with [[pmbootstrap]]}}


<pre>
<pre>
Line 113: Line 140:
</pre>
</pre>


For prebuilt images, the default username is <code>user</code> and the default password is <code>147147</code>. It isn't possible to set up full disk encryption with prebuilt images yet.
If you see <code>< waiting for any device ></code>, try running as <code>sudo</code> and restart your device into fastboot mode again.
 
It can be effective to run <code>fastboot reboot</code> after each command succeeds, to avoid above "waiting for device" connection problem.
 
{{warning|Do not reboot via the power button on the device! This can result in not all data being properly written to storage, corrupting the rootfs and resulting strange behaviour like postmarketOS getting stuck during boot!}}
{{note|Always use <code>fastboot reboot</code> after flashing.}}


If you see <code>< waiting for any device ></code>, try running as <code>sudo</code> and restart your device into fastboot mode again.


=== Manual build ===
=== Manual build ===
Line 121: Line 152:
The vendor is OnePlus, the codename is "enchilada" for the OnePlus 6 and "fajita" for the OnePlus 6T.
The vendor is OnePlus, the codename is "enchilada" for the OnePlus 6 and "fajita" for the OnePlus 6T.


Follow the [[Installation_guide|general installation guide]], return here when told to (at the "installation and flashing section").
Follow the [[pmbootstrap]] article, until you have done the install action.


Now run the following, pick a password when prompted.
With FDE (it stands for Full Disk Encryption)
<pre>
<pre>
pmbootstrap install
pmbootstrap install --split --fde
pmbootstrap export
</pre>
</pre>
 
Without
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.
<pre>
<pre>
fastboot erase dtbo
pmbootstrap install
pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher flash_kernel
</pre>
</pre>


Reboot and you're good to go!
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)
 
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 ==
Without FDE by default, the rootfs will be flashed to the system partition. This doesn't leave much free space for your applications / data, so if you don't mind factory resetting the device you can instead flash to the userdata partition by specifying the partition like below.


The OnePlus 6 uses an A/B partitioning scheme, duplicating most important partitions. Because this includes the boot partition (which contains the kernel) we're able to re-use it to dual boot with some other OS such as Android, if you don't mind jumping through a few hoops.
{{warning|Do not reboot using the power button on the device! This can result in not all data being properly written to storage, corrupting the rootfs and resulting in strange behaviour like postmarketOS getting stuck during boot!}}
{{note|Always use <code>fastboot reboot</code> after flashing.}}


[[Android_AB_Slots|See more on how A/B slots work and how to interact with them here]].
==== With FDE ====
By booting [https://twrp.me/oneplus/oneplus6.html twrp] from bootloader/fastboot mode you can do the partitioning.


=== Flashing to system ===
If you install pmOS only to the slot b you can install twrp as recovery.<br>
After partitioning you will need to format userdata in twrp.<br>
You can install to both slots if you prefer.


It is possible to dual boot with Android when flashing postmarketOS to the system partition, although this severely limits the space available.
In twrp (Android 11 version ie. 3.7.0) in <code>Advanced->Terminal</code> you can use <code>sgdisk</code>, it has long flags only e.g. <code>--print</code> and not <code>-p</code>.<br>
Or you can use <code>adb shell</code> (when booted into twrp) to run these commands from your computer.


In fastboot mode run <code>fastboot getvar current-slot</code> to get the currently active slot (where Android is installed). For this example we'll use <code>a</code> as the slot with Android, if your current slot is <code>b</code> then simply switch "a" with "b" and vice versa. To install postmarketOS to the inactive slot, run
<pre>
#Get userdata number and info on the disk
sgdisk /dev/block/sda --print


<pre>
#Delete userdata partition to remake it smaller
fastboot set_active b
sgdisk /dev/block/sda --delete=17
</pre>


before following the flashing steps above, as well as replacing <code>userdata</code> in the flashing commands with <code>system</code> so as to preserve your Android userdata partition.
#Make userdata 2 gigabytes, minimum size unknown
sgdisk /dev/block/sda --new=0:0:+2G --change-name=0:userdata


You can now switch back to Android by entering fastboot mode and running
#Make pmOS boot partition 256 megabytes (default size)
sgdisk /dev/block/sda --new=0:0:+256M --change-name=0:pmOS_boot


<pre>
#Make pmOS system partition uses the rest of the disk
fastboot set_active a
sgdisk /dev/block/sda --new=0:0:0 --change-name=0:pmOS_root
</pre>
</pre>
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 <code>pmbootstrap install</code> run


<pre>
<pre>
pmbootstrap install --split
#Both slots
# And then
fastboot erase dtbo
pmbootstrap export
fastboot flash pmOS_boot /tmp/postmarketOS-export/oneplus-enchilada-boot.img
</pre>
fastboot flash pmOS_root /tmp/postmarketOS-export/oneplus-enchilada-root.img
fastboot flash boot /tmp/postmarketOS-export/boot.img
fastboot reboot


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.
#Slot b only
 
fastboot erase dtbo_b
<pre>
fastboot flash pmOS_boot /tmp/postmarketOS-export/oneplus-enchilada-boot.img
fastboot flash userdata /tmp/postmarketOS-export/oneplus-[enchilada|fajita]-root.img
fastboot flash pmOS_root /tmp/postmarketOS-export/oneplus-enchilada-root.img
fastboot flash vendor /tmp/postmarketOS-export/oneplus-[enchilada|fajita]-boot.img
fastboot flash boot_b /tmp/postmarketOS-export/boot.img
fastboot set_active b
fastboot reboot
</pre>
</pre>


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.
==== Without FDE ====
 
If pmOS does not resize the partition properly, run the following on pmOS


<pre>
<pre>
sudo resize2fs /dev/sda17
fastboot erase dtbo
pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher flash_kernel
pmbootstrap chroot fastboot reboot
</pre>
</pre>


===Advanced Partitioning===
If you have flashing or booting issues, try flashing the latest version of OxygenOS to the slot you want to install postmarketOS to (i.e., flash the ROM using TWRP from your other slot). If you still have no luck, try flashing OxygenOS 9, as the bootloader can be more forgiving.


{{Warning|This is a dangerous process that may hard-brick your phone, requiring the use of poorly documented EDL-mode recovery tools to fix}}
== Dual booting ==
 
(See [[OnePlus_6_(oneplus-enchilada)/Dual_Booting_and_Custom_Partitioning]])
More information on partitioning userdata available at [[OnePlus 6 (oneplus-enchilada)/Custom Partitioning]].


== Fastboot bugs ==
== Fastboot bugs ==
Line 210: Line 233:
If you encounter "weird" errors from fastboot, such as "device does not support slots":
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.
Once the device is in fastboot mode, unplug it, run your fastboot / flasher command and wait for the "<waiting for device>" message, then choose the "reboot bootloader" option on the device, press the power button to select that option and plug in the device while it reboots.
 
On Fedora, <code>fastboot oem unlock</code> must be run as root in order for it to recognize the device, with
 
<pre>sudo fastboot oem unlock</pre>
 
== Upgrading ==
 
Upgrading can be done through Alpines package manager "apk", to upgrade everything simply open a terminal and run <code>sudo apk upgrade -a</code>. 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:
<pre>
sudo pmos-update-kernel postmarketos-qcom-sdm845
</pre>
 
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 <code>fastboot boot boot-oneplus-[enchilada|fajita].img</code> and wait until you see the graphics on screen.
 
3. Open your file explorer, you should see two new drives called <code>pmOS_boot</code> and <code>pmOS_root</code>, open <code>pmOS_boot</code>.
 
4. Copy the file <code>boot.img-postmarketos-qcom-sdm845</code> 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 <code>fastboot flash boot /path/to/the/boot.img/you/copied</code>
 
7. Reboot your device with <code>fastboot reboot</code>
 
You should now boot into postmarketOS with everything working again!


== Building ==
== Building ==
Line 256: Line 242:


Feel free to contact @caleb (or anyone) in the [[Matrix and IRC|#postmarketos-mainline]] matrix channel if you're stuck.
Feel free to contact @caleb (or anyone) in the [[Matrix and IRC|#postmarketos-mainline]] matrix channel if you're stuck.
See [https://wiki.postmarketos.org/wiki/User:Magdesign#Compile_Kernel this] quick and dirty tutorial on how to build the kernel.


== Info ==
== Info ==
Line 376: Line 364:
</div>
</div>
</div>
</div>
=== Camera Flash ===
Two leds (yellow and white), both functionnal, at the back of the phone.
Their max brightness value is 255.
A simple extension for Gnome mobile adds a button to the activities overview : https://gitlab.com/NekoCWD/nekotorch
See [[LEDs|LEDs]] for more details.


== Upgrading firmware without Android installed ==
== Upgrading firmware without Android installed ==
Line 383: Line 381:
* Download newest firmware from [https://www.oneplus.com/us/support/softwareupgrade here]
* Download newest firmware from [https://www.oneplus.com/us/support/softwareupgrade here]
* Extract payload.bin file from zip you downloaded in a previous step
* Extract payload.bin file from zip you downloaded in a previous step
* Extract firmware with [https://github.com/ssut/payload-dumper-go this tool] (run command: "payload-dumper-go payload.bin")
* Extract firmware with [https://github.com/ssut/payload-dumper-go payload-dumper-go] or [https://github.com/sabpprook/payload_dumper payload_dumper]
<!-- https://github.com/sabpprook/payload_dumper -->
* Run command: <pre>payload-dumper-go payload.bin</pre>
* Enter fastboot mode
* Enter fastboot mode
* Unlock partitions for flashing  
* Unlock partitions for flashing  
Line 412: Line 410:
fastboot flash xbl_config xbl_config.img
fastboot flash xbl_config xbl_config.img
</pre>
</pre>
* If you are not able to write via fastboot, even after <pre>unlock_critical</pre> [https://wiki.postmarketos.org/wiki/User:Magdesign#Install_Stock_Android_9.0.8 use edl mode] instead (turn off phone, push volume +/- and plugin the usb cable):
<pre> edl w abl_a abl.img </pre>
and so on with all the mentioned files.


== The big list of issues ==
== The big list of issues ==
Line 417: Line 421:
In no particular order...
In no particular order...


=== Stuck in fastboot after rebooting ===
=== Audio in calls ===
 
There are issues with audio disappearing in calls.
 
=== 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 [https://lore.kernel.org/linux-arm-msm/YvQyOhgSGjQLHHvv@google.com/ the kernel driver is converted to using the ABS_MISC codes] rather than introduce more "generic" input events.
 
The next step is to write [https://gitlab.postmarketos.org/postmarketOS/hkdm 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.
 
If you use Phosh with systemd, the tri-state button should work out-of-the-box (if {{MR|5969|pmaports}} is merged).
 
=== 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.
 
See [https://matrix.to/#/!xgUMIsYnSIXklwbhrG:postmarketos.org/$DEx89n6NY1ERE6TrCKe6Q_tkTOwiylXpKzDwOFY7cC8?via=postmarketos.org&via=matrix.org&via=kde.org this matrix post] by [[User:Caleb]]:
<blockquote>
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


This happens because of Android/qcom A/B slot switching, fix it with the following:
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
</blockquote>


Get the current slot
{{note|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.
}}
Host mode can be enabled by Dts method and Sysfs method.
==== Dts method ====
Install dtc and decompile the appropriate file for you device like so:
<pre>
<pre>
fastboot getvar current-slot
# apk add dtc
# cd /boot/dtbs/qcom
# dtc sdm845-oneplus-<model>.dtb -o temp.dts
</pre>
</pre>


Switch to the inactive slot and back again to reset to slot retry count:
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:
<pre>
<pre>
# Assuming the current slot is "a"
# dtc temp.dts -o sdm845-oneplus-<model>.dtb
fastboot set_active b set_active a
# mkinitfs
# If the current slot is b
# reboot
fastboot set_active a set_active b
</pre>
</pre>
To revert the changes just do the same thing again but change the line back to peripheral, kernel updates will also revert it.


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.
==== Sysfs method ====
Change "device" to "host" in "/sys/kernel/debug/usb/a600000.usb/mode" :
<pre>
# echo host | sudo tee /sys/kernel/debug/usb/a600000.usb/mode
</pre>


So after ~7 boots you'll end up in this state and have to run the above.
To revert the changes just do the same thing again but change host to device or reboot the device.


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.
==== Verify ====
Run the command as below to verify:
<pre>
# sudo cat /sys/kernel/debug/usb/a600000.usb/mode
</pre>
If the command return <code>host</code> then congratulation you have enabled the host mode successfully.


=== Tri-state key support ===
== GPS ==


First support was in userspace: https://github.com/michele-perrone/postmarketos-oneplus6-tristatekey
{{warning| To use and test GPS functions,
make sure a SIM card is inserted (mmcli v1.22.x), GPS is enabled in mmcli, geoclue is executed. Then disable suspend, go outside for 15min. until you get a fix}}


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.
'''Carefully read [[Troubleshooting:GPS]] for more details on how to activate the GPS using ModemManager's CLI and enabeling Geoclue.'''


It has been suggested that [https://lore.kernel.org/linux-arm-msm/YvQyOhgSGjQLHHvv@google.com/ the kernel driver is converted to using the ABS_MISC codes] rather than introduce more "generic" input events.


The next step is to write [https://gitlab.com/postmarketOS/hkdm 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.
As discovered in [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1505#note_1161541916 this comment thread]: if you want GPS to work, you may need to flash OxygenOS in a specific version, before flashing postmarketOS; 9.0.8 for OP6, 9.0.16 for OP6T. Its recommended to flash it to both slots (ie. use copy-partitions from LineageOS) although it is not proved that it is necessary.


=== Phosh clock hidden by notch ===
== Camera ==


One can get around this quirk by tweaking the file <code>~/.config/gtk-3.0/gtk.css</code> with something such as:
It is possible to make it work since libcamera has everything in place and pre-installed on the OP6 images for basic support (like on [https://gitlab.com/sdm845-mainline/linux/-/commits/joel%2Fwip-pocof1-camera-imx363 Poco f1]) once the required kernel bits for the IMX519 driver are upstreamed, see [https://lore.kernel.org/linux-media/20230908124344.171662-1-umang.jain@ideasonboard.com/ this patch] as an example and see [https://gitlab.com/sdm845-mainline/linux/-/commits/sdm845/6.9-camera-axolotl this branch] where we are stuck.


<pre>
The driver source is available [https://github.com/raspberrypi/linux/blob/rpi-5.19.y/drivers/media/i2c/imx519.c here] see also [https://github.com/ArduCAM/IMX519_AK7375 this].
.phosh-topbar-clock {
  padding-left: 130px;
}
</pre>


to move the clock slightly to the right of the notch.
Help and discussion can be found in [https://gitlab.com/sdm845-mainline/linux/-/issues/21 sdm845-mainline!21] or on the matrix channel.


The rounded corners on the 6T can be annoying as well.
Listen [https://cast.postmarketos.org/episode/34-Events-Fairphone-5-FF-UA-SDM845-CI-Camera-MSM8953-initramfs/ pmOS podcast #34] for information (Sep 28 2023).


=== HW Video decoding is broken ===
== Wifi ==


Venus works, gstreamer has support for it but the colours are all wrong. Firefox doesn't seem to support it properly.
Wifi works out of the box, until it doesn`t anymore. The whole modem goes offline at irregular intervals (minutes to weeks after a fresh boot).<br>
One, or sometimes multiple reboots are required to get the modem working again.<br>
See: [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/3486 #3486]


== Third party displays and touch panel issues ==
Wifi monitor mode works, but requires reloading the driver with <code>frame_mode=0</code> and enabling raw mode in <code>firmware-5.bin</code>.
The commands to do this can be found here: [https://github.com/biemster/pmos-openbox-conky/blob/1409c16efe08e360dffc78020ac52dcc78daf0b8/phone.py#L471]. Packet injection however does not 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.
When creating a hotspot you might encounter the [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/2620 issue] that you are not be able to connect to it. In this case, create it from command line with <code>wifi-sec.pmf</code> disabled:
<pre>
nmcli dev wifi hotspot ifname wlan0 ssid hotspotname password "password"
nmcli c modify Hotspot 802-11-wireless-security.pmf 1
nmcli connection modify Hotspot wifi-sec.pmf disable
</pre>


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


RMI4 attempting to probe on a fake touch IC will look something like the following:
Initial sensor support was added in {{MR|4050|pmaports}}.
<pre>
Which works nice but constantly sucks 1-2% of CPU. To fix this we need [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/2455#note_453587 your help].
[    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.
</pre>


== GPS ==
== NFC ==


GPSd should work, mostly untested. Requires [https://gitlab.com/gpsd/gpsd/-/merge_requests/139 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.
As written [https://gitlab.com/sdm845-mainline/linux/-/merge_requests/62#note_1807750385 here], NFC is working on OP6/OP6T devices.


== Camera ==
<pre>
sudo apk add dtc
cd /boot/dtbs/qcom
sudo dtc sdm845-oneplus-enchilada.dtb -o sdm845-oneplus-enchilada.dts
patch < NFC.patch
sudo dtc sdm845-oneplus-enchilada.dts -o sdm845-oneplus-enchilada.dtb
sudo reboot
</pre>


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
get [https://raw.githubusercontent.com/biemster/pmos-openbox-conky/main/NFC.patch NFC.patch here].


== Sensors ==
More info by contacting [[User:Biemster]] or opening an issue in [https://github.com/biemster/pmos-openbox-conky the repo]


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
We just miss an userspace application and the [https://github.com/NXPNFCLinux/linux_libnfc-nci libnfc-nci] as Alpine package.


== TrustZone ==
== 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 <code>include/uapi/linux/tee.h</code>. You can use the OP-TEE implementation as an example. More documentation here https://www.kernel.org/doc/html/latest/staging/tee.html.
Drivers to communicate with the QSEE (Qualcomm Secure Execution Environment) are not on mainline and you can't flash [https://optee.readthedocs.io/en/latest/general/about.html 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 <code>include/uapi/linux/tee.h</code>. You can use the OP-TEE implementation as an example. More documentation here https://www.kernel.org/doc/html/latest/tee/op-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!
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!
Line 503: Line 553:
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.
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.
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.
== Battery/Power ==
While battery and charging are working, we sometimes get inaccurate power percentage values reported. In particular, if you have a replacement battery in your device, the BMS (battery management system) chip may differ from the original one, and the battery indicator may always show 100% and charging. In this case, the following might help:
You will decompile/edit/recompile your device tree blob (.dtb) file. Add the dtc package:
<pre>
sudo apk add dtc
cd /boot/dtbs/qcom
sudo dtc sdm845-oneplus-enchilada.dtb -o temp.dts
sudo sed -i 's/bq27441/bq27541/' temp.dts
sudo sed -i 's/bq27411/bq27541/' temp.dts
sudo dtc temp.dts -o sdm845-oneplus-enchilada.dtb
</pre>
Then run mkinitfs to incorporate the changes into your initramfs:
<pre>
sudo mkinitfs
</pre>
Charging on variable powersources like solarpanel/dynamo [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/3023 does not work as expected].


== Fastboot flashing issues ==
== Fastboot flashing issues ==
Line 520: Line 590:
sudo service modemmanager stop
sudo service modemmanager stop
sudo service msm-modem-uim-selection restart
sudo service msm-modem-uim-selection restart
sudo ModemManager --debug | tee mm.log
sudo ModemManager --debug 2>&1 | tee mm.log
</pre>
</pre>


Line 528: Line 598:


Please also include the output of <code>uname -a</code> and <code>sudo qmicli -d qrtr://0 --uim-get-card-status</code> in your issue.
Please also include the output of <code>uname -a</code> and <code>sudo qmicli -d qrtr://0 --uim-get-card-status</code> 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 <code>sudo qmicli -d qrtr://0 --uim-get-card-status</code> shows that the card is present (<code>Card state: 'present'</code>), one possible solution is to increase the wait time for the SIM card to appear after starting the modem. Edit the file: <code>/etc/conf.d/msm-modem-uim-selection</code> and change: <code>sim_wait_time=1</code> to <code>sim_wait_time=30</code> and reboot.


=== Dual Sim ===
=== 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.
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.
=== Countries Where Device Fails To Connect To Mobile Network ===
Australia - Since 3G closure this device is rejected due to SOS calls needing 3G network. See this forum for possible workarounds depending on the model of OnePlus 6: https://forums.whirlpool.net.au/archive/9m01z7np
Also see this issue tracker for VoLTE progress: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1878
== Renegade Project ==
Has support in main tree, can boot PostmarketOS.
See also [[OnePlus 6 (oneplus-enchilada)/Dual Booting and Custom Partitioning#Dual booting pmos with other uefi based os (like openbsd , netbsd , freebsd,windows,etc) via Renegade Project]] and [https://renegade-project.tech/en/devices/OnePlus/sdm845 Oneplus 6/6T Renegade Project Page]


== Community Info ==
== Community Info ==
Line 540: Line 625:
=== Maintainers ===
=== Maintainers ===


* [[User:Kalube|Caleb]]
* [[User:Caleb|Caleb]]


== See also ==
== See also ==
Line 549: Line 634:
{{Special:Prefixindex|prefix=OnePlus 6 (oneplus-enchilada)/|hideredirects=1|stripprefix=0}}
{{Special:Prefixindex|prefix=OnePlus 6 (oneplus-enchilada)/|hideredirects=1|stripprefix=0}}
* [[OnePlus 6T (oneplus-fajita)]]
* [[OnePlus 6T (oneplus-fajita)]]
* [[Sxmo:Oneplus6|OnePlus 6 sxmo tricks]]
* [[Android_AB_Slots|Documentation on A/B slots]]


=== External links ===
=== External links ===
Line 559: Line 647:
* {{MR|2206|pmaports}} Update to 5.12.8 and add support for the speaker / headphone jack on the OnePlus 6
* {{MR|2206|pmaports}} Update to 5.12.8 and add support for the speaker / headphone jack on the OnePlus 6
* {{MR|2215|pmaports}} Support automatic kernel updates for Android devices (including A/B!)
* {{MR|2215|pmaports}} Support automatic kernel updates for Android devices (including A/B!)
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/community/device-oneplus-enchilada Enchilada device package]
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/community/device-oneplus-enchilada Enchilada device package]
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/community/device-oneplus-fajita Fajita device package]
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/community/device-oneplus-fajita Fajita device package]
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/main/linux-postmarketos-qcom-sdm845 Kernel package]
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/community/linux-postmarketos-qcom-sdm845 Kernel package]
* [https://cast.postmarketos.org/episode/08-Interview-Caleb-Connolly-SDM-845-Mainlining/ postmarketOS podcast interview with Caleb about mainlining the OnePlus 6]
* [https://cast.postmarketos.org/episode/08-Interview-Caleb-Connolly-SDM-845-Mainlining/ postmarketOS podcast interview with Caleb about mainlining the OnePlus 6]
* [[Android_AB_Slots|Documentation on A/B slots]]
* Recent updates concerning [https://mastodon.social/@tbernard/112679666265497509 USB C role switching on Oneplus 6]
 
=== Footnotes ===


__FORCETOC__
__FORCETOC__
[[Category:Devices with known UART pinout]]
[[Category:Devices with known UART pinout]]
[[Category:Trailblazer]]

Latest revision as of 15:29, 15 March 2025

Note This page is about the dedicated port of this device. There is also an optional generic port available for this device - see Qualcomm SDM845 (qualcomm-sdm845).
OnePlus 6
Running Phosh
Running Phosh
Manufacturer OnePlus
Name 6
Codename oneplus-enchilada
Model A6000, A6003
Released 2018
Type handset
Hardware
Chipset Qualcomm Snapdragon 845 (SDM845)
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 (OxygenOS/HydrogenOS)
Original version 8.0
Extended version 11 on Linux 4.9 (OxygenOS 11.1.2.2)
FOSS bootloader no
postmarketOS
Category community
Pre-built images yes
postmarketOS kernel Mainline
Unixbench Whet/Dhry score 6029.9
Optional Generic Port Qualcomm SDM845 (qualcomm-sdm845)
Features
Flashing
Works
USB Networking
Works
Internal storage
Works
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Works
Camera
Partial
Camera Flash
Works
Connectivity
WiFi
Partial
Bluetooth
Works
GPS
Partial
NFC
Partial
Modem
Calls
Partial
SMS
Partial
Mobile data
Partial
Miscellaneous
FDE
Works
USB OTG
Partial
Sensors
Accelerometer
Works
Magnetometer
Works
Ambient Light
Works
Proximity
Works
Hall Effect
Broken
Haptics
Works
Barometer
No data

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. While it is relatively unlikely that a vulnerability is discovered in this firmware, it is absolutely a possibility. Until OnePlus releases 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 Power and Volume Up until you see a screen showing the word START and information about the device.

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

Notice If you're struggling to enter fastboot, ensure that you have unplugged the USB cable and do not release the button combination until after the START text appears on screen

Installing

Notice The bootloader is the only firmware that postmarketOS doesn't install itself, all other firmware (devicetree, GPU, modem etc.) is supplied by postmarketOS. In contrast to custom Android ROMs, it is incredibly unlikely that any bugs or issues you encounter are caused by whatever OS you previously had installed on the device.

Prerequisites

To install prebuilt images, you will need:

1. A computer with fastboot

This can be obtained by installing the android-tools 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) on both slots. This is not a requirement but is heavily recommended to get GPS working. Try this first if you encounter issues with fastboot.

Notice If you have a very old version of OxygenOS (for example after using the "MSM Download tool" for android 10), you probably need to update twice, because the device uses A/B partitioning (read this page if you're not sure what that means). First do a normal update, then find the latest version of OxygenOS OTA signed zip, upload it to the phone, go to the updater in the settings and do a local update of the latest version again (source). OnePlus' support/softwareupgrade page seems to be inaccessible at this moment, so look at this XDA thread for 6 and this one for 6T

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 Settings, 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 hidden 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 < waiting for any device >, try running as sudo 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 oneplus-enchilada for the OnePlus 6 and oneplus-fajita for the 6T.

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

Finally, use fastboot to flash:

Notice Erasing the dtbo partition will make Android (and ALL Android-based software like Ubuntu Touch or TWRP recovery) unbootable on the current slot (read this page if you're not sure what that means). You can re-flash an Android ROM via fastboot by extracting the payload.bin from the OTA zip and using a tool like android-ota-payload-extractor to get the individual partition images. It is almost never necessary to resort to extreme measures like "MSM Download tool" to reflash the device via EDL.
Hint If you are using Arch Linux and getting errors like std::out_of_range. Uninstall android-tools and install android-sdk-platform-tools from the AUR[1][2] or build and flash your own build with pmbootstrap
fastboot erase dtbo
fastboot flash boot [the file that ends in -boot.img]
fastboot flash userdata [the other file]

If you see < waiting for any device >, try running as sudo and restart your device into fastboot mode again.

It can be effective to run fastboot reboot after each command succeeds, to avoid above "waiting for device" connection problem.

Warning WARNING: Do not reboot via the power button on the device! This can result in not all data being properly written to storage, corrupting the rootfs and resulting strange behaviour like postmarketOS getting stuck during boot!
Note Always use fastboot reboot after flashing.


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.

With FDE (it stands for Full Disk Encryption)

pmbootstrap install --split --fde
pmbootstrap export

Without

pmbootstrap install

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)

Without FDE by default, the rootfs will be flashed to the system partition. This doesn't leave much free space for your applications / data, so if you don't mind factory resetting the device you can instead flash to the userdata partition by specifying the partition like below.

Warning WARNING: Do not reboot using the power button on the device! This can result in not all data being properly written to storage, corrupting the rootfs and resulting in strange behaviour like postmarketOS getting stuck during boot!
Note Always use fastboot reboot after flashing.

With FDE

By booting twrp from bootloader/fastboot mode you can do the partitioning.

If you install pmOS only to the slot b you can install twrp as recovery.
After partitioning you will need to format userdata in twrp.
You can install to both slots if you prefer.

In twrp (Android 11 version ie. 3.7.0) in Advanced->Terminal you can use sgdisk, it has long flags only e.g. --print and not -p.
Or you can use adb shell (when booted into twrp) to run these commands from your computer.

#Get userdata number and info on the disk
sgdisk /dev/block/sda --print

#Delete userdata partition to remake it smaller
sgdisk /dev/block/sda --delete=17

#Make userdata 2 gigabytes, minimum size unknown
sgdisk /dev/block/sda --new=0:0:+2G --change-name=0:userdata

#Make pmOS boot partition 256 megabytes (default size)
sgdisk /dev/block/sda --new=0:0:+256M --change-name=0:pmOS_boot

#Make pmOS system partition uses the rest of the disk
sgdisk /dev/block/sda --new=0:0:0 --change-name=0:pmOS_root
#Both slots
fastboot erase dtbo
fastboot flash pmOS_boot /tmp/postmarketOS-export/oneplus-enchilada-boot.img
fastboot flash pmOS_root /tmp/postmarketOS-export/oneplus-enchilada-root.img
fastboot flash boot /tmp/postmarketOS-export/boot.img
fastboot reboot

#Slot b only
fastboot erase dtbo_b
fastboot flash pmOS_boot /tmp/postmarketOS-export/oneplus-enchilada-boot.img
fastboot flash pmOS_root /tmp/postmarketOS-export/oneplus-enchilada-root.img
fastboot flash boot_b /tmp/postmarketOS-export/boot.img
fastboot set_active b
fastboot reboot

Without FDE

fastboot erase dtbo
pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher flash_kernel
pmbootstrap chroot fastboot reboot

If you have flashing or booting issues, try flashing the latest version of OxygenOS to the slot you want to install postmarketOS to (i.e., flash the ROM using 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 "<waiting for device>" message, then choose the "reboot bootloader" option on the device, press the power button to select that option and plug in the device while it reboots.

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.

See this quick and dirty tutorial on how to build the kernel.

Info

Hacking

See Hacking for details.

Partition map

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

Camera Flash

Two leds (yellow and white), both functionnal, at the back of the phone.

Their max brightness value is 255.

A simple extension for Gnome mobile adds a button to the activities overview : https://gitlab.com/NekoCWD/nekotorch

See LEDs for more details.

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.

  • 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
fastboot flashing unlock_critical
  • Run below commands to update firmware
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
  • If you are not able to write via fastboot, even after
    unlock_critical
    use edl mode instead (turn off phone, push volume +/- and plugin the usb cable):
 edl w abl_a abl.img 

and so on with all the mentioned files.

The big list of issues

In no particular order...

Audio in calls

There are issues with audio disappearing in calls.

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.

If you use Phosh with systemd, the tri-state button should work out-of-the-box (if pmaports!5969 is merged).

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.

See this matrix post by User:Caleb:

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

Note 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.

Host mode can be enabled by Dts method and Sysfs method.

Dts method

Install dtc and decompile the appropriate file for you device like so:

# apk add dtc
# cd /boot/dtbs/qcom
# dtc sdm845-oneplus-<model>.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:

# dtc temp.dts -o sdm845-oneplus-<model>.dtb
# mkinitfs
# reboot

To revert the changes just do the same thing again but change the line back to peripheral, kernel updates will also revert it.

Sysfs method

Change "device" to "host" in "/sys/kernel/debug/usb/a600000.usb/mode" :

# echo host | sudo tee /sys/kernel/debug/usb/a600000.usb/mode

To revert the changes just do the same thing again but change host to device or reboot the device.

Verify

Run the command as below to verify:

# sudo cat /sys/kernel/debug/usb/a600000.usb/mode

If the command return host then congratulation you have enabled the host mode successfully.

GPS

Warning WARNING: To use and test GPS functions, make sure a SIM card is inserted (mmcli v1.22.x), GPS is enabled in mmcli, geoclue is executed. Then disable suspend, go outside for 15min. until you get a fix

Carefully read Troubleshooting:GPS for more details on how to activate the GPS using ModemManager's CLI and enabeling Geoclue.


As discovered in this comment thread: if you want GPS to work, you may need to flash OxygenOS in a specific version, before flashing postmarketOS; 9.0.8 for OP6, 9.0.16 for OP6T. Its recommended to flash it to both slots (ie. use copy-partitions from LineageOS) although it is not proved that it is necessary.

Camera

It is possible to make it work since libcamera has everything in place and pre-installed on the OP6 images for basic support (like on Poco f1) once the required kernel bits for the IMX519 driver are upstreamed, see this patch as an example and see this branch where we are stuck.

The driver source is available here see also this.

Help and discussion can be found in sdm845-mainline!21 or on the matrix channel.

Listen pmOS podcast #34 for information (Sep 28 2023).

Wifi

Wifi works out of the box, until it doesn`t anymore. The whole modem goes offline at irregular intervals (minutes to weeks after a fresh boot).
One, or sometimes multiple reboots are required to get the modem working again.
See: #3486

Wifi monitor mode works, but requires reloading the driver with frame_mode=0 and enabling raw mode in firmware-5.bin. The commands to do this can be found here: [1]. Packet injection however does not work.

When creating a hotspot you might encounter the issue that you are not be able to connect to it. In this case, create it from command line with wifi-sec.pmf disabled:

nmcli dev wifi hotspot ifname wlan0 ssid hotspotname password "password"
nmcli c modify Hotspot 802-11-wireless-security.pmf 1
nmcli connection modify Hotspot wifi-sec.pmf disable

Sensors

Initial sensor support was added in pmaports!4050. Which works nice but constantly sucks 1-2% of CPU. To fix this we need your help.

NFC

As written here, NFC is working on OP6/OP6T devices.

sudo apk add dtc
cd /boot/dtbs/qcom
sudo dtc sdm845-oneplus-enchilada.dtb -o sdm845-oneplus-enchilada.dts
patch < NFC.patch
sudo dtc sdm845-oneplus-enchilada.dts -o sdm845-oneplus-enchilada.dtb
sudo reboot

get NFC.patch here.

More info by contacting User:Biemster or opening an issue in the repo

We just miss an userspace application and the libnfc-nci as Alpine package.

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/tee/op-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.

Battery/Power

While battery and charging are working, we sometimes get inaccurate power percentage values reported. In particular, if you have a replacement battery in your device, the BMS (battery management system) chip may differ from the original one, and the battery indicator may always show 100% and charging. In this case, the following might help:

You will decompile/edit/recompile your device tree blob (.dtb) file. Add the dtc package:

sudo apk add dtc
cd /boot/dtbs/qcom
sudo dtc sdm845-oneplus-enchilada.dtb -o temp.dts
sudo sed -i 's/bq27441/bq27541/' temp.dts
sudo sed -i 's/bq27411/bq27541/' temp.dts
sudo dtc temp.dts -o sdm845-oneplus-enchilada.dtb

Then run mkinitfs to incorporate the changes into your initramfs:

sudo mkinitfs

Charging on variable powersources like solarpanel/dynamo does not work as expected.

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 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 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.

Sim not appearing

Some SIM cards or modem firmwares might take longer to initialize. If the SIM card does not appear, but sudo qmicli -d qrtr://0 --uim-get-card-status shows that the card is present (Card state: 'present'), one possible solution is to increase the wait time for the SIM card to appear after starting the modem. Edit the file: /etc/conf.d/msm-modem-uim-selection and change: sim_wait_time=1 to sim_wait_time=30 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.

Countries Where Device Fails To Connect To Mobile Network

Australia - Since 3G closure this device is rejected due to SOS calls needing 3G network. See this forum for possible workarounds depending on the model of OnePlus 6: https://forums.whirlpool.net.au/archive/9m01z7np

Also see this issue tracker for VoLTE progress: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/1878

Renegade Project

Has support in main tree, can boot PostmarketOS.

See also OnePlus 6 (oneplus-enchilada)/Dual Booting and Custom Partitioning#Dual booting pmos with other uefi based os (like openbsd , netbsd , freebsd,windows,etc) via Renegade Project and Oneplus 6/6T Renegade Project Page

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

Footnotes