BTX scripting help
Ruslan Ermilov
ru at FreeBSD.org
Thu Oct 7 11:22:56 PDT 2004
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 at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20041007/39f54400/attachment.bin
More information about the freebsd-hackers
mailing list