addwstr - Linux


addwstr is a command-line utility used to add widespread strings (WSTRs) to the current kernel. WSTRs are used to store large blocks of text, such as program documentation, within the kernel’s memory. This command is primarily employed by kernel developers to incorporate documentation or other textual information into the kernel.


addwstr [-f] [-o | -O <filename>] [-p <num>] -s <string>


  • -f: Force the addition of the WSTR even if the kernel already contains a WSTR with the same name.
  • -o: Output the added WSTR in a human-readable format to STDOUT.
  • -O : Output the added WSTR in a human-readable format to the specified file.
  • -p : Specify the order of the new WSTR. The default order is 0.
  • -s : The string to add as a WSTR. This argument must be enclosed in double quotes.


Adding a WSTR to the kernel:

addwstr -s "Hello, world!"

Adding a WSTR with a specific order:

addwstr -p 10 -s "Important Information"

Outputting the added WSTR to a file:

addwstr -O /tmp/my_wstr.txt -s "Test String"

Common Issues

  • Duplicate WSTR Names: If you attempt to add a WSTR with a name that already exists in the kernel, an error will occur unless you use the -f flag.
  • Invalid String Format: The string provided with the -s argument must be a valid C-style string enclosed in double quotes.


addwstr can be used in conjunction with other tools for advanced tasks:

  • kbuild: The Linux kernel build system can be used to automatically add WSTRs during kernel compilation.
  • modinfo: The modinfo command can be used to display information about WSTRs within kernel modules.

Related Commands

  • extractwstr: Extracts a WSTR from the kernel.
  • kobject_set_uevent_attr: Can be used to add WSTRs to kernel objects at runtime.