From owner-freebsd-current Fri Jun 9 21:26:10 2000 Delivered-To: freebsd-current@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id 3DC7F37B995; Fri, 9 Jun 2000 21:26:03 -0700 (PDT) (envelope-from dcs@newsguy.com) Received: from newsguy.com (p06-dn03kiryunisiki.gunma.ocn.ne.jp [210.232.224.135]) by peach.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id NAA13281; Sat, 10 Jun 2000 13:25:57 +0900 (JST) Message-ID: <3941C395.621849D9@newsguy.com> Date: Sat, 10 Jun 2000 13:27:01 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,pt-BR,ja MIME-Version: 1.0 To: Luoqi Chen Cc: current@FreeBSD.ORG, emulation@FreeBSD.ORG Subject: Re: VMware detection code in boot loader References: <200006091527.e59FRYb10540@lor.watermarkgroup.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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