From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 9B472905D1
 for <pve-devel@lists.proxmox.com>; Thu, 30 Mar 2023 13:01:39 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 857BA1B055
 for <pve-devel@lists.proxmox.com>; Thu, 30 Mar 2023 13:01:39 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu, 30 Mar 2023 13:01:37 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9CB5D41942
 for <pve-devel@lists.proxmox.com>; Thu, 30 Mar 2023 13:01:37 +0200 (CEST)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu, 30 Mar 2023 13:01:34 +0200
Message-Id: <20230330110134.322162-1-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.051 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [groups.io, dmtf.org, proxmox.com]
Subject: [pve-devel] [PATCH v2 edk2-firmware] fix #4625: restore SMBIOS type
 0 table defaults
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 30 Mar 2023 11:01:39 -0000

Commit 4cb94f20b0 ("OvmfPkg/SmbiosPlatformDxe: use PcdFirmware*") in
the edk2 submodule made the switch from hard coded values for the
SMBIOS type 0 table to using those defined in the PCD (Platform
Configuration Database). But this changed the value for the vendor
from "EFI Development Kit II / OVMF" to "EDK II" and made version and
release date "unknown". This can cause problems for hardware keys[0],
and the missing date can make Windows unhappy[1].

The PCD information can be specified during build. For the vendor,
just revert to the hardcoded value from before. This should be enough
to resolve the issue in [0]. For version and date, use sensible values
gathered from the build variables. The date format is mm/dd/yyyy while
the version is free-form according to [2], section 7.1.

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=4625
[1]: https://edk2.groups.io/g/devel/message/100922
[2]: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.2.0.pdf

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes from v1:
    Based on the discussion in [3] and the fact that the user from bug
    #4625 reportet that it's enough to keep the vendor the same:
    * Add trailing null character to strings, just to be sure.
    * Set version and date to sensible values generated during build.
      This was the intention behind commit 4cb94f20b0 in the first
      place.

[3]: https://edk2.groups.io/g/devel/message/102164

 debian/rules | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/debian/rules b/debian/rules
index acd304d..43fa34e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,6 +37,12 @@ OVMF32_4M_SMM_FLAGS =  $(OVMF32_4M_FLAGS) -DSMM_REQUIRE=TRUE
 AAVMF_FLAGS  = $(COMMON_FLAGS) -DTPM2_CONFIG_ENABLE=TRUE
 AAVMF_FLAGS += -DCAVIUM_ERRATUM_27456=TRUE
 
+PCD_RELEASE_DATE = $(shell date -d@$(SOURCE_DATE_EPOCH) +%m/%d/%Y)
+
+PCD_OPTIONS  = --pcd PcdFirmwareVendor=L"EFI Development Kit II / OVMF\\0"
+PCD_OPTIONS += --pcd PcdFirmwareVersionString=L"$(DEB_VERSION_UPSTREAM_REVISION)\\0"
+PCD_OPTIONS += --pcd PcdFirmwareReleaseDateString=L"$(PCD_RELEASE_DATE)\\0"
+
 # Clear variables used internally by the edk2 build system
 undefine WORKSPACE
 undefine ECP_SOURCE
@@ -89,6 +95,7 @@ $(OVMF32_BINARIES) $(OVMF32_IMAGES): debian/setup-build-stamp
 		build -a IA32 \
 			-t $(EDK2_TOOLCHAIN) \
 			-p OvmfPkg/OvmfPkgIa32.dsc \
+			$(PCD_OPTIONS) \
 			$(OVMF32_4M_SMM_FLAGS) -b $(BUILD_TYPE)
 	cp $(OVMF32_BUILD_DIR)/FV/OVMF_CODE.fd \
 		$(OVMF32_INSTALL_DIR)/OVMF32_CODE_4M.secboot.fd
@@ -103,6 +110,7 @@ $(OVMF_BINARIES) $(OVMF_IMAGES): debian/setup-build-stamp
 		build -a X64 \
 			-t $(EDK2_TOOLCHAIN) \
 			-p OvmfPkg/OvmfPkgX64.dsc \
+			$(PCD_OPTIONS) \
 			$(OVMF_2M_FLAGS) -b $(BUILD_TYPE)
 	cp $(OVMF_BUILD_DIR)/FV/OVMF_CODE.fd \
 		$(OVMF_BUILD_DIR)/FV/OVMF.fd $(OVMF_INSTALL_DIR)/
@@ -112,6 +120,7 @@ $(OVMF_BINARIES) $(OVMF_IMAGES): debian/setup-build-stamp
 		build -a IA32 -a X64 \
 			-t $(EDK2_TOOLCHAIN) \
 			-p OvmfPkg/OvmfPkgIa32X64.dsc \
+			$(PCD_OPTIONS) \
 			$(OVMF_4M_FLAGS) -b $(BUILD_TYPE)
 	cp $(OVMF3264_BUILD_DIR)/FV/OVMF_CODE.fd \
 		$(OVMF_INSTALL_DIR)/OVMF_CODE_4M.fd
@@ -122,6 +131,7 @@ $(OVMF_BINARIES) $(OVMF_IMAGES): debian/setup-build-stamp
 		build -a X64 \
 			-t $(EDK2_TOOLCHAIN) \
 			-p OvmfPkg/OvmfPkgX64.dsc \
+			$(PCD_OPTIONS) \
 			$(OVMF_2M_SMM_FLAGS) -b $(BUILD_TYPE)
 	cp $(OVMF_BUILD_DIR)/FV/OVMF_CODE.fd \
 		$(OVMF_INSTALL_DIR)/OVMF_CODE.secboot.fd
@@ -130,6 +140,7 @@ $(OVMF_BINARIES) $(OVMF_IMAGES): debian/setup-build-stamp
 		build -a IA32 -a X64 \
 			-t $(EDK2_TOOLCHAIN) \
 			-p OvmfPkg/OvmfPkgIa32X64.dsc \
+			$(PCD_OPTIONS) \
 			$(OVMF_4M_SMM_FLAGS) -b $(BUILD_TYPE)
 	cp $(OVMF3264_BUILD_DIR)/FV/OVMF_CODE.fd \
 		$(OVMF_INSTALL_DIR)/OVMF_CODE_4M.secboot.fd
-- 
2.30.2