runtime: make a copy of startup/idle kernel firmware before loading.

Fixes #716.
This commit is contained in:
whitequark 2017-04-21 16:46:40 +00:00
parent 726ee7370a
commit b913d1d6f2
1 changed files with 5 additions and 1 deletions

View File

@ -618,7 +618,11 @@ fn flash_kernel_worker(io: &Io,
config::read(config_key, |result| {
match result {
Ok(kernel) if kernel.len() > 0 => unsafe { kern_load(io, &mut session, &kernel) },
Ok(kernel) if kernel.len() > 0 => unsafe {
// kernel CPU cannot access the SPI flash address space directly,
// so make a copy.
kern_load(io, &mut session, Vec::from(kernel).as_ref())
},
_ => Err(io::Error::new(io::ErrorKind::NotFound, "kernel not found")),
}
})?;