SlideShare a Scribd company logo
Yocto ProjectĀ®
Kernel Lab, Hands-On
Trevor Woerner, TogƔn Labs
Yocto Project DevDay Virtual, North America, 2020
Yocto Project | The Linux Foundation
Ignoring TheYocto Project (briefly)
3 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - first pass
ā€¢ obtain kernel
ā€¢ obtain cross-toolchain
ā€¢ setup cross-toolchain/environment
ā€¢ configure kernel/tweak DT
ā€¢ build kernel/modules/dtb
ā€¢ install kernel/modules/dtb
ā€¢ test
4 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - later
ā€¢ edit kernel
ā€¢ write kernel module
ā€¢ do -rt stuff
ā€¢ build, install, test
5 Yocto ProjectĀ®
| The Linux FoundationĀ®
Obtain Kernel
ā€¢ upstream Linus
ā€¢ upstream linux-stable
ā€¢ vendor kernel (tries to be good)
ā€¢ evil vendor kernel (franken-kernel)
6 Yocto ProjectĀ®
| The Linux FoundationĀ®
Obtain Cross-Toolchain
ā€¢ cross-compiler from your distro
ā€¢ gnu.gcc.org (compile your own, good luck)
ā€¢ crosstool-NG (compile your own, with help)
ā€¢ ARM/Linaro
ā€¢ Bootlin
ā€¢ kernel.org (NOTE: kernel only)
ā€¢ vendor
7 Yocto ProjectĀ®
| The Linux FoundationĀ®
Obtain Cross-Toolchain
ARM/Linaro
8 Yocto ProjectĀ®
| The Linux FoundationĀ®
Obtain Cross-Toolchain
Bootlin - https://toolchains.bootlin.com
9 Yocto ProjectĀ®
| The Linux FoundationĀ®
Obtain Cross-Toolchain
kernel.org - https://www.kernel.org/pub/tools/crosstool
10 Yocto ProjectĀ®
| The Linux FoundationĀ®
Setup Toolchain/Environment
$ export ARCH=arm
$ export CROSS_COMPILE=<toolchain-prefix>
ā€¢ (compile +) install toolchain
ā€¢ setup $PATH
either:
ā€¢ tweak environment
ā€¢ specify on cmdline
$ ARCH=arm CROSS_COMPILE=<toolchain-prefix> make
11 Yocto ProjectĀ®
| The Linux FoundationĀ®
Build Kernel, Modules, DTB
$ ARCH=arm CROSS_COMPILE=<toolchain-prefix> make
12 Yocto ProjectĀ®
| The Linux FoundationĀ®
Install Kernel, Modules, DTB
ā€¢ by default:
ā€¢ kernel: $INSTALL_PATH (default: /boot)
ā€¢ modules: $INSTALL_MOD_PATH/lib/modules/$VER
ā€¢ dtb: $INSTALL_PATH/dtbs/$VER
ā€¢ this doesn't work for embedded
ā€¢ each board isā€¦ "unique"
13 Yocto ProjectĀ®
| The Linux FoundationĀ®
Install Kernel, Modules, DTB
ā€¢ how and where these various parts are installed is highly
board-specific:
ā€¢ extlinux.conf
ā€¢ uEnv.txt
ā€¢ separate partitions
ā€¢ APPENDED_DTB (i.e. "bundled")
ā€¢ U-Boot FIT image
14 Yocto ProjectĀ®
| The Linux FoundationĀ®
Install Kernel, Modules, DTB
ā€¢ how and where these various parts are installed is highly
board-specific:
ā€¢ "magic" offsets on storage device
ā€¢ multi-partition UBI (raw flash)
ā€¢ initial FAT/VFAT partition
15 Yocto ProjectĀ®
| The Linux FoundationĀ®
Install Kernel, Modules, DTB
ā€¢ there is a very tight coupling between
ā€¢ bootloader
ā€¢ kernel cmdline
ā€¢ kernel + modules + dtb
ā€¢ final image assembly (e.g. wic)
16 Yocto ProjectĀ®
| The Linux FoundationĀ®
Edit Kernel
ā€¢ not too difficult, locate and edit kernel sources
ā€¢ just make sure you're editing the correct sources
(multiple boards, multiple projects, multiple
configurations) and using the correct toolchain
(correctly)
17 Yocto ProjectĀ®
| The Linux FoundationĀ®
Write Kernel Module
ā€¢ need to copy+paste an example Makefile to get the out-
of-kernel-tree build plumbing correct
ā€¢ otherwise the mechanics aren't too complicated
18 Yocto ProjectĀ®
| The Linux FoundationĀ®
Do -rt Stuff
ā€¢ I hope the kernel version you're using is one for which
there is an -rt patch available, otherwise forget it
ā€¢ if the above is true, manually applying the -rt patch
against an unmodified base isn't too difficult
19 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow Without Yocto
ā€¢ it's not too hard if you've done it once or twice before
ā€¢ but can be tricky to get it right the first time
ā€¢ the amount of work compounds with the number of
boards you need to support
ā€¢ multiple toolchains
ā€¢ multiple configurations
ā€¢ multiple install layouts
Yocto Project | The Linux Foundation
Can TheYocto Project Help?
21 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - multiple users
ā€¢ tweaking a kernel/config or writing a kernel module using
an existing BSP
ā€¢ board bring-up (creating a BSP) for a new board
22 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - existing BSP
ā€¢ obtain kernel
ā€¢ obtain cross-toolchain
ā€¢ setup cross-toolchain/environment
ā€¢ configure kernel/tweak DT
ā€¢ build kernel/modules/dtb
ā€¢ install kernel/modules/dtb
DO
N
E!
23 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow TODO - existing BSP
ā€¢ change kernel
ā€¢ obtain cross-toolchain
ā€¢ setup cross-toolchain/environment
ā€¢ configure kernel/tweak DT
ā€¢ build kernel/modules/dtb
ā€¢ install kernel/modules/dtb
ā€¢ edit kernel sources
ā€¢ write a kernel module
24 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow TODO - existing BSP
change kernel
ā€¢ many kernels from which to choose (upstream, vendor,
stable)
ā€¢ The Yocto Project provides its own (linux-yocto) plus
tooling for use with linux-yocto, or your own
ā€¢ linux-yocto comes in a couple variants:
ā€¢ (base)
ā€¢ -dev
ā€¢ -tiny
ā€¢ -rt
25 Yocto ProjectĀ®
| The Linux FoundationĀ®
ā€¢ use your own defconfig
ā€¢ use an in-kernel _defconfig
ā€¢ generate one or more config "fragments" which are
applied on top of the base configuration
Kernel Workflow TODO - existing BSP
tweak config
26 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow TODO - existing BSP
edit kernel code
ā€¢ good for pr_notice() debugging
ā€¢ edit/add device IDs (PCI, USB) for new hardware
27 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow TODO - existing BSP
write a module
ā€¢ a frequent activity with embedded devices
ā€¢ autoload on boot with KERNEL_MODULE_AUTOLOAD
ā€¢ be sure to include your modules into your image
(MACHINE_EXTRA_RRECOMMENDS)
28 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - new BSP
ā€¢ obtain kernel
ā€¢ obtain cross-toolchain
ā€¢ setup cross-toolchain/environment
ā€¢ configure kernel/tweak DT
ā€¢ build kernel/modules/dtb
ā€¢ install kernel/modules/dtb
DO
N
E!
29 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - new BSP
ā€¢ obtain kernel
ā€¢ obtain cross-toolchain
ā€¢ setup cross-toolchain/environment
ā€¢ configure kernel/tweak DT
ā€¢ build kernel/modules/dtb
ā€¢ install kernel/modules/dtb
ā€¢ ā€¦ but with a lot of help!
DO
N
E!
30 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Workflow - new BSP
ā€¢ obtain kernel
ā€¢ implicit understanding of how to fetch code
ā€¢ setup cross-toolchain/environment
ā€¢ set the processor "TUNE" in $MACHINE
ā€¢ configure kernel/tweak DT
ā€¢ lots of linux-yocto tooling
ā€¢ install kernel/modules/dtb
ā€¢ lots of kernel-handling classes
Yocto Project | The Linux Foundation
Hands On:
Existing BSP
32 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~$ cd scratch
ilab01:~/scratch$ git clone -b dunfell git://git.yoctoproject.org/poky.git
Cloning into 'poky'...
remote: Enumerating objects: 479650, done.
remote: Counting objects: 100% (479650/479650), done.
remote: Compressing objects: 100% (113534/113534), done.
remote: Total 479650 (delta 359015), reused 478925 (delta 358472)
Receiving objects: 100% (479650/479650), 164.40 MiB | 28.37 MiB/s, done.
Resolving deltas: 100% (359015/359015), done.
33 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~/scratch$ . poky/oe-init-build-env
...
### Shell environment set up for builds. ###
...
ilab01:~/scratch/build$
ilab01:~/scratch/build$ export $PS1="${PS1}lab> "
ilab01:~/scratch/build$ lab>
ā€¢ I like to remind myself this is now a modified-
environment shell for builds:
34 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~/scratch/build$ lab> $EDITOR conf/local
ā€¢ here's what you need to change:
MACHINE = "qemux86-64"
DL_DIR = "/scratch/downloads"
SSTATE_DIR = "/scratch/sstate-cache"
SDKMACHINE = "x86_64"
OE_TERMINAL = "screen"
35 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~/scratch/build$ lab> bitbake core-image-minimal
Build Configuration:
BB_VERSION = "1.46.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.1.1"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "dunfell:93ef4736915090ac9a2402916df8924ac4439490"
ā€¢ baseline build:
36 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~/scratch/build$ lab> runqemu slirp nographic serial
...
hwclock: settimeofday: Invalid argument
chmod: /var/log/wtmp: No such file or directory
Failed to set mode -0664- for -/var/log/wtmp-.
INIT: Entering runlevel: 5
Configuring network interfaces... ip: RTNETLINK answers: File exists
hwclock: settimeofday: Invalid argument
Starting syslogd/klogd: done
Poky (Yocto Project Reference Distro) 3.1.1 qemux86-64 /dev/ttyS0
qemux86-64 login:
ā€¢ verify it runs
37 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
Poky (Yocto Project Reference Distro) 3.1.1 qemux86-64 /dev/ttyS0
qemux86-64 login: root
root@qemux86-64:~# uname -a
Linux qemux86-64 5.4.43-yocto-standard #1 SMP PREEMPT Thu May 28 15:33:30 UTC
2020
root@qemux86:~# shutdown -h now
...
[ 130.239174] ACPI: Preparing to enter system sleep state S5
[ 130.242375] reboot: Power down
runqemu - INFO - Cleaning up
ilab01:~/scratch/build$ lab>
ā€¢ shutdown
38 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Prep
ilab01:~/scratch/build$ lab> bitbake-layers create-layer meta-mytweaks
NOTE: Starting bitbake server...
Add your new layer with 'bitbake-layers add-layer meta-mytweaks'
ilab01:~/scratch/build$ lab> bitbake-layers add-layer meta-mytweaks
NOTE: Starting bitbake server...
ilab01:~/scratch/build$ lab>
ā€¢ create/add a layer for your changes
39 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
40 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> devtool modify virtual/kernel
...
Currently 1 running tasks (431 of 437) 98% | ############################ |
0: linux-yocto-5.4.43+gitAUTOINC+aafb8f095e_9e1b13d7f9-r0 do_kernel_checkout
- 1m49s (pid 1615575)
INFO: Copying kernel config to srctree
INFO: Source tree extracted to /scratch/build/workspace/sources/linux-yocto
INFO: Recipe linux-yocto now set up to build from
/scratch/build/workspace/sources/linux-yocto
ā€¢ use devtool
41 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> $EDITOR workspace/sources/linux-yocto/init/main.c
1137 /*
1138 * We try each of these until one succeeds.
1139 *
1140 * The Bourne shell can be used instead of init if we are
1141 * trying to recover a really broken machine.
1142 */
1143 pr_notice("*** --- >>> edit <<< --- ***n");
1144 if (execute_command) {
1145 ret = run_init_process(execute_command);
1146 if (!ret)
1147 return 0;
1148 panic("Requested init %s failed (error %d).",
1149 execute_command, ret);
ā€¢ edit init/main.c
42 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> bitbake core-image-minimal
...
NOTE: linux-yocto: compiling from external source tree
/scratch/build/workspace/sources/linux-yocto
...
ā€¢ build
43 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> runqemu slirp nographic serial
...
[ 5.209719] VFS: Mounted root (ext4 filesystem) on device 253:0.
[ 5.211596] devtmpfs: mounted
[ 5.312611] Freeing unused kernel image memory: 1580K
[ 5.313286] Write protecting kernel text and read-only data: 20480k
[ 5.313744] *** --- >>> edit <<< --- ***
[ 5.313980] Run /sbin/init as init process
INIT: version booting
Starting udev
[ 6.096177] udevd[138]: starting version 3.2.9
[ 6.162295] udevd[139]: starting eudev-3.2.9
...
ā€¢ test (you might have to scroll up)
44 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> pushd workspace/sources/linux-yocto
~/scratch/build/workspace/sources/linux-yocto ~/scratch/build
ilab01:~/scratch/build$ lab> git commit -avs -m "init/main.c: add my tweaks"
ilab01:~/scratch/build$ lab> popd
~/scratch/build
ā€¢ commit your changes (don't forget upstream-status)
45 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> devtool finish linux-yocto meta-mytweaks
...
NOTE: Writing append file
/scratch/build/meta-mytweaks/recipes-kernel/linux/linux-yocto_%.bbappend
NOTE: Copying 0001-init-main.c-add-my-tweaks.patch to /scratch/build/meta-
mytweaks/recipes-kernel/linux/linux-yocto/0001-init-main.c-add-my-
tweaks.patch
INFO: Cleaning sysroot for recipe linux-yocto...
INFO: Leaving source tree /scratch/build/workspace/sources/linux-yocto as-is;
if you no longer need it then please delete it manually
ilab01:~/scratch/build$ lab> rm -fr workspace/sources/linux-yocto
ā€¢ update your metadata (emphasis mine)
46 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Edit the Kernel
ilab01:~/scratch/build$ lab> tree meta-mytweaks
meta-mytweaks/
ā”œā”€ā”€ COPYING.MIT
ā”œā”€ā”€ README
ā”œā”€ā”€ conf
ā”‚Ā Ā  ā””ā”€ā”€ layer.conf
ā””ā”€ā”€ recipes-kernel
ā””ā”€ā”€ linux
ā”œā”€ā”€ linux-yocto
ā”‚Ā Ā  ā””ā”€ā”€ 0001-init-main.c-add-my-tweaks.patch
ā””ā”€ā”€ linux-yocto_%.bbappend
ā€¢ check
47 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
48 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> devtool modify virtual/kernel
...
NOTE: Tasks Summary: Attempted 437 tasks of which 426 didn't need to be rerun
and all succeeded.
INFO: Copying kernel config to srctree
INFO: Source tree extracted to
/z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto
INFO: Recipe linux-yocto now set up to build from
/z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto
ā€¢ use devtool, setup
49 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> devtool menuconfig linux-yocto
ā€¢ use devtool
50 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ā€¢ navigate to:
General Setup
Preemption Model
ā€¢ select:
No Forced Preemption (Server)
ā€¢ hit double-esc or <Exit> and save your changes
INFO: Updating config fragment
/z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto/oe-
local-files/devtool-fragment.cfg
51 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> bitbake core-image-minimal
NOTE: linux-yocto: compiling from external source tree
/scratch/build/workspace/sources/linux-yocto
ilab01:~/scratch/build$ lab> runqemu slirp nographic serial
...
[ 0.223909] rcu: Hierarchical RCU implementation.
...
qemux86-64 login: root
root@qemux86-64:~# uname -a
Linux qemux86-64 5.4.43-yocto-standard #1 SMP Wed Jul 1 20:06:32 UTC 2020
x86_64 GNU/Linux
ā€¢ test
ā€¢ NOTE: missing "Preemptible hierarchical RCU" and
"PREEMPT" in "uname -a"
52 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> devtool finish linux-yocto meta-mytweaks
...
NOTE: Writing append file
/scratch/build/meta-mytweaks/recipes-kernel/linux/linux-yocto_%.bbappend
NOTE: Copying devtool-fragment.cfg to /scratch/build/meta-mytweaks/recipes-
kernel/linux/linux-yocto/devtool-fragment.cfg
INFO: Cleaning sysroot for recipe linux-yocto...
INFO: Leaving source tree /scratch/build/workspace/sources/linux-yocto as-is;
if you no longer need it then please delete it manually
ilab01:~/scratch/build$ lab> rm -fr workspace/sources/linux-yocto
ā€¢ update metadata
53 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> tree meta-mytweaks
meta-mytweaks/
ā”œā”€ā”€ COPYING.MIT
ā”œā”€ā”€ README
ā”œā”€ā”€ conf
ā”‚Ā Ā  ā””ā”€ā”€ layer.conf
ā””ā”€ā”€ recipes-kernel
ā””ā”€ā”€ linux
ā”œā”€ā”€ linux-yocto
ā”‚Ā Ā  ā”œā”€ā”€ 0001-init-main.c-add-my-tweaks.patch
ā”‚Ā Ā  ā””ā”€ā”€ devtool-fragment.cfg
ā””ā”€ā”€ linux-yocto_%.bbappend
ā€¢ check
54 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ilab01:~/scratch/build$ lab> cat meta-mytweaks/recipes-kernel/linux/linux-
yocto/devtool-fragment.cfg
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT is not set
CONFIG_TREE_RCU=y
CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
CONFIG_INLINE_READ_UNLOCK=y
CONFIG_INLINE_READ_UNLOCK_IRQ=y
CONFIG_INLINE_WRITE_UNLOCK=y
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
ā€¢ check
55 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: Tweak the Kernel Configuration
ā€¢ NOTE: subsequent menuconfig changes clobber previous
changes, so you'll need to move/rename them if you're
generating more than one
56 Yocto ProjectĀ®
| The Linux FoundationĀ®
Hands-On: alt
ilab01:~/scratch/build$ lab> bitbake core-image-minimal -c populate_sdk
ā€¢ if you're not "sold" on the devtool workflow, you could
generate an SDK and use that instead
ā€¢ it is then very much like using any other SDK, but this one
is tailored to your image
ā€¢ it comes with an environment file that you source which
includes (among other things) settings for ARCH and
CROSS_COMPILE
Yocto Project | The Linux Foundation
The Yocto Project Kernel Metadata
58 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata
ā€¢ in the hands-on portion you saw an example of a kernel
configuration fragment and a patch
ā€¢ the Linux kernel configuration system has always had the
ability to handle config fragments, but few have made use
of it
ā€¢ patches and configs can be grouped into features
ā€¢ we have tooling to help organize and apply fragments and
patches in various conditions
59 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata
ā€¢ 3 types of kernel metadata:
ļ¬ scc files
ļ¬ patches
ļ¬ config fragments
60 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - config fragments
ā€¢ we saw this in the hands-on
ā€¢ use devtool or -c menuconfig/-c diffconfig to generate
ā€¢ filename has a *.cfg extension
61 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - patches
ā€¢ we also saw this in the hands-on
ā€¢ use devtool+git or patch or manually use git --format-patch
to generate
ā€¢ filename has a *.patch extension
62 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - scc
ā€¢ "scc" = Series Configuration Control
ā€¢ ties together config fragments and/or patches with extra
metadata that is useful to the build
ā€¢ filename has an *.scc extension
63 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - e.g. 1
ā€¢ you have a set of 6 boards:
ļ¬ 2 have graphics capabilities
ļ¬ 3 can make sounds
ļ¬ 1 uses raw flash
ļ¬ 4 have DVD devices
ā€¢ you could create sets of *.cfg/*.patch for each feature,
described in *scc files, then apply them as required
64 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - e.g. 2
ā€¢ you have "development" and "production" builds
ā€¢ for development builds you might want to enable more
kernel debugging and/or verbosity or NFS or lax security
ā€¢ for production builds you might want to enable more
kernel hardening and disable potential security things
(i.e. disable modules)
65 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - e.g. 3
ā€¢ you're creating a BSP layer and some of your boards use
one GPU while others use a second GPU and the rest use
yet another GPU
ā€¢ you can create metadata for each GPU and include them
in your builds as required
66 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - storage
ā€¢ there are 2 places you can store the kernel metadata:
ļ¬ in-tree
ļ¬ in a separate repository
ā€¢ regardless, add the location of the metadata to your
SRC_URI variable and be sure to specify "type=kmeta"
67 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - enabling
ā€¢ reference the *.scc file with KERNEL_FEATURES
68 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata - down the rabbit hole
ā€¢ it's much more sophisticated
ā€¢ you can define kernel types (i.e. KTYPE) and have
features enabled based on the kernel type (e.g. -tiny, -dev,
-rt)
ā€¢ *.scc files can include other *.scc files but there are ways
to say "include this *.scc file but not anything it wants to
include"
69 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata
ā€¢ examples of in-tree kmeta include:
ļ¬ https://github.com/akuster/meta-odroid
ļ¬ git.yoctoproject.org/meta-arm
ļ¬ git.yoctoproject.org/meta-xilinx
ā€¢ git.yoctoproject.org/meta-raspberrypi is an example of
just using *.cfg files without *.scc
70 Yocto ProjectĀ®
| The Linux FoundationĀ®
Kernel Metadata
ā€¢ an example of out-of-tree kmeta is:
ļ¬ git.yoctoproject.org/yocto-kernel-cache
Yocto Project | The Linux Foundation
Recommendations
72 Yocto ProjectĀ®
| The Linux FoundationĀ®
Recommendations
ā€¢ use linux-yocto if at all possible
ļ¬ your users will appreciate being able to take
advantage of the tooling and features that come with
The Yocto Project (i.e. they can tweak the config)
ā€¢ otherwise base your kernel recipe on poky/meta-
skeleton/recipes-kernel/linux/linux-yocto-custom.bb
inherit kernel
require recipes-kernel/linux/linux-yocto.inc
73 Yocto ProjectĀ®
| The Linux FoundationĀ®
Thank You!
Yocto Project Kernel Lab, Hands-On

More Related Content

What's hot

Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini
Ā 
Eclipse IDE Yocto Plugin
Eclipse IDE Yocto PluginEclipse IDE Yocto Plugin
Eclipse IDE Yocto Plugin
cudma
Ā 
Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Project
rossburton
Ā 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
Marco Cavallini
Ā 
Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019
Marco Cavallini
Ā 
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKYocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Marco Cavallini
Ā 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
Sherif Mousa
Ā 
Embedded Linux primer
Embedded Linux primerEmbedded Linux primer
Embedded Linux primer
Drew Fustini
Ā 
Creating new Tizen profiles using the Yocto Project
Creating new Tizen profiles  using the Yocto ProjectCreating new Tizen profiles  using the Yocto Project
Creating new Tizen profiles using the Yocto Project
Leon Anavi
Ā 
Jonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel ReportJonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel Report
linuxlab_conf
Ā 
[Webinar] An Introduction to the Yocto Embedded Framework
[Webinar] An Introduction to the Yocto Embedded Framework[Webinar] An Introduction to the Yocto Embedded Framework
[Webinar] An Introduction to the Yocto Embedded Framework
ICS
Ā 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
Sourabh Singh Tomar
Ā 
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/SourceCrafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Sourabh Singh Tomar
Ā 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoSherif Mousa
Ā 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018
Mender.io
Ā 
Bringing Tizen to a Raspberry Pi 2 Near You
Bringing Tizen to a Raspberry Pi 2 Near YouBringing Tizen to a Raspberry Pi 2 Near You
Bringing Tizen to a Raspberry Pi 2 Near You
Samsung Open Source Group
Ā 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
Sherif Mousa
Ā 
The dream is alive! Running Linux containers on an illumos kernel
The dream is alive! Running Linux containers on an illumos kernelThe dream is alive! Running Linux containers on an illumos kernel
The dream is alive! Running Linux containers on an illumos kernel
bcantrill
Ā 
F17 inside
F17 insideF17 inside
F17 inside
Teguh Dwicaksana
Ā 

What's hot (20)

Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
Ā 
Eclipse IDE Yocto Plugin
Eclipse IDE Yocto PluginEclipse IDE Yocto Plugin
Eclipse IDE Yocto Plugin
Ā 
Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Project
Ā 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
Ā 
Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019Autobuilder2 Yocto Project Summit Lyon 2019
Autobuilder2 Yocto Project Summit Lyon 2019
Ā 
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKYocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Ā 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
Ā 
Embedded Linux primer
Embedded Linux primerEmbedded Linux primer
Embedded Linux primer
Ā 
Creating new Tizen profiles using the Yocto Project
Creating new Tizen profiles  using the Yocto ProjectCreating new Tizen profiles  using the Yocto Project
Creating new Tizen profiles using the Yocto Project
Ā 
Jonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel ReportJonathan Corbet - Keynote: The Kernel Report
Jonathan Corbet - Keynote: The Kernel Report
Ā 
[Webinar] An Introduction to the Yocto Embedded Framework
[Webinar] An Introduction to the Yocto Embedded Framework[Webinar] An Introduction to the Yocto Embedded Framework
[Webinar] An Introduction to the Yocto Embedded Framework
Ā 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
Ā 
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/SourceCrafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Ā 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
Ā 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018
Ā 
Bringing Tizen to a Raspberry Pi 2 Near You
Bringing Tizen to a Raspberry Pi 2 Near YouBringing Tizen to a Raspberry Pi 2 Near You
Bringing Tizen to a Raspberry Pi 2 Near You
Ā 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
Ā 
The dream is alive! Running Linux containers on an illumos kernel
The dream is alive! Running Linux containers on an illumos kernelThe dream is alive! Running Linux containers on an illumos kernel
The dream is alive! Running Linux containers on an illumos kernel
Ā 
Kernel modules
Kernel modulesKernel modules
Kernel modules
Ā 
F17 inside
F17 insideF17 inside
F17 inside
Ā 

Similar to Yocto Project Kernel Lab, Hands-On

yocto_scale_handout-with-notes
yocto_scale_handout-with-notesyocto_scale_handout-with-notes
yocto_scale_handout-with-notesSteve Arnold
Ā 
Stefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto ProjectStefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto Project
linuxlab_conf
Ā 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
linuxlab_conf
Ā 
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
LF Events
Ā 
Building Embedded Linux UDOONEO
Building Embedded Linux UDOONEOBuilding Embedded Linux UDOONEO
Building Embedded Linux UDOONEO
NEEVEE Technologies
Ā 
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theoryEmbedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
EmbeddedFest
Ā 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
Yi-Hsiu Hsu
Ā 
The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
 The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
Yoshitake Kobayashi
Ā 
linux minimal os tutorial - by shatrix
linux minimal os tutorial - by shatrixlinux minimal os tutorial - by shatrix
linux minimal os tutorial - by shatrixSherif Mousa
Ā 
OpenEmbedded & BitBake - Denx
OpenEmbedded & BitBake - DenxOpenEmbedded & BitBake - Denx
OpenEmbedded & BitBake - Denxyang firo
Ā 
Buildroot easy embedded system
Buildroot easy embedded systemBuildroot easy embedded system
Buildroot easy embedded system
Nirma University
Ā 
Linux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involvedLinux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involved
divyammo
Ā 
Building Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto projectBuilding Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto project
twcoimbatore
Ā 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdf
ssuser30e7d2
Ā 
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
xiso
Ā 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
abinaya m
Ā 
Embedded Linux Odp
Embedded Linux OdpEmbedded Linux Odp
Embedded Linux Odp
ghessler
Ā 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Sherif Mousa
Ā 
1212312232
12123122321212312232
1212312232maclean liu
Ā 
Linux day 2016 Yocto Project
Linux day 2016 Yocto ProjectLinux day 2016 Yocto Project
Linux day 2016 Yocto Project
Marco Cavallini
Ā 

Similar to Yocto Project Kernel Lab, Hands-On (20)

yocto_scale_handout-with-notes
yocto_scale_handout-with-notesyocto_scale_handout-with-notes
yocto_scale_handout-with-notes
Ā 
Stefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto ProjectStefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto Project
Ā 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Ā 
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Generating a Reproducible and Maintainable Embedded Linux Environment with Po...
Ā 
Building Embedded Linux UDOONEO
Building Embedded Linux UDOONEOBuilding Embedded Linux UDOONEO
Building Embedded Linux UDOONEO
Ā 
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theoryEmbedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
Embedded Fest 2019. Š ŃƒŃŠ»Š°Š½ Š‘ŠøŠ»Š¾Š²Š¾Š». Linux Boot: The Big Bang theory
Ā 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
Ā 
The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
 The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
The Latest Status of CE Workgroup Shared Embedded Linux Distribution Project
Ā 
linux minimal os tutorial - by shatrix
linux minimal os tutorial - by shatrixlinux minimal os tutorial - by shatrix
linux minimal os tutorial - by shatrix
Ā 
OpenEmbedded & BitBake - Denx
OpenEmbedded & BitBake - DenxOpenEmbedded & BitBake - Denx
OpenEmbedded & BitBake - Denx
Ā 
Buildroot easy embedded system
Buildroot easy embedded systemBuildroot easy embedded system
Buildroot easy embedded system
Ā 
Linux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involvedLinux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involved
Ā 
Building Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto projectBuilding Emmbedded Linux with Yocto project
Building Emmbedded Linux with Yocto project
Ā 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdf
Ā 
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
2022-05-03 SoC Interest Group Meeting - Deploying and testing firmware-softwa...
Ā 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
Ā 
Embedded Linux Odp
Embedded Linux OdpEmbedded Linux Odp
Embedded Linux Odp
Ā 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Ā 
1212312232
12123122321212312232
1212312232
Ā 
Linux day 2016 Yocto Project
Linux day 2016 Yocto ProjectLinux day 2016 Yocto Project
Linux day 2016 Yocto Project
Ā 

More from Trevor Woerner

Sensing Temperature with a RaspberryPi
Sensing Temperature with a RaspberryPiSensing Temperature with a RaspberryPi
Sensing Temperature with a RaspberryPi
Trevor Woerner
Ā 
GSoC/EVoC Overview
GSoC/EVoC OverviewGSoC/EVoC Overview
GSoC/EVoC Overview
Trevor Woerner
Ā 
Getting Started with Buildroot - Lab
Getting Started with Buildroot - LabGetting Started with Buildroot - Lab
Getting Started with Buildroot - Lab
Trevor Woerner
Ā 
Getting Started with Buildroot
Getting Started with BuildrootGetting Started with Buildroot
Getting Started with Buildroot
Trevor Woerner
Ā 
Using OpenEmbedded
Using OpenEmbeddedUsing OpenEmbedded
Using OpenEmbedded
Trevor Woerner
Ā 
OE Hands-On
OE Hands-OnOE Hands-On
OE Hands-On
Trevor Woerner
Ā 
Using OpenEmbedded
Using OpenEmbeddedUsing OpenEmbedded
Using OpenEmbedded
Trevor Woerner
Ā 

More from Trevor Woerner (7)

Sensing Temperature with a RaspberryPi
Sensing Temperature with a RaspberryPiSensing Temperature with a RaspberryPi
Sensing Temperature with a RaspberryPi
Ā 
GSoC/EVoC Overview
GSoC/EVoC OverviewGSoC/EVoC Overview
GSoC/EVoC Overview
Ā 
Getting Started with Buildroot - Lab
Getting Started with Buildroot - LabGetting Started with Buildroot - Lab
Getting Started with Buildroot - Lab
Ā 
Getting Started with Buildroot
Getting Started with BuildrootGetting Started with Buildroot
Getting Started with Buildroot
Ā 
Using OpenEmbedded
Using OpenEmbeddedUsing OpenEmbedded
Using OpenEmbedded
Ā 
OE Hands-On
OE Hands-OnOE Hands-On
OE Hands-On
Ā 
Using OpenEmbedded
Using OpenEmbeddedUsing OpenEmbedded
Using OpenEmbedded
Ā 

Recently uploaded

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
Ā 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
Ā 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
Ā 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
Ā 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
Ā 
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing SuiteAI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
Google
Ā 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
Ā 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
Ā 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
Ā 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
Ā 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
Ā 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
Ā 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
Ā 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
Ā 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
Ā 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
Ā 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
Ā 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
Ā 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
Ā 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
Ā 

Recently uploaded (20)

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Ā 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Ā 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Ā 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Ā 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Ā 
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing SuiteAI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
AI Pilot Review: The Worldā€™s First Virtual Assistant Marketing Suite
Ā 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Ā 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Ā 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Ā 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Ā 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Ā 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Ā 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Ā 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Ā 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Ā 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Ā 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Ā 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
Ā 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Ā 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
Ā 

Yocto Project Kernel Lab, Hands-On

  • 1. Yocto ProjectĀ® Kernel Lab, Hands-On Trevor Woerner, TogĆ”n Labs Yocto Project DevDay Virtual, North America, 2020
  • 2. Yocto Project | The Linux Foundation Ignoring TheYocto Project (briefly)
  • 3. 3 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - first pass ā€¢ obtain kernel ā€¢ obtain cross-toolchain ā€¢ setup cross-toolchain/environment ā€¢ configure kernel/tweak DT ā€¢ build kernel/modules/dtb ā€¢ install kernel/modules/dtb ā€¢ test
  • 4. 4 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - later ā€¢ edit kernel ā€¢ write kernel module ā€¢ do -rt stuff ā€¢ build, install, test
  • 5. 5 Yocto ProjectĀ® | The Linux FoundationĀ® Obtain Kernel ā€¢ upstream Linus ā€¢ upstream linux-stable ā€¢ vendor kernel (tries to be good) ā€¢ evil vendor kernel (franken-kernel)
  • 6. 6 Yocto ProjectĀ® | The Linux FoundationĀ® Obtain Cross-Toolchain ā€¢ cross-compiler from your distro ā€¢ gnu.gcc.org (compile your own, good luck) ā€¢ crosstool-NG (compile your own, with help) ā€¢ ARM/Linaro ā€¢ Bootlin ā€¢ kernel.org (NOTE: kernel only) ā€¢ vendor
  • 7. 7 Yocto ProjectĀ® | The Linux FoundationĀ® Obtain Cross-Toolchain ARM/Linaro
  • 8. 8 Yocto ProjectĀ® | The Linux FoundationĀ® Obtain Cross-Toolchain Bootlin - https://toolchains.bootlin.com
  • 9. 9 Yocto ProjectĀ® | The Linux FoundationĀ® Obtain Cross-Toolchain kernel.org - https://www.kernel.org/pub/tools/crosstool
  • 10. 10 Yocto ProjectĀ® | The Linux FoundationĀ® Setup Toolchain/Environment $ export ARCH=arm $ export CROSS_COMPILE=<toolchain-prefix> ā€¢ (compile +) install toolchain ā€¢ setup $PATH either: ā€¢ tweak environment ā€¢ specify on cmdline $ ARCH=arm CROSS_COMPILE=<toolchain-prefix> make
  • 11. 11 Yocto ProjectĀ® | The Linux FoundationĀ® Build Kernel, Modules, DTB $ ARCH=arm CROSS_COMPILE=<toolchain-prefix> make
  • 12. 12 Yocto ProjectĀ® | The Linux FoundationĀ® Install Kernel, Modules, DTB ā€¢ by default: ā€¢ kernel: $INSTALL_PATH (default: /boot) ā€¢ modules: $INSTALL_MOD_PATH/lib/modules/$VER ā€¢ dtb: $INSTALL_PATH/dtbs/$VER ā€¢ this doesn't work for embedded ā€¢ each board isā€¦ "unique"
  • 13. 13 Yocto ProjectĀ® | The Linux FoundationĀ® Install Kernel, Modules, DTB ā€¢ how and where these various parts are installed is highly board-specific: ā€¢ extlinux.conf ā€¢ uEnv.txt ā€¢ separate partitions ā€¢ APPENDED_DTB (i.e. "bundled") ā€¢ U-Boot FIT image
  • 14. 14 Yocto ProjectĀ® | The Linux FoundationĀ® Install Kernel, Modules, DTB ā€¢ how and where these various parts are installed is highly board-specific: ā€¢ "magic" offsets on storage device ā€¢ multi-partition UBI (raw flash) ā€¢ initial FAT/VFAT partition
  • 15. 15 Yocto ProjectĀ® | The Linux FoundationĀ® Install Kernel, Modules, DTB ā€¢ there is a very tight coupling between ā€¢ bootloader ā€¢ kernel cmdline ā€¢ kernel + modules + dtb ā€¢ final image assembly (e.g. wic)
  • 16. 16 Yocto ProjectĀ® | The Linux FoundationĀ® Edit Kernel ā€¢ not too difficult, locate and edit kernel sources ā€¢ just make sure you're editing the correct sources (multiple boards, multiple projects, multiple configurations) and using the correct toolchain (correctly)
  • 17. 17 Yocto ProjectĀ® | The Linux FoundationĀ® Write Kernel Module ā€¢ need to copy+paste an example Makefile to get the out- of-kernel-tree build plumbing correct ā€¢ otherwise the mechanics aren't too complicated
  • 18. 18 Yocto ProjectĀ® | The Linux FoundationĀ® Do -rt Stuff ā€¢ I hope the kernel version you're using is one for which there is an -rt patch available, otherwise forget it ā€¢ if the above is true, manually applying the -rt patch against an unmodified base isn't too difficult
  • 19. 19 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow Without Yocto ā€¢ it's not too hard if you've done it once or twice before ā€¢ but can be tricky to get it right the first time ā€¢ the amount of work compounds with the number of boards you need to support ā€¢ multiple toolchains ā€¢ multiple configurations ā€¢ multiple install layouts
  • 20. Yocto Project | The Linux Foundation Can TheYocto Project Help?
  • 21. 21 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - multiple users ā€¢ tweaking a kernel/config or writing a kernel module using an existing BSP ā€¢ board bring-up (creating a BSP) for a new board
  • 22. 22 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - existing BSP ā€¢ obtain kernel ā€¢ obtain cross-toolchain ā€¢ setup cross-toolchain/environment ā€¢ configure kernel/tweak DT ā€¢ build kernel/modules/dtb ā€¢ install kernel/modules/dtb DO N E!
  • 23. 23 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow TODO - existing BSP ā€¢ change kernel ā€¢ obtain cross-toolchain ā€¢ setup cross-toolchain/environment ā€¢ configure kernel/tweak DT ā€¢ build kernel/modules/dtb ā€¢ install kernel/modules/dtb ā€¢ edit kernel sources ā€¢ write a kernel module
  • 24. 24 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow TODO - existing BSP change kernel ā€¢ many kernels from which to choose (upstream, vendor, stable) ā€¢ The Yocto Project provides its own (linux-yocto) plus tooling for use with linux-yocto, or your own ā€¢ linux-yocto comes in a couple variants: ā€¢ (base) ā€¢ -dev ā€¢ -tiny ā€¢ -rt
  • 25. 25 Yocto ProjectĀ® | The Linux FoundationĀ® ā€¢ use your own defconfig ā€¢ use an in-kernel _defconfig ā€¢ generate one or more config "fragments" which are applied on top of the base configuration Kernel Workflow TODO - existing BSP tweak config
  • 26. 26 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow TODO - existing BSP edit kernel code ā€¢ good for pr_notice() debugging ā€¢ edit/add device IDs (PCI, USB) for new hardware
  • 27. 27 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow TODO - existing BSP write a module ā€¢ a frequent activity with embedded devices ā€¢ autoload on boot with KERNEL_MODULE_AUTOLOAD ā€¢ be sure to include your modules into your image (MACHINE_EXTRA_RRECOMMENDS)
  • 28. 28 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - new BSP ā€¢ obtain kernel ā€¢ obtain cross-toolchain ā€¢ setup cross-toolchain/environment ā€¢ configure kernel/tweak DT ā€¢ build kernel/modules/dtb ā€¢ install kernel/modules/dtb DO N E!
  • 29. 29 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - new BSP ā€¢ obtain kernel ā€¢ obtain cross-toolchain ā€¢ setup cross-toolchain/environment ā€¢ configure kernel/tweak DT ā€¢ build kernel/modules/dtb ā€¢ install kernel/modules/dtb ā€¢ ā€¦ but with a lot of help! DO N E!
  • 30. 30 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Workflow - new BSP ā€¢ obtain kernel ā€¢ implicit understanding of how to fetch code ā€¢ setup cross-toolchain/environment ā€¢ set the processor "TUNE" in $MACHINE ā€¢ configure kernel/tweak DT ā€¢ lots of linux-yocto tooling ā€¢ install kernel/modules/dtb ā€¢ lots of kernel-handling classes
  • 31. Yocto Project | The Linux Foundation Hands On: Existing BSP
  • 32. 32 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~$ cd scratch ilab01:~/scratch$ git clone -b dunfell git://git.yoctoproject.org/poky.git Cloning into 'poky'... remote: Enumerating objects: 479650, done. remote: Counting objects: 100% (479650/479650), done. remote: Compressing objects: 100% (113534/113534), done. remote: Total 479650 (delta 359015), reused 478925 (delta 358472) Receiving objects: 100% (479650/479650), 164.40 MiB | 28.37 MiB/s, done. Resolving deltas: 100% (359015/359015), done.
  • 33. 33 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~/scratch$ . poky/oe-init-build-env ... ### Shell environment set up for builds. ### ... ilab01:~/scratch/build$ ilab01:~/scratch/build$ export $PS1="${PS1}lab> " ilab01:~/scratch/build$ lab> ā€¢ I like to remind myself this is now a modified- environment shell for builds:
  • 34. 34 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~/scratch/build$ lab> $EDITOR conf/local ā€¢ here's what you need to change: MACHINE = "qemux86-64" DL_DIR = "/scratch/downloads" SSTATE_DIR = "/scratch/sstate-cache" SDKMACHINE = "x86_64" OE_TERMINAL = "screen"
  • 35. 35 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~/scratch/build$ lab> bitbake core-image-minimal Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.1.1" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "dunfell:93ef4736915090ac9a2402916df8924ac4439490" ā€¢ baseline build:
  • 36. 36 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~/scratch/build$ lab> runqemu slirp nographic serial ... hwclock: settimeofday: Invalid argument chmod: /var/log/wtmp: No such file or directory Failed to set mode -0664- for -/var/log/wtmp-. INIT: Entering runlevel: 5 Configuring network interfaces... ip: RTNETLINK answers: File exists hwclock: settimeofday: Invalid argument Starting syslogd/klogd: done Poky (Yocto Project Reference Distro) 3.1.1 qemux86-64 /dev/ttyS0 qemux86-64 login: ā€¢ verify it runs
  • 37. 37 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep Poky (Yocto Project Reference Distro) 3.1.1 qemux86-64 /dev/ttyS0 qemux86-64 login: root root@qemux86-64:~# uname -a Linux qemux86-64 5.4.43-yocto-standard #1 SMP PREEMPT Thu May 28 15:33:30 UTC 2020 root@qemux86:~# shutdown -h now ... [ 130.239174] ACPI: Preparing to enter system sleep state S5 [ 130.242375] reboot: Power down runqemu - INFO - Cleaning up ilab01:~/scratch/build$ lab> ā€¢ shutdown
  • 38. 38 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Prep ilab01:~/scratch/build$ lab> bitbake-layers create-layer meta-mytweaks NOTE: Starting bitbake server... Add your new layer with 'bitbake-layers add-layer meta-mytweaks' ilab01:~/scratch/build$ lab> bitbake-layers add-layer meta-mytweaks NOTE: Starting bitbake server... ilab01:~/scratch/build$ lab> ā€¢ create/add a layer for your changes
  • 39. 39 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel
  • 40. 40 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> devtool modify virtual/kernel ... Currently 1 running tasks (431 of 437) 98% | ############################ | 0: linux-yocto-5.4.43+gitAUTOINC+aafb8f095e_9e1b13d7f9-r0 do_kernel_checkout - 1m49s (pid 1615575) INFO: Copying kernel config to srctree INFO: Source tree extracted to /scratch/build/workspace/sources/linux-yocto INFO: Recipe linux-yocto now set up to build from /scratch/build/workspace/sources/linux-yocto ā€¢ use devtool
  • 41. 41 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> $EDITOR workspace/sources/linux-yocto/init/main.c 1137 /* 1138 * We try each of these until one succeeds. 1139 * 1140 * The Bourne shell can be used instead of init if we are 1141 * trying to recover a really broken machine. 1142 */ 1143 pr_notice("*** --- >>> edit <<< --- ***n"); 1144 if (execute_command) { 1145 ret = run_init_process(execute_command); 1146 if (!ret) 1147 return 0; 1148 panic("Requested init %s failed (error %d).", 1149 execute_command, ret); ā€¢ edit init/main.c
  • 42. 42 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> bitbake core-image-minimal ... NOTE: linux-yocto: compiling from external source tree /scratch/build/workspace/sources/linux-yocto ... ā€¢ build
  • 43. 43 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> runqemu slirp nographic serial ... [ 5.209719] VFS: Mounted root (ext4 filesystem) on device 253:0. [ 5.211596] devtmpfs: mounted [ 5.312611] Freeing unused kernel image memory: 1580K [ 5.313286] Write protecting kernel text and read-only data: 20480k [ 5.313744] *** --- >>> edit <<< --- *** [ 5.313980] Run /sbin/init as init process INIT: version booting Starting udev [ 6.096177] udevd[138]: starting version 3.2.9 [ 6.162295] udevd[139]: starting eudev-3.2.9 ... ā€¢ test (you might have to scroll up)
  • 44. 44 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> pushd workspace/sources/linux-yocto ~/scratch/build/workspace/sources/linux-yocto ~/scratch/build ilab01:~/scratch/build$ lab> git commit -avs -m "init/main.c: add my tweaks" ilab01:~/scratch/build$ lab> popd ~/scratch/build ā€¢ commit your changes (don't forget upstream-status)
  • 45. 45 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> devtool finish linux-yocto meta-mytweaks ... NOTE: Writing append file /scratch/build/meta-mytweaks/recipes-kernel/linux/linux-yocto_%.bbappend NOTE: Copying 0001-init-main.c-add-my-tweaks.patch to /scratch/build/meta- mytweaks/recipes-kernel/linux/linux-yocto/0001-init-main.c-add-my- tweaks.patch INFO: Cleaning sysroot for recipe linux-yocto... INFO: Leaving source tree /scratch/build/workspace/sources/linux-yocto as-is; if you no longer need it then please delete it manually ilab01:~/scratch/build$ lab> rm -fr workspace/sources/linux-yocto ā€¢ update your metadata (emphasis mine)
  • 46. 46 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Edit the Kernel ilab01:~/scratch/build$ lab> tree meta-mytweaks meta-mytweaks/ ā”œā”€ā”€ COPYING.MIT ā”œā”€ā”€ README ā”œā”€ā”€ conf ā”‚Ā Ā  ā””ā”€ā”€ layer.conf ā””ā”€ā”€ recipes-kernel ā””ā”€ā”€ linux ā”œā”€ā”€ linux-yocto ā”‚Ā Ā  ā””ā”€ā”€ 0001-init-main.c-add-my-tweaks.patch ā””ā”€ā”€ linux-yocto_%.bbappend ā€¢ check
  • 47. 47 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration
  • 48. 48 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> devtool modify virtual/kernel ... NOTE: Tasks Summary: Attempted 437 tasks of which 426 didn't need to be rerun and all succeeded. INFO: Copying kernel config to srctree INFO: Source tree extracted to /z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto INFO: Recipe linux-yocto now set up to build from /z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto ā€¢ use devtool, setup
  • 49. 49 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> devtool menuconfig linux-yocto ā€¢ use devtool
  • 50. 50 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ā€¢ navigate to: General Setup Preemption Model ā€¢ select: No Forced Preemption (Server) ā€¢ hit double-esc or <Exit> and save your changes INFO: Updating config fragment /z/3.1-build-dunfell/kernellab/x86-64/build/workspace/sources/linux-yocto/oe- local-files/devtool-fragment.cfg
  • 51. 51 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> bitbake core-image-minimal NOTE: linux-yocto: compiling from external source tree /scratch/build/workspace/sources/linux-yocto ilab01:~/scratch/build$ lab> runqemu slirp nographic serial ... [ 0.223909] rcu: Hierarchical RCU implementation. ... qemux86-64 login: root root@qemux86-64:~# uname -a Linux qemux86-64 5.4.43-yocto-standard #1 SMP Wed Jul 1 20:06:32 UTC 2020 x86_64 GNU/Linux ā€¢ test ā€¢ NOTE: missing "Preemptible hierarchical RCU" and "PREEMPT" in "uname -a"
  • 52. 52 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> devtool finish linux-yocto meta-mytweaks ... NOTE: Writing append file /scratch/build/meta-mytweaks/recipes-kernel/linux/linux-yocto_%.bbappend NOTE: Copying devtool-fragment.cfg to /scratch/build/meta-mytweaks/recipes- kernel/linux/linux-yocto/devtool-fragment.cfg INFO: Cleaning sysroot for recipe linux-yocto... INFO: Leaving source tree /scratch/build/workspace/sources/linux-yocto as-is; if you no longer need it then please delete it manually ilab01:~/scratch/build$ lab> rm -fr workspace/sources/linux-yocto ā€¢ update metadata
  • 53. 53 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> tree meta-mytweaks meta-mytweaks/ ā”œā”€ā”€ COPYING.MIT ā”œā”€ā”€ README ā”œā”€ā”€ conf ā”‚Ā Ā  ā””ā”€ā”€ layer.conf ā””ā”€ā”€ recipes-kernel ā””ā”€ā”€ linux ā”œā”€ā”€ linux-yocto ā”‚Ā Ā  ā”œā”€ā”€ 0001-init-main.c-add-my-tweaks.patch ā”‚Ā Ā  ā””ā”€ā”€ devtool-fragment.cfg ā””ā”€ā”€ linux-yocto_%.bbappend ā€¢ check
  • 54. 54 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ilab01:~/scratch/build$ lab> cat meta-mytweaks/recipes-kernel/linux/linux- yocto/devtool-fragment.cfg CONFIG_PREEMPT_NONE=y # CONFIG_PREEMPT is not set CONFIG_TREE_RCU=y CONFIG_INLINE_SPIN_UNLOCK_IRQ=y CONFIG_INLINE_READ_UNLOCK=y CONFIG_INLINE_READ_UNLOCK_IRQ=y CONFIG_INLINE_WRITE_UNLOCK=y CONFIG_INLINE_WRITE_UNLOCK_IRQ=y ā€¢ check
  • 55. 55 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: Tweak the Kernel Configuration ā€¢ NOTE: subsequent menuconfig changes clobber previous changes, so you'll need to move/rename them if you're generating more than one
  • 56. 56 Yocto ProjectĀ® | The Linux FoundationĀ® Hands-On: alt ilab01:~/scratch/build$ lab> bitbake core-image-minimal -c populate_sdk ā€¢ if you're not "sold" on the devtool workflow, you could generate an SDK and use that instead ā€¢ it is then very much like using any other SDK, but this one is tailored to your image ā€¢ it comes with an environment file that you source which includes (among other things) settings for ARCH and CROSS_COMPILE
  • 57. Yocto Project | The Linux Foundation The Yocto Project Kernel Metadata
  • 58. 58 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata ā€¢ in the hands-on portion you saw an example of a kernel configuration fragment and a patch ā€¢ the Linux kernel configuration system has always had the ability to handle config fragments, but few have made use of it ā€¢ patches and configs can be grouped into features ā€¢ we have tooling to help organize and apply fragments and patches in various conditions
  • 59. 59 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata ā€¢ 3 types of kernel metadata: ļ¬ scc files ļ¬ patches ļ¬ config fragments
  • 60. 60 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - config fragments ā€¢ we saw this in the hands-on ā€¢ use devtool or -c menuconfig/-c diffconfig to generate ā€¢ filename has a *.cfg extension
  • 61. 61 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - patches ā€¢ we also saw this in the hands-on ā€¢ use devtool+git or patch or manually use git --format-patch to generate ā€¢ filename has a *.patch extension
  • 62. 62 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - scc ā€¢ "scc" = Series Configuration Control ā€¢ ties together config fragments and/or patches with extra metadata that is useful to the build ā€¢ filename has an *.scc extension
  • 63. 63 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - e.g. 1 ā€¢ you have a set of 6 boards: ļ¬ 2 have graphics capabilities ļ¬ 3 can make sounds ļ¬ 1 uses raw flash ļ¬ 4 have DVD devices ā€¢ you could create sets of *.cfg/*.patch for each feature, described in *scc files, then apply them as required
  • 64. 64 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - e.g. 2 ā€¢ you have "development" and "production" builds ā€¢ for development builds you might want to enable more kernel debugging and/or verbosity or NFS or lax security ā€¢ for production builds you might want to enable more kernel hardening and disable potential security things (i.e. disable modules)
  • 65. 65 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - e.g. 3 ā€¢ you're creating a BSP layer and some of your boards use one GPU while others use a second GPU and the rest use yet another GPU ā€¢ you can create metadata for each GPU and include them in your builds as required
  • 66. 66 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - storage ā€¢ there are 2 places you can store the kernel metadata: ļ¬ in-tree ļ¬ in a separate repository ā€¢ regardless, add the location of the metadata to your SRC_URI variable and be sure to specify "type=kmeta"
  • 67. 67 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - enabling ā€¢ reference the *.scc file with KERNEL_FEATURES
  • 68. 68 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata - down the rabbit hole ā€¢ it's much more sophisticated ā€¢ you can define kernel types (i.e. KTYPE) and have features enabled based on the kernel type (e.g. -tiny, -dev, -rt) ā€¢ *.scc files can include other *.scc files but there are ways to say "include this *.scc file but not anything it wants to include"
  • 69. 69 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata ā€¢ examples of in-tree kmeta include: ļ¬ https://github.com/akuster/meta-odroid ļ¬ git.yoctoproject.org/meta-arm ļ¬ git.yoctoproject.org/meta-xilinx ā€¢ git.yoctoproject.org/meta-raspberrypi is an example of just using *.cfg files without *.scc
  • 70. 70 Yocto ProjectĀ® | The Linux FoundationĀ® Kernel Metadata ā€¢ an example of out-of-tree kmeta is: ļ¬ git.yoctoproject.org/yocto-kernel-cache
  • 71. Yocto Project | The Linux Foundation Recommendations
  • 72. 72 Yocto ProjectĀ® | The Linux FoundationĀ® Recommendations ā€¢ use linux-yocto if at all possible ļ¬ your users will appreciate being able to take advantage of the tooling and features that come with The Yocto Project (i.e. they can tweak the config) ā€¢ otherwise base your kernel recipe on poky/meta- skeleton/recipes-kernel/linux/linux-yocto-custom.bb inherit kernel require recipes-kernel/linux/linux-yocto.inc
  • 73. 73 Yocto ProjectĀ® | The Linux FoundationĀ® Thank You!