mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
adjust disk space usage for lite platform
This commit is contained in:
parent
6e528f9678
commit
30ca5dec71
4 changed files with 12 additions and 5 deletions
|
|
@ -18,7 +18,10 @@ pub const SPINOR_ERASE_SIZE: u32 = bao1x_api::offsets::baosec::SPINOR_ERASE_SIZE
|
|||
pub const SPINOR_BULK_ERASE_SIZE: u32 = bao1x_api::offsets::baosec::SPINOR_BULK_ERASE_SIZE;
|
||||
pub const SPINOR_LEN: u32 = bao1x_api::offsets::baosec::SPI_FLASH_LEN as _;
|
||||
pub const PDDB_LOC: u32 = bao1x_api::offsets::baosec::PDDB_ORIGIN as _;
|
||||
#[cfg(not(feature = "oem-baosec-lite"))]
|
||||
pub const PDDB_LEN: u32 = bao1x_api::offsets::baosec::PDDB_LEN as _;
|
||||
#[cfg(feature = "oem-baosec-lite")]
|
||||
pub const PDDB_LEN: u32 = 2560 * 1024; // 2.5MiB length
|
||||
|
||||
// Define the virtual region that memory-mapped FLASH should go to
|
||||
// top 8 megs are reserved for staging updates, backups, etc.
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ board-baosec = [
|
|||
"keystore/board-baosec",
|
||||
"aes/bao1x",
|
||||
] # USB form factor token
|
||||
oem-baosec-lite = []
|
||||
hosted-baosec = [
|
||||
"gen2",
|
||||
"bao1x-emu",
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ pub(crate) struct SpaceUpdate {
|
|||
// this checksum is "weak" but we are protecting against two scenarios:
|
||||
// 1. partially written SpaceUpdate record (so the last bytes or so are FF)
|
||||
// 2. a malicious attacker
|
||||
// In the case of (1), the occurence should be diminishingly small (expected to never happen, maybe
|
||||
// a very unstable system that's "blinking" power constantly would have it occure a few times)
|
||||
// In the case of (1), the occurrence should be diminishingly small (expected to never happen, maybe
|
||||
// a very unstable system that's "blinking" power constantly would have it occur a few times)
|
||||
// In the case of (2), an attacker has a chance of generating a collision, but the result is
|
||||
// also unlikely to generate a valid PhysAddr, and if it does, the consequence is some valid data
|
||||
// being treated as free space and getting erased (data loss, not disclosure).
|
||||
|
|
|
|||
|
|
@ -814,6 +814,7 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
}
|
||||
let modals = modals::Modals::new(&xns).expect("can't connect to Modals server");
|
||||
let fast_format = if cfg!(feature = "oem-baosec-lite") { true } else { false };
|
||||
match pddb_os.ensure_password() {
|
||||
PasswordState::Correct => {
|
||||
// The behavior in gen2 is mount-or-format: no user approval
|
||||
|
|
@ -821,7 +822,9 @@ fn wrapped_main() -> ! {
|
|||
// of data corruption but I think this is the "right" user experience
|
||||
if !try_mount(&mut pddb_os, &mut basis_cache, &mut basis_monitor_notifications) {
|
||||
log::warn!("PDDB not formatted - formatting the PDDB!");
|
||||
pddb_os.pddb_format(false, Some(&modals)).expect("couldn't format PDDB");
|
||||
pddb_os
|
||||
.pddb_format(fast_format, Some(&modals))
|
||||
.expect("couldn't format PDDB");
|
||||
if !try_mount(
|
||||
&mut pddb_os,
|
||||
&mut basis_cache,
|
||||
|
|
@ -833,7 +836,7 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
PasswordState::Uninit => {
|
||||
log::warn!("PDDB not formatted - formatting the PDDB!");
|
||||
pddb_os.pddb_format(false, Some(&modals)).expect("couldn't format PDDB");
|
||||
pddb_os.pddb_format(fast_format, Some(&modals)).expect("couldn't format PDDB");
|
||||
if !try_mount(&mut pddb_os, &mut basis_cache, &mut basis_monitor_notifications) {
|
||||
panic!("Couldn't format & mount PDDB");
|
||||
}
|
||||
|
|
@ -843,7 +846,7 @@ fn wrapped_main() -> ! {
|
|||
}
|
||||
PasswordState::Incorrect(_failcount) => {
|
||||
log::warn!("PDDB formatted, but keys rotated. Formatting PDDB!");
|
||||
pddb_os.pddb_format(false, Some(&modals)).expect("couldn't format PDDB");
|
||||
pddb_os.pddb_format(fast_format, Some(&modals)).expect("couldn't format PDDB");
|
||||
if !try_mount(&mut pddb_os, &mut basis_cache, &mut basis_monitor_notifications) {
|
||||
panic!("Couldn't format & mount PDDB");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue