force 1-1 logical to physical sectors

copy our VBR code to backup VBR
This commit is contained in:
2024-10-11 12:04:44 -04:00
parent ab21f9c838
commit 94034eb7bf

View File

@@ -69,7 +69,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# get first partition, this is sloppy might need to review this... # get first partition, this is sloppy might need to review this...
firstpart=$(lsblk -ilp -o NAME $ld | tr '\n' ' ' | awk '{print $3}') 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 # copy MBR while preserving partition table
if ! dd if=$mbr_file of=$ld bs=1 count=440; then if ! dd if=$mbr_file of=$ld bs=1 count=440; then
@@ -100,6 +100,12 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
exit 1 exit 1
fi 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 #stage2 to sectors 1-64
if ! dd if=$stage2_file of=$ld bs=$disk_sector_size seek=1; then if ! dd if=$stage2_file of=$ld bs=$disk_sector_size seek=1; then
echo "Failed to write Stage2 to disk." >&2 echo "Failed to write Stage2 to disk." >&2