[Midnightbsd-cvs] src: boot/forth: Add virtual machine detection in the loader.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Jan 21 15:21:08 EST 2008
Log Message:
-----------
Add virtual machine detection in the loader. For QEMU, VBOX, VMware, or Parallels, set the hz setting to 100. This will fix "time" issues automatically in these environments.
Modified Files:
--------------
src/sys/boot/i386/loader:
Makefile (r1.1.1.1 -> r1.2)
loader.rc (r1.1.1.1 -> r1.2)
Added Files:
-----------
src/sys/boot/forth:
vm.4th (r1.1)
-------------- next part --------------
--- /dev/null
+++ sys/boot/forth/vm.4th
@@ -0,0 +1,35 @@
+: check-env? ( addr len addr len -- flag )
+ getenv
+ dup -1 <> if
+ compare 0= if
+ true exit
+ then
+ else
+ drop
+ 2drop
+ then
+ false
+;
+
+: is-vm? ( -- flag )
+ s" QEMU " s" hint.acpi.0.oem" check-env? if
+ true exit
+ then
+ s" VBOX " s" hint.acpi.0.oem" check-env? if
+ true exit
+ then
+ s" VMware, Inc." s" smbios.system.maker" check-env? if
+ true exit
+ then
+ s" Parallels Software International Inc." s" smbios.bios.vendor"
+ check-env? if
+ true exit
+ then
+ false
+;
+
+: setup-vm
+ is-vm? if
+ s" 100" s" hz" setenv
+ then
+;
Index: loader.rc
===================================================================
RCS file: /home/cvs/src/sys/boot/i386/loader/loader.rc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/boot/i386/loader/loader.rc -L sys/boot/i386/loader/loader.rc -u -r1.1.1.1 -r1.2
--- sys/boot/i386/loader/loader.rc
+++ sys/boot/i386/loader/loader.rc
@@ -4,6 +4,10 @@
\ Includes additional commands
include /boot/loader.4th
+\ Virtual machine detection
+include /boot/vm.4th
+setup-vm
+
\ Reads and processes loader.conf variables
start
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/boot/i386/loader/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/boot/i386/loader/Makefile -L sys/boot/i386/loader/Makefile -u -r1.1.1.1 -r1.2
--- sys/boot/i386/loader/Makefile
+++ sys/boot/i386/loader/Makefile
@@ -73,7 +73,7 @@
.PATH: ${.CURDIR}/../../forth
FILES= loader loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th beastie.4th
+FILES+= screen.4th frames.4th beastie.4th vm.4th
# XXX INSTALLFLAGS_loader= -b
FILESMODE_loader= ${BINMODE} -b
FILESDIR_loader.conf= /boot/defaults
More information about the Midnightbsd-cvs
mailing list