Sign up here and you can log into the forum!

unpack / repack a firmware

Have a question about devices internals, memory layout, reverse engineering, etc---This is the place for anything so technical that it would cause a n00b's head to 'splode

Re: unpack / repack a firmware   

Postby recliq » Wed May 11, 2011 4:43 am

Try! It's quite hard to actually brick a Live. Even if the fw is not working and the unit is not booting, there is a recovery partition in flash from which you can flash a valid firmware.
If the box does not come up with the recovery image byitself, I think it can be activated by pressing the reset button while powering the device on.
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: unpack / repack a firmware   

Postby RMerlin » Wed May 11, 2011 6:13 am

One way to test your flash file is to turn it into a bootable root.bin, and trying to boot from it. That will let you rule out any software issue with your code.

http://forum.wdlxtv.com/viewtopic.php?f=43&t=2713&start=20#p29495
WDLXTV Webend maintainer. Visit http://www.lostrealm.ca/wdlxtv to see my other WDLXTV projects.
If you like my work, please consider donating.
User avatar
RMerlin
WDLXTV Team
 
Posts: 3236
Joined: Sat Jun 26, 2010 9:25 am
Location: Montreal, Canada

Re: unpack / repack a firmware   

Postby zerotonero » Thu May 12, 2011 7:33 am

jamesr219 wrote:
jamesr219 wrote:When using Ty's tool to pack/unpack (thanks BTW!) an release firmware should I expect the filesize of the re-pack to be the same? For me it is growing a bit, but I can't figure out why. I am not touching any files in the unpacked directory.

I'm using the following commands:
Code: Select all
user@ubuntu:~/wdltv$ ./wdtvfw_tool unpack rootfs 1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin
stripping firmware ...
unpack cramfs image ...
unpacked to rootfs
user@ubuntu:~/wdltv$ ./wdtvfw_tool pack rootfs 1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin.new
create md5sum.txt ...
create cramfs image ...
warning: gids truncated to 8 bits (this may be a security concern)
sign image ...
1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin.new created
user@ubuntu:~/wdltv$ ls -lad 1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin*
-rw-r--r-- 1 user user 93159472 2010-10-12 00:05 1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin
-rw-r--r-- 1 user user 93372464 2010-11-29 07:51 1.03.39_B_WDLXTV.COM_WDLXTV_PLUS-0.4.3.1/wdtvlive2.bin.new


Is it ok for there to be this difference? Will this create a bootable firmware?

thanks,

-jr



Anyone comment on this? I don't want to brick my unit, but need to reconfigure some things for a custom application I am working on with the WDLive devices?

thanks!



I believe Tjay's tool is checksumming all of the files instead of the original 270 and dumping the results into the md5sums.txt file, thus the difference in file size?
zerotonero
n00b
 
Posts: 1
Joined: Thu May 12, 2011 7:27 am

Re: unpack / repack a firmware   

Postby BonzenPaule » Thu May 26, 2011 8:14 am

Hi guys,
I am a total linux noob and I would like to pack my own version of the firmware. But I've got 2 problems.
I put the cramfs binarys into the folder /usr/bin/ and the other files into another folder (/wdlxtv/firmware/).
I downloaded version 1.02.21_0.4.7.3 and unpacked it into /wdlxtv/firmware/. Then I used command "chmod -R 777" on /wdlxtv and /usr.
When I try to cramfs the wdtv.bin I get the following error:
Code: Select all
root@ubuntu:/wdlxtv/firmware# tail -c +33 wdtvlive.bin > wdtvlive.stripped.bin
root@ubuntu:/wdlxtv/firmware# cramfsck-16k -x dump wdtvlive.stripped.bin
cramfsck-16k: file length too short

Does somebody know what I did wrong? :)
And my second problem is with mkcramfs. When I try to make a wdtv.bin with files from svn I get an error with the command "signFW".
Code: Select all
root@ubuntu:/wdlxtv/firmware# mkcramfs-16k ./svn/ newFW.bin
Directory data: 248400 bytes
Everything: 86896 kilobytes
Super block: 76 bytes
CRC: 1fc17036
root@ubuntu:/wdlxtv/firmware# signFW newFW.bin signature
signFW: command not found

First of all, is "signFW newFW.bin signature" right or do I need to think of a signature? And second, well yea he is missing the command so how can I "teach" him (the OS) this command? :D
I already tried tjay's fw tool to pack the folder and it did not complain at all. (pack) But I flashed the firmware and it seems a little bit odd so maybe something went wrong there. Unpack is not working with the tool because of the same reason I already posted in the beginning

I hope somebody can help me and won't cost much effort :/
Sincerely BonzenPaule
BonzenPaule
Donor
 
Posts: 83
Joined: Thu Oct 28, 2010 10:40 am
Location: Rostock, Germany

Re: unpack / repack a firmware   

Postby recliq » Thu May 26, 2011 8:55 am

if you follow the link in the first post of this thread you find the signFW script:
http://forum.wdlxtv.com/viewtopic.php?f=43&t=33

not sure about the first error though, haven't seen that message yet. sounds like something is wrong with the file you are trying to unpack.
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: unpack / repack a firmware   

Postby BonzenPaule » Thu May 26, 2011 8:58 am

All right, thanks a lot. That should allow me to pack the svn version.
I try to unpack the wdtvlive.bin from b-rad. I downloaded it from the forum. I'll download it again and give it another try.
Again, thanks a lot. :)
BonzenPaule
BonzenPaule
Donor
 
Posts: 83
Joined: Thu Oct 28, 2010 10:40 am
Location: Rostock, Germany

Re: unpack / repack a firmware   

Postby b-rad.cc » Thu May 26, 2011 9:01 am

svn versions are not always intended to pack & flash and unless you have more skills than you're admitting to you should be very careful going there.
PM's are for private matters only, please post public matters on the forum to help others who might have the same issue.
:mrgreen:
User avatar
b-rad.cc
WDLXTV Team
 
Posts: 3003
Joined: Sat Apr 03, 2010 9:35 am
Location: New York

Re: unpack / repack a firmware   

Postby BonzenPaule » Thu May 26, 2011 9:12 am

Thanks for the warning.
The svn-root.bin is pretty stable that's why i thought it couldn't harm to give it a try. Like recliq said:
recliq wrote:Try! It's quite hard to actually brick a Live. Even if the fw is not working and the unit is not booting, there is a recovery partition in flash from which you can flash a valid firmware.
If the box does not come up with the recovery image byitself, I think it can be activated by pressing the reset button while powering the device on.

I try to learn the basic's and play around a bit, so I am maybe able to help someday at some point... :)
I consider myself warned and slow down :D

*edit: I re-downloaded b-rads firmware and cramfs is working so the error was with the .bin. I still get a warning though
Code: Select all
cramfsck-16k -x dump wdtvlive.stripped.bin
warning: file extends past end of filesystem
Last edited by BonzenPaule on Thu May 26, 2011 9:26 am, edited 1 time in total.
BonzenPaule
Donor
 
Posts: 83
Joined: Thu Oct 28, 2010 10:40 am
Location: Rostock, Germany

Re: unpack / repack a firmware   

Postby b-rad.cc » Thu May 26, 2011 9:24 am

the 1.05.04 svn trunk is not to be flashed. Other repos you should not have any issue with.

Regardless of what recliqs said you can get yourself into situations that you probably could not get yourself out of. You're only offered the upgrade recovery if you flash an invalid firmware. If you flash a firmware that is just plain broken, then its broken and there is nothing to recover from. You're running a broken firmware and its saying "i'm ok".
PM's are for private matters only, please post public matters on the forum to help others who might have the same issue.
:mrgreen:
User avatar
b-rad.cc
WDLXTV Team
 
Posts: 3003
Joined: Sat Apr 03, 2010 9:35 am
Location: New York

Re: unpack / repack a firmware   

Postby BonzenPaule » Thu May 26, 2011 9:29 am

I know I know. I just use the 1.02 svn I should have told you that before, my bad.
I know that 1.05 still is to unstable to flash.
BonzenPaule
Donor
 
Posts: 83
Joined: Thu Oct 28, 2010 10:40 am
Location: Rostock, Germany

PreviousNext

Return to WDTV Live

Who is online

Users browsing this forum: No registered users and 2 guests

cron