fi2 encoder/decoder - page 10 - DryOS Development - CHDK Forum supplierdeeply

fi2 encoder/decoder

  • 100 Replies
  • 71034 Views
*

Offline reyalp

  • ******
  • 14121
Re: fi2 encoder/decoder
« Reply #90 on: 22 / May / 2011, 17:57:48 »
Advertisements
Rom starter is always at FFFF0000, regardless of normal ROM start address. This is defined as the high exception vector (as opposed to address 0) for ARM, so ROM starter must be there to boot. I don't know why you say SX20 can't access this address, I have a dump of 102c that includes it.

Try dumping with cbasic dumper ? http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper
Don't forget what the H stands for.

*

Offline f_m_b

  • **
  • 71
Re: fi2 encoder/decoder
« Reply #91 on: 23 / May / 2011, 16:23:40 »
@reyalp:
I'am quite naive... I thought ROM-Startaddress+ROM-Size = ROM-End
0xFF810000 + 0x003FFFFF = 0xFFC0FFFF and this address is less then 0xFFFF0004

Thank you.
I am going to dump my firmware and will see... :-)

EDIT: 23.05.2011 22:58

Nice Script :-)

1.00F -> FI2IV:   ROM:FFC042E4 , Offset: 0x3F42E4
1.02B -> FI2KEY: ROM:FFFF35A0 , Offset: 0x7E35A0
1.02B -> FI2IV:   ROM:FFC0436C , Offset: 0x3F436C
1.02C -> FI2KEY: ROM:FFFF35A0 , Offset: 0x7E35A0
1.02D -> FI2IV:   ROM:FFC0452C , Offset: 0x3F452C
KEYSYS=d4

EDIT: 25.05.2011 00:47
I have tried the following steps... without success.
I think i need some more help, because the SX20 doesn't load manualy...

What have i done until now:
- got full sx20 1.02b firmware dump.
- found out addresses for FI2KEY and FI2IV (see ahead)
- got Keys from addresses and write them in section d4 of platform/fi2.inc
Code: [Select]
ifeq ($(KEYSYS), d4)
  FI2KEY= 0B45...EDE7
  FI2IV = F7C1...8398
endif
- built with CHDK-Shell 3.24, CHDK-DE 672, OPT_FI2=true (and other options), gcc4.51
- copied diskboot.bin into "pack.bat" folder
- changed first address in HDR-section of my.map to 31E4 (got from func/set - display info)
- started pack.bat with g10 for digic4
- A "ps.fi2"-File was generated with following output:
Code: [Select]
fi2encdec.exe -e -sys g10 my.map ps.fi2
fi2encdec v1.0 - FI2 file processing utility.
THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND. THE AUTHOR
OF THIS SOFTWARE ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCES
RESULTING FROM THE USE, MODIFICATION, OR REDISTRIBUTION OF THIS SOFTWARE

MAP HDR: 0x000031E4 0x02230000 0x01000000 0x00000000 0x00000001
Processing diskboot.bin (0x00000000)
Saving ps.fi2
Verifying results
HDR 0x000031E4 0x02230000 0x01000000 0x00000000 0x00000001, 1 data blocks
 -> : part 1 [addr 0x00000000 size 218112    -> 273929   ]
ps.fi2 data checksum OK
Done
- copied ps.fi2 and diskboot.bin to SD-Card
- started sx20 in play mode and found in the menu the topic "Firm Update"
- pressed ok to following answer: "Update firmware version? 1.0.2.0 -> 1.0.0.0"

-> Display got black, "On/Off"-Power lamp was still on
-> Kamera needed batteries out/in.
« Last Edit: 24 / May / 2011, 18:48:40 by f_m_b »
Greetings Frank
SX20 (1.02b)

*

Offline reyalp

  • ******
  • 14121
Re: fi2 encoder/decoder
« Reply #92 on: 24 / May / 2011, 20:55:27 »
http://chdk.wikia.com/wiki/SX20
Quote
The SX20 CHDK DOES NOT support the manual loading method through the firmware update mechanism !
This means it was already tried with all correct settings, and did not work. SX1 and a couple other cameras suffer the same problem. This isn't an encoding problem, it's some other problem with the way CHDK starts and how the camera treats FI2 files.

If you are building in the CHDK tree with all the settings correct, there is no need to use fi2encdec, the CHDK build process automatically makes the FI2 for you.

If you want to debug FI2 loading on SX20, discussion should continue in the SX20 thread...
Don't forget what the H stands for.

*

Offline f_m_b

  • **
  • 71
Re: fi2 encoder/decoder
« Reply #93 on: 27 / May / 2011, 18:02:57 »
Quote
The SX20 CHDK DOES NOT support the manual loading method through the firmware update mechanism !
So it is.

If you want to debug FI2 loading on SX20, discussion should continue in the SX20 thread...
Now i give this to other hands, because my assembler skills are not this good. ;-)

If you are building in the CHDK tree with all the settings correct, there is no need to use fi2encdec, the CHDK build process automatically makes the FI2 for you.
Someone had more "wisdom" over SX20 and had overwritten the OPT_FI2.
#suppress FI2 since it doesn't work
override OPT_FI2=

Thank's a lot. :)
Greetings Frank
SX20 (1.02b)


*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: fi2 encoder/decoder
« Reply #94 on: 29 / May / 2011, 05:14:09 »
...Someone had more "wisdom" over SX20 and had overwritten the OPT_FI2.
#suppress FI2 since it doesn't work
override OPT_FI2= 
With this we prevent including the FI2 file in the autobuild server's CHDK package, so we don't serve a broken FI2 file to the users ;)

*

Offline srsa_4c

  • ******
  • 4451
Re: fi2 encoder/decoder
« Reply #95 on: 22 / May / 2014, 14:27:31 »
I'm attaching an archive with the original(?) source (thanks to the unknown person who kept it available and to c10ud for finding it).
I'm also attaching my version of fi2dec which is based on tools/packfi2 and the original fi2encdec source. This version is able to deal with new fi2 files too, just don't forget the -pv switch.
Example output:
Code: [Select]
> fi2dec -pv 52 -key 1234567890ABCDEF1234567890ABCDEF -iv 234567890ABCDEF1234567890ABCDEF1 SOME.FI2
HLEN 0x000001CC HWID 0x00003260 UNK1 0x03410000   ID 0x01000200
  CH 0x00000001 UNK2 0x00000001   CS 0x35D94E42,  12 data blocks

rec: offs 0x00000000 unpacked size 0x0014a82c packed size 0x0006c680 dest 0x00000000
     uf1  0x00000000 mainf 0 bootf 1                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x0006c680 unpacked size 0x009530bc packed size 0x005086c0 dest 0xfc020000
     uf1  0x00000000 mainf 1 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x00574d40 unpacked size 0x00000001 packed size 0x00000010 dest 0xfd580000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x00574d50 unpacked size 0x0031ee84 packed size 0x00141b70 dest 0xfd740000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006b68c0 unpacked size 0x00001f40 packed size 0x00001600 dest 0xfdde0000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006b7ec0 unpacked size 0x00007120 packed size 0x00005770 dest 0xfde00000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006bd630 unpacked size 0x00020000 packed size 0x00000000 dest 0xfde20000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000001
rec: offs 0x006bd630 unpacked size 0x00028db8 packed size 0x00003620 dest 0xfde40000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c0c50 unpacked size 0x00020000 packed size 0x00000000 dest 0xfdfc0000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000001
rec: offs 0x006c0c50 unpacked size 0x00000010 packed size 0x00000020 dest 0xfdf60000
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c0c70 unpacked size 0x00000822 packed size 0x000003b0 dest 0xfdf61c00
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c1020 unpacked size 0x00003a80 packed size 0x000009a0 dest 0xfdf6a800
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
Done
The output files are saved into the current directory.


Update. New fi2dec source version, no longer fails on a certain r55 file. Encoder part not tested.
old version removed
fi2dec_.7z (87.98 kB - downloaded 18 times.)
Update 2. Source updated to not fail on 64-bit systems. Zlib also updated to 1.2.11.
old version removed
fi2dec2015.7z (103.19 kB - downloaded 35 times.)
« Last Edit: 10 / May / 2019, 12:58:10 by srsa_4c »

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: fi2 encoder/decoder
« Reply #96 on: 30 / May / 2014, 06:20:21 »
Thanks for this, i added a link to this post on the wikia article - http://chdk.wikia.com/wiki/For_Developers/fi2offsets

BTW - the original files by ewvr & co. are still available from the CHDK Drive repo ('Development' section) - https://drive.google.com/?usp=folder&authuser=0#folders/0B08pqRtyrObja2U5RERBMG14Q0k

*

Offline mmcon

  • *
  • 10
Re: fi2 encoder/decoder
« Reply #97 on: 19 / June / 2014, 09:50:05 »
I'm attaching an archive with the original(?) source (thanks to the unknown person who kept it available and to c10ud for finding it).
I'm also attaching my version of fi2dec which is based on tools/packfi2 and the original fi2encdec source. This version is able to deal with new fi2 files too, just don't forget the -pv switch.
/code]The output files are saved into the current directory.

I am getting "Update File Error" for ixus200-sd980 101c using the srsa_4c package

Steps done ...
Used chdk shell.
Downloaded 1.3 rev 3467 as zip file.
unziped archive(in chdk shell), unchecked opt_fi2 in compile options. Compile selected (sd980 101c)
Copy DISBOOT.BIN into same folder as fi2encdec.exe.
Copy my.map file into same directory. which contains
Code: [Select]
FI2_MAP 1
; header
HDR 0x31E5 0x02230000 0x01000000 0x00000000 0x00000001
; data blocks
0x00000000 diskboot.bin boot

Ran fi2encdec -e -sys g10 ps.fi2
Code: [Select]
C:\Users\Home\Downloads\chdk\fi2encdec_src\fi2encdec_src\Release\Win32>fi2encd
ec.exe -e -sys G10 my.map ps.fi2
fi2encdec v1.0 - FI2 file processing utility.
THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND. THE AUTHOR
OF THIS SOFTWARE ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCES
RESULTING FROM THE USE, MODIFICATION, OR REDISTRIBUTION OF THIS SOFTWARE

MAP HDR: 0x000031E5 0x02230000 0x01000000 0x00000000 0x00000001
Processing diskboot.bin (0x00000000)
Saving ps.fi2
Verifying results
HDR 0x000031E5 0x02230000 0x01000000 0x00000000 0x00000001, 1 data blocks
 -> : part 1 [addr 0x00000000 size 114240    -> 146217   ]
ps.fi2 data checksum OK
Done

Copied ps.fi2 and diskboot.bin and other files from zip in the bin directory of chdkshell onto SD
Start camera via Play and chose FW update.

I gave up trying to find the key and iv from the dump. Maybe some kind soul can PM me the key and IV values for use in fi2.inc so I can build with fi2 option turned on. I simply couldnt figure out the base address and offset.

I read 0xFF810000 is the base address for For S / SD / SX / G-Series
When I load the primary.bin downloaded from
https://drive.google.com/folderview?id=0B08pqRtyrObjTVVmZURHeGVSR1E&tid=0B08pqRtyrObjTy11Y003Sk1lYTQ#list
into hexedit, I can only see upto 0x3FFBFF.



Re: fi2 encoder/decoder
« Reply #98 on: 19 / June / 2014, 12:38:58 »
I am getting "Update File Error" for ixus200-sd980 101c using the srsa_4c package
...
I gave up trying to find the key and iv from the dump.
You might find this more useful :

http://chdk.wikia.com/wiki/GPL:extract_fi2_keys.py

from http://chdk.wikia.com/wiki/GPL_Tools

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: fi2 encoder/decoder
« Reply #99 on: 20 / June / 2014, 03:15:16 »
Unfortunately the fi2 offsets table is treated very neglected...  ;)

http://chdk.wikia.com/wiki/For_Developers/fi2offsets

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal