mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
mi4: replace chksum_crc32 with crc_32r
This uses an equivalent algorithm but with a different initial value than we normally use (all bits off vs all bits on). Use the new crc_32r to replace the original MI4 crc32 implementation. This frees up some extra space on mi4 targets which gives us more room on a few very space constrained targets (sansa c200/e200, etc). Change-Id: Iaaac3ae353b30566156b1404cbf31ca32926203d
This commit is contained in:
parent
fc92081080
commit
581081a3df
8 changed files with 6 additions and 147 deletions
|
|
@ -27,12 +27,11 @@
|
|||
#include "config.h"
|
||||
#include "mi4-loader.h"
|
||||
#include "loader_strerror.h"
|
||||
#include "crc32-mi4.h"
|
||||
#include "crc32.h"
|
||||
#include "file.h"
|
||||
#if defined(HAVE_BOOTDATA)
|
||||
#include "system.h"
|
||||
#include "bootdata.h"
|
||||
#include "crc32.h"
|
||||
|
||||
/* Write bootdata into location in FIRMWARE marked by magic header
|
||||
* Assumes buffer is already loaded with the firmware image
|
||||
|
|
@ -293,7 +292,7 @@ static int load_mi4_filename(unsigned char* buf,
|
|||
return EREAD_IMAGE_FAILED;
|
||||
|
||||
/* Check CRC32 to see if we have a valid file */
|
||||
sum = chksum_crc32 (buf, mi4header.mi4size - MI4_HEADER_SIZE);
|
||||
sum = crc_32r (buf, mi4header.mi4size - MI4_HEADER_SIZE, 0);
|
||||
|
||||
if(sum != mi4header.crc32)
|
||||
return EBAD_CHKSUM;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue