File tree Expand file tree Collapse file tree 1 file changed +30
-16
lines changed Expand file tree Collapse file tree 1 file changed +30
-16
lines changed Original file line number Diff line number Diff line change @@ -231,23 +231,37 @@ mod binary {
231
231
. parse :: < Value > ( )
232
232
. expect ( "failed to parse kernel's Cargo.toml" ) ;
233
233
234
- let config_table = manifest
235
- . get ( "package" )
236
- . and_then ( |table| table. get ( "metadata" ) )
237
- . and_then ( |table| table. get ( "bootloader" ) )
238
- . cloned ( )
239
- . unwrap_or_else ( || toml:: Value :: Table ( toml:: map:: Map :: new ( ) ) ) ;
234
+ if manifest
235
+ . get ( "dependencies" )
236
+ . and_then ( |d| d. get ( "bootloader" ) )
237
+ . is_some ( )
238
+ {
239
+ // it seems to be the correct Cargo.toml
240
+ let config_table = manifest
241
+ . get ( "package" )
242
+ . and_then ( |table| table. get ( "metadata" ) )
243
+ . and_then ( |table| table. get ( "bootloader" ) )
244
+ . cloned ( )
245
+ . unwrap_or_else ( || toml:: Value :: Table ( toml:: map:: Map :: new ( ) ) ) ;
240
246
241
- config_table
242
- . try_into :: < Config > ( )
243
- . map ( |c| format ! ( "{:?}" , c) )
244
- . unwrap_or_else ( |err| {
245
- format ! (
246
- "compile_error!(\" failed to parse bootloader config in {}:\n \n {}\" )" ,
247
- path,
248
- err. to_string( ) . escape_default( ) ,
249
- )
250
- } )
247
+ config_table
248
+ . try_into :: < Config > ( )
249
+ . map ( |c| format ! ( "{:?}" , c) )
250
+ . unwrap_or_else ( |err| {
251
+ format ! (
252
+ "compile_error!(\" failed to parse bootloader config in {}:\n \n {}\" )" ,
253
+ path,
254
+ err. to_string( ) . escape_default( ) ,
255
+ )
256
+ } )
257
+ } else {
258
+ format ! (
259
+ "compile_error!(\" no bootloader dependency in {}\n \n The \
260
+ `--kernel-manifest` path should point to the `Cargo.toml` \
261
+ of the kernel.\" )",
262
+ path,
263
+ )
264
+ }
251
265
}
252
266
} ;
253
267
You can’t perform that action at this time.
0 commit comments