build: support partition sizes in kb
This commit is contained in:
4
build.rs
4
build.rs
@@ -237,7 +237,7 @@ fn write_sim_data() {
|
||||
}
|
||||
|
||||
if unified_fd.metadata().unwrap().len() as usize >= data_size {
|
||||
// FIXME: Need to implement data resampling
|
||||
// FIXME: Need to implement automatic data resampling
|
||||
panic!("Simulation data is too big! Cannot fit {:#x} bytes into a partition with a size of {data_size:#x} bytes.", unified_fd.metadata().unwrap().len());
|
||||
}
|
||||
|
||||
@@ -252,6 +252,8 @@ fn parse_partition_number(n: &str) -> Option<usize> {
|
||||
Some(usize::from_str_radix(hex_offset, 16).unwrap())
|
||||
} else if let Some(mb_offset) = n.strip_suffix("M") {
|
||||
Some(mb_offset.parse::<usize>().unwrap() * 1024 * 1024)
|
||||
} else if let Some(kb_offset) = n.strip_suffix("K") {
|
||||
Some(kb_offset.parse::<usize>().unwrap() * 1024)
|
||||
} else {
|
||||
Some(n.parse().unwrap())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user