@@ -3,13 +3,13 @@ use std::{
33 path:: Path ,
44} ;
55
6- use anyhow:: { bail , ensure, Result } ;
6+ use anyhow:: { ensure, Result } ;
77
88use composefs:: { fsverity:: FsVerityHashValue , repository:: Repository } ;
99
1010use crate :: {
1111 bootloader:: { read_file, BootEntry , Type1Entry , Type2Entry } ,
12- cmdline:: get_cmdline_value ,
12+ cmdline:: get_cmdline_composefs ,
1313 uki,
1414} ;
1515
@@ -18,6 +18,7 @@ pub fn write_t1_simple<ObjectID: FsVerityHashValue>(
1818 bootdir : & Path ,
1919 boot_subdir : Option < & str > ,
2020 root_id : & ObjectID ,
21+ insecure : bool ,
2122 cmdline_extra : & [ & str ] ,
2223 repo : & Repository < ObjectID > ,
2324) -> Result < ( ) > {
@@ -29,7 +30,7 @@ pub fn write_t1_simple<ObjectID: FsVerityHashValue>(
2930 } ;
3031
3132 t1. entry
32- . adjust_cmdline ( Some ( & root_id. to_hex ( ) ) , cmdline_extra) ;
33+ . adjust_cmdline ( Some ( & root_id. to_hex ( ) ) , insecure , cmdline_extra) ;
3334
3435 // Write the content before we write the loader entry
3536 for ( filename, file) in & t1. files {
@@ -59,13 +60,11 @@ pub fn write_t2_simple<ObjectID: FsVerityHashValue>(
5960 create_dir_all ( & efi_linux) ?;
6061 let filename = efi_linux. join ( t2. filename . as_ref ( ) ) ;
6162 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+
6665 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:? })"
6968 ) ;
7069 write ( filename, content) ?;
7170 Ok ( ( ) )
@@ -99,10 +98,12 @@ pub fn write_t2_simple<ObjectID: FsVerityHashValue>(
9998/// * entry_id - In case of a BLS entry, the name of file to be generated in `loader/entries`
10099/// * cmdline_extra - Extra kernel command line arguments
101100///
101+ #[ allow( clippy:: too_many_arguments) ]
102102pub fn write_boot_simple < ObjectID : FsVerityHashValue > (
103103 repo : & Repository < ObjectID > ,
104104 entry : BootEntry < ObjectID > ,
105105 root_id : & ObjectID ,
106+ insecure : bool ,
106107 boot_partition : & Path ,
107108 boot_subdir : Option < & str > ,
108109 entry_id : Option < & str > ,
@@ -118,6 +119,7 @@ pub fn write_boot_simple<ObjectID: FsVerityHashValue>(
118119 boot_partition,
119120 boot_subdir,
120121 root_id,
122+ insecure,
121123 cmdline_extra,
122124 repo,
123125 ) ?;
@@ -140,6 +142,7 @@ pub fn write_boot_simple<ObjectID: FsVerityHashValue>(
140142 boot_partition,
141143 boot_subdir,
142144 root_id,
145+ insecure,
143146 cmdline_extra,
144147 repo,
145148 ) ?;
0 commit comments