From 350a255134c7d7efb6d6c456c8d50bf15f96f26d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 10 Aug 2021 08:59:00 -0700 Subject: [PATCH] new tool: creating a data disk --- shell/README.md | 8 +++++++- tools/image-data | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 tools/image-data diff --git a/shell/README.md b/shell/README.md index 2843d0f1..3431638a 100644 --- a/shell/README.md +++ b/shell/README.md @@ -22,7 +22,13 @@ Currently runs a tiny dialect of Lisp. Steps to run it from the top-level: dd if=shell/data.limg of=data.img conv=notrunc ``` - Run with data disk (and 2GB of RAM): + Equivalently, use `tools/image-data`. + + ```sh + tools/image-data 10 < shell/data.limg + ``` + +3. Run with data disk (and 2GB of RAM): ```sh qemu-system-i386 -m 2G -hda code.img -hdb data.img ``` diff --git a/tools/image-data b/tools/image-data new file mode 100755 index 00000000..fe46e310 --- /dev/null +++ b/tools/image-data @@ -0,0 +1,12 @@ +#!/bin/sh +# Create a disk image containing some (text) data. + +if [ $# -eq 0 ] +then + echo "Fill disk of some capacity (in MB) from stdin" + echo "usage: image-data capacity" + exit 1 +fi + +dd if=/dev/zero of=data.img count=$(($1*2016)) # 32 * 63 sectors/track +dd of=data.img conv=notrunc