diff options
Diffstat (limited to 'rbutil/sansapatcher')
-rw-r--r-- | rbutil/sansapatcher/sansapatcher.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/rbutil/sansapatcher/sansapatcher.c b/rbutil/sansapatcher/sansapatcher.c index 2d44e75303..bc03108930 100644 --- a/rbutil/sansapatcher/sansapatcher.c +++ b/rbutil/sansapatcher/sansapatcher.c | |||
@@ -34,7 +34,9 @@ | |||
34 | #include "bootimg_e200.h" | 34 | #include "bootimg_e200.h" |
35 | #endif | 35 | #endif |
36 | /* The offset of the MI4 image header in the firmware partition */ | 36 | /* The offset of the MI4 image header in the firmware partition */ |
37 | #define PPMI_OFFSET 0x80000 | 37 | #define PPMI_OFFSET 0x80000 |
38 | #define NVPARAMS_OFFSET 0x780000 | ||
39 | #define NVPARAMS_SIZE (0x80000-0x200) | ||
38 | 40 | ||
39 | extern int verbose; | 41 | extern int verbose; |
40 | 42 | ||
@@ -882,7 +884,26 @@ int sansa_update_of(struct sansa_t* sansa, char* filename) | |||
882 | fprintf(stderr,"[ERR] Short write in sansa_update_of\n"); | 884 | fprintf(stderr,"[ERR] Short write in sansa_update_of\n"); |
883 | return -1; | 885 | return -1; |
884 | } | 886 | } |
885 | 887 | ||
888 | /* Step 4 - zero out the nvparams section - we have to do this or we end up | ||
889 | with multiple copies of the nvparams data and don't know which one to | ||
890 | work with for the database rebuild disabling trick in our bootloader */ | ||
891 | if (strcmp(sansa->targetname,"e200") == 0) { | ||
892 | printf("[INFO] Resetting Original Firmware settings\n"); | ||
893 | if (sansa_seek(sansa, sansa->start+NVPARAMS_OFFSET+0x200) < 0) { | ||
894 | fprintf(stderr,"[ERR] Seek to 0x%08llx in sansa_update_of failed.\n", | ||
895 | sansa->start+NVPARAMS_OFFSET+0x200); | ||
896 | return -1; | ||
897 | } | ||
898 | |||
899 | memset(sectorbuf,0,NVPARAMS_SIZE); | ||
900 | n=sansa_write(sansa, sectorbuf, NVPARAMS_SIZE); | ||
901 | if (n < NVPARAMS_SIZE) { | ||
902 | fprintf(stderr,"[ERR] Short write in sansa_update_of\n"); | ||
903 | return -1; | ||
904 | } | ||
905 | } | ||
906 | |||
886 | return 0; | 907 | return 0; |
887 | } | 908 | } |
888 | 909 | ||