From owner-freebsd-hackers Wed Mar 13 9:44:48 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mailgate.rz.uni-karlsruhe.de (mailgate.rz.uni-karlsruhe.de [129.13.64.97]) by hub.freebsd.org (Postfix) with ESMTP id B729B37B402 for ; Wed, 13 Mar 2002 09:44:42 -0800 (PST) Received: from rzstud1.rz.uni-karlsruhe.de (rzstud1.rz.uni-karlsruhe.de [193.196.41.33]) by mailgate.rz.uni-karlsruhe.de with esmtp (Exim 3.33 #1) id 16lCnY-00041y-00; Wed, 13 Mar 2002 18:44:24 +0100 Received: from un1i by rzstud1.rz.uni-karlsruhe.de with local (Exim 3.33 #1) id 16lCnb-0001kA-00; Wed, 13 Mar 2002 18:44:27 +0100 From: Philipp Mergenthaler 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 X-Newsgroups: list.freebsd-hackers In-Reply-To: <20020312175820.A93263@straylight.oblivion.bg> Message-Id: Date: Wed, 13 Mar 2002 18:44:27 +0100 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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