DryOS - some success - DryOS Development - CHDK Forum  

DryOS - some success

  • 220 Replies
  • 183498 Views
*

Offline jeff666

  • ****
  • 181
  • A720IS
DryOS - some success
« on: 27 / December / 2007, 10:55:47 »
Advertisements
During the last days I poked around a bit in DryOS. This posting reports what I did and what works.

After making sure that the restart-function does actually restarts the cam (and provoke a boot-loop by reloading diskboot.bin) I took the original CHDK-Loader-framework and duplicated parts of the original firmware into the loader.

Copying data and bss is done using the existing CHDK-functions. I didn't relocate anything, yet.

I had to duplicate more than previously necessary (6 functions, till now) since the SD is initialized right before diskboot.bin is loaded. So I had to change the diskboot-loader which is called later than in VxWorks.

What works:
Right now I control the boot-process until right after my modified diskboot-loader is called. Right after that I return control to the firmware which does the rest of the start.

What needs to be done:
- Hook own code so it is called during normal operation. There is a function called "CreateProxyOfEventProcedure". Maybe this can be used as a hook. The other thought is to register a Task using "CreateTask" (and hope it gets called regularly).
- turn off the card lock.
- find the location of useful functions, create signature-files for findsig

(unsolved) Problem:
I duplicated the function that calls the diskboot-loader. This function calls about 20 other subs. My copy called a modified diskboot-loader that just initializes the SD. For some unknown reason one of the following calls doesn't return.
However if I jump into the original function, the camera starts correctly. Is it possible that my code is overwritten?

Here is my progress so far: http://www.zshare.net/download/5952071a9847ef/
The interesting file is platform/a720/sub/101c/boot.c

To demonstrate that something happens, the blue LED blinks and is turned on at the start.
The code works on a A720IS ver. 1.01C

Cheers.

*

Offline jeff666

  • ****
  • 181
  • A720IS
Re: DryOS - some success
« Reply #1 on: 28 / December / 2007, 10:27:59 »
Minor update:

I solved the problem about the possibly overwritten code. It seems as it has actually been overwritten. The bug disappeared after moving the .bss offset up by the usual amount (0x20000).

My copy of task_Startup now runs completely and the camera boots as expected.

I also had success creating a new task, but I'm a little short on information about tasks.
Is a task comparable to a process on a modern OS?
Will it get interrupted by a preemptive scheduler?
Any other interesting details about handling tasks?

Cheers.

*

Offline lukg

  • ***
  • 162
  • Eos 450D+18-55is+55-250is & Powershot S5is - 1.01a
Re: DryOS - some success
« Reply #2 on: 28 / December / 2007, 10:45:12 »
I'm with you jeff, my s5 thanks you!
I hope you will succeed to port chdk on dryos camera

*

Offline jeff666

  • ****
  • 181
  • A720IS
Re: DryOS - some success
« Reply #3 on: 28 / December / 2007, 19:46:00 »
Good news for the S5 users. I had a quick look into the S5 firmware and it's pretty much identical to the A720. There are a few minor changes, I noticed a source file was renamed but the functions remain the same.

Everything that's necessary to control the boot process can be identified within a few minutes.

Also some further progress on DryOS in general.
I created a new task that blinks an LED during normal operation. Task handling seems to be identical to the old OS. C-calls work well (no need to write everything in assembly - yay :D)
Bad news: there's probably no equivalent to taskCreateHookAdd. This is a little unfortunate but we can still create own tasks and at least "PhySw" can be redirected easily since it is started directly from task_Startup.

Tomorrow I plan to
- do graphics output (using existing CHDK code)
- hook the keyboard (using CHDK as well)
- get rid of the card lock.

Cheers.


*

Offline Mantulen

  • *
  • 2
  • Canon S5 IS
    • My Flickr!
Re: DryOS - some success
« Reply #4 on: 29 / December / 2007, 01:03:08 »
Jeff, you are the man!  I have a S5, and I am looking forward to your progress!  :)

Re: DryOS - some success
« Reply #5 on: 29 / December / 2007, 14:33:23 »
Hi, Jeff.

I've got a720 recently, and going to investigate it.
Earlier I done some work for s2is.

For now, I got the dump and making some RE on it.

I'll be online after 2008-01-13. so mail me, and let's do it together.

Sorry my poor english :)

*

Offline jeff666

  • ****
  • 181
  • A720IS
Re: DryOS - some success
« Reply #6 on: 29 / December / 2007, 16:10:16 »
Quote
I've got a720 recently, and going to investigate it.
Earlier I done some work for s2is.

It's great that there's more devs interested in DryOS support. I think it will be helpful that you know how CHDK should work, both internally as well as how it "looks".

Before you start, check the version of your A720 firmware. The available firmware (from my camera) is a 1.00C. You might need to dump yours if you have a different version.

I suppose you read the DryOS-porting-article in the wiki.

Quote
I'll be online after 2008-01-13. so mail me, and let's do it together.

That means you won't be available till Jan, 13th? I'm back at work from Jan, 8th and will work on CHDK till then. Won't have much time afterwards, though.

Anyways, here's the current progress:
- boot works (all in platform/a720/sub/100c/boot.c)
- keyboard is hooked but calls firmware-functions. No kbd-specific CHDK-code, yet.
- some entry-points have been found out and manually added to stubs_entry_2.S
- a proof-of-concept task is started that blinks an LED but it might be useful to tweak stuff that's not available during startup.

The thing that nags me the most, currently, is the card lock. In case you're available these days, you could check how to solve this.

Here's the file: http://www.zshare.net/download/6009710faa4a9a/
I also added a dump of the IDA function list to the archive. It might be useful.

Quote
Sorry my poor english :)

What's you native language?

Btw: Happy hacking :)

Cheers.

Re: DryOS - some success
« Reply #7 on: 29 / December / 2007, 17:12:47 »
Quote
I suppose you read the DryOS-porting-article in the wiki.

I've already read that article and done some research on dump (by IDA).

Quote
That means you won't be available till Jan, 13th? I'm back at work from Jan, 8th and will work on CHDK till then. Won't have much time afterwards, though.

Tomorrow I going to my "new year" rest, jan 13th'll be back for my main work and work on CHDK.

Quote
I also added a dump of the IDA function list to the archive. It might be useful.

Thanks, I've downloaded it, will check it after holidays...

Quote
What's you native language?

Russian.





*

Offline jeff666

  • ****
  • 181
  • A720IS
Re: DryOS - some success
« Reply #8 on: 29 / December / 2007, 17:49:42 »
Quote
Tomorrow I going to my "new year" rest, jan 13th'll be back for my main work and work on CHDK.

I assume you will find a much more advanced state of the dryos port when you return. I will document major progress in this thread and fill you in with details if things are unclear.

Enjoy your holidays.

Cheers.

*

Offline DataGhost

  • ****
  • 314
  • EOS 40D, S5IS
    • DataGhost.com
Re: DryOS - some success
« Reply #9 on: 31 / December / 2007, 06:10:17 »
Nice work!
I have an S5 and quite some programming experience, so I looked into it a bit... unfortunately I figured out that it's quite hard to start from scratch on ARM ASM and CHDK in general (I don't really know any of the CHDK code, though ARM ASM is quite easy... but still I get lost in the disassembly), so I couldn't really contribute there. All I really managed was to get some lights to blink in C and ASM, but that's nothing compared to what you did.
Anyway, if you need any help on the S5 part (I understand you do not have it), I'd be happy to help out whereever I can. In the meantime, I hope your progress (reports) will help familiarize myself with the code a bit. For that, it would be nice to have some more detailed reports on what you did exactly, though, if that's not too big of a hassle for you.
« Last Edit: 31 / December / 2007, 06:12:10 by DataGhost »

 

Related Topics