1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2267c4025SMathieu Desnoyersmenuconfig SAMPLES 3267c4025SMathieu Desnoyers bool "Sample kernel code" 4267c4025SMathieu Desnoyers help 5267c4025SMathieu Desnoyers You can build and test sample kernel code here. 6267c4025SMathieu Desnoyers 7267c4025SMathieu Desnoyersif SAMPLES 8267c4025SMathieu Desnoyers 987ffbba9SMasahiro Yamadaconfig SAMPLE_AUXDISPLAY 1087ffbba9SMasahiro Yamada bool "auxdisplay sample" 1187ffbba9SMasahiro Yamada depends on CC_CAN_LINK 1287ffbba9SMasahiro Yamada 139cfe06f8SSteven Rostedtconfig SAMPLE_TRACE_EVENTS 1496d17980SLi Zefan tristate "Build trace_events examples -- loadable modules only" 1596d17980SLi Zefan depends on EVENT_TRACING && m 169cfe06f8SSteven Rostedt help 17953c2f05SSteven Rostedt (Google) This builds the trace event example module. 18953c2f05SSteven Rostedt (Google) 19953c2f05SSteven Rostedt (Google)config SAMPLE_TRACE_CUSTOM_EVENTS 20953c2f05SSteven Rostedt (Google) tristate "Build custom trace event example -- loadable modules only" 21953c2f05SSteven Rostedt (Google) depends on EVENT_TRACING && m 22953c2f05SSteven Rostedt (Google) help 23953c2f05SSteven Rostedt (Google) This builds the custom trace event example module. 249cfe06f8SSteven Rostedt 25aad108aaSSteven Rostedt (Red Hat)config SAMPLE_TRACE_PRINTK 26aad108aaSSteven Rostedt (Red Hat) tristate "Build trace_printk module - tests various trace_printk formats" 27aad108aaSSteven Rostedt (Red Hat) depends on EVENT_TRACING && m 28aad108aaSSteven Rostedt (Red Hat) help 29aad108aaSSteven Rostedt (Red Hat) This builds a module that calls trace_printk() and can be used to 30aad108aaSSteven Rostedt (Red Hat) test various trace_printk() calls from a module. 31aad108aaSSteven Rostedt (Red Hat) 32b06457c8SSteven Rostedt (VMware)config SAMPLE_FTRACE_DIRECT 33b06457c8SSteven Rostedt (VMware) tristate "Build register_ftrace_direct() example" 34b06457c8SSteven Rostedt (VMware) depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m 35c316eb44SHeiko Carstens depends on HAVE_SAMPLE_FTRACE_DIRECT 36b06457c8SSteven Rostedt (VMware) help 37b06457c8SSteven Rostedt (VMware) This builds an ftrace direct function example 38b06457c8SSteven Rostedt (VMware) that hooks to wake_up_process and prints the parameters. 39b06457c8SSteven Rostedt (VMware) 40503e4510SHeiko Carstensconfig SAMPLE_FTRACE_DIRECT_MULTI 41*da8bdfbdSFlorent Revest tristate "Build register_ftrace_direct() on multiple ips example" 42503e4510SHeiko Carstens depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m 43503e4510SHeiko Carstens depends on HAVE_SAMPLE_FTRACE_DIRECT_MULTI 44503e4510SHeiko Carstens help 45503e4510SHeiko Carstens This builds an ftrace direct function example 46503e4510SHeiko Carstens that hooks to wake_up_process and schedule, and prints 47503e4510SHeiko Carstens the function addresses. 48503e4510SHeiko Carstens 49b56c68f7SMark Rutlandconfig SAMPLE_FTRACE_OPS 50b56c68f7SMark Rutland tristate "Build custom ftrace ops example" 51b56c68f7SMark Rutland depends on FUNCTION_TRACER 52b56c68f7SMark Rutland help 53b56c68f7SMark Rutland This builds an ftrace ops example that hooks two functions and 54b56c68f7SMark Rutland measures the time taken to invoke one function a number of times. 55b56c68f7SMark Rutland 5689ed4249SDivya Indiconfig SAMPLE_TRACE_ARRAY 5789ed4249SDivya Indi tristate "Build sample module for kernel access to Ftrace instancess" 5889ed4249SDivya Indi depends on EVENT_TRACING && m 5989ed4249SDivya Indi help 6089ed4249SDivya Indi This builds a module that demonstrates the use of various APIs to 6189ed4249SDivya Indi access Ftrace instances from within the kernel. 6289ed4249SDivya Indi 6340efcb05SGreg Kroah-Hartmanconfig SAMPLE_KOBJECT 64e7e34917SMasahiro Yamada tristate "Build kobject examples" 6540efcb05SGreg Kroah-Hartman help 6640efcb05SGreg Kroah-Hartman This config option will allow you to build a number of 6740efcb05SGreg Kroah-Hartman different kobject sample modules showing how to use kobjects, 6840efcb05SGreg Kroah-Hartman ksets, and ktypes properly. 6940efcb05SGreg Kroah-Hartman 7040efcb05SGreg Kroah-Hartman If in doubt, say "N" here. 7140efcb05SGreg Kroah-Hartman 72804defeaSAnanth N Mavinakayanahalliconfig SAMPLE_KPROBES 73804defeaSAnanth N Mavinakayanahalli tristate "Build kprobes examples -- loadable modules only" 74804defeaSAnanth N Mavinakayanahalli depends on KPROBES && m 75804defeaSAnanth N Mavinakayanahalli help 76804defeaSAnanth N Mavinakayanahalli This build several kprobes example modules. 77804defeaSAnanth N Mavinakayanahalli 78804defeaSAnanth N Mavinakayanahalliconfig SAMPLE_KRETPROBES 79804defeaSAnanth N Mavinakayanahalli tristate "Build kretprobes example -- loadable modules only" 80804defeaSAnanth N Mavinakayanahalli default m 81804defeaSAnanth N Mavinakayanahalli depends on SAMPLE_KPROBES && KRETPROBES 82804defeaSAnanth N Mavinakayanahalli 8343203993SK.Prasadconfig SAMPLE_HW_BREAKPOINT 8443203993SK.Prasad tristate "Build kernel hardware breakpoint examples -- loadable module only" 8543203993SK.Prasad depends on HAVE_HW_BREAKPOINT && m 8643203993SK.Prasad help 8743203993SK.Prasad This builds kernel hardware breakpoint example modules. 8843203993SK.Prasad 896ee64cc3SMasami Hiramatsuconfig SAMPLE_FPROBE 906ee64cc3SMasami Hiramatsu tristate "Build fprobe examples -- loadable modules only" 916ee64cc3SMasami Hiramatsu depends on FPROBE && m 926ee64cc3SMasami Hiramatsu help 936ee64cc3SMasami Hiramatsu This builds a fprobe example module. This module has an option 'symbol'. 946ee64cc3SMasami Hiramatsu You can specify a probed symbol or symbols separated with ','. 956ee64cc3SMasami Hiramatsu 965bf2b193SStefani Seiboldconfig SAMPLE_KFIFO 975bf2b193SStefani Seibold tristate "Build kfifo examples -- loadable modules only" 985bf2b193SStefani Seibold depends on m 995bf2b193SStefani Seibold help 1005bf2b193SStefani Seibold This config option will allow you to build a number of 1015bf2b193SStefani Seibold different kfifo sample modules showing how to use the 1025bf2b193SStefani Seibold generic kfifo API. 1035bf2b193SStefani Seibold 1045bf2b193SStefani Seibold If in doubt, say "N" here. 1055bf2b193SStefani Seibold 1064aad8f51SJason Wesselconfig SAMPLE_KDB 10725985edcSLucas De Marchi tristate "Build kdb command example -- loadable modules only" 1084aad8f51SJason Wessel depends on KGDB_KDB && m 1094aad8f51SJason Wessel help 1104aad8f51SJason Wessel Build an example of how to dynamically add the hello 1114aad8f51SJason Wessel command to the kdb shell. 1124aad8f51SJason Wessel 113842891beSBjorn Anderssonconfig SAMPLE_QMI_CLIENT 114842891beSBjorn Andersson tristate "Build qmi client sample -- loadable modules only" 115842891beSBjorn Andersson depends on m 116842891beSBjorn Andersson depends on ARCH_QCOM 117dea4bd19SArnd Bergmann depends on NET 118842891beSBjorn Andersson select QCOM_QMI_HELPERS 119842891beSBjorn Andersson help 120842891beSBjorn Andersson Build an QMI client sample driver, which demonstrates how to 121842891beSBjorn Andersson communicate with a remote QRTR service, using QMI encoded messages. 122842891beSBjorn Andersson 123779b96d2SOhad Ben-Cohenconfig SAMPLE_RPMSG_CLIENT 124779b96d2SOhad Ben-Cohen tristate "Build rpmsg client sample -- loadable modules only" 125779b96d2SOhad Ben-Cohen depends on RPMSG && m 126779b96d2SOhad Ben-Cohen help 127779b96d2SOhad Ben-Cohen Build an rpmsg client sample driver, which demonstrates how 128779b96d2SOhad Ben-Cohen to communicate with an AMP-configured remote processor over 129779b96d2SOhad Ben-Cohen the rpmsg bus. 130779b96d2SOhad Ben-Cohen 13112cf89b5SJosh Poimboeufconfig SAMPLE_LIVEPATCH 132439e7271SJoe Lawrence tristate "Build live patching samples -- loadable modules only" 13312cf89b5SJosh Poimboeuf depends on LIVEPATCH && m 13413d1cf7eSSeth Jennings help 135439e7271SJoe Lawrence Build sample live patch demonstrations. 13613d1cf7eSSeth Jennings 13751798222SChristoph Hellwigconfig SAMPLE_CONFIGFS 13851798222SChristoph Hellwig tristate "Build configfs patching sample -- loadable modules only" 13951798222SChristoph Hellwig depends on CONFIGFS_FS && m 14051798222SChristoph Hellwig help 14151798222SChristoph Hellwig Builds a sample configfs interface. 14251798222SChristoph Hellwig 14314fbff6bSArnd Bergmannconfig SAMPLE_CONNECTOR 14414fbff6bSArnd Bergmann tristate "Build connector sample -- loadable modules only" 145e949f4c2SMasahiro Yamada depends on CONNECTOR && HEADERS_INSTALL && m 14614fbff6bSArnd Bergmann help 14714fbff6bSArnd Bergmann When enabled, this builds both a sample kernel module for 14814fbff6bSArnd Bergmann the connector interface and a user space tool to communicate 14914fbff6bSArnd Bergmann with it. 150baa293e9SMauro Carvalho Chehab See also Documentation/driver-api/connector.rst 15114fbff6bSArnd Bergmann 15254510930SGabriel Krisman Bertaziconfig SAMPLE_FANOTIFY_ERROR 15354510930SGabriel Krisman Bertazi bool "Build fanotify error monitoring sample" 1548fc70b3aSGabriel Krisman Bertazi depends on FANOTIFY && CC_CAN_LINK && HEADERS_INSTALL 15554510930SGabriel Krisman Bertazi help 15654510930SGabriel Krisman Bertazi When enabled, this builds an example code that uses the 15754510930SGabriel Krisman Bertazi FAN_FS_ERROR fanotify mechanism to monitor filesystem 15854510930SGabriel Krisman Bertazi errors. 15954510930SGabriel Krisman Bertazi See also Documentation/admin-guide/filesystem-monitoring.rst. 16054510930SGabriel Krisman Bertazi 161e949f4c2SMasahiro Yamadaconfig SAMPLE_HIDRAW 162e949f4c2SMasahiro Yamada bool "hidraw sample" 16382d00a93SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 164e949f4c2SMasahiro Yamada 165ba84b0bfSMickaël Salaünconfig SAMPLE_LANDLOCK 166ba84b0bfSMickaël Salaün bool "Landlock example" 167ba84b0bfSMickaël Salaün depends on CC_CAN_LINK && HEADERS_INSTALL 168ba84b0bfSMickaël Salaün help 169ba84b0bfSMickaël Salaün Build a simple Landlock sandbox manager able to start a process 170ba84b0bfSMickaël Salaün restricted by a user-defined filesystem access control policy. 171ba84b0bfSMickaël Salaün 172e949f4c2SMasahiro Yamadaconfig SAMPLE_PIDFD 173e949f4c2SMasahiro Yamada bool "pidfd sample" 17460fb0b12SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 175e949f4c2SMasahiro Yamada 176f6041c1dSOlof Johanssonconfig SAMPLE_SECCOMP 1777206c124SMasahiro Yamada bool "Build seccomp sample code" 178f59e7668SMasahiro Yamada depends on SECCOMP_FILTER && CC_CAN_LINK && HEADERS_INSTALL 179f6041c1dSOlof Johansson help 180f6041c1dSOlof Johansson Build samples of seccomp filters using various methods of 181f6041c1dSOlof Johansson BPF filter construction. 182f6041c1dSOlof Johansson 183b98ccc71SMasahiro Yamadaconfig SAMPLE_TIMER 184b98ccc71SMasahiro Yamada bool "Timer sample" 185b98ccc71SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 186b98ccc71SMasahiro Yamada 18787ecdf4fSMasahiro Yamadaconfig SAMPLE_UHID 18887ecdf4fSMasahiro Yamada bool "UHID sample" 18987ecdf4fSMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 19087ecdf4fSMasahiro Yamada help 19187ecdf4fSMasahiro Yamada Build UHID sample program. 19287ecdf4fSMasahiro Yamada 19308c1a4efSAlex Williamsonconfig SAMPLE_VFIO_MDEV_MTTY 1946b182403SChristoph Hellwig tristate "Build VFIO mtty example mediated device sample code" 195de858a05SArnd Bergmann depends on VFIO 1968bf8c5eeSChristoph Hellwig select VFIO_MDEV 19708c1a4efSAlex Williamson help 19808c1a4efSAlex Williamson Build a virtual tty sample driver for use as a VFIO 19908c1a4efSAlex Williamson mediated device 20008c1a4efSAlex Williamson 201d61fc96fSGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY 2026b182403SChristoph Hellwig tristate "Build VFIO mdpy example mediated device sample code" 203de858a05SArnd Bergmann depends on VFIO 2048bf8c5eeSChristoph Hellwig select VFIO_MDEV 205d61fc96fSGerd Hoffmann help 206d61fc96fSGerd Hoffmann Build a virtual display sample driver for use as a VFIO 207d61fc96fSGerd Hoffmann mediated device. It is a simple framebuffer and supports 208d61fc96fSGerd Hoffmann the region display interface (VFIO_GFX_PLANE_TYPE_REGION). 209d61fc96fSGerd Hoffmann 210cacade19SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY_FB 2116b182403SChristoph Hellwig tristate "Build VFIO mdpy example guest fbdev driver" 2126b182403SChristoph Hellwig depends on FB 213cacade19SGerd Hoffmann select FB_CFB_FILLRECT 214cacade19SGerd Hoffmann select FB_CFB_COPYAREA 215cacade19SGerd Hoffmann select FB_CFB_IMAGEBLIT 216cacade19SGerd Hoffmann help 217cacade19SGerd Hoffmann Guest fbdev driver for the virtual display sample driver. 218cacade19SGerd Hoffmann 219a5e6e650SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MBOCHS 220e951eaafSye xingchen tristate "Build VFIO mbochs example mediated device sample code" 221de858a05SArnd Bergmann depends on VFIO 2228bf8c5eeSChristoph Hellwig select VFIO_MDEV 223c1abca96SArnd Bergmann select DMA_SHARED_BUFFER 224a5e6e650SGerd Hoffmann help 225a5e6e650SGerd Hoffmann Build a virtual display sample driver for use as a VFIO 226a5e6e650SGerd Hoffmann mediated device. It supports the region display interface 227a5e6e650SGerd Hoffmann (VFIO_GFX_PLANE_TYPE_DMABUF). 228a5e6e650SGerd Hoffmann Emulate enough of qemu stdvga to make bochs-drm.ko happy. 229a5e6e650SGerd Hoffmann That is basically the vram memory bar and the bochs dispi 230a5e6e650SGerd Hoffmann interface vbe registers in the mmio register bar. 231a5e6e650SGerd Hoffmann Specifically it does *not* include any legacy vga stuff. 232a5e6e650SGerd Hoffmann Device looks a lot like "qemu -device secondary-vga". 233a5e6e650SGerd Hoffmann 2349762dc14SChristian Braunerconfig SAMPLE_ANDROID_BINDERFS 2359762dc14SChristian Brauner bool "Build Android binderfs example" 236fca5e949SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2379762dc14SChristian Brauner help 2389762dc14SChristian Brauner Builds a sample program to illustrate the use of the Android binderfs 2399762dc14SChristian Brauner filesystem. 2409762dc14SChristian Brauner 241f1b5618eSDavid Howellsconfig SAMPLE_VFS 242f1b5618eSDavid Howells bool "Build example programs that use new VFS system calls" 24328949b84SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 244a528d35eSDavid Howells help 245f1b5618eSDavid Howells Build example userspace programs that use new VFS system calls such 246f1b5618eSDavid Howells as mount API and statx(). Note that this is restricted to the x86 247f1b5618eSDavid Howells arch whilst it accesses system calls that aren't yet in all arches. 248a528d35eSDavid Howells 2496859eba4STomas Winklerconfig SAMPLE_INTEL_MEI 2506859eba4STomas Winkler bool "Build example program working with intel mei driver" 2516859eba4STomas Winkler depends on INTEL_MEI 252c4c10996SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2536859eba4STomas Winkler help 2546859eba4STomas Winkler Build a sample program to work with mei device. 2556859eba4STomas Winkler 25688a8e278SMasahiro Yamadaconfig SAMPLE_WATCHDOG 25788a8e278SMasahiro Yamada bool "watchdog sample" 25888a8e278SMasahiro Yamada depends on CC_CAN_LINK 2596859eba4STomas Winkler 260f5b5a164SDavid Howellsconfig SAMPLE_WATCH_QUEUE 2618fe62e0cSGabriel Krisman Bertazi bool "Build example watch_queue notification API consumer" 262214377e9SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 263f5b5a164SDavid Howells help 264f5b5a164SDavid Howells Build example userspace program to use the new mount_notify(), 265f5b5a164SDavid Howells sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. 266267c4025SMathieu Desnoyers 267ede5bab8SMike Leachconfig SAMPLE_CORESIGHT_SYSCFG 268ede5bab8SMike Leach tristate "Build example loadable module for CoreSight config" 269ede5bab8SMike Leach depends on CORESIGHT && m 270ede5bab8SMike Leach help 271ede5bab8SMike Leach Build an example loadable module that adds new CoreSight features 272ede5bab8SMike Leach and configuration using the CoreSight system configuration API. 273ede5bab8SMike Leach This demonstrates how a user may create their own CoreSight 274ede5bab8SMike Leach configurations and easily load them into the system at runtime. 275ede5bab8SMike Leach 276e4fc6580SMiguel Ojedasource "samples/rust/Kconfig" 277e4fc6580SMiguel Ojeda 278267c4025SMathieu Desnoyersendif # SAMPLES 279c316eb44SHeiko Carstens 280c316eb44SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT 281c316eb44SHeiko Carstens bool 2820b707e57SLinus Torvalds 283503e4510SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT_MULTI 2840b707e57SLinus Torvalds bool 285