mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Bump MIN_NON_EMPTY_DTB_SIZE to 0x84
This commit is contained in:
@@ -143,14 +143,15 @@ fn print_node(node: &UnalignedNode) {
|
||||
|
||||
const DTB_MAGIC: &[u8] = b"\xd0\x0d\xfe\xed";
|
||||
|
||||
/// Minimum size of a valid, non-empty flattened device tree (72 bytes / 0x48).
|
||||
///
|
||||
/// A minimal DTB containing only an empty root node (`/`) with zero properties is
|
||||
/// exactly 72 bytes:
|
||||
/// - 40 bytes: Standard FDT header
|
||||
/// - 16 bytes: Empty memory reserve map (null terminator entry)
|
||||
/// - 16 bytes: Root node struct block (`BEGIN_NODE` + empty name `""` + `END_NODE` + `END`)
|
||||
const MIN_NON_EMPTY_DTB_SIZE: usize = 0x48;
|
||||
// Size of the flattened device tree produced by this source (132 bytes / 0x84).
|
||||
//
|
||||
// https://github.com/torvalds/linux/blob/master/drivers/of/empty_root.dts
|
||||
// - 40 bytes: standard FDT header
|
||||
// - 16 bytes: empty memory reserve map (null terminator entry)
|
||||
// - 48 bytes: root node structure block (BEGIN_NODE, empty name, two 32-bit
|
||||
// properties, END_NODE, FDT_END)
|
||||
// - 28 bytes: strings block (#address-cells and #size-cells, padded to 4 bytes)
|
||||
const MIN_NON_EMPTY_DTB_SIZE: usize = 0x84;
|
||||
|
||||
pub(crate) fn find_dtb_offset(buf: &[u8]) -> Option<usize> {
|
||||
let mut pos = 0;
|
||||
|
||||
Reference in New Issue
Block a user