From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 7 18:22:56 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59E1416A4CF for ; Thu, 7 Oct 2004 18:22:56 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8222143D68 for ; Thu, 7 Oct 2004 18:22:55 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i97IMsis073282; Thu, 7 Oct 2004 21:22:54 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 53793-19; Thu, 7 Oct 2004 21:22:53 +0300 (EEST) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i97IMrxE073278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Oct 2004 21:22:53 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id i97IMwCs084881; Thu, 7 Oct 2004 21:22:58 +0300 (EEST) (envelope-from ru) Date: Thu, 7 Oct 2004 21:22:58 +0300 From: Ruslan Ermilov To: Kelly Hall Message-ID: <20041007182258.GA84834@ip.net.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ip.net.ua cc: freebsd-hackers@FreeBSD.org Subject: Re: BTX scripting help X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 18:22:56 -0000 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 07, 2004 at 11:00:06AM -0700, Kelly Hall wrote: > Hi Folks, > =20 > I'm trying to automate a sequence of BTX commands and I'm hitting some > snags. I've got some minor forth experience, but it isn't enough. > =20 > My machine uses the standard bootloader and doesn't present a menu for > the user. By default, the machine boots a standard kernel and fs-image > file and everything is happy. Sometimes, though, I want my users to be > able to boot an alternate kernel and fs-image. To do this, what they do > now is: > - wait for the default kernel to start loading > - hit the space bar > - BTX breaks out and gives them a prompt > - they type four commands: > - unload > - load /kernel > - load -t md_image /altfs-image > - boot > I'd like to replace those four commands with one command to make things > nicer for them. > =20 > So I tried to define the obvious forth word: > : altboot unload load /kernel load -t md_image /altfs-image boot ; > which fails to compile because /kernel isn't a word. >=20 > These all compile, but reboot when invoked > : altboot unload s" /kernel" load ; \ reboots the box > : altboot unload load s" /kernel" ; \ reboots the box > : altboot unload ." /kernel" load ; \ reboots the box > : altboot unload load ." /kernel" ; \ reboots the box > =20 > I'm stumped. Any suggestions? > =20 Read the loader(8) manpage, it says: BUILTIN COMMANDS Loader's builtin commands take its parameters from the command line. Presently, the only way to call them from a script is by using evaluate on a string. : OK : altboot : s" unload" evaluate : s" load /boot/kernel/kernel" evaluate : s" lsmod" evaluate : ; : OK altboot : /boot/kernel/kernel data=3D0x5ce910+0x488e0 syms=3D[0x8+0x69798+0x8+0x564= 66] : 0xfffffc0000300000: /boot/kernel/kernel (elf kernel, 0x6d6e00) : modules: splash.1 nfsserver.1 nfs4.1 nfs.1 if_gif.1 if_faith.1 ether.1 = sysvshm.1 sysvsem.1 sysvmsg.1 cd9660.1 isa.1 pseudofs.1 procfs.1 msdosfs.1 = usb.1 random.1 ppbus.1 pci.1 null.1 mpt.1 miibus.1 mem.1 ispfw.0 isp.1 sbp.= 1 fwe.1 firewire.1 ahc.1 ahc_pci.1 ahc_isa.1 ahc_eisa.1 cam.1=20 Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --nFreZHaLTZJo0R7j Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBZYmCqRfpzJluFF4RAuSOAJ0W3X7xpMCEnAIfGu6/T43O38IXRACggZlc PDFL4HppaIQMRvxG8OSFPhA= =CC9K -----END PGP SIGNATURE----- --nFreZHaLTZJo0R7j--