@@ -12,6 +12,10 @@ use toml::Value;
12
12
#[ derive( Debug , Clone ) ]
13
13
#[ non_exhaustive]
14
14
pub struct Config {
15
+ /// The command that is used for building the kernel for `cargo bootimage`.
16
+ ///
17
+ /// Defaults to `cargo build`.
18
+ pub build_command : Vec < String > ,
15
19
/// The run command that is invoked on `bootimage run` or `bootimage runner`
16
20
///
17
21
/// The substring "{}" will be replaced with the path to the bootable disk image.
@@ -75,6 +79,9 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
75
79
( "test-success-exit-code" , Value :: Integer ( exit_code) ) => {
76
80
config. test_success_exit_code = Some ( exit_code as i32 ) ;
77
81
}
82
+ ( "build-command" , Value :: Array ( array) ) => {
83
+ config. build_command = Some ( parse_string_array ( array, "build-command" ) ?) ;
84
+ }
78
85
( "run-command" , Value :: Array ( array) ) => {
79
86
config. run_command = Some ( parse_string_array ( array, "run-command" ) ?) ;
80
87
}
@@ -110,6 +117,7 @@ fn parse_string_array(array: Vec<Value>, prop_name: &str) -> Result<Vec<String>>
110
117
111
118
#[ derive( Default ) ]
112
119
struct ConfigBuilder {
120
+ build_command : Option < Vec < String > > ,
113
121
run_command : Option < Vec < String > > ,
114
122
run_args : Option < Vec < String > > ,
115
123
test_args : Option < Vec < String > > ,
@@ -120,6 +128,9 @@ struct ConfigBuilder {
120
128
impl Into < Config > for ConfigBuilder {
121
129
fn into ( self ) -> Config {
122
130
Config {
131
+ build_command : self
132
+ . build_command
133
+ . unwrap_or ( vec ! [ "cargo" . into( ) , "build" . into( ) ] ) ,
123
134
run_command : self . run_command . unwrap_or_else ( || {
124
135
vec ! [
125
136
"qemu-system-x86_64" . into( ) ,
0 commit comments