Writing an embedded filesystem on Compact Flash

I have an embedded Linux system which runs from a compact flash IDE drive (ext3).

I can read/write new flash cards on a PCMCIA adapter under Linux, but no-one else in the office can (using various versions of Windows). The biggest problem is in the field, where I have to send a physical flash card with updates, instead of an image for a field person to write directly to flash.

Is there a way to write an image to a flash card under Windows? Everything I can find relies on Windows recognizing the flash card as a DOS filesystem, which is not helpful to me at all.

Reply to
Iain Brown
Loading thread data ...

Have you looked into "rawrite"? I found this when looking at the program Explore2fs. Unfortunately, using this program won't let me see my ext2 partition on CF.

formatting link

formatting link

Cheers, Jason.

Reply to
Jason Curl

Not sure about Windows, but you can write disk tracks in DOS assembler. Alternatively, you can build a Linux bootable CD to dd the images. That's how we distribute our system anyway.

Reply to
Linnix

Hi Iain, If you install cygwin on the windows boxes, you can use dd to do a raw read and write to the compact flash:

mount -f -b //./F: /dev/cflash dd of=myfile.bin if=/dev/cflash bs=512 count=xxx dd of=/dev/cflash if=myfile.bin bs=512 count=xxx

Where F: is a free drive letter. The first dd command will read the raw data from the CF card, and save it to a file called myfile.bin. The second dd command will write the myfile.bin file to a compact flash card. In both cases, xxx is the number of 512 byte blocks you want to read or write.

I am looking for an embedded Linux distribution that will boot of a CF card, any pointers would be appreciated. Regards, Clive

__________________ Bundu Technology Ltd.

formatting link
Custom hardware & software, design and development. Windows, Palm, Linux & Embedded.

Reply to
clevinson

I've just starting to investigate this myself. I've used Fedora Core as the host, compiled 2.6.8.1 kernel with most features removed. Installed GRUB.

I can get it to boot the CF into the kernel, the next step is a small oeprating system. I'm just about to check out BusyBox and using the ucLibc

formatting link
and uclib.org)

I've also seen Pocket-Linux, peewee linux and another one, but they all require large amounts of RAM to hold the boot system, one requiring at least 55MB. And they used SysLinux from a DOS partition. I didn't like this idea, hence the native boot into an ext2fs CF partition.

I found a good article last night on Linux Journal written about two weeks ago, using 2.6 kernel for a diskless (actually CF) firewall and router. Take away the firewall and router, and I have almost exactly what I need.

If you have any luck, I'd be glad to hear from you.

Cheers, Jason.

Reply to
Jason Curl

Hi Jason, Thanks for the pointer to the Linux Journal article

formatting link
it is a useful introduction to getting Linux up and running on a CF card. I am just starting out on this project, and only started searching for Linux and CF resources yesterday, that is how I happened onto this thread. If I turn up anything interesting, I well let you know. Regards, Clive __________________ Bundu Technology Ltd.
formatting link
Custom hardware & software, design and development. Windows, Palm, Linux & Embedded.

Reply to
clevinson

Not mounted live, I hope! Yikes!

There are several ext2 (not ext3 afaik) implementations for Windows, some userspace ("exttool", "explore2fs", etc) and one or two kernelspace loadable filesystems (try ext2fsd, or perhaps ext2fsnt).

There are also assorted "dd" raw block-writing options as others have described. Be warned that these can be more interesting than reliable in cases where you have different brands, models, or even batches of flash device.

FWIW, I've always built devices with DOS filesystems on flash (which load and boot into a ram filesystem, thereafter ignoring flash). This way field personnel can manipulate the flash contents directly with a laptop, card reader, or by using built-in diagnostic/upgrade support.

--
Grant Taylor
Embedded Linux Consultant
http://www.picante.com/
Reply to
Grant Taylor

Or you can just

dd if=/dev/hdX of=cf_image swap CF, reboot and dd if=cf_image of=/dev/hdX

...

formatting link
contains info for boot images starting from 4M.

...

formatting link
requires minimum of 4M Flash and 16M RAM. it runs from native ext2 file system.

Most people use the 8M Flash Drive for firewalls and routers, for example: freesco and m0n0wall are popular on the linnix Compact Flash drive.

Reply to
Linnix

I've had nearly the same problem some time ago. The _only_ way i could manage this was to use Hex Workshop from

formatting link

But, and that's also not so simple, you need a pcmcia-adaptor, which is reading the card as a ide-drive. I tried some adaptors and only such adaptors seems to work which are 'cardbus'-compatible. So the most cardreader you should forget now, and many of the pcipcmcia-adaptors are also not usable. I'm using a notebook and a kingston pcmcia-adaptor for this.

If Windows is recognizing the plugged cf-card as a drive (but of course cannot read or write the partition), then you can use Hex-Workshop. It reads the card sector by sector and writes it in the same way. So i was able to clone cf-cards in windows, which has two partitions (ext2 and reiser) and lilo in it's MBR, and they are working fine. Even microdrives are working in this way.

Now my customers can write and backup their cf-cards by themself, if they have this program.

regards, Jens

--
Die o.a. Adresse ist OK, wird aber nicht gelesen. Für Mails an mich bitte
"spamtrap" durch "jens.nixdorf" ersetzen.
Reply to
Jens Nixdorf

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.