Yocto + SWUpdate + RaspberryPi3
Created: 2023/10/26
概要
SWUpdateをRaspberryPi3で試す。
Raspberry Pi3で試す
次の手順でイメージをビルドしSDカードに書き込んで起動を確かめます。
- 開発用コンテナを作成
- 各レイヤの取得
- ビルド
- 書き込み
ビルド環境
- Windows 11 + WSL + Docker
ターゲット
- Raspberry Pi3
- Yocto 4.0 (kirkstone)
Poky環境のセットアップ
$ mkdir rpi-kirkstone
$ cd rpi-kirkstone/
$ git clone -b kirkstone git://git.yoctoproject.org/poky.git
$ docker run --rm -it -v $(pwd):/workdir crops/poky --workdir=/workdir
コンテナ内のシェルで作業する。関連コマンドを有効にするためにスクリプトを実行する。
pokyuser@4c5ad0c1bea7:/workdir$ source poky/oe-init-build-env
ここまでやるとbuildにconfなどが生成される
rpi-mickledore/
┣ build/
┃ ┗ conf/
┃ ┣ bblayers.conf
┃ ┣ conf-notes.txt
┃ ┣ local.conf
┃ ┗ templateconf.cfg
┗ poky/
meta-raspberrypiの取得
bitbake-layers layerindex-fetch
を利用してmeta-raspberrypiをPoky内に配置する。
pokyuser@8f2fb8eb82ec:/workdir/build$ bitbake-layers layerindex-fetch meta-raspberrypi
pokyuser@8f2fb8eb82ec:/workdir/build$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer path priority
========================================================================================================
core /workdir/poky/meta 5
yocto /workdir/poky/meta-poky 5
yoctobsp /workdir/poky/meta-yocto-bsp 5
raspberrypi /workdir/poky/meta-raspberrypi 9
meta-swupdate-boardsの取得
bitbake-layers layerindex-fetch
を利用してmeta-raspberrypiをPoky内に配置する。
pokyuser@8f2fb8eb82ec:/workdir/build$ bitbake-layers layerindex-fetch meta-swupdate-boards
TODO: ちゃんと試す
local.confを編集
conf/local.conf
をVSCodeで編集
RPI_USE_U_BOOT = "1"
を追加する。
# (中略) ...
MACHINE = "raspberrypi3-64"
DL_DIR = "${TOPDIR}/../downloads"
# enable uart
ENABLE_UART = "1"
# systemd
DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
# Accept for the synaptics license
LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
RPI_USE_U_BOOT = "1"
ビルド
pokyuser@8f2fb8eb82ec:/workdir/build$ bitbake update-image
エラー
pokyuser@1f6da7dfe01b:/workdir/build$ bitbake update-image
Loading cache: 100% |####################################################################################| Time: 0:00:00
Loaded 2838 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "2.0.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "aarch64-poky-linux"
MACHINE = "raspberrypi3-64"
DISTRO = "poky"
DISTRO_VERSION = "4.0.13"
TUNE_FEATURES = "aarch64 armv8a crc cortexa53"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "kirkstone:59077aa77b17ca6fdcc4e66d9d8b0c18dc89ecce"
meta-raspberrypi = "kirkstone:59a6a1b5dd1e21189adec49c61eae04ed3e70338"
meta-oe = "kirkstone:79a6f60dabad9e5b0e041efa91379447ef030482"
meta-swupdate = "kirkstone:07c67969137e90e98385aadfb4ef8572a66a0bb5"
meta-swupdate-boards = "kirkstone:965bcd8da5ad2174bd2ac05811580e44bbb0e036"
Initialising tasks: 100% |###############################################################################| Time: 0:00:03
Sstate summary: Wanted 907 Local 0 Mirrors 0 Missed 907 Current 728 (0% match, 44% complete)
Removing 479 stale sstate objects for arch cortexa53: 100% |#############################################| Time: 0:00:01
Removing 178 stale sstate objects for arch raspberrypi3_64: 100% |#######################################| Time: 0:00:02
Removing 28 stale sstate objects for arch allarch: 100% |################################################| Time: 0:00:00
Removing 46 stale sstate objects for arch x86_64: 100% |#################################################| Time: 0:00:00
NOTE: Executing Tasks
ERROR: update-image-1.0-r0 do_swuimage: swupdate cannot find image file: /workdir/build/tmp/deploy/images/raspberrypi3-64/core-image-full-cmdline.ext4.gz
ERROR: Logfile of failure stored in: /workdir/build/tmp/work/raspberrypi3_64-poky-linux/update-image/1.0-r0/temp/log.do_swuimage.27618
ERROR: Task (/workdir/poky/meta-swupdate-boards/recipes-extended/images/update-image.bb:do_swuimage) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4143 tasks of which 2358 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/workdir/poky/meta-swupdate-boards/recipes-extended/images/update-image.bb:do_swuimage
Summary: There was 1 ERROR message, returning a non-zero exit code.
pokyuser@1f6da7dfe01b:/workdir/build$
書き込み
bmaptoolsで書き込むのが良いが、Windows環境だと不自由なので解凍してRaspberry pi Imagerを利用して書き込む。
pokyuser@8f2fb8eb82ec:/workdir/build$ cd tmp/deploy/images/raspberrypi3-64/
pokyuser@8f2fb8eb82ec:/workdir/build/tmp/deploy/images/raspberrypi3-64$ cp core-image-base-raspberrypi3-64.wic.bz2 /workdir/
pokyuser@8f2fb8eb82ec:/workdir/build/tmp/deploy/images/raspberrypi3-64$ cd /workdir/
pokyuser@8f2fb8eb82ec:/workdir$ bunzip2 core-image-base-raspberrypi3-64.wic.bz2
Windows側にcore-image-base-raspberrypi3-64.wic
を移動させ、カスタムイメージとして書き込む。
結果
root@raspberrypi3-64:~# cat /etc/os-release
ID=poky
NAME="Poky (Yocto Project Reference Distro)"
VERSION="4.2.3 (mickledore)"
VERSION_ID=4.2.3
VERSION_CODENAME="mickledore"
PRETTY_NAME="Poky (Yocto Project Reference Distro) 4.2.3 (mickledore)"
root@raspberrypi3-64:~#