Template talk:Kernelconf2

From ThinkWiki
Jump to: navigation, search
ATTENTION!
Do not use this template, yet! It is in development and the name and contents of it are subject to change.

This template is used to automatically determine the menuconfig path for a kernel option given as variable. It also formats the output properly and allows specification if the option should be built into the kernel, as module or not at all.

Purpose

The goal is to provide a template that can automatically determine the output format so that

 standard wiki text
 {{kernelconf2|Device Drivers|}}
 {{kernelconf2|USB support|}}
 {{kernelconf2|CONFIG_USB|m}}
 {{kernelconf2|CONFIG_USB_DEVICEFS|m}}
 continuing wiki text

would result in something like:

standard wiki text

Device Drivers →
USB support →
Support for Host-side USB (CONFIG_USB=m)
USB device file system (CONFIG_USB_DEVICSFS=m)

continuing wiki text

and

 standard wiki text {{kernelconf2|CONFIG_USB|m}} continuing wiki text

would result in

standard wiki text Support for Host-side USB (CONFIG_USB=m) continuing wiki text

Usage

Scheme

{{kernelconf2|<CONFIG-Variable>|<BuildMode>}} with

  • <CONFIG-Variable> being a variable name as found in the kernels .config file,
  • <BuildMode>=[y,m, ].

Example

:{{kernelconf2|CONFIG_USB_UHCI_HCD|m}} shows as

{{kcprint_{{{3}}}|optname=|optparent=|opttype=m|optvar=CONFIG_USB_UHCI_HCD|mode={{{3}}}

name=Device Drivers →|parent=| name=USB support →|parent=Device_Drivers| name=Support for Host-side USB|parent=USB_support| name=USB device file system|parent=USB_support| name=EHCI HCD (USB 2.0) support|parent=USB_support| optname=UHCI HCD support|optparent=USB_support| name=OHCI HCD support|parent=USB_support }}

Inner Workings

The template calls Template:kc2 where the bigger part of the logic happens. This template only sets all the possible parameters (which match all kernel config variable names) to the empty string (which is necessary because of MediaWikis suboptimal parsing behavior). Finally, the parameter (variable name) given ain the first parameter value of the template call is assigned the value 2. All other parameters are just forwarded to Template:kc2, thereby naming them so they get position independent for further processing.