diff --git a/scripts/create-disk.sh b/scripts/create-disk.sh index 3d97aa5..f1aba13 100755 --- a/scripts/create-disk.sh +++ b/scripts/create-disk.sh @@ -71,6 +71,10 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then firstpart=$(lsblk -ilp -o NAME $ld | tr '\n' ' ' | awk '{print $3}') mkfs.fat -v -F32 -s 1 -n 'STEVIAFS' $firstpart + # + # MBR setup + # + # copy MBR while preserving partition table if ! dd if=$mbr_file of=$ld bs=1 count=440; then echo "Failed to write MBR to disk. (part 1)" >&2 @@ -83,6 +87,10 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then exit 1 fi + # + # VBR Setup & backup VBR + # + # copy VBR to partition 1 while preserving partition information # copy jmp short entry; nop if ! dd if=$vbr_file of=$firstpart bs=1 count=3; then @@ -106,6 +114,11 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then exit 1 fi + + # + # Stage2 Setup + # + #stage2 to sectors 1-64 if ! dd if=$stage2_file of=$ld bs=$disk_sector_size seek=1; then echo "Failed to write Stage2 to disk." >&2 @@ -132,6 +145,10 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then exit 1 fi + # + # Final Cleanup + # + # detach loop device umount $mount_point sync