22use crate :: builder:: traits:: StructAsBytes ;
33use crate :: {
44 BasicMemoryInfoTag , BootInformationInner , BootLoaderNameTag , CommandLineTag , EFISdt32 ,
5- EFISdt64 , ElfSectionsTag , EndTag , FramebufferTag , MemoryMapTag , ModuleTag ,
5+ EFISdt64 , ElfSectionsTag , EndTag , FramebufferTag , MemoryMapTag , ModuleTag , SmbiosTag ,
66} ;
77
88use alloc:: boxed:: Box ;
@@ -23,6 +23,7 @@ pub struct Multiboot2InformationBuilder {
2323 module_tags : Vec < Box < ModuleTag > > ,
2424 efisdt32 : Option < EFISdt32 > ,
2525 efisdt64 : Option < EFISdt64 > ,
26+ smbios_tags : Vec < Box < SmbiosTag > > ,
2627}
2728
2829impl Multiboot2InformationBuilder {
@@ -37,6 +38,7 @@ impl Multiboot2InformationBuilder {
3738 framebuffer_tag : None ,
3839 memory_map_tag : None ,
3940 module_tags : Vec :: new ( ) ,
41+ smbios_tags : Vec :: new ( ) ,
4042 }
4143 }
4244
@@ -88,6 +90,9 @@ impl Multiboot2InformationBuilder {
8890 for tag in & self . module_tags {
8991 len += Self :: size_or_up_aligned ( tag. byte_size ( ) )
9092 }
93+ for tag in & self . smbios_tags {
94+ len += Self :: size_or_up_aligned ( tag. byte_size ( ) )
95+ }
9196 // only here size_or_up_aligned is not important, because it is the last tag
9297 len += size_of :: < EndTag > ( ) ;
9398 len
@@ -145,6 +150,9 @@ impl Multiboot2InformationBuilder {
145150 for tag in self . module_tags {
146151 Self :: build_add_bytes ( & mut data, & tag. struct_as_bytes ( ) , false )
147152 }
153+ for tag in self . smbios_tags {
154+ Self :: build_add_bytes ( & mut data, & tag. struct_as_bytes ( ) , false )
155+ }
148156
149157 Self :: build_add_bytes ( & mut data, & EndTag :: default ( ) . struct_as_bytes ( ) , true ) ;
150158
@@ -186,6 +194,10 @@ impl Multiboot2InformationBuilder {
186194 pub fn add_module_tag ( & mut self , module_tag : Box < ModuleTag > ) {
187195 self . module_tags . push ( module_tag) ;
188196 }
197+
198+ pub fn add_smbios_tag ( & mut self , smbios_tag : Box < SmbiosTag > ) {
199+ self . smbios_tags . push ( smbios_tag) ;
200+ }
189201}
190202
191203#[ cfg( test) ]
0 commit comments