libfdt: Use zerocopy for safe fdt_header wrapper
Provide a way to get a safe &(mut) fdt_header from any <T: Libfdt(Mut)>.
Instead of manually doing the conversion from the BE-encoded DT fields,
use zerocopy to implement a zero-cost wrapper where each field has a
getter and setter function that transparently handles the endianness.
Combine those to remove the need for unsafe code in Fdt.
Test: m pvmfw
Test: atest liblibfdt.integration_test
Change-Id: I5ccaf49b48c13855d80ad386d41be3abbf3fdfe8
diff --git a/libs/libfdt/Android.bp b/libs/libfdt/Android.bp
index b5f7471..1bb5692 100644
--- a/libs/libfdt/Android.bp
+++ b/libs/libfdt/Android.bp
@@ -40,6 +40,7 @@
"libcstr",
"liblibfdt_bindgen",
"libmemoffset_nostd",
+ "libstatic_assertions",
"libzerocopy_nostd",
],
whole_static_libs: [