Postmarket OS是一個基於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 score | 840.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
鏡像源地址列表https://mirrors.postmarketos.org/ https://mirrors.alpinelinux.org/
zp@zp:~$ pmbootstrap --mirror-pmOS="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/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, nokia, oneplus, oppo, ouya, pine64, planet, purism, qemu, raspberry, samsung, semc, sharp, sony, surftab, t2m, tablet, teclast, tokio, trekstor, vernee, wexler, wiko, wileyfox, xiaomi, yu, zte, zuk
##選擇 設備的供應商和代碼
[07:03:29] Vendor [lg]:
[07:03:30] Available codenames (14): bullhead, d285, d722, d851, d855, dory, e610, h815, hammerhead, 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#帶有觸摸屏鍵盤支持的純幀緩沖控制台
[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="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/alpine/" install
中間會提示創建進入手機系統的新密碼
5.刷入手機
-
進入Fastboot Mode .在關閉設備電源的情況下,同時按住“降低音量”和“電源”按鈕幾秒鍾,直到出現“快速啟動模式”屏幕 並連接到電腦
-
解鎖OEM (已解鎖跳過)
sudo fastboot oem unlock
-
將系統刷入到手機
pmbootstrap --mirror-pmOS="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/alpine/" flasher flash_rootfs --partition userdata sudo fastboot format system pmbootstrap --mirror-pmOS="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/alpine/" flasher flash_kernel
6.Docker安裝
-
Docker內核配置 https://wiki.gentoo.org/wiki/Docker#Kernel
-
Docker由於是虛擬機比較特殊並不能直接運行,需要編輯內核
#編輯內核 qcom-msm8974代表的是芯片組Qualcomm MSM8974 其他手機需要自行對應
pmbootstrap --mirror-pmOS="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/alpine/" kconfig edit postmarketos-qcom-msm8974
#編譯
pmbootstrap --mirror-pmOS="http://postmarketos-mirror.southafricanorth.cloudapp.azure.com/" --mirror-alpine="http://mirrors.ustc.edu.cn/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支持 https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh
-
安裝Docker
sudo sed -i '$a\199.232.28.133 raw.githubusercontent.com' /etc/hosts wget https://raw.githubusercontent.com/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": [ "https://dockerhub.azk8s.cn", "https://reg-mirror.qiniu.com", "https://registry.docker-cn.com", "http://docker.mirrors.ustc.edu.cn", "http://hub-mirror.c.163.com" ] } 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 #https://wiki.alpinelinux.org/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 #.net core docker pull mcr.microsoft.com/dotnet/core/aspnet:3.1.11-buster-slim-arm32v7 docker pull mcr.microsoft.com/dotnet/core/aspnet:5.0.2-focal-arm32v7
-
參考
https://wiki.postmarketos.org/wiki/User_talk:Docker