mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: "Robert P. J. Day" <rpjday@mindspring.com>,
	Rogan Dawes <lists@dawes.za.net>,
	David Newall <david@davidnewall.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: stripping down the kernel-parameters.txt file
Date: Wed, 12 Sep 2007 10:56:24 -0700	[thread overview]
Message-ID: <20070912105624.36b74f17.randy.dunlap@oracle.com> (raw)
In-Reply-To: <3E869809-EA55-4F90-B364-788081ACEC00@mac.com>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On Wed, 12 Sep 2007 13:47:38 -0400 Kyle Moffett wrote:

> On Sep 12, 2007, at 10:44:29, Robert P. J. Day wrote:
> > in the end, there should be a nice, *short* reference for what i  
> > like to call "basic" kernel parms (defined by __setup() or  
> > early_param()), while anyone who wants to learn about any module- 
> > specific parms should then have to go look up the info for that  
> > given module, that's all.
> >
> > as a trivial starting point, this would involve nothing more than  
> > shifting current content around in kernel-parameters.txt, putting  
> > the basic stuff at the top, and the module-specific stuff after  
> > that.  heck, that would even give module authors the chance to add  
> > a line or two of module description if they wanted.  how does life  
> > get any better than that?
> 
> Well, maybe if modules could be used similarly to: "modprobe  
> my_module --help" to give a description of the available module  
> parameters.  That information might be merged into modules from text  

modinfo prints out all MODULE_PARM_DESC() strings.

> file(s) or vice-versa, but I can see it being significantly more  
> useful.  Another mildly-useful feature would be to stick the basic  
> boot params and those for built-in modules into a little text file  
> which could optionally be embedded in the initramfs along with the  
> "less" binary, so that a "vmlinuz --help" could be made to work  
> usefully from your bootloader.

This has come up before.  I wrote the attached 'module-params'
script last October (2006).  It can search .c files or .ko files
for module parameters...

---
~Randy

[-- Attachment #2: module-params --]
[-- Type: application/octet-stream, Size: 2041 bytes --]

#! /bin/sh
# Copyright (C) 2006 Randy Dunlap
# GPL version 2 license.
# prints 'modinfo -p' for all found *.ko files
# prints 'modinfo' (all) for all found *.ko files if -a is specified;
# prints all MODULE_PARM_DESC lines for all *.c files if -s is specified;

allinfo=""
sources=""

while getopts "aosh" Option ; do
	case $Option in
	a)
		allinfo="1"
		;;
	s)
		sources="1"
		;;
	o)
		sources=""
		;;
	h|*)
		echo "usage: module-params [-a] [-s] [-o] [-h]"
		echo "lists module parameter info for all found files:"
		echo "  -s searches source (.c) files"
		echo "  -o searches binary (.ko) files [default]"
		echo "  -a lists all modinfo output from .ko files"
		echo "     (else just -p: module parameters output)"
		echo "  -h prints this help text"
		exit
		;;
	esac
done
##echo shifting args by: $(($OPTIND - 1))
shift $(($OPTIND - 1))

if [ "$allinfo" == "1" ]; then
	modinfo_param=""
else
	modinfo_param="-p"	# module parameters only
fi

if [ "$sources" == "1" ]; then
	filenames=$(find . -name \*\.c)
else
	filenames=$(find . -name \*\.ko)
fi

for file in $filenames ; do

	if [ "$sources" == "1" ]; then
		grep -sq -w MODULE_PARM_DESC $file
		sts=$?

		if [ $sts -eq 0 ]; then
			if [ ${file:0:2} == "./" ]; then
				file=${file:2}
			fi
			echo "$file:"
			grep -w MODULE_PARM_DESC $file | \
				sed -e s/MODULE_PARM_DESC[[:space:]]*\(// | \
				sed -e s/"\"[[:space:]]*)[[:space:]]*;[[:space:]]*$"// |
				sed -e s/","/": "/ |
				sed -e s/'"$'/''/ |
				sed -e s/'\\$'/''/ |
				sed -e s/'\\n$'/''/ |
				sed -e s/'\\t'/' '/g |
				sed -e s/'\\n'/': '/g |
				sed -e s/'\\'/''/g |
				sed -e s/'__MODULE_STRING'/''/g |
				sed -e s/":[[:space:]]*\""/": "/
			echo "-------------------------------------------------"
		fi

	else	# object modules
		info=`modinfo $modinfo_param $file`
		if [ "$info" != "" ]; then
			# don't repeat filename
			if [ "$allinfo" != "1" ]; then
				echo "$file:"
			fi
			modinfo $modinfo_param $file | sed -e s/":"/": "/g
			echo "-------------------------------------------------"
		fi

	fi

done

      reply	other threads:[~2007-09-12 17:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12  7:50 Robert P. J. Day
2007-09-12 12:43 ` David Newall
2007-09-12 13:11   ` Robert P. J. Day
2007-09-12 13:32     ` David Newall
2007-09-12 14:06       ` Robert P. J. Day
2007-09-12 14:30     ` Rogan Dawes
2007-09-12 14:44       ` Robert P. J. Day
2007-09-12 17:47         ` Kyle Moffett
2007-09-12 17:56           ` Randy Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070912105624.36b74f17.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=david@davidnewall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists@dawes.za.net \
    --cc=mrmacman_g4@mac.com \
    --cc=rpjday@mindspring.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®