Nexus5安装PostmarketOS(AlpineLinux)并装上Docker
是⼀个基于Alpine Linux。能够安装到⼿机或其他移动设备上。当然linux deploy也可以使⽤SSH,但linux deploy运⾏在容器⾥.使⽤上会有些限制.
Nexus5 硬件信息
芯⽚组Qualcomm MSM8974 Snapdragon 800
中央处理器4x2.3 GHz Krait 400
显卡Adreno330
屏幕1080x1920 IPS
存储16/32 GB
内存  2 GB
处理器架构armv7
Unixbench Whe / Dhry score840.9
1.准备环境
科*学( 环境(最好路由器⽀持,实测ProxyChains只能部分代理)
Ubuntu系统 (或虚拟机注:Windosw⼦系统WSL不能⼯作,实测alpine ,suse Centos 安装会出其他莫名问题)
python(>=3.6) pip3 git
sudo apt install python3 git fastboot
sudo python3.8 -m easy_install pip #pyhton3.8以下版本可⽤ sudo apt install python3-pip
2.安装pmbootstrap
安装
pip3 install --user pmbootstrap
更新
pip3 install --user --upgrade pmbootstrap
安装后需要注销并重新登陆刷新path
pmbootstrap log #查看⽇志记录
pmbootstrap pull#更新
3.初始化 pmbootstrap init
镜像源地址列表/
zp@zp:~$ pmbootstrap --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/" init
[07:03:26] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
##设置⼯作路径确保该位置有⼏个GB的可⽤空间,并且它是⼀个相对标准的Linux⽂件系统
[07:03:26] Work path [/home/zp/.local/var/pmbootstrap]:
[07:03:27] NOTE: pmaports path: /home/zp/.local/var/pmbootstrap/cache_git/pmaports
[07:03:27] Choose the postmarketOS release channel.
[07:03:27] Available (2):
[07:03:27] * edge: Rolling release channel
[07:03:27] * stable: Stable release channel (first beta v20.05, does not have many devices yet)
##选择更新通道 Stable稳定版  edge 滚动更新版
[07:03:27] Channel [edge]:
[07:03:29] Choose your target device vendor (either an existing one, or a new one for porting).
[07:03:29] Available vendors (55): acer, alcatel, amazon, arrow, asus, bq, chuwi, cubietech, essential, fairphone, finepower, fly, fujitsu, google, gp, hisense, htc, huawei, infocus, jolla, leeco, lenovo, lg, medion, meizu, motorola, nextbit, nobby, no ##选择设备的供应商和代码
[07:03:29] Vendor [lg]:
[07:03:30] Available codenames (14): bullhead, d285, d722, d851, d855, dory, e610, h815, hammerhe
ad, lenok, mako, p700, vee7e, w5
##nexus5 是hammerhead
[07:03:30] Device codename [hammerhead]:
[07:03:33] This device has proprietary components, which trade some of your freedom with making more peripherals work.
[07:03:33] We would like to offer full functionality without hurting your freedom, but this is currently not possible for your device.
[07:03:33] device-lg-hammerhead-nonfree-firmware: WiFi, GPU, Modem and ADSP firmware
##是否安装 Wifi GPU Modem 等驱动
[07:03:33] Enable this package? (y/n) [y]:
##设备登陆⽤户名
[07:03:35] Username [xx]: lg3
[07:03:41] Available user interfaces (13):
#⽤户界⾯
[07:03:41] * none: No graphical environment #⽆图形环境
[07:03:41] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support#带有触摸屏键盘⽀持的纯帧缓冲控制台bootstrap 5
[07:03:41] * gnome: (Wayland) Gnome Shell
[07:03:41] * i3wm: (X11) Tiling WM (keyboard required)#(需要键盘)
[07:03:41] * mate: (X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)#MATE桌⾯环境,GNOME2的分⽀(建议使⽤⼿写笔)
[07:03:41] * phosh: (Wayland) Mobile UI developed for the Librem 5 (works only with numeric passwords!)#为Librem 5开发的移动UI(仅适⽤于数字密码!)
[07:03:41] * plasma-bigscreen: (Wayland) 10-feet variant of Plasma, made for big screen TVs#⽤于⼤屏幕电视
[07:03:41] * plasma-desktop: (X11/Wayland) KDE Desktop Environment (works well with tablets)#KDE桌⾯环境(与平板电脑配合使⽤)
[07:03:41] * plasma-mobile: (Wayland) Mobile variant of KDE Plasma (does not run without hardware acceleration, allows only numeric passwords!)#(在没有硬件加速的情况下不能运⾏,仅允许输⼊数字密码!)
[07:03:41] * shelli: Plain console with touchscreen gesture support#带有触摸屏⼿势⽀持的普通控制台
[07:03:41] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION!)#(不能在没有硬件加速的情况下运⾏!)
[07:03:41] * sxmo: (X11) Simple X Mobile: Mobile environment based on simple & suckless software (best compatibility on pinephone)
[07:03:41] * weston: (Wayland) Reference compositor (demo, not a phone interface)
[07:03:41] * xfce4: (X11) Lightweight desktop (stylus recommended)
#选择Gui fbkeyboard 其他图形界⾯不推荐,太卡
[07:03:41] User interface [weston]: fbkeyboard
#除⾮您知道要更改某些内容,否则只需按⼀下return键即可在此处使⽤默认值进⾏回答
[07:03:48] Additional options: extra free space: 0 MB, boot partition size: 128 MB, parallel jobs: 3, ccache per arch: 5G, sudo timer: False
[07:03:48] Change them? (y/n) [n]:
[07:03:51] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[07:03:51] Extra packages [none]:
[07:03:52] Your host timezone: Etc/UTC
[07:03:52] Use this timezone instead of GMT? (y/n) [y]:
[07:03:54] Available locales (14): C.UTF-8, ch_DE.UTF-8, de_CH.UTF-8, de_DE.UTF-8, en_GB.UTF-8, en_US.UTF-8, es_ES.UTF-8, fr_FR.UTF-8, it_IT.UTF-8, nb_NO.UTF-8, nl_NL.UTF-8, pt_BR.UTF-8, ru_RU.UTF-8, sv_SE.UTF-8
[07:03:54] Choose default locale for installation (y/n) [C.UTF-8]:
#安装后⼿机显⽰的计算机名
[07:03:54] Device hostname (short form, e.g. 'foo') [lg-hammerhead]:
[07:03:56] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[07:03:56] Build outdated packages during 'pmbootstrap install'? (y/n) [y]:
[07:03:56] WARNING: The chroots and git repositories in the work dir do not get updated automatically.
[07:03:56] Run 'pmbootstrap status' once a day before working with pmbootstrap to make sure that everything is up-to-date.
[07:03:56] Done!
4.初始化安装pmbootstrap install
执⾏pmbootstrap install 并等待执⾏完成(需要漫长等待,可以通过pmbootstrap log 查看详细⽇志,如果中断可以重新重试)
pmbootstrap --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/" install
中间会提⽰创建进⼊⼿机系统的新密码
5.刷⼊⼿机
进⼊Fastboot Mode .在关闭设备电源的情况下,同时按住“降低⾳量”和“电源”按钮⼏秒钟,直到出现“快速启动模式”屏幕并连接到电脑
解锁OEM (已解锁跳过)
sudo fastboot oem unlock
将系统刷⼊到⼿机
pmbootstrap --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/"  flasher flash_rootfs --partition userdata
sudo fastboot format system
pmbootstrap  --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/"  flasher flash_kernel
6.Docker安装
Docker内核配置
Docker由于是虚拟机⽐较特殊并不能直接运⾏,需要编辑内核
#编辑内核 qcom-msm8974代表的是芯⽚组Qualcomm MSM8974  其他⼿机需要⾃⾏对应
pmbootstrap  --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/"  kconfig edit postmarketos-qcom-msm8974
#编译
pmbootstrap  --mirror-pmOS="postmarketos-mirror.southafricanorth.cloudapp.azure/"  --mirror-alpine="mirrors.ustc.edu/alpine/"  build linux-postmarketos-qcom-msm8974 --force 编译后⽂件~/.local/var/pmbootstrap/packages/edge/armv7/linux-postmarketos-qcom-msm8974***.apk
通过 sudo apk add -u linux-postmarketos-qcom-msm8974-5.9.0_rc4-r0.apk (此⽅法我⼿机安装后重启并未⽣效,直接重新执⾏ 3,4,5 步骤重新刷⼊系统⽣效)
检Docker⽀持
安装Docker
sudo sed  -i '$a\199.232.28.133 raw.githubusercontent' /etc/hosts
wget raw.githubusercontent/moby/moby/master/contrib/check-config.sh
chmod 777 check-config.sh
./check-config.sh
#安装Docker
sudo apk add docker
#启动docker服务
sudo service docker start
#设置为⾃动启动
sudo rc-update add docker default
#创建docker⽤户组并把⽤户加⼊组
sudo groupadd docker
#把⽤户添加进docker组中
sudo gpasswd -a ${USER} docker
#重启
sudo reboot
#docker 加速
sudo vi /etc/docker/daemon.json
{
"registry-mirrors": [
"dockerhub.azk8s",
"reg-mirror.qiniu",
"registry.docker-cn",
"docker.mirrors.ustc.edu",
"163"
]
}
docker run --rm hello-world
7.其他说明
使⽤poweroff 并不能完全关机,得进⼊快速模式下关机,开机也⼀样
系统⾃带⼀个usb⽹卡,通过电脑与⼿机连接,电脑⾃动获取Ip地址,就可以通过usb连接到⼿机
使⽤Usb⽹卡不识别时. 可以先在电脑上查询对应的USB芯⽚是什么在编辑内核 Device Drivers => Network device support => <*> USB Network Adapters 中勾选对应USB ⽹卡驱动apk
docker 运⾏时需要选择基于arm的镜像
相机还不能正常⼯作
apk软件包中的openjdk8不建议使⽤,有性能bug,Docker中使⽤都⽐较快
其他常⽤软件
sudo apk add python3 py3-pip openjdk8 screen htop unrar curl
sudo apk add mysql mysql-client
#/wiki/Mysql
sudo apk add jenkins
#sudo service jenkins start
#sudo rc-update add jenkins default
#我的世界服务器
docker run --rm -e EULA=TRUE -it -p 25565:25565  -v ~/mcdata:/data --name mc2 janbe/minecraft-server:multiarch
# core
docker pull mcr.microsoft/dotnet/core/aspnet:3.1.11-buster-slim-arm32v7
docker pull mcr.microsoft/dotnet/core/aspnet:5.0.2-focal-arm32v7
参考

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。