Skip to content

Instantly share code, notes, and snippets.

@smoser
Last active May 29, 2025 15:03
Show Gist options
  • Save smoser/290f74c256c89cb3f3bd434a27b9f64c to your computer and use it in GitHub Desktop.
Save smoser/290f74c256c89cb3f3bd434a27b9f64c to your computer and use it in GitHub Desktop.
qemu to linux mapping of smbios / dmi information

Mappings for DMI/SMBIOS to Linux and dmidecode

Information can be put into dmi tables via some qemu-system hosts (x86_64 and aarch64). That information is exposed in Linux under /sys/class/dmi/id and can be read with dmidecode. The names are very annoyingly inconsistent. The point of this doc is to map them.

See qemu-system-x86_64 --help for the fields that qemu will accept. qemu smbios flags vary with qemu version.

Mappings

Example qemu cmdline:

qemu-system-x86_64 -smbios type=<type>,field=value[,...]
qemu-system-x86_64 -smbios type=0,vendor=superco,version=1.2.3
type -smbios field Linux path dmidecode --string=F
0 vendor bios_vendor bios-vendor
0 date bios_date bios-release-date
0 version bios_version bios-version
0 release=(%d.%d) bios_release bios-revision
0 uefi=(on|off) n/a n/a
1 manufacturer sys_vendor system-manufacturer
1 product product_name system-product-name
1 version product_version system-version
1 serial product_serial system-serial-number
1 uuid product_uuid system-uuid
1 sku product_sku system-sku-number
1 family product_family system-family
2 manufacturer board_vendor baseboard-manufacturer
2 product board_name baseboard-product-name
2 version board_version baseboard-version
2 serial board_serial baseboard-serial-number
2 asset asset_tag baseboard-asset-tag
2 location n/a n/a
3 manufacturer chassis_vendor chassis-manufacturer
3 version chassis_version chassis-version
3 serial chassis_serial chassis-serial-number
3 asset chassis_asset_tag chassis-asset-tag
3 sku n/a n/a
4 sock_pfx n/a n/a
4 manufacturer n/a processor-manufacturer
4 version n/a processor-version
4 serial n/a n/a
4 asset n/a n/a
4 part n/a n/a
4 max-speed n/a n/a
4 current-speed n/a processor-frequency
11 value n/a --oem-string=N
17 loc_pfx n/a n/a
17 bank n/a n/a
17 manufacturer n/a n/a
17 serial n/a n/a
17 asset n/a n/a
17 part=(%d) n/a n/a
17 speed=(%d) n/a n/a

Notes

  • linux exposes these files in /sys/devices/virtual/dmi/id and /sys/class/dmi/id
  • go-smbios can be used to read OEM strings and other smbios info. More info on OEM string information linked from Bug 1753559

values in /sys/class/dmi/id

  • 6.14.7

    $ ( cd /sys/class/dmi/id && grep -r . *)
    bios_date:0date
    bios_release:0.0
    bios_vendor:0vendor
    bios_version:0version
    board_asset_tag:t2asset
    board_name:t2product
    board_serial:t2serial
    board_vendor:t2manufacturer
    board_version:t2version
    chassis_asset_tag:t3asset
    chassis_serial:t3serial
    chassis_type:1
    chassis_vendor:t3manufacturer
    chassis_version:t3version
    modalias:dmi:bvn0vendor:bvr0version:bd0date:br0.0:svnt1manufacturer:pnt1product:pvrt1version:rvnt2manufacturer:rnt2product:rvrt2version:cvnt3manufacturer:ct1:cvrt3version:skut1sku:
    power/runtime_active_time:0
    power/runtime_status:unsupported
    power/runtime_suspended_time:0
    power/control:auto
    product_family:t1family
    product_name:t1product
    product_serial:t1serial
    product_sku:t1sku
    product_uuid:11111111-1111-1111-1111-111111111111
    product_version:t1version
    sys_vendor:t1manufacturer
    uevent:MODALIAS=dmi:bvn0vendor:bvr0version:bd0date:br0.0:svnt1manufacturer:pnt1product:pvrt1version:rvnt2manufacturer:rnt2product:rvrt2version:cvnt3manufacturer:ct1:cvrt3version:skut1sku:
    
    $ dmidecode --version
    3.6
    
    $ for i in $(dmidecode --list-strings); do
        out=$(dmidecode --string=$i) && echo "$i: $out"; done
    bios-vendor: 0vendor
    bios-version: 0version
    bios-release-date: 0date
    bios-revision: 0.0
    firmware-revision:
    system-manufacturer: t1manufacturer
    system-product-name: t1product
    system-version: t1version
    system-serial-number: t1serial
    system-uuid: 11111111-1111-1111-1111-111111111111
    system-sku-number: t1sku
    system-family: t1family
    baseboard-manufacturer: t2manufacturer
    baseboard-product-name: t2product
    baseboard-version: t2version
    baseboard-serial-number: t2serial
    baseboard-asset-tag: t2asset
    chassis-manufacturer: t3manufacturer
    chassis-type: Other
    chassis-version: t3version
    chassis-serial-number: t3serial
    chassis-asset-tag: t3asset
    processor-family: Other
    processor-manufacturer: t4manufacturer
    processor-version: t4version
    processor-frequency: 4443 MHz
    
  • Cirros 0.6.3 (5.15.0-117-generic)

    bios_date:0date
    bios_release:0.0
    bios_vendor:0vendor
    bios_version:0version
    board_asset_tag:t2asset
    board_name:t2product
    board_serial:t2serial
    board_vendor:t2manufacturer
    board_version:t2version
    chassis_asset_tag:t3asset
    chassis_serial:t3serial
    chassis_type:1
    chassis_vendor:t3manufacturer
    chassis_version:t3version
    modalias:dmi:bvn0vendor:bvr0version:bd0date:br0.0:svnt1manufacturer:pnt1product:pvr:
    product_family:t1family
    product_name:t1product
    product_serial:t1serial
    product_sku:t1sku
    product_uuid:11111111-1111-1111-1111-111111111111
    product_version:t1version
    sys_vendor:t1manufacturer
    uevent:MODALIAS=dmi:bvn0vendor:bvr0version:bd0date:br0.0:svnt1manufacturer:pnt1prod:
    

qemu smbios flags

Below is the --help output of qemu-system-x86 wrt -smbios. See boot-guest file for actual values used

$ qemu-system-x86_64 --version
QEMU emulator version 10.0.2 (v10.0.2)

$ qemu-system-x86_64 --help | grep -A1 -- ^-smbios | sed 's,^--$,,'
-smbios file=binary
                load SMBIOS entry from binary file
-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]
              [,uefi=on|off]

-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]
              [,uuid=uuid][,sku=str][,family=str]

-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]
              [,asset=str][,location=str]

-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]
              [,sku=str]

-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]
              [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]

-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]
                specify SMBIOS type 8 fields
-smbios type=11[,value=str][,path=filename]
                specify SMBIOS type 11 fields
-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]
               [,asset=str][,part=str][,speed=%d]

-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]
                specify SMBIOS type 41 fields
#!/bin/bash
# download cirros image and boot it.
MEM=${MEM:-256}
ARCH="x86_64"
ver="0.6.3"
img_url="http://download.cirros-cloud.net/$ver/cirros-$ver-$ARCH-disk.img"
img_dist=${1:-${img_url##*/}}
if [ ! -f "$img_dist" ]; then
wget "$img_url" -O "$img_dist.tmp" &&
mv "$img_dist.tmp" "$img_dist"
fi
echo "$ARCH/$MEM [$img_dist]"
echo '{"instance-id": "9068aef2-213e-4e43-830f-accdbadde897"}' > meta-data
cat > user-data <<"EOF"
#!/bin/sh
uname -r
echo "===== BEGIN dmi/id data ====="
cd /sys/class/dmi/id
grep -r . * 2>/dev/null
echo "===== END dmi/id data ====="
poweroff
EOF
cloud-localds seed.img user-data meta-data ||
{ echo "cloud-localds failed"; exit 1; }
out=$(qemu-img create -fqcow2 -Fqcow2 -b"$img_dist" disk1.img) ||
{ echo "qemu-img create failed: $out"; exit 1; }
#shellcheck disable=SC2054
smbios=(
"-smbios" "type=0,vendor=0vendor,version=0version,date=0date,release=0.0,uefi=on"
"-smbios" "type=1,manufacturer=t1manufacturer,product=t1product,version=t1version,serial=t1serial,uuid=11111111-1111-1111-1111-111111111111,sku=t1sku,family=t1family"
"-smbios" "type=2,manufacturer=t2manufacturer,product=t2product,version=t2version,serial=t2serial,asset=t2asset,location=t2location"
"-smbios" "type=3,manufacturer=t3manufacturer,version=t3version,serial=t3serial,asset=t3asset,sku=t3sku"
"-smbios" "type=4,sock_pfx=t4sock_pfx,manufacturer=t4manufacturer,version=t4version,serial=t4serial,asset=t4asset,part=t4part,max-speed=4444,current-speed=4443"
# type=8 doesn't just take anything - boot hangs
# "-smbios" "type=8,external_reference=t8external_reference,internal_reference=t9internal_reference,connector_type=8888,port_type=8887"
"-smbios" "type=11,value=Hello,value=World",
"-smbios" "type=17,loc_pfx=t17loc_pfx,bank=t17bank,manufacturer=t17manufacturer,serial=t17serial,asset=t17asset,part=t17part,speed=171717"
# type=41 does not just take anything - boot hangs
# "-smbios", "type=41,designation=t41designation,kind=other,instance=4141,pcidev=t41pcidev"
)
set -x
qemu-system-x86_64 -m "$MEM" \
-device virtio-net-pci,netdev=net00 \
-netdev type=user,id=net00,net=10.0.12.0/24,host=10.0.12.2 \
-drive if=virtio,file=disk1.img \
-drive if=virtio,file=seed.img \
-nographic \
"${smbios[@]}"
@franferrax
Copy link

franferrax commented May 28, 2025

Hi @smoser,

type -smbios field Linux path dmidecode --string=F
1 sku n/a n/a
1 family product_family n/a

At least with Linux 6.14.6 and dmidecode v3.6, it looks like those are:

type -smbios field Linux path dmidecode --string=F
1 sku product_sku system-sku-number
1 family product_family system-family

@smoser
Copy link
Author

smoser commented May 29, 2025

At least with Linux 6.14.6 and dmidecode v3.6, it looks like those are:

Thanks, @franferrax . I updated the table and also fixed 'boot-guest' to actually work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment