Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
efc7efbf
Commit
efc7efbf
authored
Aug 06, 2012
by
Henrik Nordstrom
Browse files
bootinfo: Add BROM header decoding
parent
c818efd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
bootinfo.c
View file @
efc7efbf
...
...
@@ -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
"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment