@@ -12,6 +12,10 @@ use toml::Value;
1212#[ derive( Debug , Clone ) ]
1313#[ non_exhaustive]
1414pub 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 > ,
1519 /// The run command that is invoked on `bootimage run` or `bootimage runner`
1620 ///
1721 /// 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> {
7579 ( "test-success-exit-code" , Value :: Integer ( exit_code) ) => {
7680 config. test_success_exit_code = Some ( exit_code as i32 ) ;
7781 }
82+ ( "build-command" , Value :: Array ( array) ) => {
83+ config. build_command = Some ( parse_string_array ( array, "build-command" ) ?) ;
84+ }
7885 ( "run-command" , Value :: Array ( array) ) => {
7986 config. run_command = Some ( parse_string_array ( array, "run-command" ) ?) ;
8087 }
@@ -110,6 +117,7 @@ fn parse_string_array(array: Vec<Value>, prop_name: &str) -> Result<Vec<String>>
110117
111118#[ derive( Default ) ]
112119struct ConfigBuilder {
120+ build_command : Option < Vec < String > > ,
113121 run_command : Option < Vec < String > > ,
114122 run_args : Option < Vec < String > > ,
115123 test_args : Option < Vec < String > > ,
@@ -120,6 +128,9 @@ struct ConfigBuilder {
120128impl Into < Config > for ConfigBuilder {
121129 fn into ( self ) -> Config {
122130 Config {
131+ build_command : self
132+ . build_command
133+ . unwrap_or ( vec ! [ "cargo" . into( ) , "build" . into( ) ] ) ,
123134 run_command : self . run_command . unwrap_or_else ( || {
124135 vec ! [
125136 "qemu-system-x86_64" . into( ) ,
0 commit comments