From b04dcc21ef1de4b63cacbcfd9b31783ccb57676b Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 3 Nov 2022 21:04:14 +0800 Subject: [PATCH] add `smalldb` flag, which builds a PDDB with a size of 4MiB do not interchange this on devices with the full sized PDDB, you may corrupt the database --- services/pddb/Cargo.toml | 2 ++ services/pddb/src/api.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/pddb/Cargo.toml b/services/pddb/Cargo.toml index b09406dd8..cc18888b4 100644 --- a/services/pddb/Cargo.toml +++ b/services/pddb/Cargo.toml @@ -88,4 +88,6 @@ hwtest = [] # routines to help with performance profiling of the PDDB in hosted mode pddb-flamegraph = ["hex"] perfcounter = ["perflib"] +# make the PDDB very small (4MiB). Note that booting a device with an incompatible `smalldb` setting will break the PDDB image. Use with caution. +smalldb = [] default = ["mbbb"] diff --git a/services/pddb/src/api.rs b/services/pddb/src/api.rs index 8ac62125d..f78ef71c9 100644 --- a/services/pddb/src/api.rs +++ b/services/pddb/src/api.rs @@ -43,10 +43,10 @@ pub(crate) const PDDB_VERSION: u32 = 0x00_00_02_01; #[allow(dead_code)] // PDDB_A_LEN may be shorter than xous::PDDB_LEN, to speed up testing. #[allow(dead_code)] -#[cfg(not(any(feature="pddbtest",feature="autobasis",feature="ci")))] +#[cfg(not(any(feature="pddbtest",feature="autobasis",feature="ci",feature="smalldb")))] pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize; #[allow(dead_code)] -#[cfg(any(feature="pddbtest",feature="autobasis",feature="ci"))] +#[cfg(any(feature="pddbtest",feature="autobasis",feature="ci",feature="smalldb"))] pub const PDDB_A_LEN: usize = 4 * 1024 * 1024; /// range for the starting point of a journal number, picked from a random seed