# 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 |
### 執行結果

## 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`

### 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