Working on it. That mkimage script looks incomplete, with empty or missing functions. But it contains the fdisk commands.
I managed to have the msdos partition created but the next breaks on "partition extends past end of unit"
This is what I pulled out of mkimage, rpi.conf and evbarm.conf. I have no idea how this is to be used in the way it comes with the source tree...
make_label_evbarm() {
local totalsize=$(( ${size} / 512 ))
local bootsize=$(( ${boot} * 1024 ))
local bootoffset=$(( ${init} * 1024 ))
local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
local aoffset=$(( ${bootoffset} + ${bootsize} ))
local bps=512
local spt=32
local tpc=64
local spc=2048
local cylinders=$(( ${totalsize} / ${spc} ))
cat << EOF
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: ${bps}
sectors/track: ${spt}
tracks/cylinder: ${tpc}
sectors/cylinder: ${spc}
cylinders: ${cylinders}
total sectors: ${totalsize}
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
8 partitions:
#size offset fstype [fsize bsize cpg/sgs]
a: ${asize} ${aoffset} 4.2BSD ${fsize} ${bsize} 0 #
c: ${totalsize} 0 unused 0 0 #
e: ${bootsize} ${bootoffset} MSDOS #
EOF
}
size=1536
image=test.img
init=32
msdosid=14
init=32
boot=$(( 192 - ${init} ))
initsecs=$((${init} * 1024))
bootsecs=$((${boot} * 1024))
alignunit=$((4*1024*1024))
alignsize=$((alignunit*((size + alignunit - 1)/alignunit)))
alignsize=$((alignsize + 1024*1024))
if [ "${size}" -lt "${alignsize}" ]; then
dd bs=1 count="$((alignsize - size))" if=/dev/zero >> "${image}" 2> /dev/null
size="${alignsize}"
fi`
fdisk -f -i ${image}
fdisk -f -a -u -0 -s ${msdosid}/${initsecs}/${bootsecs} -F ${image}
make_label_evbarm > ./tmplabel
/sbin/disklabel -R -F ${image} ./tmplabel