Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2002 18:44:27 +0100
From:      Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
To:        vladimirt@rila.bg
Cc:        roam@ringlet.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Running different startup scripts on behalf of loaded kernel and kernel modules
Message-ID:  <E16lCnb-0001kA-00@rzstud1.rz.uni-karlsruhe.de>
In-Reply-To: <20020312175820.A93263@straylight.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <20020312175820.A93263@straylight.oblivion.bg> you wrote:
> On Tue, Mar 12, 2002 at 04:38:42PM +0200, Vladimir Terziev wrote:
>> > > 	I have to configure a box, which has to run different startup
>> > > scrips on behalf of loaded kernel and kernel modules at startup.
[...]
>> How can I understand, when the startup scripts are going to be runned,
>> which menu item is choosed ?

> I think that your scripts should set some variables in the loader's
> environment that can later be passed on to the kernel and read by
> userland utilities (including startup scripts) - see kenv(1).

Yes, you can set a variable in bootforth with
: foo
  s" value"
  s" my_var"
  setenv
;

OK foo
OK

and, in a startup script, read it with kenv | grep "my_var" .

(There's a bug in setenv when used interactively; it uses the variable's
name as its value, too.  But it works correctly when used in the
definition of a word.)

Another (too fancy) way would be to use a file (bootforth has fopen,
fread, fwrite, fclose).

See libstand(3) and src/sys/boot/ficl/loader.c for more details.

Bye, Philipp

-- 
http://www.uni-karlsruhe.de/~un1i/                          (,.)
                                                          \\\@@ )
                                                            \= )
                                                            cc_|\_,^

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E16lCnb-0001kA-00>