351 lines
8.1 KiB
Markdown
351 lines
8.1 KiB
Markdown
# qubot BPI-M2C UniSoc SDK 設定紀錄
|
||||
|
|
|
|||
|
|
紀錄時間:2026-06-02 14:48 CST
|
|||
|
|
|
|||
|
|
## 目的
|
|||
|
|
|
|||
|
|
讓 `ssh qubot` 這台機器可以在:
|
|||
|
|
|
|||
|
|
`/home/qubot/bpi/BPI-M2C/sync-20260524`
|
|||
|
|
|
|||
|
|
下載並編譯本機已驗證過的 BPI-M2C UniSoc SDK 來源,來源對齊:
|
|||
|
|
|
|||
|
|
`/media/pi/SMCI/bpi/unisoc/sync-20260524/source_sync_rls_25c`
|
|||
|
|
|
|||
|
|
## 使用的 SDK 來源
|
|||
|
|
|
|||
|
|
選用 `sync-20260524/source_sync_rls_25c`,不是 trunk。
|
|||
|
|
|
|||
|
|
repo manifest 設定:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
MANIFEST_URL=https://git.unisoc.com/gerrit/platform/cus-manifest
|
|||
|
|
MANIFEST_BRANCH=bananapi/unc_linux_rls_25c
|
|||
|
|
MANIFEST_FILE=default.xml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
對應本機已成功出 PAC 的 build target:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
./build.sh uis7885_2h10+wayland+wayland+sec+uboot22 userdebug
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
這個 target 會解析為:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
MACHINENAME=uis7885-2h10
|
|||
|
|
DISTRO=unisoc-wayland
|
|||
|
|
IMAGENAME=unisoc-wayland-image
|
|||
|
|
SECBOOT_ENABLE=sec
|
|||
|
|
UNISOC_PRODUCT=uboot22
|
|||
|
|
USERDEBUG=userdebug
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
本機曾成功產出的 PAC 路徑:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/media/pi/SMCI/bpi/unisoc/sync-20260524/source_sync_rls_25c/out/target/product/uis7885-2h10/cp_sign/QOGIRN6PRO_UIS7885_2H10_SEC/uis7885_2h10+wayland+wayland+sec+uboot22-userdebug-native_QOGIRN6PRO_UIS7885_2H10_SEC.pac
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## qubot 環境確認
|
|||
|
|
|
|||
|
|
遠端主機:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
host: qubot
|
|||
|
|
hostname: qubot-machine
|
|||
|
|
user: qubot
|
|||
|
|
kernel: Ubuntu 22.04 / Linux 6.8.0-94-generic
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
磁碟狀態重點:
|
|||
|
|
|
|||
|
|
- `/home/qubot` 本身在 root filesystem 上,最早檢查只剩約 20G,不適合放 SDK。
|
|||
|
|
- `/home/qubot/bpi` 掛在 NVMe:`/dev/nvme0n1p1`,容量約 3.6T。
|
|||
|
|
- 因此所有工作都放到 `/home/qubot/bpi/BPI-M2C/sync-20260524`。
|
|||
|
|
- 2026-06-02 14:48 CST 檢查時,`/home/qubot/bpi` 剩餘約 334G。
|
|||
|
|
|
|||
|
|
工具與 Python:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
repo: /home/qubot/.bin/repo
|
|||
|
|
git: /usr/bin/git
|
|||
|
|
python: /usr/bin/python -> Python 3.10.12
|
|||
|
|
python3 Crypto.Signature: ok
|
|||
|
|
sudo: ok
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
`Crypto.Signature` 很重要,因為 `source/unisoc/trusty/halo-elf/Makefile` 會用:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/usr/bin/python prebuilts/scripts/packimage_scripts/dynamicTA/signta.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
之前本機首次 full build 曾因 `Crypto.Signature` 缺失卡在 `halo-ta`,所以遠端先確認並安裝 `python3-pycryptodome`。
|
|||
|
|
|
|||
|
|
## 已建立的遠端目錄與腳本
|
|||
|
|
|
|||
|
|
遠端工作根目錄:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
本機保留同一份 helper 紀錄:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/media/pi/SMCI/bpi/unisoc/sync-20260524/qubot-BPI-M2C
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
已建立腳本:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
scripts/install_unisoc_deps_ubuntu2204.sh
|
|||
|
|
scripts/sync_rls25c.sh
|
|||
|
|
scripts/build_bpi_m2c_rls25c.sh
|
|||
|
|
scripts/start_build_bpi_m2c_rls25c.sh
|
|||
|
|
scripts/sync_then_build_bpi_m2c_rls25c.sh
|
|||
|
|
scripts/start_sync_then_build_bpi_m2c_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
用途:
|
|||
|
|
|
|||
|
|
- `install_unisoc_deps_ubuntu2204.sh`:安裝 Yocto/UniSoc 常見依賴與 `python3-pycryptodome`。
|
|||
|
|
- `sync_rls25c.sh`:用同一個 UniSoc manifest 重新下載或續跑 `repo sync`。
|
|||
|
|
- `build_bpi_m2c_rls25c.sh`:執行已知 BPI-M2C build target。
|
|||
|
|
- `sync_then_build_bpi_m2c_rls25c.sh`:先 sync,sync 成功後自動 build。
|
|||
|
|
- `start_sync_then_build_bpi_m2c_rls25c.sh`:背景啟動 sync 後自動 build 的長任務。
|
|||
|
|
|
|||
|
|
## 已執行過的主要步驟
|
|||
|
|
|
|||
|
|
### 1. 建立遠端 helper
|
|||
|
|
|
|||
|
|
先在本機建立 helper 目錄與 README/scripts,然後同步到遠端:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
rsync -av /media/pi/SMCI/bpi/unisoc/sync-20260524/qubot-BPI-M2C/ \
|
|||
|
|
qubot:/home/qubot/bpi/BPI-M2C/sync-20260524/
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 2. 安裝遠端依賴
|
|||
|
|
|
|||
|
|
在 `qubot` 執行:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
./scripts/install_unisoc_deps_ubuntu2204.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
結果:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
python Crypto.Signature ok
|
|||
|
|
UniSoc build dependencies are ready.
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 3. 嘗試從本機搬完整 source tree
|
|||
|
|
|
|||
|
|
本機大小:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/media/pi/SMCI/bpi/unisoc/sync-20260524: 173G
|
|||
|
|
/media/pi/SMCI/bpi/unisoc/sync-20260524/source_sync_rls_25c: 105G
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
曾嘗試用 rsync 搬 `source_sync_rls_25c`,排除:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/build-*
|
|||
|
|
/out
|
|||
|
|
/sstate-cache
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
但透過目前 SSH/n2n 網路,實際速度只有 KB/s 級,不適合搬完整 SDK。
|
|||
|
|
|
|||
|
|
也嘗試過 tar stream,同樣速度很慢,所以停止。
|
|||
|
|
|
|||
|
|
停止後保留了 partial 目錄,未刪除:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
source_sync_rls_25c.rsync-partial-20260602_130428
|
|||
|
|
source_sync_rls_25c.tar-partial-20260602_130728
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
這些目錄不是正式 source tree。等正式 sync/build 完成後,可以再清理。
|
|||
|
|
|
|||
|
|
### 4. 改用 qubot 直接 repo sync
|
|||
|
|
|
|||
|
|
先確認 `qubot` 能連 UniSoc manifest:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
git ls-remote https://git.unisoc.com/gerrit/platform/cus-manifest \
|
|||
|
|
refs/heads/bananapi/unc_linux_rls_25c
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
結果可讀到分支,因此改為遠端直接下載:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
JOBS=8 ./scripts/sync_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
repo init 成功:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
repo has been initialized in /home/qubot/bpi/BPI-M2C/sync-20260524/source_sync_rls_25c
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
下載過程中確認已抓到多個重要 project,包括:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
kernel/common
|
|||
|
|
u-boot15 -> source/bsp/u-boot22
|
|||
|
|
yocto/tarballs
|
|||
|
|
pac-binary
|
|||
|
|
linuxos/os/ubuntu_deb
|
|||
|
|
vendor/sprd/release/idh/unc_linux_rls_25c
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 5. 評估 tarballs.git 的處理方式
|
|||
|
|
|
|||
|
|
最後卡比較久的是 `yocto/tarballs`。
|
|||
|
|
|
|||
|
|
本機對應 object repo:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/media/pi/SMCI/bpi/unisoc/sync-20260524/source_sync_rls_25c/.repo/project-objects/tarballs.git
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
大小約 35G,主要是一個大 pack:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
pack-509afc6c0e1388268387707fb3a5e8f4469ef20a.pack
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
曾嘗試:
|
|||
|
|
|
|||
|
|
- 用 rsync 從本機預填 `tarballs.git`,速度仍只有 KB/s。
|
|||
|
|
- 用本機 HTTP server 透過 LAN IP `192.168.50.188`,`qubot` 不可達。
|
|||
|
|
- 改用 n2n IP `172.16.199.88` / `172.16.198.88`,可達但只有約 50-80KB/s。
|
|||
|
|
|
|||
|
|
結論:本機直傳比 `qubot` 從 UniSoc Gerrit 下載更慢,因此放棄本機預填,恢復遠端 `repo sync`。
|
|||
|
|
|
|||
|
|
## 目前狀態
|
|||
|
|
|
|||
|
|
截至 2026-06-02 14:48 CST:
|
|||
|
|
|
|||
|
|
背景任務仍在跑:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
pid=1763945
|
|||
|
|
cmd=bash /home/qubot/bpi/BPI-M2C/sync-20260524/scripts/sync_then_build_bpi_m2c_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
log:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/home/qubot/bpi/BPI-M2C/sync-20260524/logs/sync-then-build-detached-20260602_135424.log
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
目前仍處於 `repo sync` 階段,還沒進入 build。正在處理:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
yocto/tarballs
|
|||
|
|
git index-pack --stdin --fix-thin --keep=fetch-pack
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
工作目錄總大小約:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/home/qubot/bpi/BPI-M2C/sync-20260524: 44G
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
磁碟剩餘:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/home/qubot/bpi: about 334G free
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 監看命令
|
|||
|
|
|
|||
|
|
看背景任務是否仍在:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot 'ps -fp $(cat /home/qubot/bpi/BPI-M2C/sync-20260524/logs/sync-then-build.pid)'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
看 log:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot 'tail -f /home/qubot/bpi/BPI-M2C/sync-20260524/logs/sync-then-build-detached-20260602_135424.log'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
看 repo sync 或 build 進程:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot 'ps -eo pid,ppid,stat,etime,pcpu,pmem,cmd | grep -E "sync_then_build|repo/main.py|git .*fetch|git-remote-https|index-pack|build.sh" | grep -v grep'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
看空間:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot 'du -sh /home/qubot/bpi/BPI-M2C/sync-20260524; df -h /home/qubot/bpi'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
看 `tarballs.git` pack 是否在增加:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot 'find /home/qubot/bpi/BPI-M2C/sync-20260524/source_sync_rls_25c/.repo/project-objects/tarballs.git/objects/pack -maxdepth 1 -type f -printf "%TY-%Tm-%Td %TH:%TM %s %f\n" | sort | tail -10'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 手動重跑方式
|
|||
|
|
|
|||
|
|
如果背景任務已退出,但 sync 沒完成:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
JOBS=8 ./scripts/sync_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
如果 sync 已完成但 build 沒有啟動:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
./scripts/build_bpi_m2c_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
如果要重新用背景方式跑 sync 後自動 build:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ssh qubot
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
./scripts/start_sync_then_build_bpi_m2c_rls25c.sh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## build 成功後預期位置
|
|||
|
|
|
|||
|
|
若 build 成功,PAC 應出現在類似:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
/home/qubot/bpi/BPI-M2C/sync-20260524/source_sync_rls_25c/out/target/product/uis7885-2h10/cp_sign/QOGIRN6PRO_UIS7885_2H10_SEC/
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
預期檔名格式:
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
uis7885_2h10+wayland+wayland+sec+uboot22-userdebug-native_QOGIRN6PRO_UIS7885_2H10_SEC.pac
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 後續清理建議
|
|||
|
|
|
|||
|
|
等 repo sync 與 build 都確認成功後,再考慮清理早期傳輸測試留下的 partial 目錄:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd /home/qubot/bpi/BPI-M2C/sync-20260524
|
|||
|
|
rm -rf source_sync_rls_25c.rsync-partial-* source_sync_rls_25c.tar-partial-*
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
不要在 repo sync/build 還沒完成前清理 `source_sync_rls_25c` 內部資料。
|