23 lines
384 B
Bash
Executable file
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"
|