add bootimg.zig

This commit is contained in:
vexdevt 2024-05-11 23:58:06 +03:00
parent 4cf38f2002
commit bab71625a1
1 changed files with 22 additions and 0 deletions

22
src/BootImg.zig Normal file
View File

@ -0,0 +1,22 @@
var BOOT_MAGIC = "ANDROID!";
var BOOT_MAGIC_SIZE = 8;
var BOOT_NAME_SIZE = 16;
var BOOT_ARGS_SIZE = 512;
struct BootImageHeader {
u8[BOOT_MAGIC_SIZE] magic;
u32 kernel_size; // size in bytes
u32 kernel_addr; // physical load address
u32 ramdisk_size; // size in bytes
u32 ramdisk_addr; // physical load address
u32 second_size; // size in bytes
u32 second_addr; // physical load address
u32 tags_addr; // physical address for kernel tags
u32 page_size; // flash page size assumed
u32[2] unused; // future expansion, should be zero
u8[BOOT_NAME_SIZE] name; // null-terminated product name
u8[BOOT_ARGS_SIZE] cmdline;
u32[8] id; // timestamp / checksum / sha1 / etc
}
// https://android.googlesource.com/platform/system/tools/mkbootimg/+/refs/heads/main/include/bootimg/bootimg.h