@@ -3,13 +3,13 @@ use std::{
3
3
path:: Path ,
4
4
} ;
5
5
6
- use anyhow:: { bail , ensure, Result } ;
6
+ use anyhow:: { ensure, Result } ;
7
7
8
8
use composefs:: { fsverity:: FsVerityHashValue , repository:: Repository } ;
9
9
10
10
use crate :: {
11
11
bootloader:: { read_file, BootEntry , Type1Entry , Type2Entry } ,
12
- cmdline:: get_cmdline_value ,
12
+ cmdline:: get_cmdline_composefs ,
13
13
uki,
14
14
} ;
15
15
@@ -18,6 +18,7 @@ pub fn write_t1_simple<ObjectID: FsVerityHashValue>(
18
18
bootdir : & Path ,
19
19
boot_subdir : Option < & str > ,
20
20
root_id : & ObjectID ,
21
+ insecure : bool ,
21
22
cmdline_extra : & [ & str ] ,
22
23
repo : & Repository < ObjectID > ,
23
24
) -> Result < ( ) > {
@@ -29,7 +30,7 @@ pub fn write_t1_simple<ObjectID: FsVerityHashValue>(
29
30
} ;
30
31
31
32
t1. entry
32
- . adjust_cmdline ( Some ( & root_id. to_hex ( ) ) , cmdline_extra) ;
33
+ . adjust_cmdline ( Some ( & root_id. to_hex ( ) ) , insecure , cmdline_extra) ;
33
34
34
35
// Write the content before we write the loader entry
35
36
for ( filename, file) in & t1. files {
@@ -59,13 +60,11 @@ pub fn write_t2_simple<ObjectID: FsVerityHashValue>(
59
60
create_dir_all ( & efi_linux) ?;
60
61
let filename = efi_linux. join ( t2. filename . as_ref ( ) ) ;
61
62
let content = read_file ( & t2. file , repo) ?;
62
- let Some ( composefs) = get_cmdline_value ( uki:: get_cmdline ( & content) ?, "composefs=" ) else {
63
- bail ! ( "The UKI is missing a composefs= commandline parameter" ) ;
64
- } ;
65
- let expected = root_id. to_hex ( ) ;
63
+ let ( composefs, _) = get_cmdline_composefs :: < ObjectID > ( uki:: get_cmdline ( & content) ?) ?;
64
+
66
65
ensure ! (
67
- composefs == expected ,
68
- "The UKI has the wrong composefs= parameter (is '{composefs}', should be {expected })"
66
+ & composefs == root_id ,
67
+ "The UKI has the wrong composefs= parameter (is '{composefs:? }', should be {root_id:? })"
69
68
) ;
70
69
write ( filename, content) ?;
71
70
Ok ( ( ) )
@@ -99,10 +98,12 @@ pub fn write_t2_simple<ObjectID: FsVerityHashValue>(
99
98
/// * entry_id - In case of a BLS entry, the name of file to be generated in `loader/entries`
100
99
/// * cmdline_extra - Extra kernel command line arguments
101
100
///
101
+ #[ allow( clippy:: too_many_arguments) ]
102
102
pub fn write_boot_simple < ObjectID : FsVerityHashValue > (
103
103
repo : & Repository < ObjectID > ,
104
104
entry : BootEntry < ObjectID > ,
105
105
root_id : & ObjectID ,
106
+ insecure : bool ,
106
107
boot_partition : & Path ,
107
108
boot_subdir : Option < & str > ,
108
109
entry_id : Option < & str > ,
@@ -118,6 +119,7 @@ pub fn write_boot_simple<ObjectID: FsVerityHashValue>(
118
119
boot_partition,
119
120
boot_subdir,
120
121
root_id,
122
+ insecure,
121
123
cmdline_extra,
122
124
repo,
123
125
) ?;
@@ -140,6 +142,7 @@ pub fn write_boot_simple<ObjectID: FsVerityHashValue>(
140
142
boot_partition,
141
143
boot_subdir,
142
144
root_id,
145
+ insecure,
143
146
cmdline_extra,
144
147
repo,
145
148
) ?;
0 commit comments