mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
imxtools/sbtools: various fixes
Change bug() macro, fix memory leaks, always use -h for help, fix usage(), fix comment, remove useless macro Change-Id: I30554b5e07e6f2845560a570808603cf8c4da5ad
This commit is contained in:
parent
2b20026dd7
commit
5ff3a3a98f
6 changed files with 39 additions and 24 deletions
|
|
@ -802,7 +802,11 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo
|
|||
if(memcmp(hdr_sha1, computed_sha1, 20) == 0)
|
||||
printf(RED, " Ok\n");
|
||||
else
|
||||
{
|
||||
printf(RED, " Failed\n");
|
||||
if(!(flags & SB_IGNORE_SHA1))
|
||||
fatal(SB_FORMAT_ERROR, "Bad header checksum\n");
|
||||
}
|
||||
printf(GREEN, " Flags: ");
|
||||
printf(YELLOW, "%x\n", sb_header->flags);
|
||||
printf(GREEN, " Total file size : ");
|
||||
|
|
@ -1045,7 +1049,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo
|
|||
printf(OFF, "%s", indent);
|
||||
uint8_t checksum = instruction_checksum(hdr);
|
||||
if(checksum != hdr->checksum)
|
||||
printf(GREY, "[Bad checksum']");
|
||||
printf(GREY, "[Bad checksum]");
|
||||
|
||||
if(hdr->opcode == SB_INST_NOP)
|
||||
{
|
||||
|
|
@ -1093,6 +1097,14 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo
|
|||
printf(RED, " (Encrypted)");
|
||||
printf(OFF, "\n");
|
||||
|
||||
/* skip it if we cannot decrypt it */
|
||||
if(encrypted && !valid_key)
|
||||
{
|
||||
printf(GREY, " Skipping section content (no valid key)\n");
|
||||
offset += size;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* save it */
|
||||
byte *sec = xmalloc(size);
|
||||
if(encrypted)
|
||||
|
|
@ -1161,7 +1173,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo
|
|||
else if(flags & SB_IGNORE_SHA1)
|
||||
{
|
||||
/* some weird images produced by some buggy tools have wrong SHA-1,
|
||||
* this probably gone unnoticed because the bootloader ignores the SH1-1
|
||||
* this probably gone unnoticed because the bootloader ignores the SHA-1
|
||||
* anyway */
|
||||
printf(RED, " Failed\n");
|
||||
cprintf(u, true, GREY, "Warning: SHA-1 mismatch ignored per flags\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue