trios/scripts/mkdisk.sh
2023-04-28 19:17:17 -04:00

23 lines
384 B
Bash
Executable file

#!/bin/sh
DISKSIZE_MB=16
DISK=disk.img
OFFSET=1048576
dd if=/dev/zero of="$DISK" bs=1M count="$DISKSIZE_MB"
sfdisk "$DISK" <<EOF
label: dos
label-id: 0x7c295044
device: disk.img
unit: sectors
sector-size: 512
disk.img1 : start= 2048, size= 30720, type=4
EOF
LOOPDEV="$(losetup -f)"
losetup "$LOOPDEV" "$DISK" -o "$OFFSET"
mkfs.fat -F16 "$LOOPDEV"
losetup -D "$DISK"