使用 Yocto 建置完整映像檔
公開的 Yocto layer meta-simaai 可從原始碼為 Modalix 電路板建置完整的映像檔。一次建置即可產生 U-Boot、核心、device tree 與 overlay、SiMa.ai 韌體,以及最小化的根檔案系統,並整合為一個可燒錄的檔案。當您需要自行產生整個映像檔時,請使用此方式。若只是要在已可開機的電路板上變更核心或 device tree,從原始碼建置 BSP會更快。
本頁的建置已於 2026-10-06 在 Ubuntu 22.04 容器中,以該 layer 的 2.1.3 版本提交執行過一次。產生的映像檔尚未燒錄到電路板,也尚未開機驗證。
目前尚未提供以您自己的原始碼建置完整 eLxr 映像檔的說明。電路板硬體啟動仍建議採用 eLxr。請參閱 eLxr 或 Yocto。
開始之前
-
請使用 Linux 建置主機。該 layer 的手冊建議使用 Ubuntu 22.04,並指出 Yocto Project 不支援 WSL。
-
這些 recipe 會以 SSH URL 從 GitHub 取得 SiMa.ai 的核心與 U-Boot 原始碼。請在建置主機上設定 GitHub SSH 金鑰,或設定 Git 對這些 URL 改用 HTTPS:
sima-user@sima-user-machine:~$ git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"sima-user@sima-user-machine:~$ git config --global --add url."https://github.com/".insteadOf "git@github.com:" -
安裝 Yocto Project 針對 Ubuntu 列出的建置主機套件,並確保
en_US.UTF-8語系可用。接著安裝該 layer 的手冊另外列出的套件:sima-user@sima-user-machine:~$ sudo apt-get install chrpath diffstat g++ gawk make liblz4-tool cmake python3 python3-distutils libncurses5 git gfortransima-user@sima-user-machine:~$ sudo dpkg --add-architecture i386sima-user@sima-user-machine:~$ sudo apt updatesima-user@sima-user-machine:~$ sudo apt install libc6:i386
取得 Layer
此建置使用 Yocto Project 的 scarthgap 版本。請將下列 layer 複製到同一個目錄:
pokymeta-openembeddedmeta-armmeta-clang與meta-clang-revivalmeta-python-aimeta-swupdatemeta-simaai
請保留這些目錄名稱,並將這些目錄放在同一層。範本會依建置目錄旁的路徑尋找各個 layer。
各 layer 的儲存庫與確切修訂版本,請見該 layer 中的建置手冊,並請使用其中指定的修訂版本。若要取得 SiMa.ai 的 layer:
sima-user@sima-user-machine:~$ git clone https://github.com/SiMa-ai/meta-simaai.git
設定建置環境
該 layer 提供範本,可用來填入 layer 清單與建置設定。請在存放各 layer 的目錄中執行:
sima-user@sima-user-machine:~$ export TEMPLATECONF=$PWD/meta-simaai/conf/templates/custom
sima-user@sima-user-machine:~$ source poky/oe-init-build-env
sima-user@sima-user-machine:~/build$ bitbake-layers show-layers
最後一個指令會列出建置所使用的 layer。請確認清單中包含 meta-simaai。
該 layer 的建置範本會啟用 debug-tweaks 映像檔功能,以產生適合開發的映像檔,而且映像檔已為 root 與 sima 使用者設定預設密碼。產品出貨前,請從 conf/local.conf 的 EXTRA_IMAGE_FEATURES 移除 debug-tweaks,並設定您自己的密碼。
建置映像檔
sima-user@sima-user-machine:~/build$ MACHINE=modalix bitbake simaai-image-minimal
由於範本的預設值是另一款電路板,請在指令列指定 MACHINE=modalix。此映像檔包含 最小化的根檔案系統,其中有 SiMa.ai 韌體、核心模組、OpenSSH 與 swupdate。
機器設定已接受 commercial 授權旗標,因此建置時不會詢問就納入 SiMa.ai 韌體。發布映像檔之前,請先閱讀 licenses/SiMaai-EULA-1.0 中的授權條款。
在 20 核心的機器上以 12 個建置執行緒進行的首次建置,約需 35 分鐘,並使用約 70 GB 的磁碟空間。
尋找輸出檔案
建置的輸出會寫入建置目錄下的 tmp/deploy/images/modalix。
| 檔案 | 用途 |
|---|---|
simaai-image-minimal-modalix.rootfs.wic.gz 與 .wic.bmap | 完整的 eMMC 映像檔及其區塊對應表。請燒錄這兩個檔案。 |
simaai-image-minimal-modalix.rootfs.ext4.gz | 僅根檔案系統 |
simaai-image-minimal-modalix.rootfs.cpio.gz | 作為初始 RAM 磁碟的根檔案系統,用於從網路開機 |
Image、u-boot.bin、.dtb 與 overlays/*.dtbo | 核心、U-Boot、device tree 與 overlay |
分割區配置
eMMC 映像檔的 GPT 分割表中包含下列分割區:
| 分割區 | 大小 | 內容 |
|---|---|---|
u-boot0 與 u-boot1 | 各 2 MB | U-Boot,共兩份 |
boot | 512 MB,FAT | boot-0 與 boot-1 目錄,各含核心、device tree 與 overlay |
platform0 與 platform1 | 各 2 GB,ext4 | 根檔案系統,共兩份 |
userdata | 約 10 GB,ext4 | 使用者資料 |
燒錄映像檔
依照將映像檔燒錄到 eMMC的說明,將 .wic.gz 檔案連同其 .wic.bmap 檔案寫入電路板的 eMMC。
後續步驟
- 將映像檔燒錄到 eMMC:從網路或 SD 卡啟動電路板並寫入映像檔。
- 建置與套用更新套件:不重新寫入整個 eMMC 即可更新電路板。
- 板級支援套件:原始碼,以及 eLxr 與 Yocto 的比較。
- 版本相容性:每個平台版本所對應的核心與 U-Boot commit。