Possible bug in partitioning from within CHDK

  • 2 Replies
  • 680 Views
Possible bug in partitioning from within CHDK
« on: 24 / April / 2016, 01:27:21 »
Advertisements
On a PowerShot A570 IS with firmware v1.01a and CHDK v1.4.1, it is well documented that using an SD card 4GB or larger requires partitioning the card. Starting CHDK using the "firmware update method" -- http://chdk.wikia.com/wiki/Bootable_SD_card -- and then using the running CHDK to partition the card results in a first partition size of 2MB with partition type code 1 (FAT12), which does not work for autoboot.

The problem seems to be that too small a first partition causes it to be formatted FAT12 even if the type code is manually changed to 6 (FAT16). In order to have the first partition correctly formatted FAT16 instead of FAT12 it is necessary for it to have a minimum size of 16MB. The following partitioning works correctly on a 16GB card:

Code: [Select]
Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1  *     2048    34815    32768  16M  6 FAT16
/dev/sdb2       34816 31422463 31387648  15G  b W95 FAT32

This was tested on Ubuntu Linux 15.10. With the above partitioning, "mkfs.fat" works for both of the two partitions using defaults. The rest of the documented procedure for autoboot then works as documented: writing ASCII "BOOTDISK" into the first partition beginning at offset 0x40 (64 decimal), copying "DISKBOOT.BIN" and "PS.FIR" into the root directory of the first partition, copying everything else of the CHDK file tree into the root directory of the second partition, and setting the SD card write-protect tab.

*

Offline reyalp

  • ******
  • 11264
Re: Possible bug in partitioning from within CHDK
« Reply #1 on: 24 / April / 2016, 15:50:42 »
AFAIK FAT12 works fine for autoboot, or did on the cameras that were current at the time this code was implemented, which should include a570.
Don't forget what the H stands for.

Re: Possible bug in partitioning from within CHDK
« Reply #2 on: 24 / April / 2016, 18:30:39 »
I don't have an explanation beyond that I tried repeatedly without success letting the camera partition the card using CHDK, and it finally worked when I manually partitioned the card using Ubuntu Linux. The two files written to the small first partition are under 300KB together, so most of it is empty space even when the camera allocates 2MB. I can't see any difference trying increasingly larger partitions where 2MB, 4MB, and 8MB didn't work but 16MB did. Looking at the partition with a hex editor showed that the key change was from FAT12 to FAT16.
« Last Edit: 24 / April / 2016, 18:32:14 by mikebw »

 

Related Topics