Install Archlinux on your OnePlus 6T, OnePlus 6 or pocophone f1!

This tutorial will help you install GNU/Linux on OnePlus 6T, OnePlus 6 or Mi Pocophone f1)

Other contributors:@BigfootACA @skr-niao @Redstoneeeeeee

We will take OnePlus 6T and Archlinux as an example

Supporting Status(click to expand)

For OnePlus 6T
What is working: touchscreen, LTE, SMS, Audio, UFS, Display, GPU, Battery, Charging, Bluetooth
Not working:Camera, GPS, NFC
Not fully working or untested: Call, Sensors, USB OTG


1 Compile Linux Kernel

1.1 Install dependencies

For Ubuntu 22.04 LTS:

sudo apt install build-essential openssl pkg-config libssl-dev libncurses5-dev pkg-config minizip libelf-dev flex bison  libc6-dev libidn11-dev rsync bc liblz4-tool  
sudo apt install gcc-aarch64-linux-gnu dpkg-dev dpkg git

1.2 Clone the source code

You can choose other branches.

mkdir ~/workspace
cd ~/workspace
git clone -b sdm845/5.18-release

1.3 Add tfa98xx module for OnePlus 6T(Optional)

OnePlus 6T has tfa9894 codec, so additional modules are needed.

1.3.1 Add tfa98xx source code

(Modyfied from
Extract it and then copy the inc and src folder to linux/sound/soc/codecs

1.3.2 Modify Makefile and Kconfig

cd ~/workspace/linux/sound/soc/codecs Modify Makefile
nano Makefile
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index fbd409148efb..2a8294abbd8b 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -244,6 +244,10 @@ snd-soc-tda7419-objs := tda7419.o
 snd-soc-tas2770-objs := tas2770.o
 snd-soc-tfa9879-objs := tfa9879.o
 snd-soc-tfa989x-objs := tfa989x.o
+snd-soc-tfa98xx-objs += src/tfa98xx.o
+snd-soc-tfa98xx-objs += src/tfa_container.o
+snd-soc-tfa98xx-objs += src/tfa_dsp.o
+snd-soc-tfa98xx-objs += src/tfa_init.o
 snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
@@ -587,6 +591,7 @@ obj-$(CONFIG_SND_SOC_TAS6424)       += snd-soc-tas6424.o
 obj-$(CONFIG_SND_SOC_TDA7419)  += snd-soc-tda7419.o
 obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o
 obj-$(CONFIG_SND_SOC_TFA9879)  += snd-soc-tfa9879.o
+obj-$(CONFIG_SND_SOC_TFA98XX) += snd-soc-tfa98xx.o
 obj-$(CONFIG_SND_SOC_TFA989X)  += snd-soc-tfa989x.o
 obj-$(CONFIG_SND_SOC_TLV320ADC3XXX)    += snd-soc-tlv320adc3xxx.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)      += snd-soc-tlv320aic23.o Modify Kconfig
nano Kconfig
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index edc090b38afb..39693c63a325 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -222,6 +222,7 @@ config SND_SOC_ALL_CODECS
        imply SND_SOC_TDA7419
        imply SND_SOC_TFA9879
        imply SND_SOC_TFA989X
+       imply SND_SOC_TFA98xx
        imply SND_SOC_TLV320ADC3XXX
        imply SND_SOC_TLV320ADCX140
        imply SND_SOC_TLV320AIC23_I2C
@@ -1534,6 +1535,16 @@ config SND_SOC_TFA989X
          Note that the driver currently bypasses the built-in "CoolFlux DSP"
          and does not support (hardware) volume control.

+config SND_SOC_TFA98XX
+        tristate "NXP/Goodix TFA98XX (TFA1) amplifiers"
+        depends on I2C
+        select REGMAP_I2C
+        help
+          Enable support for NXP (now Goodix) TFA98XX (TFA1 family) speaker
+          amplifiers, e.g. TFA98XX.
+          Note that the driver currently bypasses the built-in "CoolFlux DSP"
+          and does not support (hardware) volume control.
        tristate "Texas Instruments TLV320ADC3001/3101 audio ADC"
        depends on I2C

1.4 Generate .config

You may refer to arch/arm64/configs/sdm845.config and generate one yourself, but you can also directly use mine, just replacing arch/arm64/configs/defconfig with config-5.18.0-sdm845-00109-gf7ad1e5036bb-dirty.

Then generate .config

make ARCH=arm64 defconfig sdm845.config
# generate .config

1.5 Compile

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)

If you want to generate deb files for GNU/Linux based on Debian, use the following command:

make -j$(nproc) ARCH=arm64 KBUILD_DEBARCH=arm64 KDEB_CHANGELOG_DIST=mobile CROSS_COMPILE=aarch64-linux-gnu- deb-pkg
# This will generate several deb files in ../

2 Make rootfs

2.1 Download origin rootfs


cd ~/workspace

Index of /ubuntu-base

2.2 Customize

2.2.1 Enter chroot environment

sudo apt install qemu-user-static 
dd if=/dev/zero of=archlinux.img bs=1G count=6
mkfs.ext4 archlinux.img
mkdir arch
sudo mount archlinux.img arch
cd arch
sudo tar -xpvf ../ArchLinuxARM-aarch64-latest.tar.gz
cd ..
sudo mount --bind /dev arch/dev
sudo mount -t devpts devpts arch/dev/pts -o gid=5,mode=620
sudo mount -t proc proc arch/proc
sudo mount -t sysfs sysfs arch/sys
sudo mount -t tmpfs tmpfs arch/run

sudo chroot arch

2.2.2 initialize pacman keyring

pacman-key --init
pacman-key --populate archlinuxarm

2.2.3 Upgrade

pacman -Syyu
# upgrade

2.2.4 Remove old kernel and firmware

pacman -Q | grep -i linux
pacman -R linux-aarch64 linux-firmware linux-firmware-whence
# exit chroot environment

2.2.5 Install new kernel and firmware

First exit chroot environment



cd ~/workspace/linux
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-  INSTALL_MOD_PATH=~/workspace/arch modules_install
sudo make ARCH=arm64 INSTALL_PATH=../workspace/temp2/boot install

Download firmware modified for OnePlus 6T and OnePlus 6(I got them from mobian source and Debian source)
For pocophone f1, please download yourself( Index of /pool/non-free/f/ ( Index of /debian/pool/non-free/f/firmware-nonfree/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
You will got 3 deb files.
:warning: WARNING :warning:

sudo cp -r *.deb ~/workspace/arch/root/

To make audio in OnePlus 6T working, download tfa98xx.cnt .
Then copy it to rootfs

sudo cp tfa98xx.cnt ~/workspace/arch/root/

Then you can enter chrootenvironment , install firmware, then generate initial ramdisk.
See also mkinitcpio - ArchWiki (

sudo chroot ~/workspace/arch
cd ~
dpkg -i *.deb
mv ~/tfa98xx.cnt /usr/lib/firmware/
ls /usr/lib/modules
# get kernel version
mkinitcpio --generate /boot/initrd.img-5.18.0-sdm845-00109-gf7ad1e5036bb-dirty --kernel 5.18.0-sdm845-00109-gf7ad1e5036bb-dirty

2.2.6 Install software and do some basic configurations Set time zone

For Shanghai:

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# Shanghai Set locale

See also Locale - ArchWiki (

nano /etc/locale.gen
# uncomment en_US.UTF-8 UTF-8


image Cusomize hostname
# For example
echo 'OnePlus6T' > /etc/hostname alarm configuration

Change password for user alarm, then add it to group wheel

passwd alarm
# Change its password. Default is "alarm"

usermod -aG wheel alarm

Add sudo and set sudo property

pacman -S sudo
EDITOR=nano visudo

Find a line like this and delete the # .

#%wheel ALL=(ALL:ALL) ALL Some essential software
pacman -S base base-devel dhcpcd iwd
pacman -S grub efibootmgr

pacman -S networkmanager modemmanager
pacman -S bluez bluez-utils pulseaudio-bluetooth
pacman -S qrtr rmtfs
systemctl enable NetworkManager bluetooth qrtr-ns rmtfs 
systemctl enable ModemManager

pacman -S git wget
pacman -S ntfs-3g usbutils

Install pd-mapper and tqftpserv
Note:Default PKGBUILD contains some errors which we need to fix it manually. If you do not know how to, you can directly compile and install without using PKGBUILD.

Directly compile and install (Click to expand)
git clone
git clone

cd pd-mapper && make && make install && cd ..
cd tqftpserv && make && make install && cd ..

# clean
rm -rf tqftpserv pd-mapper

Using pkgbuild:

#switch to alarm
su alarm
cd ~
# Compile and Install pd-mapper
git clone ~/pd-mapper-git
cd ~/pd-mapper-git

# fix some errors
makepkg -si

#Compile and Install tqftpserv
git clone ~/tqftpserv-git
cd ~/tqftpserv-git

# fix some errors
makepkg -si
sudo systemctl enable tqftpserv pd-mapper

Return to root acoount

exit Add danctnix source

danctnix (

nano /etc/pacman.conf


Include = /etc/pacman.d/mirrorlist

Include = /etc/pacman.d/mirrorlist

Include = /etc/pacman.d/mirrorlist

Add information about danctnix source below

Server =$repo/$arch/

Add keyring then update

cd ~
pacman -U danctnix-keyring-2-1-any.pkg.tar.xz

pacman-key --init
pacman-key --populate danctnix

rm danctnix-keyring-2-1-any.pkg.tar.xz
# clean

pacman -Syy USB Networking

See also USB Networking · dreemurrs-embedded/Pine64-Arch Wiki (

pacman -Sy danctnix-usb-tethering
systemctl enable usb-tethering.service

Very useful function. For example it can help you to ssh to your phone through usb network. Other software


su alarm
git clone
cd yay-bin && makepkg -si

Desktop Environment

Gnome or phosh are recommended

pacman -S gnome
systemctl enable gdm

If you want phosh, danctnix source danctnix ( is needed

Web browser

# for example, chromium
pacman -S chromium

2.2.7 LTE configuration; Audio configuration for OnePlus 6T Modify Modemmanager

Compile ModemManager and install

su alarm
mkdir ~/modemmanager
cd ~/modemmanager

Copy contents of PKGBUILD - modemmanager (aarch64) | Package Files | Arch Linux ARM into PKGBUILD

Change arch=(x86_64) to arch=(x86_64 aarch64)
Delete -D plugin_qcom_soc=disabled

< arch=(x86_64)
> arch=(x86_64 aarch64)
<     -D plugin_qcom_soc=disabled
makepkg -rsi
# compile and install

cd ..
sudo rm -rf ~/modemmanager
systemctl enable ModemManager Fix Audio in OnePlus 6T

In chroot environment, downgrade alsa-ucm-conf to 1.2.4

cd ~
pacman -U alsa-ucm-conf-1.2.4-2-any.pkg.tar.zst
rm alsa-ucm-conf-1.2.4-2-any.pkg.tar.zst
# Downgrade alsa-ucm-conf to 1.2.4

Make sure that tfa98xx module loads

echo 'snd-soc-tfa98xx' > /etc/modules-load.d/snd-soc-tfa98xx.conf

2.2.7 Packaging

Clean temp files

pacman -Scc
# pacman

su alarm # switch to alarm
# clean bash history for alarm
cat /dev/null > ~/.bash_history && history -c && exit

# clean bash history for root
cat /dev/null > ~/.bash_history && history -c

exit chroot environment

cd ~/workspace
sudo umount ~/workspace/arch/run
sudo umount ~/workspace/arch/sys
sudo umount ~/workspace/arch/proc
sudo umount ~/workspace/arch/dev/pts
sudo umount ~/workspace/arch/dev

Use tar to package

cd ~/workspace/arch
tar -czvf ~/workspace/arch.tar.gz *
# This will generate arch.tar.gz

3 Install to your phone

3.1 Unlock bootloader and Install TWRP and Magisk

Unlock bootloader and Install TWRP and Magisk

3.2 Modify partitions

Connect your phone that has booted twrp to your computer

Copy parted to Internal Storage

On your computer, input:

adb shell
cp /sdcard/parted /sbin/ && chmod 755 /sbin/parted
umount /data && umount /sdcard
parted /dev/block/sda

For OnePlus 6T

resizepart 17
# input 61GB
mkpart esp fat32 61GB 62GB
mkpart arch ext4 62GB 125GB
set 18 esp on
# exit parted

Reboot to twrp and format some partition

adb shell
mkfs.fat -F32 -s1 /dev/block/by-name/esp
mke2fs -t ext4 /dev/block/by-name/arch
mke2fs -t ext4 /dev/block/by-name/userdata

3.3 Get UUID

Reboot to Android,input in termux

pkg install tsu
blkid /dev/block/by-name/arch

3.4 Prepare grub

Download grub template (78.5 KB)
boot.tar(1).gz (6.7 MB)

Replace uuid in grub.cfg with what you got in 3.3

3.5 Extract rootfs

Copy arch.tar.gz to internal storage

pkg update
pkg install tsu

# root permission needed
cd ~
mkdir temp
mount /dev/block/by-name/arch ~/temp

cd ~/temp
tar -xpvf /sdcard/arch.tar.gz
# extract

3.6 Install grub


cd ~
mkdir esp
mount /dev/block/by-name/esp esp
mkdir esp/EFI

Copy the 2 folders in to ~/esp/EFI/

# /dev/block/by-name/arch has been mounted!
cd ~/arch/boot && ls

Copy the 2 folders in boot.tar.gz to ~/arch/boot

3.7 Get and add dtb

According to arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi, we can not directly use dtb generated when compiling the kernel.

Part of arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi (click to expand)

/delete-node/ &rmtfs_mem;

/ {
	aliases {
		serial0 = &uart9;
		hsuart0 = &uart6;

	chosen {
		stdout-path = "serial0:115200n8"; /*line 30 in dtsi*/

	volume-keys {
		compatible = "gpio-keys";
		label = "Volume keys";

3.7.1 Get dtb

Download boot.img.xz for your phone and extract it

Here we use extract-dtb · PyPI to get dtb

pip3 install extract-dtb
extract-dtb 20220608-1408-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img -o .
# use your own img
# will generate something like 01_dtbdump_,OnePlus_6T.dtb

mv 01_dtbdump_,OnePlus_6T.dtb sdm845-oneplus-fajita.dtb

3.7.2 modify dtb to make it possible to support USB otg

#for Ubuntu 22.04 LTS
sudo apt install device-tree-compiler -y

dtc -I dtb -O dts -o temp.dts xxx.dtb
# e.g. dtc -I dtb -O dts -o temp.dts sdm845-oneplus-fajita.dtb

nano temp.dts

Search dr_mode

                        dwc3@a600000 {
                                compatible = "snps,dwc3";
                                reg = <0x00 0xa600000 0x00 0xcd00>;
                                interrupts = <0x00 0x85 0x04>;
                                iommus = <0x25 0x740 0x00>;
                                phys = <0xb8>;
                                phy-names = "usb2-phy";
                                dr_mode = "peripheral";
                                maximum-speed = "high-speed";

Change peripheral to host
Then generate new dtb:

dtc -I dts -O dtb -o xxx-host.dtb temp.dts
# e.g. dtc -I dts -O dtb -o sdm845-oneplus-fajita-host.dtb temp.dts
# generate modyfied dtb

copy two dtbs to /boot in rootfs
Then your usb otg might work

4 Flash UEFI

5 Enjoy!

Congratulations!!! You’ve installed Archlinux on your phone! WOW!! :grinning: :smiley: :smile:

5.1 ssh through USB network

ssh alarm@
# ssh allows you to control your phone!

5.2 coremark

yay -S coremark-git

5.3 unixbench

   BYTE UNIX Benchmarks (Version 5.1.3)

   System: : GNU/Linux
   OS: GNU/Linux -- 5.18.0-sdm845-00109-gf7ad1e5036bb-dirty -- #1 SMP PREEMPT Thu Jun 2 01:12:20 UTC 2022
   Machine: aarch64 (unknown)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0:  (38.4 bogomips)

   CPU 1:  (38.4 bogomips)

   CPU 2:  (38.4 bogomips)

   CPU 3:  (38.4 bogomips)

   CPU 4:  (38.4 bogomips)

   CPU 5:  (38.4 bogomips)

   CPU 6:  (38.4 bogomips)

   CPU 7:  (38.4 bogomips)

   08:08:45 up 4 min,  3 users,  load average: 0.23, 0.15, 0.07; runlevel

Benchmark Run: Wed Jun 15 2022 08:08:45 - 08:36:48
8 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       31371686.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     6636.9 MWIPS (9.9 s, 7 samples)
Execl Throughput                               3464.7 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        431850.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          212468.6 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1100792.9 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1189114.2 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  16156.4 lps   (10.0 s, 7 samples)
Process Creation                               1880.5 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   1267.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    928.5 lpm   (60.0 s, 2 samples)
System Call Overhead                         904143.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   31371686.9   2688.2
Double-Precision Whetstone                       55.0       6636.9   1206.7
Execl Throughput                                 43.0       3464.7    805.7
File Copy 1024 bufsize 2000 maxblocks          3960.0     431850.5   1090.5
File Copy 256 bufsize 500 maxblocks            1655.0     212468.6   1283.8
File Copy 4096 bufsize 8000 maxblocks          5800.0    1100792.9   1897.9
Pipe Throughput                               12440.0    1189114.2    955.9
Pipe-based Context Switching                   4000.0      16156.4     40.4
Process Creation                                126.0       1880.5    149.2
Shell Scripts (1 concurrent)                     42.4       1267.7    299.0
Shell Scripts (8 concurrent)                      6.0        928.5   1547.5
System Call Overhead                          15000.0     904143.8    602.8
System Benchmarks Index Score                                         687.6

Benchmark Run: Wed Jun 15 2022 08:36:48 - 09:05:10
8 CPUs in system; running 8 parallel copies of tests

Dhrystone 2 using register variables      157010560.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    38380.8 MWIPS (9.5 s, 7 samples)
Execl Throughput                              14684.0 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        775566.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          247697.5 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1947686.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                             6462292.1 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 535021.4 lps   (10.0 s, 7 samples)
Process Creation                              21863.7 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  12727.2 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1865.6 lpm   (60.1 s, 2 samples)
System Call Overhead                        4647127.5 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  157010560.9  13454.2
Double-Precision Whetstone                       55.0      38380.8   6978.3
Execl Throughput                                 43.0      14684.0   3414.9
File Copy 1024 bufsize 2000 maxblocks          3960.0     775566.4   1958.5
File Copy 256 bufsize 500 maxblocks            1655.0     247697.5   1496.7
File Copy 4096 bufsize 8000 maxblocks          5800.0    1947686.0   3358.1
Pipe Throughput                               12440.0    6462292.1   5194.8
Pipe-based Context Switching                   4000.0     535021.4   1337.6
Process Creation                                126.0      21863.7   1735.2
Shell Scripts (1 concurrent)                     42.4      12727.2   3001.7
Shell Scripts (8 concurrent)                      6.0       1865.6   3109.4
System Call Overhead                          15000.0    4647127.5   3098.1
System Benchmarks Index Score                                        3187.6

[alarm@OnePlus6T UnixBench]$


5.5 LTE、SMS and phone call test

【sn】你甚至可以用Linux收发短信和4G上网!一加6t手机原生运行Archlinux,新增LTE支持(kernel 5.17.7))_哔哩哔哩_bilibili

Special Thanks to @moderators

Is the archlinux boot selection supposed to automatically be found? or do you have to add it some how. Im unable to find a way to get it to boot. Im able to go to the “boot linux” option in edk2 and launch grub but when it launches it complains about being unable to find “,gpt19”

Sorry, but I have never encountered this problem. Maybe you can try to replace “gpt19” with the partition number of Arch partition. Besides, you ought to replace the uuid in the grub.cfg. If it still cannot boot, you may try to copy the vmlinuz and initrd to a fat32 partition like esp or logfs and use SimpleInit to boot it. (See
You can also turn to @BigfootACA for help, he’s expert! :joy:

Thank you I’ll give it a shot. I did do one thing differently though. Instead of using blkid from termux i ran it in the adb shell because i didnt have android installed on the device. The weird part is that the partition number is gpt19 lol. I will shoot him a message if I cant figure it out. Thank you!