はじめに
- 表示器が無いデバイスでは、ライセンス情報は企業のHPに載せたりする。
- 表示器のあるデバイスでは、ライセンス情報をデバイス内部に持つことが多い。
- yoctoでデバイス内(rootfs)にライセンス情報を持たせる方法を説明する。
方法
- local.confに以下を記載する
COPY_LIC_MANIFEST = "1"
COPY_LIC_DIRS = "1"
LICENSE_CREATE_PACKAGE = "1"
項目 | 生成物 |
---|---|
COPY_LIC_MANIFEST | usr/share/common-licenses/license.manifest(ライセンス情報の一覧) |
COPY_LIC_DIRS | usr/share/common-licenses/${PN}(ライセンステキスト+レシピ情報)等 |
LICENSE_CREATE_PACKAGE | usr/share/common-licenses/${PN}-lic(ライセンステキスト+レシピ情報), usr/share/licenses/(ライセンステキスト) |
例
- bitbake準備
takeshi@X250:~/yocto/poky$ source oe-init-build-env
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-ide-support
You can also run generated qemu images with a command like 'runqemu qemux86'
Other commonly useful commands are:
- 'devtool' and 'recipetool' handle common recipe tasks
- 'bitbake-layers' handles common layer tasks
- 'oe-pkgdata-util' handles common target package tasks
- local.confでCOPY_LIC_MANIFEST、COPY_LIC_DIRS、LICENSE_CREATE_PACKAGE を有効にしておく
takeshi@X250:~/yocto/poky/build$ cat conf/local.conf | tail -n 3
COPY_LIC_MANIFEST = "1"
COPY_LIC_DIRS = "1"
LICENSE_CREATE_PACKAGE = "1"
- bitbakeする
takeshi@X250:~/yocto/poky/build$ bitbake core-image-minimal
WARNING: Host distribution "zorin-15" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |##################################################################################################################################| Time: 0:00:44
Parsing of 772 .bb files complete (0 cached, 772 parsed). 1298 targets, 41 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.44.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "zorin-15"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.0"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "my-yocto-3.0:94f6b31befda5c496f65e863a6f8152b42d7ebf0"
Initialising tasks: 100% |###############################################################################################################################| Time: 0:00:02
Sstate summary: Wanted 818 Found 815 Missed 3 Current 0 (99% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
WARNING: core-image-minimal-1.0-r0 do_rootfs: [log_check] core-image-minimal: found 2 warning messages in the logfile:
[log_check] warning: group shutdown does not exist - using root
[log_check] warning: group shutdown does not exist - using root
NOTE: Tasks Summary: Attempted 2654 tasks of which 2424 didn't need to be rerun and all succeeded.
Summary: There were 2 WARNING messages shown.
- rootfsの生成物を確認する
takeshi@X250:~/yocto/poky/build$ ls tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs/usr/share/common-licenses/
base-files eudev generic_MIT initscripts-functions modutils-initscripts-lic sysvinit-inittab v86d-lic
base-files-lic eudev-lic generic_PD initscripts-lic netbase sysvinit-inittab-lic zlib
base-passwd generic_BSD-3-Clause generic_Zlib kernel-base netbase-lic sysvinit-lic zlib-lic
base-passwd-lic generic_BSD-4-Clause generic_bzip2 kernel-module-uvesafb-5.2.17-yocto-standard opkg-utils-lic sysvinit-pidof
busybox generic_GPL-2.0 glibc kmod-lic packagegroup-core-boot update-alternatives-opkg
busybox-hwclock generic_GPLv2 glibc-lic libkmod packagegroup-core-boot-lic update-rc.d
busybox-lic generic_GPLv2.0 init-ifupdown license.manifest run-postinsts update-rc.d-lic
busybox-syslog generic_LGPL-2.1 init-ifupdown-lic linux-yocto-lic run-postinsts-lic util-linux-libblkid
busybox-udhcpc generic_LGPLv2.1 initscripts modutils-initscripts sysvinit v86d
takeshi@X250:~/yocto/poky/build$ ls tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs/usr/share/licenses/
base-files busybox glibc initscripts linux-yocto netbase packagegroup-core-boot sysvinit update-rc.d zlib
base-passwd eudev init-ifupdown kmod modutils-initscripts opkg-utils run-postinsts sysvinit-inittab v86d
※local.confにINHERIT += "rm_work"を記載していると、ビルド後にworkディレクトリは削除されるため、コメントアウト等で無効化しておくこと