Sponge
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # RaspberryPi 5 構建 OpenBMC ## Learning Motivation 熟悉 Yocto Project 與 OpenBMC 的檔案架構 (Metadata, Layer) 及編譯流程。 ## Equipment * RaspberryPi 5 (8GB) * SD card * 1 * Ubuntu24.04 虛擬機(建議硬碟空間 120GB 以上) * 我的虛擬機配置: * 6-core CPU * RAM : 8 GB * Disk Space : 250 GB * 路由器 + 網路線 * UART 轉接線 (Option) ## 0. Required Packages 請先閱讀以下 [Yocto Documentation](https://docs.yoctoproject.org/ref-manual/system-requirements.html#required-packages-for-the-build-host) Yocto Prerequisite Package (Option) ```bash sudo apt-get install build-essential chrpath cpio debianutils diffstat \ file gawk gcc git iputils-ping libacl1 locales python3 python3-git \ python3-jinja2 python3-pexpect python3-pip python3-subunit socat texinfo \ unzip wget xz-utils zstd ``` OpenBMC Prerequisite Package ```bash sudo apt install git python3-distutils gcc g++ make file wget \ gawk diffstat bzip2 cpio chrpath zstd lz4 bzip2 ``` ## 1. Download Source Code ```bash git clone https://github.com/openbmc/openbmc cd openbmc ``` ## 2. Create Custom Layer 資料夾命名使用 meta-xxx 這邊需先建立 `layer.conf` ,後面才能成功初始化環境 ```bash mkdir -p meta-rpi5-openbmc/conf touch meta-rpi5-openbmc/conf/layer.conf vi meta-rpi5-openbmc/conf/layer.conf ``` 按 `i` 進入 `Insert mode` 在 `meta-rpi5-openbmc/conf/layer.conf` 貼上以下內容: ```bash # We have a conf and classes directory, add to BBPATH BBPATH .= ":${LAYERDIR}" # Path to .bb / .bbappend BBFILES += "\ ${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend \ " BBFILE_COLLECTIONS += "evb" BBFILE_PATTERN_evb = "^${LAYERDIR}/" # Yocto Version LAYERSERIES_COMPAT_evb = "scarthgap" ``` 按 `esc` 退出 `Insert mode` 輸入 `:wq` 儲存並退出 ## 3. Select Template and Initialize Build Environment ```bash # Copy Raspberrypi Template cp -r meta-evb/meta-evb-raspberrypi/* meta-rpi5-openbmc # Select Template export TEMPLATECONF=meta-rpi5-openbmc/conf/templates/default # 初始化 OpenBMC build 環境 # 預設會建立 ./build . openbmc-env # 也可以自訂 build 名稱(例如:build-rpi5-openbmc) . openbmc-env build-rpi5-openbmc ``` 成功後可以看到: ```txt Common targets are: obmc-phosphor-image ``` ## 4. Setup local.conf 修改 `build-rpi5-openbmc/conf/local.conf` : ```bash # 記得根據樹莓派型號進行修改 MACHINE ??= "raspberrypi5" DISTRO ?= "openbmc-phosphor" PACKAGE_CLASSES ?= "package_ipk" SANITY_TESTED_DISTROS:append ?= " *" EXTRA_IMAGE_FEATURES ?= "ssh-server-openssh allow-root-login" USER_CLASSES ?= "buildstats" PATCHRESOLVE = "noop" BB_DISKMON_DIRS ??= "\ STOPTASKS,${TMPDIR},1G,100K \ STOPTASKS,${DL_DIR},1G,100K \ STOPTASKS,${SSTATE_DIR},1G,100K \ STOPTASKS,/tmp,100M,100K \ HALT,${TMPDIR},100M,1K \ HALT,${DL_DIR},100M,1K \ HALT,${SSTATE_DIR},100M,1K \ HALT,/tmp,10M,1K" CONF_VERSION = "2" # Set the root password to '0penBmc' # Defaults from meta-phosphor/conf/distro/include/phosphor-defaults.inc # require conf/machine/include/obmc-bsp-common.inc # require conf/machine/include/obmc-evb-common.inc ############################################################## # Enable the UART ENABLE_UART = "1" # Enable I2C Support ENABLE_I2C = "1" KERNEL_MODULE_AUTOLOAD:rpi += " i2c-dev" IMAGE_INSTALL:append = " i2c-tools" # Enable nano text editor # Enable WiFi configuration via wpa-supplicant.conf # ipmitool: CLI tool for BMC management IMAGE_INSTALL:append = " nano wpa-supplicant ipmitool" # Accept Synaptics license required linux-firmware-rpidistro LICENSE_FLAGS_ACCEPTED += "synaptics-killswitch" # Enable generation of disk images in WIC format IMAGE_FSTYPES += " wic wic.bz2" # Specify Raspberry Pi kernel as the provider for virtual/kernel PREFERRED_PROVIDER_virtual/kernel = "linux-raspberrypi" # Parallel Build Configuration in BitBake # BB_NUMBER_THREADS = "2" # PARALLEL_MAKE = "-j6" # Increase FLASH_SIZE to Avoid Image Size Limits FLASH_SIZE = "131072" MACHINEOVERRIDES:append = ":phosphor-evb" ``` --- ### MACHINE :::success MACHINE ??= "raspberrypi5" ::: 參考 [meta-raspberrypi/conf/machine](https://github.com/openbmc/openbmc/tree/scarthgap/meta-raspberrypi/conf/machine) 或是輸入指令: ```bash ls meta-raspberrypi/conf/machine/*raspberrypi* | xargs -n 1 basename ``` --- ### IMAGE_FEATURES :::success EXTRA_IMAGE_FEATURES ?= "ssh-server-openssh allow-root-login" ::: 參考 core-image [poky/meta/classes-recipe/core-image.bbclass](https://github.com/openbmc/openbmc/blob/scarthgap/poky/meta/classes-recipe/core-image.bbclass#L12) ```txt # Available IMAGE_FEATURES: # # - weston - Weston Wayland compositor # - x11 - X server # - x11-base - X server with minimal environment # - x11-sato - OpenedHand Sato environment # - tools-debug - debugging tools # - eclipse-debug - Eclipse remote debugging support # - tools-profile - profiling tools # - tools-testapps - tools usable to make some device tests # - tools-sdk - SDK (C/C++ compiler, autotools, etc.) # - nfs-server - NFS server # - nfs-client - NFS client # - ssh-server-dropbear - SSH server (dropbear) # - ssh-server-openssh - SSH server (openssh) # - hwcodecs - Install hardware acceleration codecs # - package-management - installs package management tools and preserves the package manager database # - debug-tweaks - makes an image suitable for development, e.g. allowing passwordless root logins # - empty-root-password # - allow-empty-password # - allow-root-login # - post-install-logging # - serial-autologin-root - with 'empty-root-password': autologin 'root' on the serial console # - dev-pkgs - development packages (headers, etc.) for all installed packages in the rootfs # - dbg-pkgs - debug symbol packages for all installed packages in the rootfs # - lic-pkgs - license packages for all installed pacakges in the rootfs, requires # LICENSE_CREATE_PACKAGE="1" to be set when building packages too # - doc-pkgs - documentation packages for all installed packages in the rootfs # - bash-completion-pkgs - bash-completion packages for recipes using bash-completion bbclass # - ptest-pkgs - ptest packages for all ptest-enabled recipes # - read-only-rootfs - tweaks an image to support read-only rootfs # - stateless-rootfs - systemctl-native not run, image populated by systemd at runtime # - splash - bootup splash screen ``` 參考 obmc-phosphor-image [meta-phosphor/classes/obmc-phosphor-image.bbclass](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/classes/obmc-phosphor-image.bbclass#L3) ```txt # Additional IMAGE_FEATURES available with Phosphor OpenBMC: # # - obmc-bmc-state-mgmt - OpenBMC BMC state management # - obmc-bmcweb - OpenBMC webserver # - obmc-chassis-mgmt - OpenBMC chassis management # - obmc-chassis-state-mgmt - OpenBMC chassis state management # - obmc-console - OpenBMC serial over LAN # - obmc-dbus-monitor - OpenBMC dbus monitoring # - obmc-debug-collector - OpenBMC debug collector # - obmc-devtools - OpenBMC development and debugging tools # - obmc-fan-control - OpenBMC fan management # - obmc-fan-mgmt - Deprecated - use obmc-fan-control instead # - obmc-flash-mgmt - OpenBMC flash management # - obmc-health-monitor - OpenBMC health monitoring # - obmc-host-ctl - OpenBMC host control # - obmc-host-ipmi - OpenBMC host IPMI # - obmc-host-state-mgmt - OpenBMC host state management # - obmc-ikvm - OpenBMC KVM over IP # - obmc-inventory - OpenBMC inventory support # - obmc-leds - OpenBMC LED support # - obmc-logging-mgmt - OpenBMC logging management # - obmc-remote-logging-mgmt - OpenBMC remote logging management # - obmc-sensors - OpenBMC sensor support # - obmc-settings-mgmt - OpenBMC settings management # - obmc-software - OpenBMC software management # - obmc-system-mgmt - OpenBMC system management # - obmc-telemetry - OpenBMC telemetry solution # - obmc-user-mgmt - OpenBMC user management # - obmc-user-mgmt-ldap - OpenBMC LDAP users # - obmc-webui - OpenBMC Web User Interface # - obmc-tpm - OpenBMC TPM Applications ``` --- ### IMAGE_TYPES :::success IMAGE_FSTYPES += " wic wic.bz2" ::: 參考 image_types [poky/meta/classes-recipe/image_types.bbclass](https://github.com/openbmc/openbmc/blob/scarthgap/poky/meta/classes-recipe/image_types.bbclass#L305) ```bash # This variable is available to request which values are suitable for IMAGE_FSTYPES IMAGE_TYPES = " \ jffs2 jffs2.sum \ cramfs \ ext2 ext2.gz ext2.bz2 ext2.lzma \ ext3 ext3.gz \ ext4 ext4.gz \ btrfs \ vfat \ squashfs squashfs-xz squashfs-lzo squashfs-lz4 squashfs-zst \ ubi ubifs multiubi \ tar tar.gz tar.bz2 tar.xz tar.lz4 tar.zst \ cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 cpio.zst \ wic wic.gz wic.bz2 wic.lzma wic.zst \ container \ f2fs \ erofs erofs-lz4 erofs-lz4hc \ " # These image types are x86 specific as they need syslinux IMAGE_TYPES:append:x86 = " hddimg iso" IMAGE_TYPES:append:x86-64 = " hddimg iso" ``` --- ### PREFERRED_PROVIDER (Option) > If multiple recipes provide the same item, this variable determines which recipe is preferred and thus provides the item (i.e. the preferred provider). You should always suffix this variable with the name of the provided item. And, you should define the variable using the preferred recipe’s name (PN). > :::success PREFERRED_PROVIDER_virtual/kernel = "linux-raspberrypi" ::: 當 build 系統加入多個 metadata layer 時,可能會有多個 kernel recipes(如 `linux-yocto`、`linux-raspberrypi`)同時提供 `virtual/kernel`。 由於 BitBake 在建置時只會選擇其中一個 provider 來提供 `virtual/kernel`,因此可以透過宣告 `PREFERRED_PROVIDER` 來指定要使用哪一個 kernel recipe。 若未明確指定,會直接依照變數賦值規則(`=`, `?=`, `??=`)決定最終值,可以參考 [rpi-default-providers.inc](https://github.com/openbmc/openbmc/blob/master/upstream-layers/meta-raspberrypi/conf/machine/include/rpi-default-providers.inc#L3) , [rpi-base.inc](https://github.com/openbmc/openbmc/blob/master/upstream-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc#L3) 的設定。 ```bash ls meta/recipes-kernel/linux/*linux* ``` ```bash meta/recipes-kernel/linux/linux-dummy.bb meta/recipes-kernel/linux/linux-yocto_6.18.bb meta/recipes-kernel/linux/linux-yocto-rt_6.18.bb meta/recipes-kernel/linux/linux-yocto-dev.bb meta/recipes-kernel/linux/linux-yocto-tiny_6.18.bb meta/recipes-kernel/linux/linux-yocto-fitimage.bb ``` ```bash ls meta-raspberrypi/recipes-kernel/linux/*raspberrypi* ``` ```bash meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_6.1.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_6.6.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_6.12.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-v7_6.1.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-v7_6.6.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-v7_6.12.bb meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb ``` 使用 `bitbake -e` 分析 kernel provider 設定: ```bash bitbake -e virtual/kernel | grep -A20 "# \$PREFERRED_PROVIDER_virtual/kernel" ``` ```txt # $PREFERRED_PROVIDER_virtual/kernel [2 operations] # set /home/sponge/yocto/openbmc/build-rpi5-openbmc/conf/local.conf:45 # "linux-raspberrypi" # set /home/sponge/yocto/openbmc/meta-raspberrypi/conf/machine/include/rpi-default-providers.inc:3 # [_defaultval] "linux-raspberrypi" ``` `PREFERRED_VERSION` 則是可以指定要使用 recipe 的哪個版本 :::success PREFERRED_VERSION_linux-raspberrypi = "6.12%" ::: --- ### Parallel Build Configuration in BitBake `BB_NUMBER_THREADS` > The maximum number of tasks BitBake should run in parallel at any one time. If your host development system supports multiple cores a good rule of thumb is to set this variable to twice the number of cores.` * 控制 BitBake 可以同時執行多少獨立任務 `recipe(.bb)` 的數量 * 消耗資源: 主要消耗 RAM 。執行越多線程,消耗的記憶體越高。 `PARALLEL_MAKE` > Specifies extra options that are passed to the make command during the compile tasks. This variable is usually in the form -j 4, where the number represents the maximum number of parallel threads make can run. If you development host supports multiple cores a good rule of thumb is to set this variable to twice the number of cores on the host. * 控制單一套件在編譯階段(Compile)可同時跑幾個編譯工作(動用多少 CPU 進行編譯)。 * 消耗資源: 主要消耗 CPU 。 :::info **如果 RAM <= 8 GB ,建議開啟以下設定,數量可自行調整** (以我的虛擬機 6-core CPU, RAM 8GB 來說,因為會遇到部分套件佔用太多RAM空間,因此我的目標是 **減少同時處理的套件數量以節省記憶體,並集中 CPU 火力加速單一編譯任務**。) ```bash BB_NUMBER_THREADS = "2" PARALLEL_MAKE = "-j6" # or BB_NUMBER_THREADS = "1" PARALLEL_MAKE = "-j6" ``` ::: :::danger **Error Massage Example ( Insufficient RAM )**: DEBUG: Executing shell function do_compile NOTE: VERBOSE=1 cmake --build /home/sponge/yocto/openbmc/build-rpi5-openbmc/tmp/work/aarch64-linux/**llvm-native**/21.1.8/build --target all ... ... **g++: fatal error: Killed signal terminated program cc1plus compilation terminated.** ninja: build stopped: subcommand failed. ::: --- ### Increase FLASH_SIZE to Avoid Image Size Limits :::success FLASH_SIZE = "131072" ::: 修改 `FLASH_SIZE` 為 131072 (131072 KB / 1024 KB = 128 MB)。 參考 https://github.com/openbmc/openbmc/issues/3590 如果在 OpenBMC 加入某些大型軟體套件,產出的image大小會變大,可能會超過OpenBMC 預設的 32 MB (32768 KB) 限制,因此透過將 `FLASH_SIZE` 擴充至 128 MB (131072 KB),可避免 BitBake 在執行 task 時因空間不足而出錯。 在跑 Romulus 時遇到的錯誤訊息: :::danger **Error Massage Example**: ERROR: obmc-phosphor-image-1.0-r0 do_generate_static: Image '/home/sponge/yocto/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/obmc-phosphor-image/1.0/deploy-obmc-phosphor-image-image-complete/**obmc-phosphor-image-romulus.squashfs-xz' is 1994752 bytes too large!** ::: 參考 [meta-phosphor/classes/image_types_phosphor.bbclass](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/classes/image_types_phosphor.bbclass#L47) ```bash=47 # Flash characteristics in KB unless otherwise noted DISTROOVERRIDES .= ":flash-${FLASH_SIZE}" FLASH_PEB_SIZE ?= "64" # Flash page and overhead sizes in bytes FLASH_PAGE_SIZE ?= "1" FLASH_NOR_UBI_OVERHEAD ?= "64" ``` 原本 `FLASH_SIZE` 的定義在以下路徑:[meta-phosphor/conf/machine/include/obmc-bsp-common.inc](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/conf/machine/include/obmc-bsp-common.inc#L8),但因為目前使用的 machine 是 raspberrypi ,而不是 OpenBMC 預設的 machine (32 MB, 32768 KB) ,為了避免預設值影響到建置結果,因此直接在 `local.conf` 覆寫 `FLASH_SIZE` ,並將原本預設的 require 註解掉。 ```txt # require conf/machine/include/obmc-bsp-common.inc ``` :::info 也可以直接修改在 `meta-phosphor/classes/image_types_phosphor.bbclass` 裡面: ```bash=47 # Flash characteristics in KB unless otherwise noted DISTROOVERRIDES .= ":flash-${FLASH_SIZE}" ### FLASH_SIZE ?= "131072" FLASH_PEB_SIZE ?= "64" # Flash page and overhead sizes in bytes FLASH_PAGE_SIZE ?= "1" FLASH_NOR_UBI_OVERHEAD ?= "64" ``` 但建議在 `local.conf` 覆寫 `FLASH_SIZE`,而不是直接修改 `.bbclass`,因為 `.bbclass` 屬於全域共用設定,會影響所有相關的 machine 與 image。 ::: --- ### MACHINEOVERRIDES :::success MACHINEOVERRIDES:append = ":phosphor-evb" ::: 參考 [meta-phosphor/conf/machine/include/obmc-evb-common.inc](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/conf/machine/include/obmc-evb-common.inc) ```bash # require conf/machine/include/obmc-evb-common.inc ``` ```bash # EVB systems have different packages they can support, due to not having a # managed host. Enable this machine override to allow other recipes to know # that the machine is a special type. MACHINEOVERRIDES =. "phosphor-evb:" ``` 如同前面所說,因為目前使用的 machine 是 RaspberryPi (可視為簡單的 EVB, Evaluation Board) ,而不是 OpenBMC 預設的 machine ,因此直接在 `local.conf` 設定 `MACHINEOVERRIDES:append = ":phosphor-evb"` ,讓系統套用 EVB 類型的 override 設定,關閉不需要的功能,並將原本預設的 `require` 註解掉(雖然是做相同的事)。 > EVB(Evaluation Board)是用來開發與測試的硬體,通常只具備基本功能,不包含完整的 server 架構與 host system(如主機控制與系統管理)。 --- ### MACHINEOVERRIDES - Debug 如果沒加上 `MACHINEOVERRIDES` ,會出現以下錯誤訊息: :::danger ERROR: Nothing RPROVIDES 'virtual-obmc-system-mgmt' ::: 參考 [meta-phosphor/conf/distro/include/phosphor-base.inc](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/conf/distro/include/phosphor-base.inc#L91) ```bash=91 DISTRO_FEATURES_OBMC = " \ obmc-host-ctl \ obmc-host-ipmi \ obmc-phosphor-chassis-mgmt \ obmc-phosphor-fan-mgmt \ obmc-phosphor-flash-mgmt \ obmc-phosphor-system-mgmt \ " ``` 參考 [meta-phosphor/classes/obmc-phosphor-image.bbclass](https://github.com/openbmc/openbmc/blob/scarthgap/meta-phosphor/classes/obmc-phosphor-image.bbclass) ```bash=68 FEATURE_PACKAGES_obmc-system-mgmt ?= "${@bb.utils.contains('DISTRO_FEATURES', 'obmc-phosphor-system-mgmt', 'virtual-obmc-system-mgmt', '', d)}" ``` ```bash=83 FEATURE_PACKAGES_obmc-system-mgmt:phosphor-evb = "" ``` 第 68 行可以這樣解讀: ```python if "obmc-phosphor-system-mgmt" in DISTRO_FEATURES: return "virtual-obmc-system-mgmt" else: return "" ``` 因為 `local.conf` 設定: ```txt DISTRO ?= "openbmc-phosphor" ``` 系統會使用`meta-phosphor/conf/distro/openbmc-phosphor.conf` include `conf/distro/include/phosphor-base.inc` ,所以會讀取 `DISTRO_FEATURES_OBMC` 裡面的設定,預設開啟 `obmc-phosphor-system-mgmt`功能(只代表功能被啟用,並不會直接安裝此套件。可以透過在 `local.conf` 加上 `IMAGE_FEATURES` 指定所需功能進行安裝) ,因此第 68 行會回傳: ```bash FEATURE_PACKAGES_obmc-system-mgmt = "virtual-obmc-system-mgmt" ``` 表示 BitBake 在處理 image feature 時,會要求安裝 `virtual-obmc-system-mgmt`。但如果目前的 platform 或 layer 中沒有任何 recipe/package 宣告提供這個 `virtual package`,便會出現錯誤。 所以可透過第 83 行的 override 設定,將 `FEATURE_PACKAGES_obmc-system-mgmt` 設為空值。 ## 5. Bitbake ### 用法 ```bash bitbake -h ``` ```bash bitbake-layers show-layers ``` ```bash # -c : 執行特定 recipe 的編譯任務 bitbake <recipe_name> -c listtasks ``` ### 耐心等待 ```bash bitbake obmc-phosphor-image ``` 約 2~5 hr(看電腦性能),中途若離線或斷線,直接重新執行即可, Bitbake 會自動檢查之前的建置狀態(tmp, sstate-cache 等等資料),並從中斷處繼續建置 image ,不會從頭開始。 :::info 可以中斷此過程,修改 `BB_NUMBER_THREADS` 的數字,看看有什麼不一樣。 ::: 若 bitbake 過程被中斷後重新執行,可能會出現類似以下錯誤訊息 `failed with exit code '1'`: :::danger ERROR: Task (/home/sponge/yocto/openbmc/meta/recipes-connectivity/openssl/openssl_3.5.5.bb:do_compile) **failed with exit code '1'** ::: 可以執行: ```bash bitbake -c clean <recipe_name> # Example bitbake -c clean openssl ``` | Task | Description | | -------------- | -------------------------------------------------------------------------------------- | | do_clean | Removes all output files for a target | | do_cleanall | Removes all output files, shared state cache, and downloaded source files for a target | | do_cleansstate | Removes all output files and shared state cache for a target | ### 執行結果 ![image](https://hackmd.io/_uploads/B1IX2uMhWg.png) ## 6. Flash the Image file to SD Card ### Way 1 : Direct Image Flashing via dd 先輸入 `lsblk` 插上 SD card 後,再輸入一次 `lsblk` ,觀察後可發現 SD card 是 `sda` <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/ry9yMtf3We.png)" width="80%"> </div> 在 `build-rpi5-openbmc/tmp/deploy/images/raspberrypi5/` 路徑下可以找到 **obmc-phosphor-image-raspberrypi5-xxx_time_xxx.wic** ```bash sudo dd if=./tmp/deploy/images/raspberrypi5/obmc-phosphor-image-raspberrypi5-xxx_time_xxx.wic of=/dev/sda status=progress sync ``` --- ### Way 2 : Raspberry Pi Imager 使用官方的 `Raspberry Pi Imager` 將 .wic 寫入 SD card 中。 https://www.raspberrypi.com/software/ <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/rkjaXFM2Wg.png)" width="80%"> </div> <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/BySJNFzhZl.png)" width="80%"> </div> ## 7. Power On the Device 插入 SD card 和網路線,再插上電源開機。 <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/BJFFqtGhZx.jpg)" width="50%"> </div> 透過 nmap 或路由器取得 raspberrypi 的 ip address。 > 若電腦 IP 為 192.168.3.111,且子網路遮罩為 /24(255.255.255.0),則其所屬網段為 192.168.3.0/24,因此可使用: > ```bash > nmap -sn 192.168.3.0/24 > ``` > 掃描該網段中所有在線主機。 > (我的 UART線 蝦皮還沒到貨,之後補上) ```txt 預設帳號: root 預設密碼: 0penBmc ``` ### SSH Connection ```bash ssh root@<ip_address> ``` 輸入:`obmcutil state` ![SCR-20260418-tihp](https://hackmd.io/_uploads/BJwGNfZp-e.png) ### OpenBMC Web 查詢以下網址: ```txt https://<ip_address> ``` <div style="text-align: center;"> <img src="https://hackmd.io/_uploads/Hywtitz3Zg.png)" width="40%"> </div> <div align="text-align: center;"> <img src="https://hackmd.io/_uploads/r1QX5tM3bl.png" width="100%"> </div> ## 8. References - [OpenBMC GDB Debug - COSCUP](https://hackmd.io/9pFJdZzCRHKaK0Roxvev3g) - [樹梅派構建openbmc](https://hackmd.io/T0LMpjeaTDODybGxyDYJEg) - [樹莓派搭建openbmc](https://blog.csdn.net/qq_20050959/article/details/108163331) - [Yocto Project Documents](https://docs.yoctoproject.org/index.html) - [OpenBMC](https://github.com/openbmc/openbmc/tree/scarthgap) - https://github.com/openbmc/openbmc/issues/3590 - https://github.com/agherzan/meta-raspberrypi/issues/1111

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully