On Mon, 25 Mar 2024 16:09:20 +0300 Michael Tokarev <m...@tls.msk.ru> wrote:
> When building qemu with smbios but not legacy mode (eg minimal microvm build), > link fails with: > > hw/i386/fw_cfg.c:74: undefined reference to `smbios_get_table_legacy' > > This is because fw_cfg interface can call this function if CONFIG_SMBIOS > is defined. Made this code block to depend on CONFIG_SMBIOS_LEGACY. > > Fixes: b42b0e4daaa5 "smbios: build legacy mode code only for 'pc' machine" > Signed-off-by: Michael Tokarev <m...@tls.msk.ru> hmh, it looks like MICROVM doesn't select SMBIOS nor FW_CFG_DMA which looks broken to me, does following help: diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index a6ee052f9a..54c77b5bcc 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -119,6 +119,8 @@ config MICROVM select PCI_EXPRESS_GENERIC_BRIDGE select USB_XHCI_SYSBUS select I8254 + select SMBIOS + select FW_CFG_DMA config X86_IOMMU bool > --- > hw/i386/fw_cfg.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c > index d802d2787f..d5e78a9183 100644 > --- a/hw/i386/fw_cfg.c > +++ b/hw/i386/fw_cfg.c > @@ -70,6 +70,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState > *fw_cfg, > /* tell smbios about cpuid version and features */ > smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); > > +#ifdef CONFIG_SMBIOS_LEGACY > if (pcmc->smbios_legacy_mode) { > smbios_tables = smbios_get_table_legacy(&smbios_tables_len, > &error_fatal); > @@ -77,6 +78,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState > *fw_cfg, > smbios_tables, smbios_tables_len); > return; > } > +#endif > > /* build the array of physical mem area from e820 table */ > mem_array = g_malloc0(sizeof(*mem_array) * e820_get_num_entries());