1
1
//! Module for [`Builder`].
2
2
3
3
use crate :: apm:: ApmTag ;
4
+ use crate :: bootdev:: BootdevTag ;
4
5
use crate :: {
5
6
BasicMemoryInfoTag , BootInformationHeader , BootLoaderNameTag , CommandLineTag ,
6
7
EFIBootServicesNotExitedTag , EFIImageHandle32Tag , EFIImageHandle64Tag , EFIMemoryMapTag ,
@@ -19,7 +20,7 @@ pub struct Builder {
19
20
bootloader : Option < Box < BootLoaderNameTag > > ,
20
21
modules : Vec < Box < ModuleTag > > ,
21
22
meminfo : Option < BasicMemoryInfoTag > ,
22
- // missing bootdev: Option<BootDevice>
23
+ bootdev : Option < BootdevTag > ,
23
24
mmap : Option < Box < MemoryMapTag > > ,
24
25
vbe : Option < VBEInfoTag > ,
25
26
framebuffer : Option < Box < FramebufferTag > > ,
@@ -54,6 +55,7 @@ impl Builder {
54
55
bootloader : None ,
55
56
modules : vec ! [ ] ,
56
57
meminfo : None ,
58
+ bootdev : None ,
57
59
mmap : None ,
58
60
vbe : None ,
59
61
framebuffer : None ,
@@ -101,6 +103,13 @@ impl Builder {
101
103
self
102
104
}
103
105
106
+ /// Sets the [`BootdevTag`] tag.
107
+ #[ must_use]
108
+ pub fn bootdev ( mut self , bootdev : BootdevTag ) -> Self {
109
+ self . bootdev = Some ( bootdev) ;
110
+ self
111
+ }
112
+
104
113
/// Sets the [`MemoryMapTag`] tag.
105
114
#[ must_use]
106
115
pub fn mmap ( mut self , mmap : Box < MemoryMapTag > ) -> Self {
@@ -223,9 +232,6 @@ impl Builder {
223
232
pub fn build ( self ) -> Box < DynSizedStructure < BootInformationHeader > > {
224
233
let header = BootInformationHeader :: new ( 0 ) ;
225
234
let mut byte_refs = Vec :: new ( ) ;
226
- if let Some ( tag) = self . apm . as_ref ( ) {
227
- byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
228
- }
229
235
if let Some ( tag) = self . cmdline . as_ref ( ) {
230
236
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
231
237
}
@@ -238,6 +244,9 @@ impl Builder {
238
244
if let Some ( tag) = self . meminfo . as_ref ( ) {
239
245
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
240
246
}
247
+ if let Some ( tag) = self . bootdev . as_ref ( ) {
248
+ byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
249
+ }
241
250
if let Some ( tag) = self . mmap . as_ref ( ) {
242
251
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
243
252
}
@@ -308,6 +317,7 @@ mod tests {
308
317
. add_module ( ModuleTag :: new ( 0x1000 , 0x2000 , "module 1" ) )
309
318
. add_module ( ModuleTag :: new ( 0x3000 , 0x4000 , "module 2" ) )
310
319
. meminfo ( BasicMemoryInfoTag :: new ( 0x4000 , 0x5000 ) )
320
+ . bootdev ( BootdevTag :: new ( 0x00 , 0x00 , 0x00 ) )
311
321
. mmap ( MemoryMapTag :: new ( & [ MemoryArea :: new (
312
322
0x1000000 ,
313
323
0x1000 ,
@@ -331,6 +341,7 @@ mod tests {
331
341
FramebufferType :: Text ,
332
342
) )
333
343
. elf_sections ( ElfSectionsTag :: new ( 0 , 32 , 0 , & [ ] ) )
344
+ . apm ( ApmTag :: new ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) )
334
345
. efi32 ( EFISdt32Tag :: new ( 0x1000 ) )
335
346
. efi64 ( EFISdt64Tag :: new ( 0x1000 ) )
336
347
. add_smbios ( SmbiosTag :: new ( 0 , 0 , & [ 1 , 2 , 3 ] ) )
@@ -341,6 +352,7 @@ mod tests {
341
352
MemoryDescriptor :: default ( ) ,
342
353
MemoryDescriptor :: default ( ) ,
343
354
] ) )
355
+ . network ( NetworkTag :: new ( & [ 0 ; 1500 ] ) )
344
356
. efi_bs ( EFIBootServicesNotExitedTag :: new ( ) )
345
357
. efi32_ih ( EFIImageHandle32Tag :: new ( 0x1000 ) )
346
358
. efi64_ih ( EFIImageHandle64Tag :: new ( 0x1000 ) )
0 commit comments