[7163] qemu: Add support for SMBIOS command line otions (Alex Williamson)
Revision: 7163
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7163 Author: aliguori Date: 2009-04-17 18:59:56 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
qemu: Add support for SMBIOS command line otions (Alex Williamson)
Create a new -smbios option (x86-only) to allow binary SMBIOS entries to be passed through to the BIOS or modify the default values of individual fields of type 0 and 1 entries on the command line.
Binary SMBIOS entries can be generated as follows:
dmidecode -t 1 -u | grep $'^\t\t[^"]' | xargs -n1 | \
perl -lne 'printf "%c", hex($_)' > smbios_type_1.binThese can then be passed to the BIOS using this switch:
-smbios file=smbios_type_1.bin
Command line generation supports the following syntax:
-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d] -smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]
[,uuid=$(uuidgen)][,sku=str][,family=str]
For instance, to add a serial number to the type 1 table:
-smbios type=1,serial=0123456789
Interface is extensible to support more fields/tables as needed.
aliguori: remove texi formatting from help output
Modified Paths:
--------------
trunk/Makefile.target
trunk/hw/pc.c
trunk/pc-bios/bios-pq/series
trunk/pc-bios/bios.bin
trunk/qemu-options.hx
trunk/vl.c
Added Paths:
-----------
trunk/hw/smbios.c
trunk/hw/smbios.h trunk/pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch
Modified: trunk/Makefile.target
===================================================================
Makefile.target +1 -1
@@ -576,7 +576,7 @@ OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o -OBJS += device-hotplug.o pci-hotplug.o +OBJS += device-hotplug.o pci-hotplug.o smbios.o CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE endif ifeq ($(TARGET_BASE_ARCH), ppc)
Modified: trunk/hw/pc.c
===================================================================
hw/pc.c +9 -0
@@ -37,6 +37,7 @@#include "virtio-balloon.h" #include "virtio-console.h" #include "hpet_emul.h" +#include "smbios.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS
@@ -51,6 +52,7 @@#define ACPI_DATA_SIZE 0x10000#define BIOS_CFG_IOPORT 0x510#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) +#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)#define MAX_IDE_BUS 2
@@ -425,6 +427,8 @@static void bochs_bios_init (void ) {void *fw_cfg; +uint8_t *smbios_table; +size_t smbios_len;register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL );register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL );
@@ -442,6 +446,11 @@fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , (uint64_t )ram_size);fw_cfg_add_bytes (fw_cfg,FW_CFG_ACPI_TABLES , (uint8_t *)acpi_tables, acpi_tables_len); + + smbios_table =smbios_get_table (&smbios_len); +if (smbios_table) +fw_cfg_add_bytes (fw_cfg,FW_CFG_SMBIOS_ENTRIES , + smbios_table, smbios_len); }/* Generate an initial boot sector which sets state and jump to
Added: trunk/hw/smbios.c
===================================================================
hw/smbios.c +224 -0
224 lines not on this page · raw message
Added: trunk/hw/smbios.h
===================================================================
hw/smbios.h +162 -0
162 lines not on this page · raw message
Added: trunk/pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch
===================================================================
pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch +470 -0
470 lines not on this page · raw message
Modified: trunk/pc-bios/bios-pq/series
===================================================================
pc-bios/bios-pq/series +1 -0
@@ -9,3 +9,4 @@ 0009_qemu-bios-pci-hotplug-support.patch 0010_bios-mark-the-acpi-sci-interrupt-as-connected-to-irq-9.patch 0011_read-additional-acpi-tables-from-a-vm.patch +0012-load-smbios-entries-and-files-from-qemu.patch
Modified: trunk/pc-bios/bios.bin
===================================================================
(Binary files differ)
Modified: trunk/qemu-options.hx
===================================================================
qemu-options.hx +21 -0
@@ -683,6 +683,27 @@ ETEXI #ifdef TARGET_I386 +DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, + "-smbios file=binary\n" + " Load SMBIOS entry from binary file\n" + "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%%d.%%d]\n" + " Specify SMBIOS type 0 fields\n" + "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n" + " [,uuid=uuid][,sku=str][,family=str]\n" + " Specify SMBIOS type 1 fields\n") +#endif +STEXI +@item -smbios file=@var{binary} +Load SMBIOS entry from binary file. + +@item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}] +Specify SMBIOS type 0 fields + +@item -smbios type=1[,manufacturer=@var{str}][,product=@var{str}][,version=@var{str}][,serial=@var{str}][,uuid=@var{uuid}][,sku=@var{str}][,family=@var{str}] +Specify SMBIOS type 1 fields +ETEXI + +#ifdef TARGET_I386 DEFHEADING() #endif STEXI
Modified: trunk/vl.c
===================================================================
vl.c +11 -0
@@ -138,6 +138,7 @@#include "hw/isa.h" #include "hw/baum.h" #include "hw/bt.h" +#include "hw/smbios.h" #include "bt-host.h" #include "net.h" #include "monitor.h"
@@ -4214,6 +4215,10 @@if (ret !=16 )return -1 ; +#ifdef TARGET_I386 +smbios_add_field (1 , offsetof(struct smbios_type_1 , uuid),16 , uuid); +#endif +return 0 ; }
@@ -4797,6 +4802,12 @@ exit(1); }break ; +case QEMU_OPTION_smbios: +if (smbios_entry_add (optarg) <0 ) { +fprintf (stderr,"Wrong smbios provided\n" ); +exit (1 ); + } +break ;#endif #ifdef USE_KQEMU case QEMU_OPTION_no_kqemu: