win2008 R2 server要激活需要读取bios信息,在虚拟机情况下Bios信息是不完整的,所以各种网上的激活方法都是无效的,必须对虚拟机Bios硬化才能够实现!在CentOS中利用KVM建立 虚拟机硬化Bios的难度还是很大的。
1、准备的工具 :SLIC_Toolkit用户在检验客户机读取SLIC信息是否正确
几乎所有OEM机器的SLIC文件和证书用于导入到我们的虚拟机中的bios中,其中还包含了客户机使用的认证证书
最新的SeaBios源码用于编译生成bios.bin文件,来替换kvm中的系统默认bios.bin
2、步骤
1)安装git:首先下载git官网,系统已经有的可以略过,安装很简单,不会可以百度下
2)使用git获取sealic项目源码
$ cd ~ //路径自己随便建
$ git clone git://github.com/ghuntley/seaslic
获取完成之后会有多出一目录
[root@zxm test]# ls
seaslic
[root@zxm test]# cd seaslic
[root@zxm seaslic]# ls
patch.sh README.markdown seabios.patch seabios.submodule
其中在该目录中的seabios.submodule需要删除掉,用我们后面下载的内容重建
[root@zxm seaslic]# rm -rf seabios.submodule
3)将我们前面下载的SeaBios源码解压,重建seabios.submodule
[root@zxm test]# ls
seabios-1.7.3.2.tar.gz seaslic
[root@zxm test]# tar xzvf seabios-1.7.3.2.tar.gz
seabios-1.7.3.2/
seabios-1.7.3.2/.gitignore
seabios-1.7.3.2/COPYING
seabios-1.7.3.2/COPYING.LESSER
seabios-1.7.3.2/Makefile
seabios-1.7.3.2/README
seabios-1.7.3.2/README.CSM
seabios-1.7.3.2/TODO
seabios-1.7.3.2/src/
seabios-1.7.3.2/src/Kconfig
seabios-1.7.3.2/src/LegacyBios.h
seabios-1.7.3.2/src/acpi-dsdt-cpu-hotplug.dsl
seabios-1.7.3.2/src/acpi-dsdt-dbug.dsl
seabios-1.7.3.2/src/acpi-dsdt-hpet.dsl
seabios-1.7.3.2/src/acpi-dsdt-isa.dsl
seabios-1.7.3.2/src/acpi-dsdt-pci-crs.dsl
seabios-1.7.3.2/src/acpi-dsdt.dsl
seabios-1.7.3.2/src/acpi.c
seabios-1.7.3.2/src/acpi.h
seabios-1.7.3.2/src/ahci.c
seabios-1.7.3.2/src/ahci.h
seabios-1.7.3.2/src/apm.c
seabios-1.7.3.2/src/asm-offsets.c
seabios-1.7.3.2/src/ata.c
seabios-1.7.3.2/src/ata.h
seabios-1.7.3.2/src/biostables.c
seabios-1.7.3.2/src/biosvar.h
seabios-1.7.3.2/src/block.c
seabios-1.7.3.2/src/blockcmd.c
seabios-1.7.3.2/src/blockcmd.h
seabios-1.7.3.2/src/bmp.c
seabios-1.7.3.2/src/bmp.h
seabios-1.7.3.2/src/boot.c
seabios-1.7.3.2/src/boot.h
seabios-1.7.3.2/src/bootsplash.c
seabios-1.7.3.2/src/bregs.h
seabios-1.7.3.2/src/byteorder.h
seabios-1.7.3.2/src/cdrom.c
seabios-1.7.3.2/src/clock.c
seabios-1.7.3.2/src/cmos.h
seabios-1.7.3.2/src/code16gcc.s
seabios-1.7.3.2/src/config.h
seabios-1.7.3.2/src/coreboot.c
seabios-1.7.3.2/src/csm.c
seabios-1.7.3.2/src/csm.h
seabios-1.7.3.2/src/dev-q35.h
seabios-1.7.3.2/src/disk.c
seabios-1.7.3.2/src/disk.h
seabios-1.7.3.2/src/entryfuncs.S
seabios-1.7.3.2/src/esp-scsi.c
seabios-1.7.3.2/src/esp-scsi.h
seabios-1.7.3.2/src/farptr.h
seabios-1.7.3.2/src/floppy.c
seabios-1.7.3.2/src/font.c
seabios-1.7.3.2/src/gen-defs.h
seabios-1.7.3.2/src/ioport.h
seabios-1.7.3.2/src/jpeg.c
seabios-1.7.3.2/src/jpeg.h
seabios-1.7.3.2/src/kbd.c
seabios-1.7.3.2/src/list.h
seabios-1.7.3.2/src/lsi-scsi.c
seabios-1.7.3.2/src/lsi-scsi.h
seabios-1.7.3.2/src/lzmadecode.c
seabios-1.7.3.2/src/lzmadecode.h
seabios-1.7.3.2/src/megasas.c
seabios-1.7.3.2/src/megasas.h
seabios-1.7.3.2/src/memmap.c
seabios-1.7.3.2/src/memmap.h
seabios-1.7.3.2/src/misc.c
seabios-1.7.3.2/src/mouse.c
seabios-1.7.3.2/src/mptable.c
seabios-1.7.3.2/src/mptable.h
seabios-1.7.3.2/src/mtrr.c
seabios-1.7.3.2/src/optionroms.c
seabios-1.7.3.2/src/optionroms.h
seabios-1.7.3.2/src/output.c
seabios-1.7.3.2/src/paravirt.c
seabios-1.7.3.2/src/paravirt.h
seabios-1.7.3.2/src/pci.c
seabios-1.7.3.2/src/pci.h
seabios-1.7.3.2/src/pci_ids.h
seabios-1.7.3.2/src/pci_regs.h
seabios-1.7.3.2/src/pcibios.c
seabios-1.7.3.2/src/pciinit.c
seabios-1.7.3.2/src/pic.c
seabios-1.7.3.2/src/pic.h
seabios-1.7.3.2/src/pirtable.c
seabios-1.7.3.2/src/pmm.c
seabios-1.7.3.2/src/pnpbios.c
seabios-1.7.3.2/src/post.c
seabios-1.7.3.2/src/post.h
seabios-1.7.3.2/src/ps2port.c
seabios-1.7.3.2/src/ps2port.h
seabios-1.7.3.2/src/q35-acpi-dsdt.dsl
seabios-1.7.3.2/src/ramdisk.c
seabios-1.7.3.2/src/resume.c
seabios-1.7.3.2/src/romfile.c
seabios-1.7.3.2/src/romlayout.S
seabios-1.7.3.2/src/serial.c
seabios-1.7.3.2/src/shadow.c
seabios-1.7.3.2/src/smbios.c
seabios-1.7.3.2/src/smbios.h
seabios-1.7.3.2/src/smm.c
seabios-1.7.3.2/src/smp.c
seabios-1.7.3.2/src/ssdt-misc.dsl
seabios-1.7.3.2/src/ssdt-pcihp.dsl
seabios-1.7.3.2/src/ssdt-proc.dsl
seabios-1.7.3.2/src/stacks.c
seabios-1.7.3.2/src/system.c
seabios-1.7.3.2/src/types.h
seabios-1.7.3.2/src/usb-ehci.c
seabios-1.7.3.2/src/usb-ehci.h
seabios-1.7.3.2/src/usb-hid.c
seabios-1.7.3.2/src/usb-hid.h
seabios-1.7.3.2/src/usb-hub.c
seabios-1.7.3.2/src/usb-hub.h
seabios-1.7.3.2/src/usb-msc.c
seabios-1.7.3.2/src/usb-msc.h
seabios-1.7.3.2/src/usb-ohci.c
seabios-1.7.3.2/src/usb-ohci.h
seabios-1.7.3.2/src/usb-uas.c
seabios-1.7.3.2/src/usb-uas.h
seabios-1.7.3.2/src/usb-uhci.c
seabios-1.7.3.2/src/usb-uhci.h
seabios-1.7.3.2/src/usb.c
seabios-1.7.3.2/src/usb.h
seabios-1.7.3.2/src/util.c
seabios-1.7.3.2/src/util.h
seabios-1.7.3.2/src/vbe.h
seabios-1.7.3.2/src/vgahooks.c
seabios-1.7.3.2/src/virtio-blk.c
seabios-1.7.3.2/src/virtio-blk.h
seabios-1.7.3.2/src/virtio-pci.c
seabios-1.7.3.2/src/virtio-pci.h
seabios-1.7.3.2/src/virtio-ring.c
seabios-1.7.3.2/src/virtio-ring.h
seabios-1.7.3.2/src/virtio-scsi.c
seabios-1.7.3.2/src/virtio-scsi.h
seabios-1.7.3.2/src/xen.c
seabios-1.7.3.2/src/xen.h
seabios-1.7.3.2/tools/
seabios-1.7.3.2/tools/acpi_extract.py
seabios-1.7.3.2/tools/acpi_extract_preprocess.py
seabios-1.7.3.2/tools/buildrom.py
seabios-1.7.3.2/tools/buildversion.sh
seabios-1.7.3.2/tools/checkrom.py
seabios-1.7.3.2/tools/checkstack.py
seabios-1.7.3.2/tools/checksum.py
seabios-1.7.3.2/tools/encodeint.py
seabios-1.7.3.2/tools/gen-offsets.sh
seabios-1.7.3.2/tools/kconfig/
seabios-1.7.3.2/tools/kconfig/.gitignore
seabios-1.7.3.2/tools/kconfig/Makefile
seabios-1.7.3.2/tools/kconfig/POTFILES.in
seabios-1.7.3.2/tools/kconfig/check.sh
seabios-1.7.3.2/tools/kconfig/conf.c
seabios-1.7.3.2/tools/kconfig/confdata.c
seabios-1.7.3.2/tools/kconfig/expr.c
seabios-1.7.3.2/tools/kconfig/expr.h
seabios-1.7.3.2/tools/kconfig/gconf.c
seabios-1.7.3.2/tools/kconfig/gconf.glade
seabios-1.7.3.2/tools/kconfig/images.c
seabios-1.7.3.2/tools/kconfig/kconfig_load.c
seabios-1.7.3.2/tools/kconfig/kxgettext.c
seabios-1.7.3.2/tools/kconfig/lex.zconf.c_shipped
seabios-1.7.3.2/tools/kconfig/lkc.h
seabios-1.7.3.2/tools/kconfig/lkc_proto.h
seabios-1.7.3.2/tools/kconfig/lxdialog/
seabios-1.7.3.2/tools/kconfig/lxdialog/.gitignore
seabios-1.7.3.2/tools/kconfig/lxdialog/BIG.FAT.WARNING
seabios-1.7.3.2/tools/kconfig/lxdialog/check-lxdialog.sh
seabios-1.7.3.2/tools/kconfig/lxdialog/checklist.c
seabios-1.7.3.2/tools/kconfig/lxdialog/dialog.h
seabios-1.7.3.2/tools/kconfig/lxdialog/inputbox.c
seabios-1.7.3.2/tools/kconfig/lxdialog/menubox.c
seabios-1.7.3.2/tools/kconfig/lxdialog/textbox.c
seabios-1.7.3.2/tools/kconfig/lxdialog/util.c
seabios-1.7.3.2/tools/kconfig/lxdialog/yesno.c
seabios-1.7.3.2/tools/kconfig/mconf.c
seabios-1.7.3.2/tools/kconfig/menu.c
seabios-1.7.3.2/tools/kconfig/nconf.c
seabios-1.7.3.2/tools/kconfig/nconf.gui.c
seabios-1.7.3.2/tools/kconfig/nconf.h
seabios-1.7.3.2/tools/kconfig/qconf.cc
seabios-1.7.3.2/tools/kconfig/qconf.h
seabios-1.7.3.2/tools/kconfig/symbol.c
seabios-1.7.3.2/tools/kconfig/util.c
seabios-1.7.3.2/tools/kconfig/zconf.gperf
seabios-1.7.3.2/tools/kconfig/zconf.hash.c_shipped
seabios-1.7.3.2/tools/kconfig/zconf.l
seabios-1.7.3.2/tools/kconfig/zconf.tab.c_shipped
seabios-1.7.3.2/tools/kconfig/zconf.y
seabios-1.7.3.2/tools/layoutrom.py
seabios-1.7.3.2/tools/readserial.py
seabios-1.7.3.2/tools/test-build.sh
seabios-1.7.3.2/tools/transdump.py
seabios-1.7.3.2/tools/vgafixup.py
seabios-1.7.3.2/vgasrc/
seabios-1.7.3.2/vgasrc/Kconfig
seabios-1.7.3.2/vgasrc/bochsvga.c
seabios-1.7.3.2/vgasrc/bochsvga.h
seabios-1.7.3.2/vgasrc/clext.c
seabios-1.7.3.2/vgasrc/clext.h
seabios-1.7.3.2/vgasrc/geodevga.c
seabios-1.7.3.2/vgasrc/geodevga.h
seabios-1.7.3.2/vgasrc/stdvga.c
seabios-1.7.3.2/vgasrc/stdvga.h
seabios-1.7.3.2/vgasrc/stdvgaio.c
seabios-1.7.3.2/vgasrc/stdvgamodes.c
seabios-1.7.3.2/vgasrc/vbe.c
seabios-1.7.3.2/vgasrc/vgabios.c
seabios-1.7.3.2/vgasrc/vgabios.h
seabios-1.7.3.2/vgasrc/vgaentry.S
seabios-1.7.3.2/vgasrc/vgafb.c
seabios-1.7.3.2/vgasrc/vgafonts.c
seabios-1.7.3.2/vgasrc/vgahw.h
seabios-1.7.3.2/vgasrc/vgalayout.lds.S
[root@zxm test]#
其中的压缩文件就是我们下载的文件,方便期间都放在了test目录下,加压完成会出现seabios-....不同版本路径略有不同
下面开始重建目录
[root@zxm test]# mv seabios-1.7.3.2 seaslic/seabios.submodule
[root@zxm test]# cd seaslic
[root@zxm seaslic]# ls
patch.sh README.markdown seabios.patch seabios.submodule
[root@zxm seaslic]# cd seabios.submodule
[root@zxm seabios.submodule]# ls
COPYING COPYING.LESSER Makefile README README.CSM src TODO tools vgasrc
[root@zxm seabios.submodule]# cd src
这个时候可以看到在src目录中有很多的源码了,我们不需要对这些源码再做修改,我就再此花了大量时间修改了老的版本源码导致越改越乱
4)接下来开始生成bios.bin文件
[root@zxm src]# cd ..
[root@zxm seabios.submodule]# ls
COPYING COPYING.LESSER Makefile README README.CSM src TODO tools vgasrc
[root@zxm seabios.submodule]# cd ..
[root@zxm seaslic]# ls
patch.sh README.markdown seabios.patch seabios.submodule
[root@zxm seaslic]# ./patch.sh
===========================================================================
dump the slic from motherboard (root password required)
===========================================================================
===========================================================================
patching seabios...
===========================================================================
patching file src/acpi.c
Hunk #1 succeeded at 20 with fuzz 2 (offset -194 lines).
Hunk #2 succeeded at 37 with fuzz 2 (offset -194 lines).
Hunk #3 succeeded at 631 with fuzz 2 (offset -205 lines).
===========================================================================
compiling seabios...
===========================================================================
Build default config
#
# configuration written to /test/seaslic/seabios.submodule/.config
#
Build Kconfig config file
Compile checking out/misc.o
Compile checking out/stacks.o
Compile checking out/output.o
Compile checking out/util.o
Compile checking out/block.o
Compile checking out/floppy.o
Compile checking out/ata.o
Compile checking out/mouse.o
Compile checking out/kbd.o
Compile checking out/pci.o
Compile checking out/serial.o
Compile checking out/clock.o
Compile checking out/pic.o
Compile checking out/cdrom.o
Compile checking out/ps2port.o
Compile checking out/smp.o
Compile checking out/resume.o
Compile checking out/pnpbios.o
Compile checking out/vgahooks.o
Compile checking out/ramdisk.o
Compile checking out/pcibios.o
Compile checking out/blockcmd.o
Compile checking out/usb.o
Compile checking out/usb-uhci.o
Compile checking out/usb-ohci.o
Compile checking out/usb-ehci.o
Compile checking out/usb-hid.o
Compile checking out/usb-msc.o
Compile checking out/virtio-ring.o
Compile checking out/virtio-pci.o
Compile checking out/virtio-blk.o
Compile checking out/virtio-scsi.o
Compile checking out/apm.o
Compile checking out/ahci.o
Compile checking out/usb-uas.o
Compile checking out/lsi-scsi.o
Compile checking out/esp-scsi.o
Compile checking out/megasas.o
Compile checking out/post.o
Compile checking out/shadow.o
Compile checking out/memmap.o
Compile checking out/pmm.o
Compile checking out/coreboot.o
Compile checking out/boot.o
Compiling IASL out/acpi-dsdt.hex
ASL Input: out/acpi-dsdt.dsl.i - 476 lines, 19181 bytes, 316 keywords
AML Output: out/acpi-dsdt.aml - 4407 bytes, 159 named objects, 157 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 246 Optimizations
Compiling IASL out/ssdt-proc.hex
ASL Input: out/ssdt-proc.dsl.i - 36 lines, 762 bytes, 8 keywords
AML Output: out/ssdt-proc.aml - 120 bytes, 6 named objects, 2 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 0 Optimizations
Compiling IASL out/ssdt-pcihp.hex
ASL Input: out/ssdt-pcihp.dsl.i - 52 lines, 782 bytes, 6 keywords
AML Output: out/ssdt-pcihp.aml - 88 bytes, 5 named objects, 1 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 0 Optimizations
Compiling IASL out/ssdt-misc.hex
ASL Input: out/ssdt-misc.dsl.i - 128 lines, 2593 bytes, 35 keywords
AML Output: out/ssdt-misc.aml - 354 bytes, 24 named objects, 11 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 2 Optimizations
Compiling IASL out/q35-acpi-dsdt.hex
ASL Input: out/q35-acpi-dsdt.dsl.i - 515 lines, 28287 bytes, 413 keywords
AML Output: out/q35-acpi-dsdt.aml - 7344 bytes, 239 named objects, 174 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 445 Optimizations
Compile checking out/acpi.o
Compile checking out/smm.o
Compile checking out/mptable.o
Compile checking out/pirtable.o
Compile checking out/smbios.o
Compile checking out/pciinit.o
Compile checking out/optionroms.o
Compile checking out/mtrr.o
Compile checking out/lzmadecode.o
Compile checking out/bootsplash.o
Compile checking out/jpeg.o
Compile checking out/usb-hub.o
Compile checking out/paravirt.o
Compile checking out/biostables.o
Compile checking out/xen.o
Compile checking out/bmp.o
Compile checking out/romfile.o
Compile checking out/csm.o
Compiling whole program out/ccode32flat.o
Compiling whole program out/code32seg.o
Compile checking out/system.o
Compile checking out/disk.o
Compile checking out/font.o
Compiling whole program out/ccode16.o
Compiling to assembler out/asm-offsets.s
Generating offset file out/asm-offsets.h
Compiling (16bit) out/romlayout.o
Building ld scripts
Version: ?-20140227_172433-zxm
Fixed space: 0xe05b-0x10000 total: 8101 slack: 11 Percent slack: 0.1%
16bit size: 39096
32bit segmented size: 1481
32bit flat size: 18816
32bit flat init size: 67392
Lowmem size: 2176
f-segment var size: 1759
Linking out/rom16.o
Stripping out/rom16.strip.o
Linking out/rom32seg.o
Stripping out/rom32seg.strip.o
Linking out/rom.o
Prepping out/bios.bin
Total size: 133500 Fixed: 61160 Free: 128644 (used 50.9% of 256KiB rom)
===========================================================================
your bios awaits....
===========================================================================
seabios.submodule/out/bios.bin
看到最后生成的结果了吧,会在seabios.submodule/out/中多出一个bios.bin文件,这个文件将用来替换KVM的系统Bios.bin文件
5)开始替换系统bios.bin文件
[root@zxm seaslic]# ls
patch.sh README.markdown seabios.patch seabios.submodule
[root@zxm seaslic]# cd seabios.submodule
[root@zxm seabios.submodule]# ls
COPYING Makefile README src tools
COPYING.LESSER out README.CSM TODO vgasrc
[root@zxm seabios.submodule]# cp out/bios.bin /usr/share/qemu-kvm/bios.bin
cp:是否覆盖"/usr/share/qemu-kvm/bios.bin"? y
6)最后开始配置KVM启动项参数,利用qemu-kvm的-acpitable选项添加一外部的bin文件,就是我们前面下载的压缩包,解压后会有各种型号对应的bin文件,可以复制一个到本目录下。然后利用virsh修改KVM的启动参数。
[root@zxm seabios.submodule]# virsh edit win2008
其中win2008就是我们建立的客户机的名称,打开后需要修改文件的头部信息,如下:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
另外再最后增加一个命令行参数节
</devices>
<qemu:commandline>
<qemu:arg value='-acpitable'/>
<qemu:arg value='file=/usr/share/qemu/Sony.BIN'/>
</qemu:commandline>
到此已经在KVM中配置完成,启动你的客户机,然后利用SLIC_toolkit工具检查,会发现你的SLIC信息已经获取成功,下面就是利用slgmgr.vbs 增加签名,以及写入注册号了,直接cmd进入命令行模式,然后还要找前面下载的OEM的bois信息及证书文件找到对应的型号下的证书文件进行注册
slmgr -ilc Sony.XRM-MS
接下来就是写入注册号了,自己找注册号吧!命令方式如下
slmgr -ipk D7TCH-6P8JP-KRG4P-VJKYY-P9GFF
至此已全部完成,重起客户机你会发现你的系统已出于激活状态了。剩下的就不用说了,各种也都能用了!
重要提示:win2008 企业版该方法无效。另可将bios.bin 直接覆盖原有的/usr/shared/sebios下的bios.bin即可