supplierdeeply

setting up a 2 partition card using only the camera ?

  • 15 Replies
  • 10451 Views
*

Offline reyalp

  • ******
  • 9955
  • Publish
    setting up a 2 partition card using only the camera ?
    « on: 18 / April / 2009, 17:24:35 »
    Advertisements
    Is there a way to do this ?

    "Make card with two partitions" creates 2 partitions, but doesn't format them. You can reboot and format the large partition using the camera, but I don't see any way to format the small one. Swap partitions refuses to run if the other partition isn't formatted.

    If CHDK could format the small partition and copy diskboot.bin, dual partition setup could be done without needing a computer that understood multiple partitions on the SD card.
    Don't forget what the H stands for.

    *

    Offline whim

    • ******
    • 2013
    • A495/590/620/630 ixus70/115/220/230/300/870 S95
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #1 on: 18 / April / 2009, 19:31:02 »
    edited: at first i thought quietschi's method here: http://chdk.setepontos.com/index.php/topic,2155.msg25925.html#msg25925 would do it, but on rereading saw you still
    need external formatting for 1st partition ...
    sorry,
    wim

    BTW re your commute video: nice car to commute in, is that an Alpha Romeo spider ?
    « Last Edit: 18 / April / 2009, 19:45:41 by whim »

    *

    Offline PhyrePhoX

    • *****
    • 2253
    • make RAW not WAR
      • PhyreWorX
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #2 on: 19 / April / 2009, 06:47:39 »
    in camera formatting sounds a lot like lost data to me, if carried out by noobs ;)
    but other than that, sounds like a good idea.

    *

    Offline fe50

    • ******
    • 3034
    • IXUS50 & 860, SX10 Star WARs-Star RAWs
      • fe50
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #3 on: 19 / April / 2009, 07:20:06 »
    in camera formatting sounds a lot like lost data to me, if carried out by noobs ;)
    but other than that, sounds like a good idea.

    But since the "Make card with two partitions" also destroy noob's data, this shouldn't be a big problem...


    *

    Offline reyalp

    • ******
    • 9955
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #4 on: 19 / April / 2009, 15:05:02 »
    But since the "Make card with two partitions" also destroy noob's data, this shouldn't be a big problem...
    Canons own firmware also let your format the card. If we could swap to the second unformatted, we could even require users to do it through the UI (assuming the canon firmware will do that, and not just use the first formatted partition).

    I don't have time to really dig into this now, but playing with the 'make card with two partitions' option, I realized we have almost everything we need to set it up entirely using the camera, which would simplify things for windows users.

    @whim Triumph, as it says in the description.
    Don't forget what the H stands for.

    *

    Offline Thorwak

    • *
    • 26
    • a470
      • Nostalgia Public NetHack Server
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #5 on: 12 / June / 2009, 19:40:22 »
    I mentioned here http://chdk.setepontos.com/index.php/topic,3368.msg35090.html#msg35090 I was going to take a look at formatting the boot partition from within CHDK. I thought I could maybe adapt some existing code, but I ended up writing it from scratch, using wikipedia and similar a lot  :D And now I have something to be tested :)

    It's a fairly basic FAT12 formatter, but that is quite enough for small partitions like the boot partition (2 MB). This is a first step to be able to completely install a bootable CHDK once the first PS.FI? and DISKBOOT.BIN has been copied to the card from within the cam, yay :)

    I tested the new code on my 8 GB SDHC card this way:
    - Low level format card in camera to make sure nothing else would interfere. Card is now 8 GB FAT32.
    - Unpack the "small" build of CHDK directly to the card using PC
    - Start CHDK (Firmware update), "Create card with two partitions" (change name maybe to "Create boot partition?). CHDK now creates the boot partition as before, but also formats it using FAT12 and marks the partition bootable.
    - Card back in PC, re-unpack small CHDK dist to the 2 MB partition, write protect card.
    - Camera now boots on card :) -> "Swap partition"
    - Finally back in PC, format big partion, unpack full CHDK dist
    - Firmware update start method one more time, "Swap partition".

    There, no special card reader drivers nor manual boot sector hacking needed.

    Here's the diff (against trunk 766)
    http://nostalgia.suroot.com/chdk-a470-unofficial/patch-chdk-766-bootpart-fat12-formatting.txt

    Since the managers of CHDK may very well have opinions where I put the code and put it somewhere else (if it gets accepted), I didn't bother to change every single makefile for the platforms - just look at how it's done for a470. I first tried to put it in wrappers.c, but some platforms would bail out when trying a batchbuild (assembler errors, I think related to ARM 4k boundaries) so I had to put it in a separate object.

    Thinking ahead, it would be VERY nice to read DISKBOOT.BIN to temporary RAM before re-partioning the card and then write it back to the bootable partition. That is definately possible, but writing an entire FAT FS handler would be lots of work and would make CHDK bigger than it has to be. It may be possible to have the camera work from the new partition table without rebooting though. After all, it does this when you low-level format the card. Then one could use the built in file handing to do all the copying (should be trivial) and skip all file copying with the PC above, except the very first one.

    If one were to try to implement (safe) internal CHDK file handling without the camera knowing about the correct partition table, there would be a need for a _ReadSDCard. Has this been considered? Surely there must be a function in the firmware that reads raw sectors?

    Finally, it's of course tempting to try writing a similar formatter for FAT16 (not so different, I think) and FAT32 (wee, entire card prepared without even rebooting, that would be really cool  8) )

    Please do test and report, I have only tested my own a470 1.02c so far... If you happen to have a 470, prebuilt binaries are here: http://nostalgia.suroot.com/chdk-a470-unofficial/

    (And, don't forget to backup your card :P You WILL loose everything on it)


    Have fun!


    EDIT: Updated the makefiles etc after all (scripted it), bug fix in FAT allocation, root directory and volume label implemented. Test built binaries for all cams that have CAM_MULTIPART.
    Test binaries:
    http://nostalgia.suroot.com/chdk-build/bootpart-fat12format

    New patch (776)
    http://nostalgia.suroot.com/chdk-build/bootpart-fat12format/patch-chdk-776-bootpart-fat12-formatting-v2.txt

    « Last Edit: 14 / June / 2009, 07:04:20 by Thorwak »
    Do it 'til it Hz

    *

    Offline reyalp

    • ******
    • 9955
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #6 on: 13 / June / 2009, 19:34:03 »
    Just thinking out load at the moment, but on vxworks I'd expect we can do this all using normal OS calls.
    Don't forget what the H stands for.

    *

    Offline Thorwak

    • *
    • 26
    • a470
      • Nostalgia Public NetHack Server
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #7 on: 13 / June / 2009, 20:05:25 »
    Just thinking out load at the moment, but on vxworks I'd expect we can do this all using normal OS calls.
    Quite possibly (you mentioned you could format the partiions from within the cam without nuking the whole card as I understood it, so that makes sense). You'd have to have a way to make the camera re-read the partition table though without rebooting, but that is probably possible.

    On dryos it seems to wipe all of the card every time you do a format no matter what you do. :(

    I'd like to see something like:
    - copy diskboot.bin and ps.fi? to ram (compressed maybe). Worst case, copy to raw high sectors...
    - partition card, format both partitions, make bootable (fat12 resp. fat32)
    - write back diskboot.bin to bootpart, ps.fi? to data partition.

    That way one would only need to push a button once :) In fact, the entie -full.zip would fit on boot partition, so if we would copy to temporary blocks (some "rescue area" at end of card which won't be available on any partition perhaps? We're talking about 2 MB tops...) a full installation could be done this way.

    Sorry if it's hard to follow my thinking right now, I'm a little bit too tired.

    But you agree with the general idea then?

    Do it 'til it Hz


    *

    Offline Thorwak

    • *
    • 26
    • a470
      • Nostalgia Public NetHack Server
  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #8 on: 21 / July / 2010, 10:08:54 »
    Sorry for raising the dead (thread), but did this (fat12 formatter) ever make it into the SVN?

    I see the Wiki now references this as a alternative way for > 4GB cards ( http://chdk.wikia.com/index.php?title=Bootable_SD_card&diff=19968&oldid=19779   - Windows case 4) but if it relies on my very old test builds I think it should either be moved to trunk to be included in normal build, or wiki edited..

    I felt there was no interest in this line of work so I kind of dropped it after my last post, a bit over a year ago  ::)
    Do it 'til it Hz

  • Publish
    Re: setting up a 2 partition card using only the camera ?
    « Reply #9 on: 04 / August / 2010, 19:02:02 »
    Sorry for raising the dead (thread), but did this (fat12 formatter) ever make it into the SVN?
    I see the Wiki now references this as a alternative way for > 4GB cards ( http://chdk.wikia.com/index.php?title=Bootable_SD_card&diff=19968&oldid=19779   - Windows case 4) but if it relies on my very old test builds I think it should either be moved to trunk to be included in normal build, or wiki edited..

    I felt there was no interest in this line of work so I kind of dropped it after my last post, a bit over a year ago  ::)

    Sorry if I'm posting a bit off topic here, but at least I tried to follow the windows case #4 in the bootable sd card guide (I've got a 8 gb sdhc card), but the "Create card with two partitions" step doesn't seem to work as it should. After I've finished this step and put the back the sd card in my card reader, I only get an system message that the card is not formatted. I thought maybe it was because of my windows 7 (64 bit) didn't support reading fat16 cards, but maybe it's something wrong with the code instead? I'm running autobuild build 0.9.9, revision 918, on a powershot a590 (a590-101b-0.9.9-918). The first thing i wondered about was if i was supposed to get a confirm message after the "Create card with two partitions" step was completed? I'm not referring to the warning dialog about erasing content (I confirmed yes on this step), but after this I get no visual response that the partition process was done. Is this correct beaviour?

    As I wrote, I'm not sure if I'm doing something wrong, or if it's a bug in the code. Anyway, I think this function is really important, so thanks for your efforts anyway :)

     

    Related Topics