@@ -35,6 +35,8 @@ pub enum DVerb {
3535 GenerateUpdateMetadata ( GenerateOpts ) ,
3636 #[ clap( name = "install" , about = "Install components" ) ]
3737 Install ( InstallOpts ) ,
38+ #[ clap( name = "extend-payload-to-esp" , about = "Extend bootloader payload with additional files" ) ]
39+ ExtendPayload ( ExtendPayloadOpts ) ,
3840}
3941
4042#[ derive( Debug , Parser ) ]
@@ -82,12 +84,36 @@ pub struct GenerateOpts {
8284 sysroot : Option < String > ,
8385}
8486
87+ #[ derive( Debug , Parser ) ]
88+ pub struct ExtendPayloadOpts {
89+ /// System root directory
90+ #[ clap( value_parser, default_value_t = String :: from( "/" ) ) ]
91+ sysroot : String ,
92+
93+ /// Source directory containing files to add
94+ #[ clap( value_parser) ]
95+ src_root : String ,
96+ }
97+
98+ #[ derive( Debug , Parser ) ]
99+ pub struct InstallToFilesystemOpts {
100+ #[ clap( long, default_value_t = String :: from( "/" ) , help = "Source root directory" ) ]
101+ src_root : String ,
102+
103+ #[ clap( long, help = "Destination root directory" ) ]
104+ dest_root : String ,
105+
106+ #[ clap( value_parser, help = "file relative path" ) ]
107+ file_path : String ,
108+ }
109+
85110impl DCommand {
86111 /// Run CLI application.
87112 pub fn run ( self ) -> Result < ( ) > {
88113 match self . cmd {
89114 DVerb :: Install ( opts) => Self :: run_install ( opts) ,
90115 DVerb :: GenerateUpdateMetadata ( opts) => Self :: run_generate_meta ( opts) ,
116+ DVerb :: ExtendPayload ( opts) => Self :: run_extend_payload ( opts) ,
91117 }
92118 }
93119
@@ -122,4 +148,16 @@ impl DCommand {
122148 . context ( "boot data installation failed" ) ?;
123149 Ok ( ( ) )
124150 }
151+
152+ pub ( crate ) fn run_extend_payload ( opts : ExtendPayloadOpts ) -> Result < ( ) > {
153+ let components = crate :: bootupd:: get_components ( ) ;
154+ for component in components. values ( ) {
155+ if let Some ( updated) = component. extend_payload ( & opts. sysroot , & opts. src_root ) ? {
156+ if updated {
157+ println ! ( "Extended payload for {} successfully" , component. name( ) ) ;
158+ }
159+ }
160+ }
161+ Ok ( ( ) )
162+ }
125163}
0 commit comments