Author Topic: Porting chdk to the G9  (Read 45870 times)

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Porting chdk to the G9
« on: 19 / April / 2008, 19:27:38 »
Hello all,
this topic is aimed to concentrate the effort in order to have a working chdk for the canon powershot G9.

I'm a total newbie in this things like: assembling, disassembling, reverse engeenering, compiling etc., so I hope some of the developers could take to heart the issue and help us (G9 users interested in the porting) coordinating the job.

What we have/know:

1) G9 works with DryOs

2) G9 P-id

- should be 315A according to P-ID - CHDK Wiki

3) Fimware dumps:

- a complete dump made by Titan_G9 - Firmware G9 1.00D (from 0xFF810000 created by Titan_G9)
- 2 partitial dump of the Firmware G9 1.00f, one made by dew (not uploaded, at least as I know) and one made by me (avaible). Dew wrote that our two dumps are different.

The links to those firmwares can be found in G9 - CHDK Wiki

Useful links:

1) Knowledge

- G9 chdk wiki page at G9 - CHDK Wiki
- Loading dump to IDA at Loading dump to IDA - CHDK Wiki
- Dryos porting page at DryOS Porting - CHDK Wiki
- ADDING SUPPORT FOR NEW CAMERA at HDK/Adding support for new camera - chdk - Trac
- Property case list: PropertyCase - CHDK Wiki
- Modifying the CHDK Sources at Modifying the CHDK Sources - CHDK Wiki
- For Developers For Developers - CHDK Wiki
- Trunk /trunk - chdk - Trac

2) Video tutorials

- Happy dumping with IDA:

 - How to load dump in IDA 1:  "ida_load_g9"- Director: GrAnd
 - How to load dump in IDA 2: the  data offset method:
"ida_load_g9_with_offset"
- Director: GrAnd
 

3) Tools

- udumper at
- Winmerge at WinMerge
- Notepad++ and Hex Plug-in at .:: NOTEPAD++ ::.

4) Files

- Signatures and idc for Dryos at DryOS - some success
- Auto-generated Dryos signatures.h for CHDK at /trunk/tools - chdk - Trac - file signatures_dryos.h

Hope this helps
« Last Edit: 20 / April / 2008, 21:10:44 by bongo_bingo »

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #1 on: 19 / April / 2008, 19:44:13 »
What I'm doing at the moment:

I've loaded my dump in disassembler this way:

1) switched to Arm processor

2)- Rom start address: 0x00000000
   - Rom size: 0x003FFFFF

It seems that the instructions starts at ROM:0009BE00

I'm trying to apply the Dryos Signature:
 

- searching in the forum I've found this DryOS - some success
 GrAnd made IDA-signature file for DryOS firmwares (based on functions from A720 dump), wil this work for the G series?
 I'm trying
« Last Edit: 19 / April / 2008, 20:04:33 by bongo_bingo »

Offline tommi2water

  • Full Member
  • ***
  • Posts: 157
  • IXUS 220 HS Firmware: 1.00c
Re: Porting chdk to the G9
« Reply #2 on: 19 / April / 2008, 20:04:07 »
Hi,

have you already seen the signatures.zip in this message?

http://chdk.setepontos.com/index.php/topic,234.msg3146.html#msg3146

Best regards,
tommi


Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #3 on: 19 / April / 2008, 20:09:44 »
Hi,

have you already seen the signatures.zip in this message?

http://chdk.setepontos.com/index.php/topic,234.msg3146.html#msg3146

Best regards,
tommi




which differences with DryOS - some success ?

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
Re: Porting chdk to the G9
« Reply #4 on: 19 / April / 2008, 20:17:31 »
which differences with DryOS - some success ?


This is signatures for IDA, "official" release is here: http://grandag.nm.ru/hdk/CanonFW_A-Series_Signatures_for_IDA.rar (for all cameras, VxWorks and DRYOS).

Auto-generated signatures.h for CHDK build already in trunk: http://tools.assembla.com/chdk/browser/trunk/tools -  signatures_dryos.h and signatures_vxworks.h files.
« Last Edit: 19 / April / 2008, 20:24:31 by ewavr »

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
perhaps I am too much insufficient in order to help
« Reply #5 on: 19 / April / 2008, 20:23:23 »
which differences with DryOS - some success ?


This is signatures for IDA, "official" release is there: http://grandag.nm.ru/hdk/CanonFW_A-Series_Signatures_for_IDA.rar

Auto-generated signatures.h for CHDK build already in trunk: http://tools.assembla.com/chdk/browser/trunk/tools - file signatures_dryos.h


thanks ewavr

But should I compile signatures_dryos.h before using it in Ida?
« Last Edit: 19 / April / 2008, 20:26:56 by bongo_bingo »

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
Re: Porting chdk to the G9
« Reply #6 on: 19 / April / 2008, 20:25:44 »
But should I compile signatures_dryos.h before using it in Ida?

No. This signatures not for IDA.

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #7 on: 19 / April / 2008, 21:14:49 »
But should I compile signatures_dryos.h before using it in Ida?

No. This signatures not for IDA.

Ok!
how should I use it?

Loaded CanonFW_DryOS_A-Series.sig, running CHDK.idc -> 17:18:26
It takes a lot of time! :o (turion 64 tl 50, 2.5 Gb ram)
« Last Edit: 19 / April / 2008, 21:55:55 by bongo_bingo »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #8 on: 19 / April / 2008, 22:53:46 »
No. This signatures not for IDA.


how should I use it?


They are used automatically during the compilation.


I've loaded my dump in disassembler this way:
1) switched to Arm processor
2)- Rom start address: 0x00000000
   - Rom size: 0x003FFFFF


Incorrect.
Before loading, you should strip zeros at least in the beginning of file. Then load it from 0xFF810000 in the way shown at Loading dump to IDA - CHDK Wiki


- 2 partitial dump of the Firmware G9 1.00f, one made by dew (not uploaded, at least as I know) and one made by me (avaible). Dew wrote that our two dumps are different.


Just have checked. There are no differences between them, of course in part you dumped.
« Last Edit: 19 / April / 2008, 23:08:38 by GrAnd »
CHDK Developer.

CHDK Forum

Re: Porting chdk to the G9
« Reply #8 on: 19 / April / 2008, 22:53:46 »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #9 on: 19 / April / 2008, 23:32:25 »
Loaded CanonFW_DryOS_A-Series.sig, running CHDK.idc -> 17:18:26
It takes a lot of time! :o (turion 64 tl 50, 2.5 Gb ram)


4m 45s with all my actions from choosing the file to the readiness.
See flash movie - Loading G9 dump into IDA
« Last Edit: 19 / April / 2008, 23:59:07 by GrAnd »
CHDK Developer.

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #10 on: 20 / April / 2008, 11:35:28 »
Loaded CanonFW_DryOS_A-Series.sig, running CHDK.idc -> 17:18:26
It takes a lot of time! :o (turion 64 tl 50, 2.5 Gb ram)


4m 45s with all my actions from choosing the file to the readiness.
See flash movie - Loading G9 dump into IDA


Hello GrAnd,
thank for the movie, very clear I think it will be usefull for a lot of future developers.

I've made it wrong, the analisys went to 0x00000000 to eof, it tool more than 2 hours, I left the pc working alone.
No error, this is the log:

Executing function 'main'...
Plan  FLIRT signature: "DryOS Canon Firmware; A720-based"
Compiling file 'C:\Programmi\IDA\idc\CHDK.idc'...
Executing function 'main'...
*** START OF ANALYSIS ***
Searching for code...
Code found 86300 times
Please wait...
Using FLIRT signature: "DryOS Canon Firmware; A720-based"
Searching for tasks...
Tasks found 127 times
Please wait...
Searching for events...
Events found 286 times
Please wait...
Searching for strings...
Strings found 5131 times
Please wait...
Searching for references...
Refs found 71716 times
Please wait...
*** END OF ANALYSIS ***
Retrieving information from the database... ok

I'm restarting the analisys following yours direction, thanks again.

Are the sig and idc files you used the same present in http://grandag.nm.ru/hdk/CanonFW_A-Series_Signatures_for_IDA.rar ?
Can I use notepad to strip off the zeros?
« Last Edit: 20 / April / 2008, 11:54:52 by bongo_bingo »

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #11 on: 20 / April / 2008, 14:38:50 »
hELLO,
just finished the analisys the way GrAnd showed, but less things where found.
At this point I have a lack competence, I'm posting the Ida log hoping you can help me to understand what's wrong.

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #12 on: 20 / April / 2008, 15:05:02 »
Are the sig and idc files you used the same present in http://grandag.nm.ru/hdk/CanonFW_A-Series_Signatures_for_IDA.rar ?


Yes.


Can I use notepad to strip off the zeros?


No. It will replace some symbols, as notepad is textual editor, not binary.

edit: You can yse the following command line to strip your dump (empty.dum):
tail -c +638465 empty.dum | head -c 3345368 > PRIMARY.BIN
Both 'tail' and 'head' programs are in CHDK working environment for Windows.
« Last Edit: 20 / April / 2008, 15:14:54 by GrAnd »
CHDK Developer.

Offline bongo_bingo

  • Full Member
  • ***
  • Posts: 167
    • My photos at DA
Re: Porting chdk to the G9
« Reply #13 on: 20 / April / 2008, 15:25:22 »
Are the sig and idc files you used the same present in http://grandag.nm.ru/hdk/CanonFW_A-Series_Signatures_for_IDA.rar ?


Yes.


Can I use notepad to strip off the zeros?


No. It will replace some symbols, as notepad is textual editor, not binary.

edit: You can yse the following command line to strip your dump (empty.dum):
tail -c +638465 empty.dum | head -c 3345368 > PRIMARY.BIN
Both 'tail' and 'head' programs are in CHDK working environment for Windows.


ok,
I've used notepad++ to cut off the zeroes, will test tail-head in the afternoon.

bye

Have a nice sunday!

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #14 on: 20 / April / 2008, 16:08:28 »
will test tail-head in the afternoon.


Or, you can load your dump "as-is" directly to IDA with specifying the offset of data:
Loading G9 dump into IDA, episode 2 :)
« Last Edit: 20 / April / 2008, 16:11:51 by GrAnd »
CHDK Developer.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal