An example to build disk image directly
#!/bin/sh
B=16 # cylinders
P1=100 # cylinders
P2=200 # cylinders
dd bs=1k count=16 if=/dev/zero of=0 # Linux disk first 16k stores MBR and partition table
dd bs=1k count=$((P1*64-$B)) if=/dev/zero of=1
dd bs=1k count=$((P2*64)) if=/dev/zero of=2
printf "nn\np\n1\n\n$P1\na\n1\nn\np\n2\n\n$P2\nw\nq\n" | fdisk -H 4 -S 32 -C $(($P1+$P2)) 0
mke2fs -F 1
mount -o loop 1 /mnt
cp files /mnt # copy your files to partition 1
umount /mnt
mke2fs -jF 2
mount -o loop 2 /mnt
cp files /mnt # copy your files to partition 2
umount /mnt
cat 0 1 2 > image.dd
Load image to disk
# dd if=image.dd of=/dev/sda
# fdisk -l /dev/sda
Disk /dev/sda: 32 MB, 32702976 bytes
4 heads, 32 sectors/track, 499 cylinders
Units = cylinders of 128 * 512 = 65536 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 100 6384 83 Linux
/dev/sda2 101 200 6400 83 Linux