请同时参考在骁龙(835 845 855等)设备通过UEFI运行Archlinux - Linux - Renegade Project (renegade-project.cn)
本篇以一加6T(fajita)(sdm845)为例
1.制作rootfs
1.1 下载
https://cdimage.ubuntu.com/ubuntu-base/
选择自己喜欢的版本,这边使用Ubuntu 22.04 LTS
cd ~/workspace
wget https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04.1-base-arm64.tar.gz
1.2 制作
1.2.1 进入chroot
sudo apt install qemu-user-static
cd ~/workspace
dd if=/dev/zero of=ubuntu.img bs=1G count=6
mkfs.ext4 ubuntu.img
mkdir ubuntu
sudo mount ubuntu.img ubuntu
cd ubuntu
sudo tar -xpvf ../ubuntu-base-22.04.1-base-arm64.tar.gz
cd ..
sudo mount --bind /dev ubuntu/dev
sudo mount -t devpts devpts ubuntu/dev/pts -o gid=5,mode=620
sudo mount -t proc proc ubuntu/proc
sudo mount -t sysfs sysfs ubuntu/sys
sudo mount -t tmpfs tmpfs ubuntu/run
sudo rm -rf ubuntu/etc/resolv.conf && sudo cp /etc/resolv.conf ubuntu/etc/
sudo chroot ubuntu
1.2.2 基础配置
apt update
apt install ca-certificates dialog locales nano apt-utils -y
然后可以换源并更新系统
nano /etc/apt/sources.list
apt update
apt upgrade -y
设置locales
locale-gen en_US.UTF-8
locale-gen zh_CN.UTF-8
设置hostname(内容随意)
echo 'OnePlus6T' > /etc/hostname
安装基本软件包
apt install man-db sudo openssh-server net-tools network-manager iputils-ping bash-completion kmod busybox-initramfs cpio initramfs-tools initramfs-tools-bin initramfs-tools-core linux-base netplan.io git --no-install-recommends -y
exit
1.2.3 安装firmware和内核
内核需要自行编译或下载成品,详见 在骁龙(835 845 855等)设备通过UEFI运行Archlinux - Linux - Renegade Project
sudo cp -r *.deb ~/workspace/ubuntu/root/
下载为一加6和一加6T定制的firmware(来自mobian源和Debian源)( Index of /pool/non-free/f/ (mobian.org) )( Index of /debian/pool/non-free/f/firmware-nonfree/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror )
https://stor.classfun.cn:4443/s/0Nsa
对于其它设备,如果有PostmarketOS
/Mobian
支持,可以从中直接提取(/lib/firmware/
目录下所有文件)
sudo cp -r *.deb ~/workspace/ubuntu/root/
如果要启用一加6T的声音,下载(GitHub - J0SH1X/tfa98xx )中的 tfa98xx.cnt
复制入rootfs
sudo cp tfa98xx.cnt ~/workspace/ubuntu/root/
重新进入chroot环境
sudo chroot ~/workspace/ubuntu
nano /usr/share/initramfs-tools/hooks/qcom-firmware
对于一加6T,填入以下内容
这两个固件的来源一般是手机提取并放在特殊的位置加载(具体由dts/dtsi
指定)
#!/bin/sh
set -e
PREREQS=""
case $1 in
prereqs) echo "${PREREQS}"; exit 0;;
esac
. /usr/share/initramfs-tools/hook-functions
add_firmware qcom/sdm845/oneplus6/a630_zap.mbn
add_firmware qcom/sdm845/oneplus6/ipa_fws.mbn
设置权限
chmod +x /usr/share/initramfs-tools/hooks/qcom-firmware
安装内核和固件
cd ~
dpkg -i *.deb
mv ~/tfa98xx.cnt /usr/lib/firmware/
ldconfig
清理
rm -rf /root/*.deb
1.2.4 安装qrtr/rmtfs/pd-mapper/tqftpserv
https://stor.classfun.cn:4443/s/l1un
解压zip得到几个deb
在chroot环境安装
dpkg -i *.deb
apt --fix-broken install
systemctl enable qrtr-ns tqftpserv rmtfs pd-mapper
1.2.5 安装喜欢的桌面环境
apt install ubuntu-desktop-minimal
# apt install phosh-core --no-install-recommends
# systemctl enable phosh
1.2.6 创建新账号
adduser fajita
usermod -aG sudo fajita
usermod -aG adm fajita
usermod -aG dialout fajita
usermod -aG cdrom fajita
usermod -aG floppy fajita
usermod -aG audio fajita
usermod -aG dip fajita
usermod -aG video fajita
usermod -aG plugdev fajita
1.2.7 修复一加6系列的音频
echo 'snd-soc-tfa98xx' > /etc/modules-load.d/snd-soc-tfa98xx.conf
cd
git clone https://gitlab.com/sdm845-mainline/alsa-ucm-conf.git -b op6-earpiece
cd /usr/share/alsa
rm -rf ucm*
cp -r ~/alsa-ucm-conf/ucm* .
rm -rf /root/alsa-ucm-conf
apt-mark hold alsa-ucm-conf
1.2.8 修复LTE
TODO
1.2.9 时间同步
apt install ntp -y