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 17*953c2f05SSteven Rostedt (Google) This builds the trace event example module. 18*953c2f05SSteven Rostedt (Google) 19*953c2f05SSteven Rostedt (Google)config SAMPLE_TRACE_CUSTOM_EVENTS 20*953c2f05SSteven Rostedt (Google) tristate "Build custom trace event example -- loadable modules only" 21*953c2f05SSteven Rostedt (Google) depends on EVENT_TRACING && m 22*953c2f05SSteven Rostedt (Google) help 23*953c2f05SSteven 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 4989ed4249SDivya Indiconfig SAMPLE_TRACE_ARRAY 5089ed4249SDivya Indi tristate "Build sample module for kernel access to Ftrace instancess" 5189ed4249SDivya Indi depends on EVENT_TRACING && m 5289ed4249SDivya Indi help 5389ed4249SDivya Indi This builds a module that demonstrates the use of various APIs to 5489ed4249SDivya Indi access Ftrace instances from within the kernel. 5589ed4249SDivya Indi 5640efcb05SGreg Kroah-Hartmanconfig SAMPLE_KOBJECT 57e7e34917SMasahiro Yamada tristate "Build kobject examples" 5840efcb05SGreg Kroah-Hartman help 5940efcb05SGreg Kroah-Hartman This config option will allow you to build a number of 6040efcb05SGreg Kroah-Hartman different kobject sample modules showing how to use kobjects, 6140efcb05SGreg Kroah-Hartman ksets, and ktypes properly. 6240efcb05SGreg Kroah-Hartman 6340efcb05SGreg Kroah-Hartman If in doubt, say "N" here. 6440efcb05SGreg Kroah-Hartman 65804defeaSAnanth N Mavinakayanahalliconfig SAMPLE_KPROBES 66804defeaSAnanth N Mavinakayanahalli tristate "Build kprobes examples -- loadable modules only" 67804defeaSAnanth N Mavinakayanahalli depends on KPROBES && m 68804defeaSAnanth N Mavinakayanahalli help 69804defeaSAnanth N Mavinakayanahalli This build several kprobes example modules. 70804defeaSAnanth N Mavinakayanahalli 71804defeaSAnanth N Mavinakayanahalliconfig SAMPLE_KRETPROBES 72804defeaSAnanth N Mavinakayanahalli tristate "Build kretprobes example -- loadable modules only" 73804defeaSAnanth N Mavinakayanahalli default m 74804defeaSAnanth N Mavinakayanahalli depends on SAMPLE_KPROBES && KRETPROBES 75804defeaSAnanth N Mavinakayanahalli 7643203993SK.Prasadconfig SAMPLE_HW_BREAKPOINT 7743203993SK.Prasad tristate "Build kernel hardware breakpoint examples -- loadable module only" 7843203993SK.Prasad depends on HAVE_HW_BREAKPOINT && m 7943203993SK.Prasad help 8043203993SK.Prasad This builds kernel hardware breakpoint example modules. 8143203993SK.Prasad 825bf2b193SStefani Seiboldconfig SAMPLE_KFIFO 835bf2b193SStefani Seibold tristate "Build kfifo examples -- loadable modules only" 845bf2b193SStefani Seibold depends on m 855bf2b193SStefani Seibold help 865bf2b193SStefani Seibold This config option will allow you to build a number of 875bf2b193SStefani Seibold different kfifo sample modules showing how to use the 885bf2b193SStefani Seibold generic kfifo API. 895bf2b193SStefani Seibold 905bf2b193SStefani Seibold If in doubt, say "N" here. 915bf2b193SStefani Seibold 924aad8f51SJason Wesselconfig SAMPLE_KDB 9325985edcSLucas De Marchi tristate "Build kdb command example -- loadable modules only" 944aad8f51SJason Wessel depends on KGDB_KDB && m 954aad8f51SJason Wessel help 964aad8f51SJason Wessel Build an example of how to dynamically add the hello 974aad8f51SJason Wessel command to the kdb shell. 984aad8f51SJason Wessel 99842891beSBjorn Anderssonconfig SAMPLE_QMI_CLIENT 100842891beSBjorn Andersson tristate "Build qmi client sample -- loadable modules only" 101842891beSBjorn Andersson depends on m 102842891beSBjorn Andersson depends on ARCH_QCOM 103dea4bd19SArnd Bergmann depends on NET 104842891beSBjorn Andersson select QCOM_QMI_HELPERS 105842891beSBjorn Andersson help 106842891beSBjorn Andersson Build an QMI client sample driver, which demonstrates how to 107842891beSBjorn Andersson communicate with a remote QRTR service, using QMI encoded messages. 108842891beSBjorn Andersson 109779b96d2SOhad Ben-Cohenconfig SAMPLE_RPMSG_CLIENT 110779b96d2SOhad Ben-Cohen tristate "Build rpmsg client sample -- loadable modules only" 111779b96d2SOhad Ben-Cohen depends on RPMSG && m 112779b96d2SOhad Ben-Cohen help 113779b96d2SOhad Ben-Cohen Build an rpmsg client sample driver, which demonstrates how 114779b96d2SOhad Ben-Cohen to communicate with an AMP-configured remote processor over 115779b96d2SOhad Ben-Cohen the rpmsg bus. 116779b96d2SOhad Ben-Cohen 11712cf89b5SJosh Poimboeufconfig SAMPLE_LIVEPATCH 118439e7271SJoe Lawrence tristate "Build live patching samples -- loadable modules only" 11912cf89b5SJosh Poimboeuf depends on LIVEPATCH && m 12013d1cf7eSSeth Jennings help 121439e7271SJoe Lawrence Build sample live patch demonstrations. 12213d1cf7eSSeth Jennings 12351798222SChristoph Hellwigconfig SAMPLE_CONFIGFS 12451798222SChristoph Hellwig tristate "Build configfs patching sample -- loadable modules only" 12551798222SChristoph Hellwig depends on CONFIGFS_FS && m 12651798222SChristoph Hellwig help 12751798222SChristoph Hellwig Builds a sample configfs interface. 12851798222SChristoph Hellwig 12914fbff6bSArnd Bergmannconfig SAMPLE_CONNECTOR 13014fbff6bSArnd Bergmann tristate "Build connector sample -- loadable modules only" 131e949f4c2SMasahiro Yamada depends on CONNECTOR && HEADERS_INSTALL && m 13214fbff6bSArnd Bergmann help 13314fbff6bSArnd Bergmann When enabled, this builds both a sample kernel module for 13414fbff6bSArnd Bergmann the connector interface and a user space tool to communicate 13514fbff6bSArnd Bergmann with it. 136baa293e9SMauro Carvalho Chehab See also Documentation/driver-api/connector.rst 13714fbff6bSArnd Bergmann 13854510930SGabriel Krisman Bertaziconfig SAMPLE_FANOTIFY_ERROR 13954510930SGabriel Krisman Bertazi bool "Build fanotify error monitoring sample" 1408fc70b3aSGabriel Krisman Bertazi depends on FANOTIFY && CC_CAN_LINK && HEADERS_INSTALL 14154510930SGabriel Krisman Bertazi help 14254510930SGabriel Krisman Bertazi When enabled, this builds an example code that uses the 14354510930SGabriel Krisman Bertazi FAN_FS_ERROR fanotify mechanism to monitor filesystem 14454510930SGabriel Krisman Bertazi errors. 14554510930SGabriel Krisman Bertazi See also Documentation/admin-guide/filesystem-monitoring.rst. 14654510930SGabriel Krisman Bertazi 147e949f4c2SMasahiro Yamadaconfig SAMPLE_HIDRAW 148e949f4c2SMasahiro Yamada bool "hidraw sample" 14982d00a93SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 150e949f4c2SMasahiro Yamada 151ba84b0bfSMickaël Salaünconfig SAMPLE_LANDLOCK 152ba84b0bfSMickaël Salaün bool "Landlock example" 153ba84b0bfSMickaël Salaün depends on CC_CAN_LINK && HEADERS_INSTALL 154ba84b0bfSMickaël Salaün help 155ba84b0bfSMickaël Salaün Build a simple Landlock sandbox manager able to start a process 156ba84b0bfSMickaël Salaün restricted by a user-defined filesystem access control policy. 157ba84b0bfSMickaël Salaün 158e949f4c2SMasahiro Yamadaconfig SAMPLE_PIDFD 159e949f4c2SMasahiro Yamada bool "pidfd sample" 16060fb0b12SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 161e949f4c2SMasahiro Yamada 162f6041c1dSOlof Johanssonconfig SAMPLE_SECCOMP 1637206c124SMasahiro Yamada bool "Build seccomp sample code" 164f59e7668SMasahiro Yamada depends on SECCOMP_FILTER && CC_CAN_LINK && HEADERS_INSTALL 165f6041c1dSOlof Johansson help 166f6041c1dSOlof Johansson Build samples of seccomp filters using various methods of 167f6041c1dSOlof Johansson BPF filter construction. 168f6041c1dSOlof Johansson 169b98ccc71SMasahiro Yamadaconfig SAMPLE_TIMER 170b98ccc71SMasahiro Yamada bool "Timer sample" 171b98ccc71SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 172b98ccc71SMasahiro Yamada 17387ecdf4fSMasahiro Yamadaconfig SAMPLE_UHID 17487ecdf4fSMasahiro Yamada bool "UHID sample" 17587ecdf4fSMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 17687ecdf4fSMasahiro Yamada help 17787ecdf4fSMasahiro Yamada Build UHID sample program. 17887ecdf4fSMasahiro Yamada 17908c1a4efSAlex Williamsonconfig SAMPLE_VFIO_MDEV_MTTY 18008c1a4efSAlex Williamson tristate "Build VFIO mtty example mediated device sample code -- loadable modules only" 181af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 18208c1a4efSAlex Williamson help 18308c1a4efSAlex Williamson Build a virtual tty sample driver for use as a VFIO 18408c1a4efSAlex Williamson mediated device 18508c1a4efSAlex Williamson 186d61fc96fSGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY 187d61fc96fSGerd Hoffmann tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only" 188af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 189d61fc96fSGerd Hoffmann help 190d61fc96fSGerd Hoffmann Build a virtual display sample driver for use as a VFIO 191d61fc96fSGerd Hoffmann mediated device. It is a simple framebuffer and supports 192d61fc96fSGerd Hoffmann the region display interface (VFIO_GFX_PLANE_TYPE_REGION). 193d61fc96fSGerd Hoffmann 194cacade19SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MDPY_FB 195cacade19SGerd Hoffmann tristate "Build VFIO mdpy example guest fbdev driver -- loadable module only" 196cacade19SGerd Hoffmann depends on FB && m 197cacade19SGerd Hoffmann select FB_CFB_FILLRECT 198cacade19SGerd Hoffmann select FB_CFB_COPYAREA 199cacade19SGerd Hoffmann select FB_CFB_IMAGEBLIT 200cacade19SGerd Hoffmann help 201cacade19SGerd Hoffmann Guest fbdev driver for the virtual display sample driver. 202cacade19SGerd Hoffmann 203a5e6e650SGerd Hoffmannconfig SAMPLE_VFIO_MDEV_MBOCHS 204a5e6e650SGerd Hoffmann tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only" 205af3ab3f9SJason Gunthorpe depends on VFIO_MDEV && m 206c1abca96SArnd Bergmann select DMA_SHARED_BUFFER 207a5e6e650SGerd Hoffmann help 208a5e6e650SGerd Hoffmann Build a virtual display sample driver for use as a VFIO 209a5e6e650SGerd Hoffmann mediated device. It supports the region display interface 210a5e6e650SGerd Hoffmann (VFIO_GFX_PLANE_TYPE_DMABUF). 211a5e6e650SGerd Hoffmann Emulate enough of qemu stdvga to make bochs-drm.ko happy. 212a5e6e650SGerd Hoffmann That is basically the vram memory bar and the bochs dispi 213a5e6e650SGerd Hoffmann interface vbe registers in the mmio register bar. 214a5e6e650SGerd Hoffmann Specifically it does *not* include any legacy vga stuff. 215a5e6e650SGerd Hoffmann Device looks a lot like "qemu -device secondary-vga". 216a5e6e650SGerd Hoffmann 2179762dc14SChristian Braunerconfig SAMPLE_ANDROID_BINDERFS 2189762dc14SChristian Brauner bool "Build Android binderfs example" 219fca5e949SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2209762dc14SChristian Brauner help 2219762dc14SChristian Brauner Builds a sample program to illustrate the use of the Android binderfs 2229762dc14SChristian Brauner filesystem. 2239762dc14SChristian Brauner 224f1b5618eSDavid Howellsconfig SAMPLE_VFS 225f1b5618eSDavid Howells bool "Build example programs that use new VFS system calls" 22628949b84SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 227a528d35eSDavid Howells help 228f1b5618eSDavid Howells Build example userspace programs that use new VFS system calls such 229f1b5618eSDavid Howells as mount API and statx(). Note that this is restricted to the x86 230f1b5618eSDavid Howells arch whilst it accesses system calls that aren't yet in all arches. 231a528d35eSDavid Howells 2326859eba4STomas Winklerconfig SAMPLE_INTEL_MEI 2336859eba4STomas Winkler bool "Build example program working with intel mei driver" 2346859eba4STomas Winkler depends on INTEL_MEI 235c4c10996SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 2366859eba4STomas Winkler help 2376859eba4STomas Winkler Build a sample program to work with mei device. 2386859eba4STomas Winkler 23988a8e278SMasahiro Yamadaconfig SAMPLE_WATCHDOG 24088a8e278SMasahiro Yamada bool "watchdog sample" 24188a8e278SMasahiro Yamada depends on CC_CAN_LINK 2426859eba4STomas Winkler 243f5b5a164SDavid Howellsconfig SAMPLE_WATCH_QUEUE 2448fe62e0cSGabriel Krisman Bertazi bool "Build example watch_queue notification API consumer" 245214377e9SMasahiro Yamada depends on CC_CAN_LINK && HEADERS_INSTALL 246f5b5a164SDavid Howells help 247f5b5a164SDavid Howells Build example userspace program to use the new mount_notify(), 248f5b5a164SDavid Howells sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. 249267c4025SMathieu Desnoyers 250ede5bab8SMike Leachconfig SAMPLE_CORESIGHT_SYSCFG 251ede5bab8SMike Leach tristate "Build example loadable module for CoreSight config" 252ede5bab8SMike Leach depends on CORESIGHT && m 253ede5bab8SMike Leach help 254ede5bab8SMike Leach Build an example loadable module that adds new CoreSight features 255ede5bab8SMike Leach and configuration using the CoreSight system configuration API. 256ede5bab8SMike Leach This demonstrates how a user may create their own CoreSight 257ede5bab8SMike Leach configurations and easily load them into the system at runtime. 258ede5bab8SMike Leach 259267c4025SMathieu Desnoyersendif # SAMPLES 260c316eb44SHeiko Carstens 261c316eb44SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT 262c316eb44SHeiko Carstens bool 2630b707e57SLinus Torvalds 264503e4510SHeiko Carstensconfig HAVE_SAMPLE_FTRACE_DIRECT_MULTI 2650b707e57SLinus Torvalds bool 266