代码拉取完成,页面将自动刷新
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "dtimgextract.h"
typedef struct {
uint32_t platform_id;
uint32_t variant_id;
uint32_t sec_rev;
uint32_t msm_id2;
uint32_t pmic1;
uint32_t pmic2;
uint32_t pmic3;
uint32_t pmic4;
uint32_t offset;
uint32_t len;
char something[30];
} dtb_entry_v3_moto;
void dump_files_v3_moto(FILE *fd, qca_head header, uint32_t headerat) {
int i;
dtb_entry_v3_moto *images = malloc(header.num * sizeof(dtb_entry_v3_moto));
printf("\nPid\tVid\tSrev\tmsm_id2\tpmic1\tpmic2\tpmic3\tpmic4\toffset\tlen\tsomething\n");
for ( i = 0; i < header.num ; i++ ){
fread(&images[i], sizeof(dtb_entry_v3_moto), 1, fd);
printf("%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%x\t%s\n",
images[i].platform_id, images[i].variant_id,
images[i].sec_rev, images[i].msm_id2,
images[i].pmic1, images[i].pmic2,
images[i].pmic3, images[i].pmic4,
images[i].offset, images[i].len, images[i].something);
printf(" qcom,msm-id=<0x%x 0x%x>;\n",images[i].platform_id, images[i].msm_id2);
printf(" qcom,pmic-id=<0x%x 0x%x 0x%x 0x%x>;\n", images[i].pmic1, images[i].pmic2, images[i].pmic3, images[i].pmic4);
printf(" qcom,board-id=<0x%x 0x%x>;\n", images[i].variant_id, images[i].sec_rev);
}
printf("\n");
fseek(fd, headerat, SEEK_SET);
for ( i = 0; i < header.num; i++ ){
char dtbname[256];
char *dtb;
FILE *out_fd = NULL;
sprintf(dtbname, "%x_%x_%x_%x.dtb", images[i].platform_id, images[i].variant_id,
images[i].sec_rev, images[i].msm_id2);
printf("Writing %s(%x bytes)\n", dtbname, images[i].len);
dtb = malloc(images[i].len);
fseek(fd, images[i].offset + headerat, SEEK_SET);
fread(dtb, images[i].len, 1, fd);
out_fd = fopen(dtbname, "wb");
fwrite(dtb, images[i].len, 1, out_fd);
free(dtb);
fclose(out_fd);
}
free(images);
}
dt_parser v3_parser_moto = {
.dt_file_dumper = &dump_files_v3_moto,
.version = 259,
.extended = 1,
};
int __attribute__((constructor)) register_v3_parser_moto(void) {
add_dt_parser(&v3_parser_moto);
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。