0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【yocto】kernelのソースコードを確認する方法

Last updated at Posted at 2022-07-14

方法

(1) 以下のコマンドで、イメージに含まれるカーネルのレシピ名を確認する

bitbake -e <イメージのレシピ名> | grep "PREFERRED_PROVIDER_virtual/kernel"

(2) 以下のコマンドで、kernelにパッチを当てた状態でビルドを停止させる

bitbake -c do_patch <カーネルのレシピ名> 

(3) tmp/work-shared/<アーキテクチャ名>/kernel-sourceを確認する
※展開されない場合、bitbake -e <カーネルのレシピ名> | grep '^S='で展開先が確認できる

動作確認

  • 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
  • imageにどんなkernelが採用されているかを確認する
takeshi@X250:~/yocto/poky/build$ bitbake -e core-image-minimal | grep "PREFERRED_PROVIDER_virtual/kernel"
# $PREFERRED_PROVIDER_virtual/kernel
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
  • kernelのソースコードの展開先がどこかを確認する
takeshi@X250:~/yocto/poky/build$ bitbake -e linux-yocto | grep '^S='
S="/home/takeshi/yocto/poky/build/tmp/work-shared/qemux86-64/kernel-source"
  • kernelのビルドをパッチを当てた時点で停止する
takeshi@X250:~/yocto/poky/build$ bitbake -c do_patch linux-yocto
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:00
Sstate summary: Wanted 2 Found 2 Missed 0 Current 0 (100% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
NOTE: Tasks Summary: Attempted 22 tasks of which 16 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.
  • 展開されたソースコードを確認する
takeshi@X250:~/yocto/poky/build$ ls tmp/work-shared/qemux86-64/kernel-source/
COPYING  Documentation  Kconfig   MAINTAINERS  README  block  crypto   fs       init  kernel  mm   samples  security  tools  virt
CREDITS  Kbuild         LICENSES  Makefile     arch    certs  drivers  include  ipc   lib     net  scripts  sound     usr
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?