bootinfo: Add BROM header decoding
This commit is contained in:
parent
c818efd144
commit
efc7efbf7a
23
bootinfo.c
23
bootinfo.c
@ -47,6 +47,16 @@ typedef struct boot_file_head
|
||||
u8 platform[8]; // platform information
|
||||
} boot_file_head_t;
|
||||
|
||||
typedef struct brom_file_head
|
||||
{
|
||||
u32 jump_instruction; // one intruction jumping to real code
|
||||
u8 magic[8]; // ="eGON.BRM", not C-style string.
|
||||
u32 length; // generated by PC
|
||||
u8 Boot_vsn[4]; // Boot version
|
||||
u8 eGON_vsn[4]; // eGON version
|
||||
u8 platform[8]; // platform information
|
||||
} brom_file_head_t;
|
||||
|
||||
typedef struct _boot_dram_para_t {
|
||||
__u32 dram_baseaddr;
|
||||
__u32 dram_clk;
|
||||
@ -137,6 +147,7 @@ typedef struct _boot_sdcard_info_t {
|
||||
__s32 line_count[4];
|
||||
} boot_sdcard_info_t;
|
||||
|
||||
#define BROM_MAGIC "eGON.BRM"
|
||||
#define BOOT0_MAGIC "eGON.BT0"
|
||||
#define BOOT1_MAGIC "eGON.BT1"
|
||||
|
||||
@ -145,6 +156,15 @@ void fail(char *msg) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void print_brom_file_head(brom_file_head_t *hdr)
|
||||
{
|
||||
printf("Magic : %.8s\n", hdr->magic);
|
||||
printf("Length : %u\n", hdr->length);
|
||||
printf("BOOT ver : %.4s\n", hdr->Boot_vsn);
|
||||
printf("eGON ver : %.4s\n", hdr->eGON_vsn);
|
||||
printf("Chip? : %.8s\n", hdr->platform);
|
||||
}
|
||||
|
||||
void print_boot_file_head(boot_file_head_t *hdr)
|
||||
{
|
||||
printf("Magic : %.8s\n", hdr->magic);
|
||||
@ -283,6 +303,7 @@ int main(int argc, char * argv[])
|
||||
boot_file_head_t boot;
|
||||
boot0_file_head_t boot0;
|
||||
boot1_file_head_t boot1;
|
||||
brom_file_head_t brom;
|
||||
} hdr;
|
||||
int len;
|
||||
|
||||
@ -293,6 +314,8 @@ int main(int argc, char * argv[])
|
||||
print_boot0_file_head(&hdr.boot0);
|
||||
} else if (strncmp((char *)hdr.boot.magic, BOOT1_MAGIC, strlen(BOOT1_MAGIC)) == 0) {
|
||||
print_boot1_file_head(&hdr.boot1);
|
||||
} else if (strncmp((char *)hdr.boot.magic, BROM_MAGIC, strlen(BROM_MAGIC)) == 0) {
|
||||
print_brom_file_head(&hdr.brom);
|
||||
} else {
|
||||
fail("Invalid magic\n");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user