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 41503e4510SHeiko Carstens tristate "Build register_ftrace_direct_multi() 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 49*b56c68f7SMark Rutlandconfig SAMPLE_FTRACE_OPS 50*b56c68f7SMark Rutland tristate "Build custom ftrace ops example" 51*b56c68f7SMark Rutland depends on FUNCTION_TRACER 52*b56c68f7SMark Rutland help 53*b56c68f7SMark Rutland This builds an ftrace ops example that hooks two functions and 54*b56c68f7SMark Rutland measures the time taken to invoke one function a number of times. 55*b56c68f7SMark 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 19408c1a4efSAlex Williamson tristate "Build VFIO mtty example mediated device sample code -- loadable modules only" 195af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 19608c1a4efSAlex Williamson help 19708c1a4efSAlex Williamson Build a virtual tty sample driver for use as a VFIO 19808c1a4efSAlex Williamson mediated device 19908c1a4efSAlex Williamson 200d61fc96fSGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY 201d61fc96fSGerd Hoffmann tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only" 202af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 203d61fc96fSGerd Hoffmann help 204d61fc96fSGerd Hoffmann Build a virtual display sample driver for use as a VFIO 205d61fc96fSGerd Hoffmann mediated device. It is a simple framebuffer and supports 206d61fc96fSGerd Hoffmann the region display interface (VFIO_GFX_PLANE_TYPE_REGION). 207d61fc96fSGerd Hoffmann 208cacade19SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY_FB 209cacade19SGerd Hoffmann tristate "Build VFIO mdpy example guest fbdev driver -- loadable module only" 210cacade19SGerd Hoffmann depends on FB && m 211cacade19SGerd Hoffmann select FB_CFB_FILLRECT 212cacade19SGerd Hoffmann select FB_CFB_COPYAREA 213cacade19SGerd Hoffmann select FB_CFB_IMAGEBLIT 214cacade19SGerd Hoffmann help 215cacade19SGerd Hoffmann Guest fbdev driver for the virtual display sample driver. 216cacade19SGerd Hoffmann 217a5e6e650SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MBOCHS 218a5e6e650SGerd Hoffmann tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only" 219af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 220c1abca96SArnd Bergmann select DMA_SHARED_BUFFER 221a5e6e650SGerd Hoffmann help 222a5e6e650SGerd Hoffmann Build a virtual display sample driver for use as a VFIO 223a5e6e650SGerd Hoffmann mediated device. It supports the region display interface 224a5e6e650SGerd Hoffmann (VFIO_GFX_PLANE_TYPE_DMABUF). 225a5e6e650SGerd Hoffmann Emulate enough of qemu stdvga to make bochs-drm.ko happy. 226a5e6e650SGerd Hoffmann That is basically the vram memory bar and the bochs dispi 227a5e6e650SGerd Hoffmann interface vbe registers in the mmio register bar. 228a5e6e650SGerd Hoffmann Specifically it does *not* include any legacy vga stuff. 229a5e6e650SGerd Hoffmann Device looks a lot like "qemu -device secondary-vga". 230a5e6e650SGerd Hoffmann 2319762dc14SChristian Braunerconfig SAMPLE_ANDROID_BINDERFS 2329762dc14SChristian Brauner bool "Build Android binderfs example" 233fca5e949SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2349762dc14SChristian Brauner help 2359762dc14SChristian Brauner Builds a sample program to illustrate the use of the Android binderfs 2369762dc14SChristian Brauner filesystem. 2379762dc14SChristian Brauner 238f1b5618eSDavid Howellsconfig SAMPLE_VFS 239f1b5618eSDavid Howells bool "Build example programs that use new VFS system calls" 24028949b84SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 241a528d35eSDavid Howells help 242f1b5618eSDavid Howells Build example userspace programs that use new VFS system calls such 243f1b5618eSDavid Howells as mount API and statx(). Note that this is restricted to the x86 244f1b5618eSDavid Howells arch whilst it accesses system calls that aren't yet in all arches. 245a528d35eSDavid Howells 2466859eba4STomas Winklerconfig SAMPLE_INTEL_MEI 2476859eba4STomas Winkler bool "Build example program working with intel mei driver" 2486859eba4STomas Winkler depends on INTEL_MEI 249c4c10996SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2506859eba4STomas Winkler help 2516859eba4STomas Winkler Build a sample program to work with mei device. 2526859eba4STomas Winkler 25388a8e278SMasahiro Yamadaconfig SAMPLE_WATCHDOG 25488a8e278SMasahiro Yamada bool "watchdog sample" 25588a8e278SMasahiro Yamada depends on CC_CAN_LINK 2566859eba4STomas Winkler 257f5b5a164SDavid Howellsconfig SAMPLE_WATCH_QUEUE 2588fe62e0cSGabriel Krisman Bertazi bool "Build example watch_queue notification API consumer" 259214377e9SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 260f5b5a164SDavid Howells help 261f5b5a164SDavid Howells Build example userspace program to use the new mount_notify(), 262f5b5a164SDavid Howells sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. 263267c4025SMathieu Desnoyers 264ede5bab8SMike Leachconfig SAMPLE_CORESIGHT_SYSCFG 265ede5bab8SMike Leach tristate "Build example loadable module for CoreSight config" 266ede5bab8SMike Leach depends on CORESIGHT && m 267ede5bab8SMike Leach help 268ede5bab8SMike Leach Build an example loadable module that adds new CoreSight features 269ede5bab8SMike Leach and configuration using the CoreSight system configuration API. 270ede5bab8SMike Leach This demonstrates how a user may create their own CoreSight 271ede5bab8SMike Leach configurations and easily load them into the system at runtime. 272ede5bab8SMike Leach 273e4fc6580SMiguel Ojedasource "samples/rust/Kconfig" 274e4fc6580SMiguel Ojeda 275267c4025SMathieu Desnoyersendif # SAMPLES 276c316eb44SHeiko Carstens 277c316eb44SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT 278c316eb44SHeiko Carstens bool 2790b707e57SLinus Torvalds 280503e4510SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT_MULTI 2810b707e57SLinus Torvalds bool 282