Memtest 86 on a compact flash card

Many embedded systems as well as other devices have the ability to boot from compact flash disks or other solid-state storage devices. This is great for systems that don't need or can't use a hard disk drive, but what happens when you need to test your RAM to make sure it's not going bad?

Memtest86 is an excellent tool for diagnosing memory errors. Many resellers and distributors use memtest86 to test a system's RAM before shipping to the customer. The problem arises when you need to boot this program from an embedded device that uses a solid-state storage disk. The memtest86 website provides the source and binaries and even an ISO image for booting from CD. This is great if your system has a CD-ROM but what if it doesn't?

Without a CD-ROM drive you could use rawrite to write the memtest86 to a floppy disk ... your embedded system has a floppy drive right? Of course not. So now what? You can't write the image itself to the flash disk and boot it like a floppy. Oh no, you need a boot loader to accomplish that. The memtest86 website doesn't offer an image with a bootloader. After all, your OS most likely has it's own bootloader that you could add an entry to boot memtest86 right?

Wrong yet again. The only option is to find a bootloader enabled image somewhere on the Internet and write it to your CF card. Well, looks like no one else has run into this problem (not from what I could find) so the last resort, do it yourself.

The process is quite simple:

  1. Download the memtest86 source and binary package
  2. Download syslinux so that we can use the memdisk feature
  3. Create a syslinux.cfg like so:

    default memtest86
    prompt 1
    timeout 10
    label memtest86
        kernel memtest

  4. Create an empty image for the CF (i.e. dd if=/dev/zero of=memtest.img bs=1k; count=1000;)
  5. Partition/Format your CF image with a FAT filesystem
  6. Copy the ldlinux.sys, syslinux.cfg, and memtest files to the CF image
  7. Execute syslinux on the CF (of course you have to build syslinux first)
  8. Done!

I may have left some steps out or was not clear so email me at