Yocto設定
概要
- https://www.yoctoproject.org/development/releases/
- Wrynose
- https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html
- Scarthgap
- https://docs.yoctoproject.org/scarthgap/brief-yoctoprojectqs/index.html
設定
Wrynose
$ sudo apt-get install build-essential chrpath cpio debianutils diffstat file gawk gcc git iputils-ping libacl1 libc
$ locale --all-locales | grep en_US.utf8
$ sudo dpkg-reconfigure locales
$ git clone https://git.openembedded.org/bitbake
$ ./bitbake/bin/bitbake-setup init
※「./bitbake/bin/bitbake-setup init」を非対話で設定
$ ./bitbake/bin/bitbake-setup init --non-interactive poky-wrynose poky distro/poky machine/qemuarm64
$ source bitbake-builds/poky-wrynose/build/init-build-env
$ bitbake-config-build list-fragments
$ bitbake-config-build enable-fragment core/yocto/root-login-with-empty-password
Raspberry Pi用の設定
$ bitbake-layers layerindex-fetch meta-raspberrypi
($ git clone -b wrynose https://git.yoctoproject.org/meta-raspberrypi ../layers/meta-raspberrypi)
($ bitbake-layers add-layer ../layers/meta-raspberrypi)
$ bitbake-layers show-layers
$ bitbake-config-build enable-fragment machine/raspberrypi4-64
- conf/local.conf
LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
$ bitbake core-image-minimal
($ runqemu snapshot)
$ cd build/tmp/deploy/images/raspberrypi4-64/
$ sudo bmaptool copy core-image-sato-raspberrypi4-64.rootfs.wic.bz2 /dev/sdX
Scarthgap
$ git clone -b scarthgap https://git.yoctoproject.org/poky
$ source poky/oe-init-build-env
$ bitbake-layers layerindex-fetch meta-raspberrypi
$ bitbake-layers show-layers
- conf/local.conf
MACHINE = "raspberrypi4-64"
$ bitbake core-image-minimal
kas
- kas-poky-rpi.yml
Scarthgap
header:
version: 14
machine: raspberrypi4-64
distro: poky
target:
- core-image-minimal
repos:
poky:
url: https://git.yoctoproject.org/poky
branch: scarthgap
layers:
meta:
meta-poky:
meta-yocto-bsp:
meta-openembedded:
url: https://git.openembedded.org/meta-openembedded
branch: scarthgap
layers:
meta-oe:
meta-python:
meta-raspberrypi:
url: https://git.yoctoproject.org/meta-raspberrypi
branch: scarthgap
layers:
.:
$ kas-container build kas-poky-rpi.yml
SDK
ビルド
~/yocto/build$ bitbake -c populate_sdk core-image-base
インストール
~/yocto/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-base-cortexa57-qemuarm64-toolchain-5.0.4.sh
環境設定
$ source /opt/poky/5.0.4/environment-setup-cortexa57-poky-linux
使用方法
$ pkg-config --list-all
自作アプリの追加
デバッグ
git clone -b kirkstone https://git.openembedded.org/meta-openembedded
bitbake-layers add-layer meta-oe
bitbake-layers add-layer meta-python
local.conf
CORE_IMAGE_EXTRA_INSTALL += " python3 apache2 gdb gdbserver"
DISTRO_FEATURES += " debuginfod"
debuginfod
- local.conf
gdb /bin/cat
ホスト
oe-debuginfod
gdbserver
local.conf
IMAGE_GEN_DEBUGFS = "1"
IMAGE_FSTYPES_DEBUGFS = "tar.bz2"
EXTRA_IMAGE_FEATURES:append = " tools-debug"
mkdir debugfs
cd debugfs
tar xjf build/tmp/deploy/images/qemuarm64/core-image-minimal-qemuarm64.rootfs.tar.bz2
tar xjf build/tmp/deploy/images/qemuarm64/core-image-minimal-qemuarm64.rootfs-dbg.tar.bz2
build-dir/tmp/sysrootfs/host/usr/bin/architecture/architecture-gdb
gdbserver localhost:1234 /bin/gzip -help
cd debugfs
aarch64-poky-linux-gdb
(gdb) set sysroot debugfs
(gdb) set substitute-path /usr/src/debug debugfs/usr/src/debug
(gdb) target remote IP-of-target:1234
- ~/.gdbinit
bitback bash
bitbake -c devshell bash
cd ..
scp packages-split/bash/bin/bash target:/bin/bash
cp -a packages-split/bash-dbg/* path/debugfs
ターゲット上でのみデバッグ
- local.conf
EXTRA_IMAGE_FEATURES:append = " tools-debug"
IMAGE_INSTALL:append = " packagename-dbg"
EXTRA_IMAGE_FEATURES:append = " dbg-pkgs"
DEBUG_BUILD = "1"
USBブート
- local.conf
CMDLINE_remove = "root=/dev/mmcblk0p2"
CMDLINE_append = "root=/dev/sda2"