mkfs.vfat -C "floppy.img" 1440
You now have an empty, but valid, floppy disk image. In order to copy files to the image, you need to mount the image using the loop device:
sudo mount -o loop,uid=$UID -t vfat floppy.img /mnt/floppy
Note that the mount command must either be run as root or using sudo; the uid argument makes the mount point owned by the current user rather so that you have permission to copy files into it.
After you're finished copying files, unmount the image and you're done. You can now attach it to your emulator of choice as a floppy disk image. W00t.
To make things even easier, the following script automates the entire process; just pass it the directory containing all of the files you want copied to the floppy disk and it'll do the rest.
#!/bin/bash
# Setup environment
FORMAT=$(which mkfs.vfat 2>/dev/null)
MOUNT=$(which mount 2>/dev/null)
TMP='/tmp'
shopt -s dotglob
# Verify binaries exist
MISSING=''
[ ! -e "$FORMAT" ] && MISSING+='mkfs.vfat, '
[ ! -e "$MOUNT" ] && MISSING+='mount, '
if [ -n "$MISSING" ]; then
echo "Error: cannot find the following binaries: ${MISSING%%, }"
exit
fi
# Verify arguments
if [ ! -d "$1" ]; then
echo "Error: You must specify a directory containing the floppy disk files"
exit
else
DISK=$(basename "${1}")
IMG="${TMP}/${DISK}.img"
TEMP="${TMP}/temp_${DISK}"
fi
# Load loopback module if necessary
if [ ! -e /dev/loop0 ]; then
sudo modprobe loop
sleep 1
fi
# Create disk image
${FORMAT} -C "${IMG}" 1440
mkdir "${TEMP}"
sudo $MOUNT -o loop,uid=$UID -t vfat "${IMG}" "${TEMP}"
cp -f "${DISK}"/* "${TEMP}"/
sudo umount "${TEMP}"
rmdir "${TEMP}"
mv "${IMG}" .