Luoqi Chen wrote:
> 
> Would anyone object if I add a ficl word to detect whether we're booting
> from a vmware virtual machine? I find it extremely useful when I'm running
> FreeBSD as a guest under NT. Because it is a dual cpu box, I can't use a
> single kernel to boot both directly or inside the virtual machine. With this
> new word, I can determine which kernel to use in the loader script, saving
> me the trouble to unload and reload a new kernel each time I reboot.
> 
> Here's the patch to the boot loader,
> 
> --- boot/ficl/ficl.h    2000/06/01 18:10:43     1.14
> +++ boot/ficl/ficl.h    2000/06/07 18:18:38
> @@ -860,6 +860,7 @@
>  #if defined(__i386__) && !defined(TESTMAIN)
>  extern void ficlOutb(FICL_VM *pVM);
               ^^^^^^^^
>  extern void ficlInb(FICL_VM *pVM);
               ^^^^^^^
> +extern void vmware(FICL_VM *pVM);

We have inb and outb. Can't vmware be written in Forth? If inl cannot be
replaced with inb, I'd rather add inl than vmware.

> To use this feature, you first create a file /boot/vmware.4th:
> 
>         : vmware-conf
>                 vmware dup 0> if
>                         ." VMware version " . cr
>                         ." Loading /boot/vmware.conf..." cr
>                         s" /boot/vmware.conf" read-conf
>                 else
>                         drop
>                 then
>         ;
> 
> then create /boot/vmware.conf which sets the kernel to use:
> 
>         kernel="/kernel.VMWARE"
> 
> finally, change your /boot/loader.rc to
> 
>         include /boot/loader.4th
>         include /boot/vmware.4th
>         initialize drop
>         vmware-conf
>         boot-conf
>         check-password

IMHO, it would be better to add

exec="include /boot/vmware.4th"

to the end of your /boot/loader.conf, and either execute vmware-conf
from there or script the whole thing:

s" arch-i386" environment? [if]
        \ Get vmware version, magic
        0x564d868 ( VMware magic ) = [if]
                .( VMware version ) . cr
                .( Loading /boot/vmware.conf...) cr
                s" /boot/vmware.conf" read-conf
        [else]
                drop
        [then]
[then]

Either way, no changes to /boot/loader.rc would be required.

-- 
Daniel C. Sobral                        (8-DCS)

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

        Hmmm - I have to go check this. My reality assumptions are shattered.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to