以mtk平台为例,分析android源码编译生成的vendor_boot.img的结构。 vendor_boot包括boot.img header、kernel、ramdisk系统。
vendor_boot的文件头信息具体在lk阶段platform/common/include/bootimg.h可以看到:
#define VENDOR_BOOT_MAGIC "VNDRBOOT"
#define VENDOR_BOOT_MAGIC_SIZE 8
#define VENDOR_BOOT_ARGS_SIZE 2048
#define VENDOR_BOOT_NAME_SIZE 16
struct vendor_boot_img_hdr_v4 {
// Must be VENDOR_BOOT_MAGIC.
uint8_t magic[VENDOR_BOOT_MAGIC_SIZE];
// Version of the vendor boot image header.
uint32_t header_version;
uint32_t page_size; /* flash page size we assume */
uint32_t kernel_addr; /* physical load addr */
uint32_t ramdisk_addr; /* physical load addr */
uint32_t vendor_ramdisk_size; /* size in bytes */
uint8_t cmdline[VENDOR_BOOT_ARGS_SIZE];
uint32_t tags_addr; /* physical addr for kernel tags */
uint8_t name[VENDOR_BOOT_NAME_SIZE]; /* asciiz product name */
uint32_t header_size;
uint32_t dtb_size; /* size in bytes for DTB image */
uint64_t dtb_addr; /* physical load address for DTB image */
uint32_t vendor_ramdisk_table_size; /* size in bytes for the vendor ramdisk table */
uint32_t vendor_ramdisk_table_entry_num; /* number of entries in the vendor ramdisk table */
uint32_t vendor_ramdisk_table_entry_size; /* size in bytes for a vendor ramdisk table entry */
uint32_t bootconfig_size; /* size in bytes for the bootconfig section */
} __attribute__((packed));
结合vendor_boot.img文件(UltraEdit打开)
header_version = 0x 00 00 00 04
page_size = 0x 00 00 10 00(4096-4k)
kernel_addr = 0x 40 08 00 00
ramdisk_addr = 0x 66 f0 00 00
vendor_ramdisk_size = 0x 01 8b 04 cc
tags_addr = 0x 54 00 00 00
header_size = 0x 00 00 08 50
dtb_size = 0x 00 02 9f 89
dtb_addr = 0x 54 00 00 00
总结:通过增加log调试打印验证vendor_boot.img的结构成员变量
标签:ramdisk,00,vendor,addr,img,文件格式,uint32,size From: https://blog.csdn.net/weixin_48175016/article/details/144209287