OnePlus OnePlus 3
Manufacturer

OnePlus

Name

OnePlus 3

Identifier

oneplus-oneplus3

System Type

android

SoC

qualcomm-msm8996

Architecture

aarch64-linux

Supports Stage-0

no

Source

Mobile NixOS repository

Builds

Hydra (default build)

Building and installing

There are multiple installation methods for your OnePlus OnePlus 3. They all rely on flashing one or more partitions on your device.

Warning

All installation methods can lead to data loss.

Flashing a partition will erase everything on the partition. Additionally, the common backups methods, e.g. TWRP, will not backup the userdata partition, which may be the installation target.

Make backups.

Using Fastboot

This will produce a folder with a flashing script, and the partition images for your OnePlus OnePlus 3.

$ nix-build --argstr device oneplus-oneplus3 -A build.android-fastboot-images

Alternatively, you can build a specific partition image:

$ nix-build --argstr device oneplus-oneplus3 -A build.android-bootimg
$ nix-build --argstr device oneplus-oneplus3 -A build.rootfs

The device will need to be booted in its bootloader, or fastboot, mode.

The boot images can be installed using the following command, assuming the android-fastboot-images output was used.

$ result/flash-critical.sh

If you have a system image (system.img) built, you can use fastboot to flash it to the device. Note that it might be too big to fit over the system partition. In such case, it can be flashed on the userdata partition.

$ fastboot flash userdata system.img

Using a flashable zip

An alternative installation method is to use a flashable zip. The flashable zip can be built for your OnePlus OnePlus 3 using one of the following commands:

$ nix-build --argstr device oneplus-oneplus3 -A build.android-flashable-bootimg
$ nix-build --argstr device oneplus-oneplus3 -A build.android-flashable-system
$ nix-build --argstr device oneplus-oneplus3 -A build.android-flashable-zip

The first two will flash only a specific partition. The last one contains the partitions of the two previous one.

The zip can either be copied to the device and selected in a compatible Android recovery, or sent to the device through adb sideload.

$ adb sideload /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-flashable-oneplus-oneplus3-boot.zip

By default it will flash to the system partition. Some configurations may change this to flash to the userdata partition. In that case, no warning is given before flashing.

Device-specific notes

rootfs installation

Using fastboot to burn system.img to the userdata partition will fail.

It seems like it flashes successfully like other devices do, but the flashed image will not boot.

The current workaround is to use the flashable zip for the system image, or for the full device install.

Alternatively, fastboot boot TWRP and use dd through adb to flash the image.

 $ cat .../.system.img | adb shell dd of=/dev/block/by-name/userdata bs=8m

Firmware for Wi-Fi

This particular phone keeps the firmware files on a partition named modem.

To make use of the Wi-Fi capabilities of this phone you will need to make them available to the firmware derivation.

The files can be acquired through different methods. You can use an alternate recovery like TWRP, mount the partition (identified using blkid) and copy the files.

Another way is to do it using an installed Mobile NixOS system, where, too, you mount the partition and copy them:

$ sudo mount -o ro /dev/disk/by-partlabel/modem /mnt
$ cp -r /mnt ./modem
$ sudo umount /mnt

The copy of the firmware files will be in the modem directory, in the current working directory, ready to be referred to.