安装编译依赖
这里使用Ubuntu22.04
1
| sudo apt install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache bison flex qtbase5-dev fastboot -y
|
内核源码及编译链
内核源码mianline建议选择release分支
编译链zyc_clang
pmbootstrap
安装pmbootstrap
1 2 3 4 5
| git clone https://gitlab.com/postmarketOS/pmbootstrap.git mkdir -p ~/.local/bin ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap export PATH="$HOME/.local/bin:$PATH" pmbootstrap --version
|
初始化,选项说明
编译内核
内核配置
1 2
| cp ~/.local/var/pmbootstrap/cache_git/pmaports/device/community/linux-postmarketos-sdm845/config-linux-postmarketos-qcom-sdm845.aarch64 arch/arm64/configs/defconfig
|
编译
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| export PATH="/home/mkr/Downloads/toolchains/zyc_clang/bin:${PATH}" make ARCH=arm64 CC=clang defconfig O=.output make ARCH=arm64 CC=clang menuconfig O=.output
make -j$(nproc --all) \ ARCH=arm64 \ O=.output \ CC=clang \ CROSS_COMPILE=aarch64-linux-gnu- \ CROSS_COMPILE_ARM32=arm-linux-gnueabi- \ AR=llvm-ar \ NM=llvm-nm \ OBJCOPY=llvm-objcopy \ OBJDUMP=llvm-objdump \ STRIP=llvm-strip \ LLVM=1 \ LLVM_IAS=1
pmbootstrap build --envkernel linux-postmarketos-qcom-sdm845
|
烧录
手机进入fastboot模式
1 2 3 4 5 6 7 8 9 10 11
| pmbootstrap flasher flash_kernel
pmbootstrap install --fde
fastboot erase dtbo pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap --mirror-pmOS=https://mirrors.aliyun.com/postmarketOS/ --mirror-alpine=https://mirrors.aliyun.com/alpine/ init pmbootstrap --mirror-pmOS=https://mirrors.aliyun.com/postmarketOS/ --mirror-alpine=https://mirrors.aliyun.com/alpine/ install
|