summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2021-06-21 09:36:54 +0000
committerJames Buren <braewoods+rb@braewoods.net>2021-06-21 09:36:54 +0000
commit581081a3df072833ab22a58af574992820c2ae8f (patch)
tree741a88ef6978b85f62468146ffbcb948a4341139 /firmware/target
parentfc9208108052440ccde79b6cd33e3598e8fb7c26 (diff)
downloadrockbox-581081a3df072833ab22a58af574992820c2ae8f.tar.gz
rockbox-581081a3df072833ab22a58af574992820c2ae8f.zip
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
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/pp/mi4-loader.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/firmware/target/arm/pp/mi4-loader.c b/firmware/target/arm/pp/mi4-loader.c
index 31b0065888..0104496e9d 100644
--- a/firmware/target/arm/pp/mi4-loader.c
+++ b/firmware/target/arm/pp/mi4-loader.c
@@ -27,12 +27,11 @@
27#include "config.h" 27#include "config.h"
28#include "mi4-loader.h" 28#include "mi4-loader.h"
29#include "loader_strerror.h" 29#include "loader_strerror.h"
30#include "crc32-mi4.h" 30#include "crc32.h"
31#include "file.h" 31#include "file.h"
32#if defined(HAVE_BOOTDATA) 32#if defined(HAVE_BOOTDATA)
33#include "system.h" 33#include "system.h"
34#include "bootdata.h" 34#include "bootdata.h"
35#include "crc32.h"
36 35
37/* Write bootdata into location in FIRMWARE marked by magic header 36/* Write bootdata into location in FIRMWARE marked by magic header
38 * Assumes buffer is already loaded with the firmware image 37 * Assumes buffer is already loaded with the firmware image
@@ -293,7 +292,7 @@ static int load_mi4_filename(unsigned char* buf,
293 return EREAD_IMAGE_FAILED; 292 return EREAD_IMAGE_FAILED;
294 293
295 /* Check CRC32 to see if we have a valid file */ 294 /* Check CRC32 to see if we have a valid file */
296 sum = chksum_crc32 (buf, mi4header.mi4size - MI4_HEADER_SIZE); 295 sum = crc_32r (buf, mi4header.mi4size - MI4_HEADER_SIZE, 0);
297 296
298 if(sum != mi4header.crc32) 297 if(sum != mi4header.crc32)
299 return EBAD_CHKSUM; 298 return EBAD_CHKSUM;