CFtool is a simple console-mode application to aid in setting up a Compact Flash memory card for use as a bootable disk device in an Embedded PC. Although CF cards can be considered 'just disks', they cannot be easily managed using the Windows operating system, as none of the standard tools will allow the user direct access to the card's contents. ***NOTE*** These tools DO require Administrator-level access on the computer on which they are run! The tools don't do much at all without that access.. This new tool handles tasks like transferring images of partitions from and to the CF card, and so on. The program can be started without arguments to see what their calling syntax (usage) is. For example, P:\ALIX> cftool DUTCH*Star CF Image Transfer Tool V1.0.6 Copyright 2011,2012 MicroWalt Corporation. Usage: cftool [-dqv] [-bblksz] [-ooffset] [-sskip] [-llength] [-LIRW] [drive] [args] -L -I -R -W list show copy copy available drives detailed info on a drive data from drive to image file data from image file to drive P:\ALIX> _ Although this may look a bit scary, relax: most of these options will never be used by most people, as they are mostly intended for advanced users who have to perform some complex operation on a card. The 'v' option means verbose. Most of my tools have both this and the 'd' (debug) option, where more options on the commandline mean a higher level, thus '-v -v -v' (or '-vvv') means a verbose level of 3. This use of an option allows the amount of blah to be controlled :) Where the 'v' (verbose) and 'd' (debug) options cause more data to be displayed by the program, the 'q' (quiet) option does exactly the opposite: in quiet mode, the program will run quietly unless an error occurs. The 'CFtool' program can be used to transfer image files from and to the CF card, but before we do so, we first must find out what the drive number of the CF card is in Windows; this usually depends on how the card is connected to the PC, for example. To get a list of (usable) disk devices, start up the program with just the -L option, which should produce a list of usable devices for the program: P:\ALIX> cftool -L DUTCH*Star CF Image Transfer Tool V1.0.6 Copyright 2011,2012 MicroWalt Corporation. Available drives: 0 size = 100030242816 (93 GB) 1 unavailable (empty socket?) 2 size = 4017807360 (3831 MB) 3 unavailable (empty socket?) 4 unavailable (empty socket?) P:\ALIX> _ On this PC, we have the system drive (normally referred to as the "C" drive), and we have an USB-connected multi-cardreader device, one of which' sockets is holding our 4GB CF card. Some of those cardreader devices always enable all their sockets (which is the case on the one we use here), and some of them will only activate a socket if there is a card in that socket, so your display may look very different. Since we know that we only have one system disk and one possible CF card, we can assume that disk 2 is the one we would like to work with. However, if there is any doubt at all, or if want to see additional parameters of that device, you can use the -I command to tell the program to show more info: P:\ALIX> cftool -I 2 DUTCH*Star CF Image Transfer Tool V1.0.6 Copyright 2011,2012 MicroWalt Corporation. Disk: PhysicalDrive2 [Drive Geometry] Device size (LBA) Active C/H/S Bytes per sector Device size (CHS) = = = = 4017807360 (3831 MB) 488/255/63 512 4013936640 (3827 MB) [Adapter & Device properties] Bus type = USB Removable device = Yes Device hotplug = Yes Media hotplug = No Vendor = Myson Product = CS8819A2-111 Revision = 1.01 1 P:\ALIX> _ As expected, this indeed looks like the 4GB card we have in the cardreader, so all is good. The remaining two commands are 'R' (to read the contents of the card into an image file on disk) and 'W' (to write the contents of an image file back to the CF card. Reading the contents of a CF card into an image file on disk is easy- just specify the device number and the name of an image file to write to: P:\ALIX> cftool -R 2 test.img DUTCH*Star CF Image Transfer Tool V1.0.6 Copyright 2011,2012 MicroWalt Corporation. Device written to image file. [Operation] Passes: 1 Errors: 0 Read Bytes: Avg. read speed: Max/Min read speed: 4017807360 (3831 MB) 8838899 (8631 KB/s) 0 (0 B/s) / 0 (0 B/s) P:\ALIX> _ Obviously, it will take a while to read all the data from the card into the image file- the exact time depends on the speed of the CF card, the speed of your computer, and so on. During the operation, the program will try to adjust itself to optimize its I/O throughput, so normally, you don't have to provide any other options. Sometimes, it may save time if only part of the CF card is read and written to an image file. For this purpose we can use the 'o' (starting offset in blocks) and 'l' (length of data to read, in blocks) parameters. These default to 0 (first block of the card) and 'all blocks on the card', respectively. So, a command like: P:\ALIX> cftool -o 20000 -l 1024000 -R 2 test.img would read a total of 1024000 blocks (sectors) from the CF card, starting at block number 20000. This comes in handy if only parts of the card, for example a single partition, have to be copied. Writing image files onto a CF card is just as easy in most cases; we just specify the device number and the name of an image file to write to the device. For example, the command: P:\ALIX> cftool -b 1048576 -W 2 test.img DUTCH*Star CF Image Transfer Tool V1.0.6 Copyright 2011,2012 MicroWalt Corporation. Image file written to device. [Operation] Passes: 1 Errors: 0 Write Bytes: 4017807360 (3831 MB) Avg. write speed: 6125708 (5982 KB/s) Max/Min write speed: 6315473 (6167 KB/s) / 1899827 (1855 KB/s) P:\ALIX> _ will write the image file named 'test.img' onto the CF card known to the system as 'disk 2', using a blocksize of 1MB (1048576 bytes.) In the case of writing files, we sometimes get better results using different blocksizes; the default blocksize is the size (in bytes) of a single sector, usually 512 bytes. By specifying a larger size, it usually (but not always) results in faster transfer speeds. As with reading only parts of devices into a file, we can also tell the program to write only a part of the image file to the CF card. The 'o' option again tells it which device (CF card) block to start on (defaulting to 0, start of the card), and the 'l' option again tells it how many blocks to transfer (defaulting to 'all of image file'.) We also have the 's' (skip) option, which tells the program how many blocks of the image file to skip before starting to really read data from it. Obviously, this parameter, too, defaults to 0. Enjoy, Fred PA4YBR, info@dutch-star.eu The DUTCH*Star Project http://www.dutch-star.eu/