pub struct HeaderV3 {
pub kernel_size: u32,
pub ramdisk_size: u32,
pub osversionpatch: OsVersionPatch,
pub cmdline: Box<[u8; 1536]>,
pub v4_signature_size: Option<u32>,
}Expand description
Standard Android boot image header versions 3 and 4
The page size is always 4096 bytes.
§Section layout in the image
Sections after the header are marked by fields of the form *_size, and are stored
consecutively, padded to page size.
┌───────────────────────┐
│boot image header │
│+ padding to page size │
├───────────────────────┤
│kernel │
│+ padding to page size │
├───────────────────────┤
│ramdisk │
│+ padding to page size │
├───────────────────────┤
│boot signature (v4) │
│+ padding to page size │
└───────────────────────┘Fields§
§kernel_size: u32Kernel size
ramdisk_size: u32Ramdisk size
osversionpatch: OsVersionPatchOS version and patch level
cmdline: Box<[u8; 1536]>Kernel command line
v4_signature_size: Option<u32>Boot signature size.
This is only present in version 4 and the version will be inferred from this field.
Implementations§
Source§impl HeaderV3
impl HeaderV3
Sourcepub const fn header_version(&self) -> u32
pub const fn header_version(&self) -> u32
Returns the boot image header’s version number.
Sourcepub const fn kernel_position() -> usize
pub const fn kernel_position() -> usize
Returns the kernel’s position in the boot image.
Hardcoded to the page size, which is 4096.
Sourcepub const fn ramdisk_position(&self) -> usize
pub const fn ramdisk_position(&self) -> usize
Returns the ramdisk’s position in the boot image.
Sourcepub const fn bootsig_position(&self) -> usize
pub const fn bootsig_position(&self) -> usize
Returns the boot signature’s position in the boot image.
Note that this section is undefined in version 3.
Trait Implementations§
Source§impl BinRead for HeaderV3
impl BinRead for HeaderV3
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for HeaderV3
impl BinWrite for HeaderV3
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming little-endian byte order. Read moreSource§fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming native-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self to the writer using the given arguments. Read moreSource§fn write_be_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self to the writer, assuming big-endian byte order, using the
given arguments. Read moreSource§impl ReadEndian for HeaderV3
impl ReadEndian for HeaderV3
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
The endianness of the type.
Source§impl WriteEndian for HeaderV3
impl WriteEndian for HeaderV3
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
The endianness of the type.
Source§impl WriteMagic for HeaderV3
impl WriteMagic for HeaderV3
impl Eq for HeaderV3
impl StructuralPartialEq for HeaderV3
Auto Trait Implementations§
impl Freeze for HeaderV3
impl RefUnwindSafe for HeaderV3
impl Send for HeaderV3
impl Sync for HeaderV3
impl Unpin for HeaderV3
impl UnwindSafe for HeaderV3
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more