about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-22 23:09:30 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-22 23:09:30 -0800
commita451b2e14f06c19eaf98f32dcc2b45e2940a570b (patch)
tree308ea1de8534a582370d9b0cacded13484c8d3f3
parent328d76e4ef151adbc8d5d8608c0d77d091fc28fd (diff)
downloadmu-a451b2e14f06c19eaf98f32dcc2b45e2940a570b.tar.gz
7546 - baremetal: disk size check
-rwxr-xr-xtranslate_subx_baremetal6
-rwxr-xr-xtranslate_subx_baremetal_emulated6
2 files changed, 12 insertions, 0 deletions
diff --git a/translate_subx_baremetal b/translate_subx_baremetal
index 29750abb..adfa4aa0 100755
--- a/translate_subx_baremetal
+++ b/translate_subx_baremetal
@@ -38,3 +38,9 @@ dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
 apps/hex < baremetal/boot.hex  > boot.bin
 cat boot.bin a.bin > disk.bin
 dd if=disk.bin of=disk.img conv=notrunc
+
+if [ `stat --printf="%s" disk.bin` -ge 32256 ]  # 63 sectors * 512 bytes per sector
+then
+  echo "disk.bin won't all be loaded on boot"
+  exit 1
+fi
diff --git a/translate_subx_baremetal_emulated b/translate_subx_baremetal_emulated
index 6a75cac7..f73f09a5 100755
--- a/translate_subx_baremetal_emulated
+++ b/translate_subx_baremetal_emulated
@@ -32,3 +32,9 @@ dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
 ./bootstrap run apps/hex < baremetal/boot.hex  > boot.bin
 cat boot.bin a.bin > disk.bin
 dd if=disk.bin of=disk.img conv=notrunc
+
+if [ `stat --printf="%s" disk.bin` -ge 32256 ]  # 63 sectors * 512 bytes per sector
+then
+  echo "disk.bin won't all be loaded on boot"
+  exit 1
+fi