| 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | menuconfig SAMPLES |
| 3 | bool "Sample kernel code" |
| 4 | help |
| 5 | You can build and test sample kernel code here. |
| 6 | |
| 7 | if SAMPLES |
| 8 | |
| 9 | config SAMPLE_AUXDISPLAY |
| 10 | bool "auxdisplay sample" |
| 11 | depends on CC_CAN_LINK |
| 12 | |
| 13 | config SAMPLE_TRACE_EVENTS |
| 14 | tristate "Build trace_events examples -- loadable modules only" |
| 15 | depends on EVENT_TRACING && m |
| 16 | help |
| 17 | This builds the trace event example module. |
| 18 | |
| 19 | config SAMPLE_TRACE_CUSTOM_EVENTS |
| 20 | tristate "Build custom trace event example -- loadable modules only" |
| 21 | depends on EVENT_TRACING && m |
| 22 | help |
| 23 | This builds the custom trace event example module. |
| 24 | |
| 25 | config SAMPLE_TRACE_PRINTK |
| 26 | tristate "Build trace_printk module - tests various trace_printk formats" |
| 27 | depends on EVENT_TRACING && m |
| 28 | help |
| 29 | This builds a module that calls trace_printk() and can be used to |
| 30 | test various trace_printk() calls from a module. |
| 31 | |
| 32 | config SAMPLE_FTRACE_DIRECT |
| 33 | tristate "Build register_ftrace_direct() example" |
| 34 | depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m |
| 35 | depends on HAVE_SAMPLE_FTRACE_DIRECT |
| 36 | help |
| 37 | This builds an ftrace direct function example |
| 38 | that hooks to wake_up_process and prints the parameters. |
| 39 | |
| 40 | config SAMPLE_FTRACE_DIRECT_MULTI |
| 41 | tristate "Build register_ftrace_direct() on multiple ips example" |
| 42 | depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m |
| 43 | depends on HAVE_SAMPLE_FTRACE_DIRECT_MULTI |
| 44 | help |
| 45 | This builds an ftrace direct function example |
| 46 | that hooks to wake_up_process and schedule, and prints |
| 47 | the function addresses. |
| 48 | |
| 49 | config SAMPLE_FTRACE_OPS |
| 50 | tristate "Build custom ftrace ops example" |
| 51 | depends on FUNCTION_TRACER |
| 52 | help |
| 53 | This builds an ftrace ops example that hooks two functions and |
| 54 | measures the time taken to invoke one function a number of times. |
| 55 | |
| 56 | config SAMPLE_TRACE_ARRAY |
| 57 | tristate "Build sample module for kernel access to Ftrace instancess" |
| 58 | depends on EVENT_TRACING && m |
| 59 | help |
| 60 | This builds a module that demonstrates the use of various APIs to |
| 61 | access Ftrace instances from within the kernel. |
| 62 | |
| 63 | config SAMPLE_KOBJECT |
| 64 | tristate "Build kobject examples" |
| 65 | help |
| 66 | This config option will allow you to build a number of |
| 67 | different kobject sample modules showing how to use kobjects, |
| 68 | ksets, and ktypes properly. |
| 69 | |
| 70 | If in doubt, say "N" here. |
| 71 | |
| 72 | config SAMPLE_KPROBES |
| 73 | tristate "Build kprobes examples -- loadable modules only" |
| 74 | depends on KPROBES && m |
| 75 | help |
| 76 | This build several kprobes example modules. |
| 77 | |
| 78 | config SAMPLE_KRETPROBES |
| 79 | tristate "Build kretprobes example -- loadable modules only" |
| 80 | default m |
| 81 | depends on SAMPLE_KPROBES && KRETPROBES |
| 82 | |
| 83 | config SAMPLE_HW_BREAKPOINT |
| 84 | tristate "Build kernel hardware breakpoint examples -- loadable module only" |
| 85 | depends on HAVE_HW_BREAKPOINT && m |
| 86 | help |
| 87 | This builds kernel hardware breakpoint example modules. |
| 88 | |
| 89 | config SAMPLE_FPROBE |
| 90 | tristate "Build fprobe examples -- loadable modules only" |
| 91 | depends on FPROBE && m |
| 92 | help |
| 93 | This builds a fprobe example module. This module has an option 'symbol'. |
| 94 | You can specify a probed symbol or symbols separated with ','. |
| 95 | |
| 96 | config SAMPLE_KFIFO |
| 97 | tristate "Build kfifo examples -- loadable modules only" |
| 98 | depends on m |
| 99 | help |
| 100 | This config option will allow you to build a number of |
| 101 | different kfifo sample modules showing how to use the |
| 102 | generic kfifo API. |
| 103 | |
| 104 | If in doubt, say "N" here. |
| 105 | |
| 106 | config SAMPLE_KDB |
| 107 | tristate "Build kdb command example -- loadable modules only" |
| 108 | depends on KGDB_KDB && m |
| 109 | help |
| 110 | Build an example of how to dynamically add the hello |
| 111 | command to the kdb shell. |
| 112 | |
| 113 | config SAMPLE_QMI_CLIENT |
| 114 | tristate "Build qmi client sample -- loadable modules only" |
| 115 | depends on m |
| 116 | depends on ARCH_QCOM |
| 117 | depends on NET |
| 118 | select QCOM_QMI_HELPERS |
| 119 | help |
| 120 | Build an QMI client sample driver, which demonstrates how to |
| 121 | communicate with a remote QRTR service, using QMI encoded messages. |
| 122 | |
| 123 | config SAMPLE_RPMSG_CLIENT |
| 124 | tristate "Build rpmsg client sample -- loadable modules only" |
| 125 | depends on RPMSG && m |
| 126 | help |
| 127 | Build an rpmsg client sample driver, which demonstrates how |
| 128 | to communicate with an AMP-configured remote processor over |
| 129 | the rpmsg bus. |
| 130 | |
| 131 | config SAMPLE_LIVEPATCH |
| 132 | tristate "Build live patching samples -- loadable modules only" |
| 133 | depends on LIVEPATCH && m |
| 134 | help |
| 135 | Build sample live patch demonstrations. |
| 136 | |
| 137 | config SAMPLE_CONFIGFS |
| 138 | tristate "Build configfs patching sample -- loadable modules only" |
| 139 | depends on CONFIGFS_FS && m |
| 140 | help |
| 141 | Builds a sample configfs interface. |
| 142 | |
| 143 | config SAMPLE_CONNECTOR |
| 144 | tristate "Build connector sample -- loadable modules only" |
| 145 | depends on CONNECTOR && HEADERS_INSTALL && m |
| 146 | help |
| 147 | When enabled, this builds both a sample kernel module for |
| 148 | the connector interface and a user space tool to communicate |
| 149 | with it. |
| 150 | See also Documentation/driver-api/connector.rst |
| 151 | |
| 152 | config SAMPLE_FANOTIFY_ERROR |
| 153 | bool "Build fanotify error monitoring sample" |
| 154 | depends on FANOTIFY && CC_CAN_LINK && HEADERS_INSTALL |
| 155 | help |
| 156 | When enabled, this builds an example code that uses the |
| 157 | FAN_FS_ERROR fanotify mechanism to monitor filesystem |
| 158 | errors. |
| 159 | See also Documentation/admin-guide/filesystem-monitoring.rst. |
| 160 | |
| 161 | config SAMPLE_HIDRAW |
| 162 | bool "hidraw sample" |
| 163 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 164 | |
| 165 | config SAMPLE_LANDLOCK |
| 166 | bool "Landlock example" |
| 167 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 168 | help |
| 169 | Build a simple Landlock sandbox manager able to start a process |
| 170 | restricted by a user-defined filesystem access control policy. |
| 171 | |
| 172 | config SAMPLE_PIDFD |
| 173 | bool "pidfd sample" |
| 174 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 175 | |
| 176 | config SAMPLE_SECCOMP |
| 177 | bool "Build seccomp sample code" |
| 178 | depends on SECCOMP_FILTER && CC_CAN_LINK && HEADERS_INSTALL |
| 179 | help |
| 180 | Build samples of seccomp filters using various methods of |
| 181 | BPF filter construction. |
| 182 | |
| 183 | config SAMPLE_TIMER |
| 184 | bool "Timer sample" |
| 185 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 186 | |
| 187 | config SAMPLE_TSM_MR |
| 188 | tristate "TSM measurement sample" |
| 189 | select TSM_MEASUREMENTS |
| 190 | select VIRT_DRIVERS |
| 191 | help |
| 192 | Build a sample module that emulates MRs (Measurement Registers) and |
| 193 | exposes them to user mode applications through the TSM sysfs |
| 194 | interface (/sys/class/misc/tsm_mr_sample/emulated_mr/). |
| 195 | |
| 196 | The module name will be tsm-mr-sample when built as a module. |
| 197 | |
| 198 | config SAMPLE_UHID |
| 199 | bool "UHID sample" |
| 200 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 201 | help |
| 202 | Build UHID sample program. |
| 203 | |
| 204 | config SAMPLE_VFIO_MDEV_MTTY |
| 205 | tristate "Build VFIO mtty example mediated device sample code" |
| 206 | depends on VFIO |
| 207 | select VFIO_MDEV |
| 208 | help |
| 209 | Build a virtual tty sample driver for use as a VFIO |
| 210 | mediated device |
| 211 | |
| 212 | config SAMPLE_VFIO_MDEV_MDPY |
| 213 | tristate "Build VFIO mdpy example mediated device sample code" |
| 214 | depends on VFIO |
| 215 | select VFIO_MDEV |
| 216 | help |
| 217 | Build a virtual display sample driver for use as a VFIO |
| 218 | mediated device. It is a simple framebuffer and supports |
| 219 | the region display interface (VFIO_GFX_PLANE_TYPE_REGION). |
| 220 | |
| 221 | config SAMPLE_VFIO_MDEV_MDPY_FB |
| 222 | tristate "Build VFIO mdpy example guest fbdev driver" |
| 223 | depends on FB |
| 224 | select FB_IOMEM_HELPERS |
| 225 | help |
| 226 | Guest fbdev driver for the virtual display sample driver. |
| 227 | |
| 228 | config SAMPLE_VFIO_MDEV_MBOCHS |
| 229 | tristate "Build VFIO mbochs example mediated device sample code" |
| 230 | depends on VFIO |
| 231 | select VFIO_MDEV |
| 232 | select DMA_SHARED_BUFFER |
| 233 | help |
| 234 | Build a virtual display sample driver for use as a VFIO |
| 235 | mediated device. It supports the region display interface |
| 236 | (VFIO_GFX_PLANE_TYPE_DMABUF). |
| 237 | Emulate enough of qemu stdvga to make bochs-drm.ko happy. |
| 238 | That is basically the vram memory bar and the bochs dispi |
| 239 | interface vbe registers in the mmio register bar. |
| 240 | Specifically it does *not* include any legacy vga stuff. |
| 241 | Device looks a lot like "qemu -device secondary-vga". |
| 242 | |
| 243 | config SAMPLE_ANDROID_BINDERFS |
| 244 | bool "Build Android binderfs example" |
| 245 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 246 | help |
| 247 | Builds a sample program to illustrate the use of the Android binderfs |
| 248 | filesystem. |
| 249 | |
| 250 | config SAMPLE_VFS |
| 251 | bool "Build example programs that use new VFS system calls" |
| 252 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 253 | help |
| 254 | Build example userspace programs that use new VFS system calls such |
| 255 | as mount API and statx(). Note that this is restricted to the x86 |
| 256 | arch whilst it accesses system calls that aren't yet in all arches. |
| 257 | |
| 258 | config SAMPLE_INTEL_MEI |
| 259 | bool "Build example program working with intel mei driver" |
| 260 | depends on INTEL_MEI |
| 261 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 262 | help |
| 263 | Build a sample program to work with mei device. |
| 264 | |
| 265 | config SAMPLE_TPS6594_PFSM |
| 266 | bool "Build example program working with TPS6594 PFSM driver" |
| 267 | depends on HEADERS_INSTALL |
| 268 | depends on CC_CAN_LINK |
| 269 | help |
| 270 | Build a sample program to work with PFSM devices. |
| 271 | |
| 272 | config SAMPLE_WATCHDOG |
| 273 | bool "watchdog sample" |
| 274 | depends on CC_CAN_LINK |
| 275 | |
| 276 | config SAMPLE_WATCH_QUEUE |
| 277 | bool "Build example watch_queue notification API consumer" |
| 278 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 279 | help |
| 280 | Build example userspace program to use the new mount_notify(), |
| 281 | sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. |
| 282 | |
| 283 | config SAMPLE_CORESIGHT_SYSCFG |
| 284 | tristate "Build example loadable module for CoreSight config" |
| 285 | depends on CORESIGHT && m |
| 286 | help |
| 287 | Build an example loadable module that adds new CoreSight features |
| 288 | and configuration using the CoreSight system configuration API. |
| 289 | This demonstrates how a user may create their own CoreSight |
| 290 | configurations and easily load them into the system at runtime. |
| 291 | |
| 292 | config SAMPLE_KMEMLEAK |
| 293 | tristate "Simple test for the kernel memory leak detector" |
| 294 | depends on DEBUG_KMEMLEAK && m |
| 295 | help |
| 296 | Build a sample program which have explicitly leaks memory to test |
| 297 | kmemleak |
| 298 | |
| 299 | config SAMPLE_CGROUP |
| 300 | bool "Build cgroup sample code" |
| 301 | depends on CGROUPS && CC_CAN_LINK && HEADERS_INSTALL |
| 302 | help |
| 303 | Build samples that demonstrate the usage of the cgroup API. |
| 304 | |
| 305 | config SAMPLE_CHECK_EXEC |
| 306 | bool "Exec secure bits examples" |
| 307 | depends on CC_CAN_LINK && HEADERS_INSTALL |
| 308 | help |
| 309 | Build a tool to easily configure SECBIT_EXEC_RESTRICT_FILE and |
| 310 | SECBIT_EXEC_DENY_INTERACTIVE, and a simple script interpreter to |
| 311 | demonstrate how they should be used with execveat(2) + |
| 312 | AT_EXECVE_CHECK. |
| 313 | |
| 314 | config SAMPLE_HUNG_TASK |
| 315 | tristate "Hung task detector test code" |
| 316 | depends on DETECT_HUNG_TASK && DEBUG_FS |
| 317 | help |
| 318 | Build a module that provides debugfs files (e.g., mutex, semaphore, |
| 319 | etc.) under <debugfs>/hung_task. If user reads one of these files, |
| 320 | it will sleep long time (256 seconds) with holding a lock. Thus, |
| 321 | if 2 or more processes read the same file concurrently, it will |
| 322 | be detected by the hung_task watchdog. |
| 323 | |
| 324 | source "samples/rust/Kconfig" |
| 325 | |
| 326 | source "samples/damon/Kconfig" |
| 327 | |
| 328 | endif # SAMPLES |
| 329 | |
| 330 | config HAVE_SAMPLE_FTRACE_DIRECT |
| 331 | bool |
| 332 | |
| 333 | config HAVE_SAMPLE_FTRACE_DIRECT_MULTI |
| 334 | bool |