Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jun 2000 13:27:01 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Luoqi Chen <luoqi@watermarkgroup.com>
Cc:        current@FreeBSD.ORG, emulation@FreeBSD.ORG
Subject:   Re: VMware detection code in boot loader
Message-ID:  <3941C395.621849D9@newsguy.com>
References:  <200006091527.e59FRYb10540@lor.watermarkgroup.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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)

dcs@newsguy.com
dcs@freebsd.org
capo@yet.another.bsdconspiracy.org

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


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3941C395.621849D9>