Date: Thu, 7 Oct 2004 21:22:58 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: Kelly Hall <khall@stbernard.com> Cc: freebsd-hackers@FreeBSD.org Subject: Re: BTX scripting help Message-ID: <20041007182258.GA84834@ip.net.ua> In-Reply-To: <E7E213858379814A9AE48CA6754F5ECB030FD340@mail01.stbernard.com> References: <E7E213858379814A9AE48CA6754F5ECB030FD340@mail01.stbernard.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Thu, Oct 07, 2004 at 11:00:06AM -0700, Kelly Hall wrote:
> Hi Folks,
>
> 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.
>
> 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.
>
> 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.
>
> 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
>
> I'm stumped. Any suggestions?
>
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=0x5ce910+0x488e0 syms=[0x8+0x69798+0x8+0x56466]
: 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
Cheers,
--
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
iD8DBQFBZYmCqRfpzJluFF4RAuSOAJ0W3X7xpMCEnAIfGu6/T43O38IXRACggZlc
PDFL4HppaIQMRvxG8OSFPhA=
=CC9K
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041007182258.GA84834>
