Disable ramdump with debug policy
This CL disables ramdump if debug policy doesn't explicitly
enables ramdump via ramdump prop in the /avf/guest/common node.
The virtualization service always provides crashkernel=17M via
kernel command, so this CL removes crashkernel=17MB in the
microdroid's bootargs in the /chosen node.
Here's the test result on my machine with MicrodroidTestApp.
- Before the CL (or this CL + ramdump is enabled)
$ adb shell /proc/meminfo
MemTotal: 212968 kB
MemFree: 138336 kB
MemAvailable: 171980 kB
- With this CL + ramdump is disabled
$ adb shell /proc/meminfo
MemTotal: 230372 kB
MemFree: 165240 kB
MemAvailable: 192648 kB
Bug: 243630590
Test: Boot microdroid with following AVF debug policies \
- AVF debug policy exists, and ramdump=<1> \
- AVF debug policy exists, and ramdump=<0> \
- No AVF debug policy
Change-Id: Ia486448b5513c2d5662a4f16ddb3334b20913329
diff --git a/libs/libfdt/src/lib.rs b/libs/libfdt/src/lib.rs
index 8fd1879..29d7abe 100644
--- a/libs/libfdt/src/lib.rs
+++ b/libs/libfdt/src/lib.rs
@@ -388,6 +388,23 @@
fdt_err_expect_zero(ret)
}
+ /// Create or change a property name-value pair to the given node.
+ pub fn setprop(&mut self, name: &CStr, value: &[u8]) -> Result<()> {
+ // SAFETY - New value size is constrained to the DT totalsize
+ // (validated by underlying libfdt).
+ let ret = unsafe {
+ libfdt_bindgen::fdt_setprop(
+ self.fdt.as_mut_ptr(),
+ self.offset,
+ name.as_ptr(),
+ value.as_ptr().cast::<c_void>(),
+ value.len().try_into().map_err(|_| FdtError::BadValue)?,
+ )
+ };
+
+ fdt_err_expect_zero(ret)
+ }
+
/// Get reference to the containing device tree.
pub fn fdt(&mut self) -> &mut Fdt {
self.fdt