Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
fa1399ed
Commit
fa1399ed
authored
21 years ago
by
Wolfgang Denk
Browse files
Options
Downloads
Patches
Plain Diff
Accelerate booting on TRAB board: read and check autoupdate image
headers first instead of always reading the whole images.
parent
b96619a1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG
+3
-0
3 additions, 0 deletions
CHANGELOG
board/trab/auto_update.c
+47
-16
47 additions, 16 deletions
board/trab/auto_update.c
with
50 additions
and
16 deletions
CHANGELOG
+
3
−
0
View file @
fa1399ed
...
...
@@ -2,6 +2,9 @@
Changes since U-Boot 1.0.0:
======================================================================
* Accelerate booting on TRAB board: read and check autoupdate image
headers first instead of always reading the whole images.
* Fix type in MPC5XXX code (pointed out by Victor Wren)
* Enabled password check on RMU board
...
...
This diff is collapsed.
Click to expand it.
board/trab/auto_update.c
+
47
−
16
View file @
fa1399ed
...
...
@@ -207,7 +207,32 @@ extern block_dev_desc_t *get_dev (char*, int);
extern
int
u_boot_hush_start
(
void
);
int
au_check_valid
(
int
idx
,
long
nbytes
)
au_check_cksum_valid
(
int
idx
,
long
nbytes
)
{
image_header_t
*
hdr
;
unsigned
long
checksum
;
hdr
=
(
image_header_t
*
)
LOAD_ADDR
;
if
(
nbytes
!=
(
sizeof
(
*
hdr
)
+
ntohl
(
hdr
->
ih_size
)))
{
printf
(
"Image %s bad total SIZE
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
/* check the data CRC */
checksum
=
ntohl
(
hdr
->
ih_dcrc
);
if
(
crc32
(
0
,
(
char
*
)(
LOAD_ADDR
+
sizeof
(
*
hdr
)),
ntohl
(
hdr
->
ih_size
))
!=
checksum
)
{
printf
(
"Image %s bad data checksum
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
return
0
;
}
int
au_check_header_valid
(
int
idx
,
long
nbytes
)
{
image_header_t
*
hdr
;
unsigned
long
checksum
;
...
...
@@ -222,11 +247,14 @@ au_check_valid(int idx, long nbytes)
printf
(
"size %#x %#lx "
,
ntohl
(
hdr
->
ih_size
),
nbytes
);
printf
(
"type %#x %#x "
,
hdr
->
ih_type
,
IH_TYPE_KERNEL
);
#endif
if
(
ntohl
(
hdr
->
ih_magic
)
!=
IH_MAGIC
||
hdr
->
ih_arch
!=
IH_CPU_ARM
||
nbytes
!=
(
sizeof
(
*
hdr
)
+
ntohl
(
hdr
->
ih_size
)))
if
(
nbytes
<
sizeof
(
*
hdr
))
{
printf
(
"Image %s bad MAGIC or ARCH or SIZE
\n
"
,
aufile
[
idx
]);
printf
(
"Image %s bad header SIZE
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
if
(
ntohl
(
hdr
->
ih_magic
)
!=
IH_MAGIC
||
hdr
->
ih_arch
!=
IH_CPU_ARM
)
{
printf
(
"Image %s bad MAGIC or ARCH
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
/* check the hdr CRC */
...
...
@@ -238,15 +266,6 @@ au_check_valid(int idx, long nbytes)
return
-
1
;
}
hdr
->
ih_hcrc
=
htonl
(
checksum
);
/* check the data CRC */
checksum
=
ntohl
(
hdr
->
ih_dcrc
);
if
(
crc32
(
0
,
(
char
*
)(
LOAD_ADDR
+
sizeof
(
*
hdr
)),
ntohl
(
hdr
->
ih_size
))
!=
checksum
)
{
printf
(
"Image %s bad data checksum
\n
"
,
aufile
[
idx
]);
return
-
1
;
}
/* check the type - could do this all in one gigantic if() */
if
((
idx
==
IDX_FIRMWARE
)
&&
(
hdr
->
ih_type
!=
IH_TYPE_FIRMWARE
))
{
printf
(
"Image %s wrong type
\n
"
,
aufile
[
idx
]);
...
...
@@ -548,6 +567,18 @@ do_auto_update(void)
bitmap_first
=
0
;
/* just loop thru all the possible files */
for
(
i
=
0
;
i
<
AU_MAXFILES
;
i
++
)
{
/* just read the header */
sz
=
file_fat_read
(
aufile
[
i
],
LOAD_ADDR
,
sizeof
(
image_header_t
));
debug
(
"read %s sz %ld hdr %d
\n
"
,
aufile
[
i
],
sz
,
sizeof
(
image_header_t
));
if
(
sz
<=
0
||
sz
<
sizeof
(
image_header_t
))
{
debug
(
"%s not found
\n
"
,
aufile
[
i
]);
continue
;
}
if
(
au_check_header_valid
(
i
,
sz
)
<
0
)
{
debug
(
"%s header not valid
\n
"
,
aufile
[
i
]);
continue
;
}
sz
=
file_fat_read
(
aufile
[
i
],
LOAD_ADDR
,
MAX_LOADSZ
);
debug
(
"read %s sz %ld hdr %d
\n
"
,
aufile
[
i
],
sz
,
sizeof
(
image_header_t
));
...
...
@@ -555,8 +586,8 @@ do_auto_update(void)
debug
(
"%s not found
\n
"
,
aufile
[
i
]);
continue
;
}
if
(
au_check_valid
(
i
,
sz
)
<
0
)
{
debug
(
"%s not valid
\n
"
,
aufile
[
i
]);
if
(
au_check_
cksum_
valid
(
i
,
sz
)
<
0
)
{
debug
(
"%s
checksum
not valid
\n
"
,
aufile
[
i
]);
continue
;
}
#ifdef CONFIG_VFD
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment