This is much more complicated than necessary ... the problem is, making a bootable (!!) FAT partition using only free linux tools. This procedure did work for me
disk="$1" parted -s ${disk} mklabel msdos sleep 1 sfdisk -D -uM ${disk} <<EOF ,32,06,* ,,0c, EOF sleep 1 mkdosfs ${disk}1 mkdosfs ${disk}2 dd if=/usr/lib/syslinux/mbr.bin conv=notrunc of=${disk} bs=440 count=1 syslinux ${disk}1 mcopy -i ${disk}1 vmlinuz initrd.img syslinux.cfg ::
The problems are
mformat
can create bootable partitions but hangs for no reasonsfdisk
fails on a disk without a partition tablesyslinux
didn't work with FAT32parted
did not create properly aligned partitions for DOSparted
cannot automatically derive the size of a partition to create from the available spacemakebootfat
did not accept the ldlinux.bss
file from the syslinux
source distribution