Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormadmonkey <madfkingmonkey@gmail.com>2017-03-01 21:54:12 +0300
committermadmonkey <madfkingmonkey@gmail.com>2017-03-01 21:54:12 +0300
commit2df54929d86c75b39971c688fd816c80ca74644c (patch)
tree4685e22c76fbbb0123672c639f48ffea2c30954b
parent9d16ffd1ecc8cb5c2fa5a5fbc7ef35745e52d154 (diff)
uboot checksum check/fix added
-rw-r--r--sntool/sntool.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/sntool/sntool.cpp b/sntool/sntool.cpp
index 3aaa51a..22aa582 100644
--- a/sntool/sntool.cpp
+++ b/sntool/sntool.cpp
@@ -121,16 +121,16 @@ int checksum(const char*in,int fix)
fs=loadFile(in,data);
uint32_t*data32=reinterpret_cast<uint32_t*>(data);
- if((fs<32)||(memcmp(data+4,"eGON.BT",7)!=0))
+ if((fs<32)||((memcmp(data+4,"eGON.BT",7)!=0)&&(memcmp(data+4,"uboot",6)!=0)))
{
- printf("eGON header is not found\n");
+ printf("header is not found\n");
return 1;
}
- uint32_t l=le32toh(data32[4]);
+ uint32_t l=le32toh(data32[(memcmp(data+4,"uboot",6)==0)?5:4]);
if((l>fs)||((l%4)!=0))
{
- printf("bad length in the eGON header\n");
+ printf("bad length in header\n");
return 1;
}
l/=4;
@@ -176,6 +176,7 @@ int split(const char*in)
fs=offs;
while(data[fs-1]==0xff)
--fs;
+ data32[3]=0;
data32[5]=0;
data32[6]=0;
saveFile(in,data,fs);
@@ -205,6 +206,7 @@ int join(const char*in0,const char*in1)
data[fs0++]=0xff;
data32[5]=htole32(fs0);
saveFile(in0,data,fs0);
+ checksum(in0,1);
return 0;
}
return 1;