From aff631f3db2c1ed847070dba016ec0c114cde423 Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Fri, 11 Oct 2024 12:04:44 -0400 Subject: [PATCH] force 1-1 logical to physical sectors copy our VBR code to backup VBR --- scripts/create-disk.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/create-disk.sh b/scripts/create-disk.sh index 2d1928b..3d97aa5 100755 --- a/scripts/create-disk.sh +++ b/scripts/create-disk.sh @@ -69,7 +69,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # get first partition, this is sloppy might need to review this... firstpart=$(lsblk -ilp -o NAME $ld | tr '\n' ' ' | awk '{print $3}') - mkfs.fat -v -F32 -n 'STEVIAFS' $firstpart + mkfs.fat -v -F32 -s 1 -n 'STEVIAFS' $firstpart # copy MBR while preserving partition table if ! dd if=$mbr_file of=$ld bs=1 count=440; then @@ -100,6 +100,12 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then exit 1 fi + # write backup VBR + if ! dd if=$firstpart of=$firstpart bs=$disk_sector_size count=1 seek=6; then + echo "Failed to copy VBR (sector 1) to backup VBR." >&2 + exit 1 + fi + #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