Update littlefs including shrinking and block count check flag

This commit is contained in:
Sosthène Guédon
2025-05-12 17:44:44 +02:00
committed by sosthene-nitrokey
parent 55d0f97434
commit 1cfd35c997
4 changed files with 3 additions and 30 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
[submodule "littlefs"]
path = littlefs
url = https://github.com/ARMmbed/littlefs
url = https://github.com/trussed-dev/littlefs
-2
View File
@@ -19,5 +19,3 @@ trace = []
malloc = []
software-intrinsics = []
multiversion = []
unstable-disable-block-count-check = []
+1 -26
View File
@@ -1,6 +1,5 @@
use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
@@ -23,30 +22,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.expect("Failed to write lfs.h");
// maybe patch lfs.c to remove the mount check for the block count
println!("cargo::rerun-if-changed=littlefs/lfs.c");
let out_lfs_c = out_path.join("lfs.c");
if cfg!(feature = "unstable-disable-block-count-check") {
println!("cargo::rerun-if-changed=remove-mount-check.patch");
assert!(
Command::new("patch")
.args([
"littlefs/lfs.c",
"-o",
out_lfs_c.to_str().unwrap(),
"remove-mount-check.patch"
])
.spawn()
.unwrap()
.wait()
.unwrap()
.success(),
"Failed to apply patch"
)
} else {
std::fs::copy("littlefs/lfs.c", out_path.join("lfs.c")).unwrap();
}
let mut builder = cc::Build::new();
let builder = builder
.flag("-std=c99")
@@ -55,7 +30,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.flag("-DLFS_NO_ERROR")
.include(&out_path)
.include("littlefs")
.file(out_lfs_c)
.file("littlefs/lfs.c")
.file("littlefs/lfs_util.c")
.file("string.c");