|
@@ -2,7 +2,7 @@
|
|
|
use crate::builder::traits::StructAsBytes;
|
|
|
use crate::{
|
|
|
BasicMemoryInfoTag, BootInformationInner, BootLoaderNameTag, CommandLineTag, EFISdt32,
|
|
|
- EFISdt64, ElfSectionsTag, EndTag, FramebufferTag, MemoryMapTag, ModuleTag,
|
|
|
+ EFISdt64, ElfSectionsTag, EndTag, FramebufferTag, MemoryMapTag, ModuleTag, SmbiosTag,
|
|
|
};
|
|
|
|
|
|
use alloc::boxed::Box;
|
|
@@ -23,6 +23,7 @@ pub struct Multiboot2InformationBuilder {
|
|
|
module_tags: Vec<Box<ModuleTag>>,
|
|
|
efisdt32: Option<EFISdt32>,
|
|
|
efisdt64: Option<EFISdt64>,
|
|
|
+ smbios_tags: Vec<Box<SmbiosTag>>,
|
|
|
}
|
|
|
|
|
|
impl Multiboot2InformationBuilder {
|
|
@@ -37,6 +38,7 @@ impl Multiboot2InformationBuilder {
|
|
|
framebuffer_tag: None,
|
|
|
memory_map_tag: None,
|
|
|
module_tags: Vec::new(),
|
|
|
+ smbios_tags: Vec::new(),
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -88,6 +90,9 @@ impl Multiboot2InformationBuilder {
|
|
|
for tag in &self.module_tags {
|
|
|
len += Self::size_or_up_aligned(tag.byte_size())
|
|
|
}
|
|
|
+ for tag in &self.smbios_tags {
|
|
|
+ len += Self::size_or_up_aligned(tag.byte_size())
|
|
|
+ }
|
|
|
// only here size_or_up_aligned is not important, because it is the last tag
|
|
|
len += size_of::<EndTag>();
|
|
|
len
|
|
@@ -145,6 +150,9 @@ impl Multiboot2InformationBuilder {
|
|
|
for tag in self.module_tags {
|
|
|
Self::build_add_bytes(&mut data, &tag.struct_as_bytes(), false)
|
|
|
}
|
|
|
+ for tag in self.smbios_tags {
|
|
|
+ Self::build_add_bytes(&mut data, &tag.struct_as_bytes(), false)
|
|
|
+ }
|
|
|
|
|
|
Self::build_add_bytes(&mut data, &EndTag::default().struct_as_bytes(), true);
|
|
|
|
|
@@ -186,6 +194,10 @@ impl Multiboot2InformationBuilder {
|
|
|
pub fn add_module_tag(&mut self, module_tag: Box<ModuleTag>) {
|
|
|
self.module_tags.push(module_tag);
|
|
|
}
|
|
|
+
|
|
|
+ pub fn add_smbios_tag(&mut self, smbios_tag: Box<SmbiosTag>) {
|
|
|
+ self.smbios_tags.push(smbios_tag);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#[cfg(test)]
|