Can your help me,about hikpack repack firmware

aclicetom

n3wb
Joined
Jul 25, 2017
Messages
3
Reaction score
0
Hello, I want to customize my firmware package, and then I found a tool hikpack tool by @montecrypto, which is a very nice tool. I can with (-t k41) to correctly extract and decrypt my firmware package. Repack, once again upgrade no problem.
When I modified the start.sh file, then (encrypt start.sh-> md5 start.sh-> decrypt new_10.bin-> mod new_10.bin-> encrypt new_10.bin-> mkcramfs-> decrypt new_20.bin -> md5 cramfs.img-> encrypt) .After this process is repackaged, the upgrade is successful but the system fails after reboot.
I would like to know, if I changed the start.sh file, except to update new_10.bin file,is there anything else I should be modifying?how to , thank you.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,963
Reaction score
6,794
Location
Scotland
but the system fails after reboot.
What errors did the serial console show on startup?
Is this a CN NVR you are trying the firmware on?
new_20.bin
I'm not sure if hikpack correctly handles new_20.bin and the small tail after the end of it.
Maybe try handling the full tail on digicap.dav manually - tail original digicap,dav, decrypt new_20.bin + extra bytes, modify, encrypt, append to new digicap.dav and see if that works.
 

aclicetom

n3wb
Joined
Jul 25, 2017
Messages
3
Reaction score
0
What errors did the serial console show on startup?
Is this a CN NVR you are trying the firmware on?

I'm not sure if hikpack correctly handles new_20.bin and the small tail after the end of it.
Maybe try handling the full tail on digicap.dav manually - tail original digicap,dav, decrypt new_20.bin + extra bytes, modify, encrypt, append to new digicap.dav and see if that works.
I replaced logo.jpg of sys_app.tar.lzma, and then repack (md5sum -> ...), no problem with the upgrade, the system starts normally, my logo picture can also be displayed.
But I used the same method to modify the start.sh, like add a line "echo hello", and repacked, after the upgrade, the system failed to start. I can not connect to the serial port, I will try your method, there may be other checks here I do not know.
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,963
Reaction score
6,794
Location
Scotland
Was your finished new_20.bin 480 bytes long, or 476?

*edit*
Just had a thought - did you 'chmod +x start.sh' ?
Perhaps it has been left as not executable.
 

aclicetom

n3wb
Joined
Jul 25, 2017
Messages
3
Reaction score
0
Was your finished new_20.bin 480 bytes long, or 476?

*edit*
Just had a thought - did you 'chmod +x start.sh' ?
Perhaps it has been left as not executable.
start.sh will run automatic,I can't control
my new_20.bin 360 bytes long.....
 

alastairstevenson

Staff member
Joined
Oct 28, 2014
Messages
15,963
Reaction score
6,794
Location
Scotland
But before you do the mkfs.cramfs check if start.sh is executable.
If you modified it, it may have lost the 'x' attribute. The chmod +x command will put it back.
 
Top