1
1
//! Module for [`Builder`].
2
2
3
+ use crate :: apm:: ApmTag ;
4
+ use crate :: bootdev:: BootdevTag ;
5
+ use crate :: network:: NetworkTag ;
3
6
use crate :: {
4
7
BasicMemoryInfoTag , BootInformationHeader , BootLoaderNameTag , CommandLineTag ,
5
8
EFIBootServicesNotExitedTag , EFIImageHandle32Tag , EFIImageHandle64Tag , EFIMemoryMapTag ,
@@ -18,18 +21,18 @@ pub struct Builder {
18
21
bootloader : Option < Box < BootLoaderNameTag > > ,
19
22
modules : Vec < Box < ModuleTag > > ,
20
23
meminfo : Option < BasicMemoryInfoTag > ,
21
- // missing bootdev: Option<BootDevice>
24
+ bootdev : Option < BootdevTag > ,
22
25
mmap : Option < Box < MemoryMapTag > > ,
23
26
vbe : Option < VBEInfoTag > ,
24
27
framebuffer : Option < Box < FramebufferTag > > ,
25
28
elf_sections : Option < Box < ElfSectionsTag > > ,
26
- // missing apm:
29
+ apm : Option < ApmTag > ,
27
30
efi32 : Option < EFISdt32Tag > ,
28
31
efi64 : Option < EFISdt64Tag > ,
29
32
smbios : Vec < Box < SmbiosTag > > ,
30
33
rsdpv1 : Option < RsdpV1Tag > ,
31
34
rsdpv2 : Option < RsdpV2Tag > ,
32
- // missing: network
35
+ network : Option < Box < NetworkTag > > ,
33
36
efi_mmap : Option < Box < EFIMemoryMapTag > > ,
34
37
efi_bs : Option < EFIBootServicesNotExitedTag > ,
35
38
efi32_ih : Option < EFIImageHandle32Tag > ,
@@ -53,16 +56,19 @@ impl Builder {
53
56
bootloader : None ,
54
57
modules : vec ! [ ] ,
55
58
meminfo : None ,
59
+ bootdev : None ,
56
60
mmap : None ,
57
61
vbe : None ,
58
62
framebuffer : None ,
59
63
elf_sections : None ,
64
+ apm : None ,
60
65
efi32 : None ,
61
66
efi64 : None ,
62
67
smbios : vec ! [ ] ,
63
68
rsdpv1 : None ,
64
69
rsdpv2 : None ,
65
70
efi_mmap : None ,
71
+ network : None ,
66
72
efi_bs : None ,
67
73
efi32_ih : None ,
68
74
efi64_ih : None ,
@@ -99,6 +105,13 @@ impl Builder {
99
105
self
100
106
}
101
107
108
+ /// Sets the [`BootdevTag`] tag.
109
+ #[ must_use]
110
+ pub const fn bootdev ( mut self , bootdev : BootdevTag ) -> Self {
111
+ self . bootdev = Some ( bootdev) ;
112
+ self
113
+ }
114
+
102
115
/// Sets the [`MemoryMapTag`] tag.
103
116
#[ must_use]
104
117
pub fn mmap ( mut self , mmap : Box < MemoryMapTag > ) -> Self {
@@ -127,6 +140,13 @@ impl Builder {
127
140
self
128
141
}
129
142
143
+ /// Sets the [`ApmTag`] tag.
144
+ #[ must_use]
145
+ pub const fn apm ( mut self , apm : ApmTag ) -> Self {
146
+ self . apm = Some ( apm) ;
147
+ self
148
+ }
149
+
130
150
/// Sets the [`EFISdt32Tag`] tag.
131
151
#[ must_use]
132
152
pub const fn efi32 ( mut self , efi32 : EFISdt32Tag ) -> Self {
@@ -169,6 +189,13 @@ impl Builder {
169
189
self
170
190
}
171
191
192
+ /// Sets the [`NetworkTag`] tag.
193
+ #[ must_use]
194
+ pub fn network ( mut self , network : Box < NetworkTag > ) -> Self {
195
+ self . network = Some ( network) ;
196
+ self
197
+ }
198
+
172
199
/// Sets the [`EFIBootServicesNotExitedTag`] tag.
173
200
#[ must_use]
174
201
pub const fn efi_bs ( mut self , efi_bs : EFIBootServicesNotExitedTag ) -> Self {
@@ -226,6 +253,9 @@ impl Builder {
226
253
if let Some ( tag) = self . meminfo . as_ref ( ) {
227
254
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
228
255
}
256
+ if let Some ( tag) = self . bootdev . as_ref ( ) {
257
+ byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
258
+ }
229
259
if let Some ( tag) = self . mmap . as_ref ( ) {
230
260
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
231
261
}
@@ -238,6 +268,9 @@ impl Builder {
238
268
if let Some ( tag) = self . elf_sections . as_ref ( ) {
239
269
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
240
270
}
271
+ if let Some ( tag) = self . apm . as_ref ( ) {
272
+ byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
273
+ }
241
274
if let Some ( tag) = self . efi32 . as_ref ( ) {
242
275
byte_refs. push ( tag. as_bytes ( ) . as_ref ( ) ) ;
243
276
}
@@ -293,6 +326,7 @@ mod tests {
293
326
. add_module ( ModuleTag :: new ( 0x1000 , 0x2000 , "module 1" ) )
294
327
. add_module ( ModuleTag :: new ( 0x3000 , 0x4000 , "module 2" ) )
295
328
. meminfo ( BasicMemoryInfoTag :: new ( 0x4000 , 0x5000 ) )
329
+ . bootdev ( BootdevTag :: new ( 0x00 , 0x00 , 0x00 ) )
296
330
. mmap ( MemoryMapTag :: new ( & [ MemoryArea :: new (
297
331
0x1000000 ,
298
332
0x1000 ,
@@ -316,6 +350,7 @@ mod tests {
316
350
FramebufferType :: Text ,
317
351
) )
318
352
. elf_sections ( ElfSectionsTag :: new ( 0 , 32 , 0 , & [ ] ) )
353
+ . apm ( ApmTag :: new ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) )
319
354
. efi32 ( EFISdt32Tag :: new ( 0x1000 ) )
320
355
. efi64 ( EFISdt64Tag :: new ( 0x1000 ) )
321
356
. add_smbios ( SmbiosTag :: new ( 0 , 0 , & [ 1 , 2 , 3 ] ) )
@@ -326,6 +361,7 @@ mod tests {
326
361
MemoryDescriptor :: default ( ) ,
327
362
MemoryDescriptor :: default ( ) ,
328
363
] ) )
364
+ . network ( NetworkTag :: new ( & [ 0 ; 1500 ] ) )
329
365
. efi_bs ( EFIBootServicesNotExitedTag :: new ( ) )
330
366
. efi32_ih ( EFIImageHandle32Tag :: new ( 0x1000 ) )
331
367
. efi64_ih ( EFIImageHandle64Tag :: new ( 0x1000 ) )
0 commit comments