pmos编译
直接编译
https://www.cnblogs.com/x383494/p/18304008
https://mp.weixin.qq.com/s/Wb1sybyzAudTIfxBXxWmiQ
https://yzddmr6.com/posts/android-run-docker/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| git clone --depth=1 https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
mkdir -p ~/.local/bin
ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap
vim ~/.zshrc # bash换成.bashrc
===
PATH="$HOME/.local/bin:$PATH"
===
source ~/.zshrc
pmbootstrap --version
# 设置镜像源
# 3.x alpha设置镜像, 不稳定, 改为2.3
# pmbootstrap config mirrors.alpine https://mirrors.tuna.tsinghua.edu.cn/alpine/
# pmbootstrap config mirrors.pmaports https://mirrors.tuna.tsinghua.edu.cn/postmarketOS/
# 拉取最新的配置列表和文件
pmbootstrap pull
# 设置型号
pmbootstrap init
# 2.设置加速源
pmbootstrap --mirror-pmOS https://mirrors.tuna.tsinghua.edu.cn/postmarketOS/ --mirror-alpine https://mirrors.tuna.tsinghua.edu.cn/alpine/ init
# 编译安卓刷机包
pmbootstrap install
# 参数
# 生成安卓刷机包
--android-recovery-zip
# 制定安装分区, 例如/分区太小时添加
--recovery-install-partition=data
# 分区格式
--filesystem btrfs
# 导出刷机包
pmbootstrap export
# 找到刷机包的位置, 在work目录执行
cd /tmp/postmarketOS-export
# 刷入zip的方法
先进入twrp,然后unmount所有的分区,再进行sideload刷入
adb sideload pmos-xiaomi-sagit.zip
# 生成的img位置
# 进入work目录
# rootfs
cd ./chroot_native/home/pmos/rootfs
# config boot.img lk2nd.img
./chroot_rootfs_型号/boot
# 监控Í日志
pmbootstrap log
# 清理构建缓存
pmbootstrap zap
# 针对某个包
pmbootstrap zap --package linux-postmarketos-qcom-msm8998
|
1
2
3
4
5
6
| # 解包
bootimg.cfg:boot 分区配置信息,内核启动参数
config:默认内核编译配置
firmware:启动加载必须的驱动固件文件
abootimg -x boot.img
mv 命令复制 initrd.img 为 initrd.img.gz,然后使用解压命令
|
修改内核选项
https://www.twblogs.net/a/601638e4e64365bb610bbf47/?lang=zh-cn
https://ivonblog.com/posts/xperia5-ii-postmarketos-porting/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # cd ~/.local/var/pmbootstrap/cache_git/pmaports/device
# find . -name '*mido*'
# ~/.local/var/pmbootstrap/cache_git/pmaports/device/community/device-xiaomi-mido
# 查看APKBUILD: linux-postmarketos-qcom-msm8953 lk2nd-msm8953 mkbootimg postmarketos-base soc-qcom-msm8953
# find . -name '*8953*'
# ./community/linux-postmarketos-qcom-msm8953/config-postmarketos-qcom-msm8953.aarch64
# 代理要开tun模式, proxy下不动
pmbootstrap kconfig edit --arch=aarch64 linux-postmarketos-qcom-msm8953
# smb挂载 需要cifs 和 utf8
pmbootstrap build linux-postmarketos-qcom-msm8953 --force --arch=aarch64
# 生成路径
# ~/.local/var/pmbootstrap/packages/edge/aarch64/
|
pom登录后的设置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| sudo -i//提权操作
passwd root //设置root账户密码,但是此时root远程连接默认关闭
nmtui //链接wifi,如果链接不成功,手机在安卓系统升级到第三方高版本,再重新刷入
setup-ntp #回车直接使用 chrony 同步时间
date #查看时间同步成功再使用apk update,因为使用的是ustc https的镜像站,时间不对更新不了,安装不了
# 启动sshd
sudo service sshd start
sudo rc-update add sshd
# 换源 https://mirrors.tuna.tsinghua.edu.cn/help/alpine/
/etc/apk/repositories
===
https://mirrors.tuna.tsinghua.edu.cn/alpine/latest-stable/main
https://mirrors.tuna.tsinghua.edu.cn/alpine/latest-stable/community
===
apk update
# 开启root用户登录
echo -e "PermitRootLogin yes\nPasswordAuthentication yes" >> /etc/ssh/sshd_config&&service sshd restart
# 关闭防火墙
sudo service nftables stop
sudo rc-update del nftables
# 安装Docker
apk update
apk upgrade
apk add docker
addgroup $USER docker
rc-update add docker boot
service docker start
docker info
echo -e 'sleep 10&&sudo dockerd --iptables=false &>/dev/null &' >> /etc/rc.conf
|
新版pmos rndis用不了
https://postmarketos.org/edge/2023/10/29/rndis-ncm/
ncm改回rndis
1
2
3
4
5
| vim /etc/deviceinfo
===
deviceinfo_usb_network_function="rndis.usb0"
===
sudo mkinitfs
|
提取
1
| pmbootstrap pull 容器路径 本地路径
|
在工作目录的 chroot_native
降级
查看pmaports上对应文件夹的变更记录 https://gitlab.com/postmarketOS/pmaports/-/commits/master/device/testing/firmware-xiaomi-sagit?ref_type=heads
仓库迁移了, 新的记录在 https://gitlab.postmarketos.org/postmarketOS/pmaports/-/commits/master/device/testing/device-xiaomi-sagit?ref_type=heads
1
2
3
| # 进work目录
# 先降级 `./pmbootstrap/cache_git/pmaports`
# 查看`pmaports.cfg`需要`pmbootstrap`的版本, 再降级`pmbootstrap`
|
- firmware-xiaomi-sagit: support new mkintifs paths (MR 3895)
073e26136091c01a86d1a7e53a68259451d6d5a8
- xiaomi-sagit: fix initramfs module list and blacklist ipa module (MR 3644)
c18d2da154458fd0ab3ad523a81bbf019305e5c0
还是用的github主线
- xiaomi-sagit: new device (Xiaomi Mi6) (MR 3134)
341e959e45ae95f32a9d4f6b304d7b60055491b2
更换驱动和内核
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| # 在pmaports目录
# 修改内核
cd device/testing/linux-postmarketos-qcom-msm8998
# 修改 APKBUILD
# 修改内核github仓库的地址
# 修改xxx.aarch64
# 修改sha512sums: shasum -a 512 config-postmarketos-qcom-msm8998.aarch64
# 内核可以下到本地再放到该目录下, 路径改为本地相对路径, 注意build指定的路径和压缩包解压后的名称
# 修改内核名称
pkgver=5.16.0
_config="config-sagit.$arch"
makedepends="
bash
bison
findutils
flex
linux-headers
openssl-dev
perl
postmarketos-installkernel
xz
zstd
"
source="
msm8998-mainline-sagit.tar.zst
$_config
"
builddir="$srcdir/msm8998-mainline-sagit"
prepare() {
default_prepare
cp "$srcdir/config-sagit.$arch" .config
}
sha512sums="
7e282e81f3efc4abda46caaaa351971a254a0ffdac45364facb2d6fecaae3ff3d315f310ba7070e46a4cd757e1f829b42d7dd5e2bc6d7ecac4f1be3f0fe5f4f2 msm8998-mainline-sagit.tar.zst
b9058996ac52fa09d41663db6405052d99abeb42293db5d2d4a56fc5c4fb95c5a76300bbe30250a34c19c43b2c6d7ccfd2eefbb932ec07eee95d78c5c1d8b192 config-sagit.aarch64
"
CONFIG_LOCALVERSION
|
device-xiaomi-sagit
linux-postmarketos-qcom-msm8998
本地重新编译旧的内核和驱动
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| pmbootstrap build --arch aarch64 --force device-xiaomi-sagit
pmbootstrap build --arch aarch64 --force linux-postmarketos-qcom-msm8998
# 进入工作目录,搜到编译后的apk
sudo find -name '*device-xiaomi-sagit*.apk'
# 删掉不需要的版本
# 然后进入chroot
pmbootstrap chroot -r
# 查看已安装的版本
apk list | grep linux-postmarketos-qcom-msm8998
# 卸载
apk del --purge linux-postmarketos-qcom-msm8998
# 安装指定版本
apk add linux-postmarketos-qcom-msm8998=5.16.0-r0
# 后面install的时候虽然还提示安装新的, 但并不会替换
|
删除init里的设置
~/.config/pmbootstrap.cfg
故障排查
https://wiki.postmarketos.org/wiki/Troubleshooting