162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenuconfig SAMPLES
362306a36Sopenharmony_ci	bool "Sample kernel code"
462306a36Sopenharmony_ci	help
562306a36Sopenharmony_ci	  You can build and test sample kernel code here.
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciif SAMPLES
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciconfig SAMPLE_AUXDISPLAY
1062306a36Sopenharmony_ci	bool "auxdisplay sample"
1162306a36Sopenharmony_ci	depends on CC_CAN_LINK
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciconfig SAMPLE_TRACE_EVENTS
1462306a36Sopenharmony_ci	tristate "Build trace_events examples -- loadable modules only"
1562306a36Sopenharmony_ci	depends on EVENT_TRACING && m
1662306a36Sopenharmony_ci	help
1762306a36Sopenharmony_ci	  This builds the trace event example module.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciconfig SAMPLE_TRACE_CUSTOM_EVENTS
2062306a36Sopenharmony_ci	tristate "Build custom trace event example -- loadable modules only"
2162306a36Sopenharmony_ci	depends on EVENT_TRACING && m
2262306a36Sopenharmony_ci	help
2362306a36Sopenharmony_ci	  This builds the custom trace event example module.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciconfig SAMPLE_TRACE_PRINTK
2662306a36Sopenharmony_ci        tristate "Build trace_printk module - tests various trace_printk formats"
2762306a36Sopenharmony_ci	depends on EVENT_TRACING && m
2862306a36Sopenharmony_ci	help
2962306a36Sopenharmony_ci	 This builds a module that calls trace_printk() and can be used to
3062306a36Sopenharmony_ci	 test various trace_printk() calls from a module.
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciconfig SAMPLE_FTRACE_DIRECT
3362306a36Sopenharmony_ci	tristate "Build register_ftrace_direct() example"
3462306a36Sopenharmony_ci	depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m
3562306a36Sopenharmony_ci	depends on HAVE_SAMPLE_FTRACE_DIRECT
3662306a36Sopenharmony_ci	help
3762306a36Sopenharmony_ci	  This builds an ftrace direct function example
3862306a36Sopenharmony_ci	  that hooks to wake_up_process and prints the parameters.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciconfig SAMPLE_FTRACE_DIRECT_MULTI
4162306a36Sopenharmony_ci	tristate "Build register_ftrace_direct() on multiple ips example"
4262306a36Sopenharmony_ci	depends on DYNAMIC_FTRACE_WITH_DIRECT_CALLS && m
4362306a36Sopenharmony_ci	depends on HAVE_SAMPLE_FTRACE_DIRECT_MULTI
4462306a36Sopenharmony_ci	help
4562306a36Sopenharmony_ci	  This builds an ftrace direct function example
4662306a36Sopenharmony_ci	  that hooks to wake_up_process and schedule, and prints
4762306a36Sopenharmony_ci	  the function addresses.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciconfig SAMPLE_FTRACE_OPS
5062306a36Sopenharmony_ci	tristate "Build custom ftrace ops example"
5162306a36Sopenharmony_ci	depends on FUNCTION_TRACER
5262306a36Sopenharmony_ci	help
5362306a36Sopenharmony_ci	  This builds an ftrace ops example that hooks two functions and
5462306a36Sopenharmony_ci	  measures the time taken to invoke one function a number of times.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciconfig SAMPLE_TRACE_ARRAY
5762306a36Sopenharmony_ci        tristate "Build sample module for kernel access to Ftrace instancess"
5862306a36Sopenharmony_ci	depends on EVENT_TRACING && m
5962306a36Sopenharmony_ci	help
6062306a36Sopenharmony_ci	 This builds a module that demonstrates the use of various APIs to
6162306a36Sopenharmony_ci	 access Ftrace instances from within the kernel.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciconfig SAMPLE_KOBJECT
6462306a36Sopenharmony_ci	tristate "Build kobject examples"
6562306a36Sopenharmony_ci	help
6662306a36Sopenharmony_ci	  This config option will allow you to build a number of
6762306a36Sopenharmony_ci	  different kobject sample modules showing how to use kobjects,
6862306a36Sopenharmony_ci	  ksets, and ktypes properly.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci	  If in doubt, say "N" here.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciconfig SAMPLE_KPROBES
7362306a36Sopenharmony_ci	tristate "Build kprobes examples -- loadable modules only"
7462306a36Sopenharmony_ci	depends on KPROBES && m
7562306a36Sopenharmony_ci	help
7662306a36Sopenharmony_ci	  This build several kprobes example modules.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciconfig SAMPLE_KRETPROBES
7962306a36Sopenharmony_ci	tristate "Build kretprobes example -- loadable modules only"
8062306a36Sopenharmony_ci	default m
8162306a36Sopenharmony_ci	depends on SAMPLE_KPROBES && KRETPROBES
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciconfig SAMPLE_HW_BREAKPOINT
8462306a36Sopenharmony_ci	tristate "Build kernel hardware breakpoint examples -- loadable module only"
8562306a36Sopenharmony_ci	depends on HAVE_HW_BREAKPOINT && m
8662306a36Sopenharmony_ci	help
8762306a36Sopenharmony_ci	  This builds kernel hardware breakpoint example modules.
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ciconfig SAMPLE_FPROBE
9062306a36Sopenharmony_ci	tristate "Build fprobe examples -- loadable modules only"
9162306a36Sopenharmony_ci	depends on FPROBE && m
9262306a36Sopenharmony_ci	help
9362306a36Sopenharmony_ci	  This builds a fprobe example module. This module has an option 'symbol'.
9462306a36Sopenharmony_ci	  You can specify a probed symbol or symbols separated with ','.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ciconfig SAMPLE_KFIFO
9762306a36Sopenharmony_ci	tristate "Build kfifo examples -- loadable modules only"
9862306a36Sopenharmony_ci	depends on m
9962306a36Sopenharmony_ci	help
10062306a36Sopenharmony_ci	  This config option will allow you to build a number of
10162306a36Sopenharmony_ci	  different kfifo sample modules showing how to use the
10262306a36Sopenharmony_ci	  generic kfifo API.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci	  If in doubt, say "N" here.
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ciconfig SAMPLE_KDB
10762306a36Sopenharmony_ci	tristate "Build kdb command example -- loadable modules only"
10862306a36Sopenharmony_ci	depends on KGDB_KDB && m
10962306a36Sopenharmony_ci	help
11062306a36Sopenharmony_ci	  Build an example of how to dynamically add the hello
11162306a36Sopenharmony_ci	  command to the kdb shell.
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ciconfig SAMPLE_QMI_CLIENT
11462306a36Sopenharmony_ci	tristate "Build qmi client sample -- loadable modules only"
11562306a36Sopenharmony_ci	depends on m
11662306a36Sopenharmony_ci	depends on ARCH_QCOM
11762306a36Sopenharmony_ci	depends on NET
11862306a36Sopenharmony_ci	select QCOM_QMI_HELPERS
11962306a36Sopenharmony_ci	help
12062306a36Sopenharmony_ci	  Build an QMI client sample driver, which demonstrates how to
12162306a36Sopenharmony_ci	  communicate with a remote QRTR service, using QMI encoded messages.
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciconfig SAMPLE_RPMSG_CLIENT
12462306a36Sopenharmony_ci	tristate "Build rpmsg client sample -- loadable modules only"
12562306a36Sopenharmony_ci	depends on RPMSG && m
12662306a36Sopenharmony_ci	help
12762306a36Sopenharmony_ci	  Build an rpmsg client sample driver, which demonstrates how
12862306a36Sopenharmony_ci	  to communicate with an AMP-configured remote processor over
12962306a36Sopenharmony_ci	  the rpmsg bus.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciconfig SAMPLE_LIVEPATCH
13262306a36Sopenharmony_ci	tristate "Build live patching samples -- loadable modules only"
13362306a36Sopenharmony_ci	depends on LIVEPATCH && m
13462306a36Sopenharmony_ci	help
13562306a36Sopenharmony_ci	  Build sample live patch demonstrations.
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciconfig SAMPLE_CONFIGFS
13862306a36Sopenharmony_ci	tristate "Build configfs patching sample -- loadable modules only"
13962306a36Sopenharmony_ci	depends on CONFIGFS_FS && m
14062306a36Sopenharmony_ci	help
14162306a36Sopenharmony_ci	  Builds a sample configfs interface.
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciconfig SAMPLE_CONNECTOR
14462306a36Sopenharmony_ci	tristate "Build connector sample -- loadable modules only"
14562306a36Sopenharmony_ci	depends on CONNECTOR && HEADERS_INSTALL && m
14662306a36Sopenharmony_ci	help
14762306a36Sopenharmony_ci	  When enabled, this builds both a sample kernel module for
14862306a36Sopenharmony_ci	  the connector interface and a user space tool to communicate
14962306a36Sopenharmony_ci	  with it.
15062306a36Sopenharmony_ci	  See also Documentation/driver-api/connector.rst
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ciconfig SAMPLE_FANOTIFY_ERROR
15362306a36Sopenharmony_ci	bool "Build fanotify error monitoring sample"
15462306a36Sopenharmony_ci	depends on FANOTIFY && CC_CAN_LINK && HEADERS_INSTALL
15562306a36Sopenharmony_ci	help
15662306a36Sopenharmony_ci	  When enabled, this builds an example code that uses the
15762306a36Sopenharmony_ci	  FAN_FS_ERROR fanotify mechanism to monitor filesystem
15862306a36Sopenharmony_ci	  errors.
15962306a36Sopenharmony_ci	  See also Documentation/admin-guide/filesystem-monitoring.rst.
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ciconfig SAMPLE_HIDRAW
16262306a36Sopenharmony_ci	bool "hidraw sample"
16362306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciconfig SAMPLE_LANDLOCK
16662306a36Sopenharmony_ci	bool "Landlock example"
16762306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
16862306a36Sopenharmony_ci	help
16962306a36Sopenharmony_ci	  Build a simple Landlock sandbox manager able to start a process
17062306a36Sopenharmony_ci	  restricted by a user-defined filesystem access control policy.
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ciconfig SAMPLE_PIDFD
17362306a36Sopenharmony_ci	bool "pidfd sample"
17462306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ciconfig SAMPLE_SECCOMP
17762306a36Sopenharmony_ci	bool "Build seccomp sample code"
17862306a36Sopenharmony_ci	depends on SECCOMP_FILTER && CC_CAN_LINK && HEADERS_INSTALL
17962306a36Sopenharmony_ci	help
18062306a36Sopenharmony_ci	  Build samples of seccomp filters using various methods of
18162306a36Sopenharmony_ci	  BPF filter construction.
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ciconfig SAMPLE_TIMER
18462306a36Sopenharmony_ci	bool "Timer sample"
18562306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ciconfig SAMPLE_UHID
18862306a36Sopenharmony_ci	bool "UHID sample"
18962306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
19062306a36Sopenharmony_ci	help
19162306a36Sopenharmony_ci	  Build UHID sample program.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ciconfig SAMPLE_VFIO_MDEV_MTTY
19462306a36Sopenharmony_ci	tristate "Build VFIO mtty example mediated device sample code"
19562306a36Sopenharmony_ci	depends on VFIO
19662306a36Sopenharmony_ci	select VFIO_MDEV
19762306a36Sopenharmony_ci	help
19862306a36Sopenharmony_ci	  Build a virtual tty sample driver for use as a VFIO
19962306a36Sopenharmony_ci	  mediated device
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ciconfig SAMPLE_VFIO_MDEV_MDPY
20262306a36Sopenharmony_ci	tristate "Build VFIO mdpy example mediated device sample code"
20362306a36Sopenharmony_ci	depends on VFIO
20462306a36Sopenharmony_ci	select VFIO_MDEV
20562306a36Sopenharmony_ci	help
20662306a36Sopenharmony_ci	  Build a virtual display sample driver for use as a VFIO
20762306a36Sopenharmony_ci	  mediated device.  It is a simple framebuffer and supports
20862306a36Sopenharmony_ci	  the region display interface (VFIO_GFX_PLANE_TYPE_REGION).
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ciconfig SAMPLE_VFIO_MDEV_MDPY_FB
21162306a36Sopenharmony_ci	tristate "Build VFIO mdpy example guest fbdev driver"
21262306a36Sopenharmony_ci	depends on FB
21362306a36Sopenharmony_ci	select FB_IOMEM_HELPERS
21462306a36Sopenharmony_ci	help
21562306a36Sopenharmony_ci	  Guest fbdev driver for the virtual display sample driver.
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ciconfig SAMPLE_VFIO_MDEV_MBOCHS
21862306a36Sopenharmony_ci	tristate "Build VFIO mbochs example mediated device sample code"
21962306a36Sopenharmony_ci	depends on VFIO
22062306a36Sopenharmony_ci	select VFIO_MDEV
22162306a36Sopenharmony_ci	select DMA_SHARED_BUFFER
22262306a36Sopenharmony_ci	help
22362306a36Sopenharmony_ci	  Build a virtual display sample driver for use as a VFIO
22462306a36Sopenharmony_ci	  mediated device.  It supports the region display interface
22562306a36Sopenharmony_ci	  (VFIO_GFX_PLANE_TYPE_DMABUF).
22662306a36Sopenharmony_ci	  Emulate enough of qemu stdvga to make bochs-drm.ko happy.
22762306a36Sopenharmony_ci	  That is basically the vram memory bar and the bochs dispi
22862306a36Sopenharmony_ci	  interface vbe registers in the mmio register bar.
22962306a36Sopenharmony_ci	  Specifically it does *not* include any legacy vga stuff.
23062306a36Sopenharmony_ci	  Device looks a lot like "qemu -device secondary-vga".
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ciconfig SAMPLE_ANDROID_BINDERFS
23362306a36Sopenharmony_ci	bool "Build Android binderfs example"
23462306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
23562306a36Sopenharmony_ci	help
23662306a36Sopenharmony_ci	  Builds a sample program to illustrate the use of the Android binderfs
23762306a36Sopenharmony_ci	  filesystem.
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ciconfig SAMPLE_VFS
24062306a36Sopenharmony_ci	bool "Build example programs that use new VFS system calls"
24162306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
24262306a36Sopenharmony_ci	help
24362306a36Sopenharmony_ci	  Build example userspace programs that use new VFS system calls such
24462306a36Sopenharmony_ci	  as mount API and statx().  Note that this is restricted to the x86
24562306a36Sopenharmony_ci	  arch whilst it accesses system calls that aren't yet in all arches.
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ciconfig SAMPLE_INTEL_MEI
24862306a36Sopenharmony_ci	bool "Build example program working with intel mei driver"
24962306a36Sopenharmony_ci	depends on INTEL_MEI
25062306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
25162306a36Sopenharmony_ci	help
25262306a36Sopenharmony_ci	  Build a sample program to work with mei device.
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ciconfig SAMPLE_TPS6594_PFSM
25562306a36Sopenharmony_ci	bool "Build example program working with TPS6594 PFSM driver"
25662306a36Sopenharmony_ci	depends on HEADERS_INSTALL
25762306a36Sopenharmony_ci	depends on CC_CAN_LINK
25862306a36Sopenharmony_ci	help
25962306a36Sopenharmony_ci	  Build a sample program to work with PFSM devices.
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ciconfig SAMPLE_WATCHDOG
26262306a36Sopenharmony_ci	bool "watchdog sample"
26362306a36Sopenharmony_ci	depends on CC_CAN_LINK
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ciconfig SAMPLE_WATCH_QUEUE
26662306a36Sopenharmony_ci	bool "Build example watch_queue notification API consumer"
26762306a36Sopenharmony_ci	depends on CC_CAN_LINK && HEADERS_INSTALL
26862306a36Sopenharmony_ci	help
26962306a36Sopenharmony_ci	  Build example userspace program to use the new mount_notify(),
27062306a36Sopenharmony_ci	  sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function.
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ciconfig SAMPLE_CORESIGHT_SYSCFG
27362306a36Sopenharmony_ci	tristate "Build example loadable module for CoreSight config"
27462306a36Sopenharmony_ci	depends on CORESIGHT && m
27562306a36Sopenharmony_ci	help
27662306a36Sopenharmony_ci	  Build an example loadable module that adds new CoreSight features
27762306a36Sopenharmony_ci	  and configuration using the CoreSight system configuration API.
27862306a36Sopenharmony_ci	  This demonstrates how a user may create their own CoreSight
27962306a36Sopenharmony_ci	  configurations and easily load them into the system at runtime.
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ciconfig SAMPLE_KMEMLEAK
28262306a36Sopenharmony_ci        tristate "Simple test for the kernel memory leak detector"
28362306a36Sopenharmony_ci        depends on DEBUG_KMEMLEAK && m
28462306a36Sopenharmony_ci        help
28562306a36Sopenharmony_ci          Build a sample program which have explicitly leaks memory to test
28662306a36Sopenharmony_ci          kmemleak
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_cisource "samples/rust/Kconfig"
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ciconfig SAMPLE_HCK
29162306a36Sopenharmony_ci	bool "HCK sample"
29262306a36Sopenharmony_ci	help
29362306a36Sopenharmony_ci	  HCK sample
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ciconfig SAMPLE_HCK_CALL
29662306a36Sopenharmony_ci	bool "HCK call sample"
29762306a36Sopenharmony_ci	depends on SAMPLE_HCK
29862306a36Sopenharmony_ci	help
29962306a36Sopenharmony_ci	  HCK call sample
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ciconfig SAMPLE_HCK_REGISTER
30262306a36Sopenharmony_ci	bool "HCK register sample"
30362306a36Sopenharmony_ci	depends on SAMPLE_HCK
30462306a36Sopenharmony_ci	help
30562306a36Sopenharmony_ci	  HCK register sample
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ciconfig SAMPLE_HCK_REGISTER_ONE
30862306a36Sopenharmony_ci	bool "HCK register one interface sample"
30962306a36Sopenharmony_ci	depends on SAMPLE_HCK
31062306a36Sopenharmony_ci	help
31162306a36Sopenharmony_ci	  HCK register sample
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ciendif # SAMPLES
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ciconfig HAVE_SAMPLE_FTRACE_DIRECT
31662306a36Sopenharmony_ci	bool
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ciconfig HAVE_SAMPLE_FTRACE_DIRECT_MULTI
31962306a36Sopenharmony_ci	bool
320