URI: 
  TEXT View source
       
       # 2025-02-22 - Install SvarDOS In Virtual Machine
       
       I recently read an article about SvarDOS:
       
  HTML SvarDOS: DR-DOS Is Reborn As Open Source Operating System
       
  TEXT DR-DOS on Wikipedia
       
  HTML SvarDOS web page
       
       I installed SvarDOS both on real hardware and in two virtual
       machines, and it went pretty well.  I loved the minimal but highly
       functional default configuration.
       
       In this log entry, i will walk through the process of installing
       SvarDOS in qemu and dosbox-x running on Slackware64 15.0.  I am
       using dosbox-x-2025.02.01 and qemu-9.2.0, which are the latest
       versions from SlackBuilds at the time of writing this log entry.
       I also use kpartx from multipath-tools to mount the disk images.
       
  HTML dosbox-x-2025.02.01 SlackBuild
       
  HTML qemu-9.2.0 SlackBuild
       
  HTML multipath-tools-0.8.7 SlackBuild
       
       Download the SvarDOS stable build (20240915) and package ISO.
       
  HTML SvarDOS 1.44M floppy disk
       
  HTML SvarDOS package repository ISO
       
       I placed these in ~/dist/dos/os/svardos/20240915/ and unzipped the
       floppy image.
       
       # Install SvarDOS using Qemu
       
       SvarDOS supports FAT32, but i avoid it because it can be
       pathologically slow to repair using the free dosfsck.exe.  I accept
       the limitations of FAT16B as a trade-off for better compatibility and
       maintenance.  This limits partition sizes to 2G using the SvarDOS
       installer.
       
       There's a lot of FAT filesystem lore on the Internet.  For example, i
       read that keeping the partitions slightly under 1G results in a
       smaller cluster size, which greatly reduces disk space overhead,
       resulting in more space available for data.  Since i am using a
       virtual machine with practically limitless storage, i consider this
       a micro-optimization.
       
       Below is a table of FAT16 cluster size vs disk space efficiency.
       
           Cluster Size  Efficiency  FAT16 Partition Size
           ------------  ----------  --------------------
                     2K       98.4%              0-127 MB
                     4K       96.6%            128-255 MB
                     8K       92.9%            256-511 MB
                    16K       85.8%           512-1023 MB
                    32K       73.8%          1024-2047 MB
                    64K       56.6%             > 2047 MB
       
  HTML http://www.project9.com/fat32/
       
       I believe Windows NT could format FAT16 partitions up to 8G using 64K
       cluster sizes, but DOS was limited to 2G using 32K clusters.
       
       * * *
       
       Later in these instructions i answer "Y" to permit fdisk to create a
       partition with the maximum size.  With the 2G disk image, this uses
       a 32K cluster size, which is compatible with other versions of DOS.
       
       With a larger disk, it might use a 64K cluster size, which is
       not compatible with some versions of DOS.  I might need to answer "N"
       and enter 2000 as the partition size, to keep the partition under 2G.
       
       I can verify the cluster size of a FAT16 filesystem using the
       CHKDSK command.
       
           C:\>chkdsk c: /s | find "every cluster"
           
                    32.768 bytes in every cluster
       
       32.768 means the c: drive has the more compatible 32K cluster size.
       
       * * *
       
       My first DOS hard disk was 80M.  In comparison, 2G should be more than
       enough.  I use the raw disk image format for maximum compatibility
       with various virtual machine software.  I use a sparse file to
       conserve space on the host system.
       
           $ mkdir -p Qemu/svardos
           $ cd Qemu/svardos
           $ truncate -s 2G svardos.raw
       
       The last truncate command creates the 2G sparse raw disk image.
       Note, I didn't have to use the truncate command!  Alternatives
       are the dd or fallocate commands.
       
           * dd if=/dev/zero of=svardos.raw bs=1 count=0 seek=2G
           * fallocate -l 2G svardos.raw
       
       Create a shell script and run it to start qemu.  I use new-style qemu
       configuration options rather than the easier compatibility options.
       This allows a greater degree of control.
       
           $ cat >qemu-svardos.sh <<__EOF__
       #!/bin/sh
       DISK="/home/ben/Qemu/svardos/svardos.raw"
       CDROM="/home/ben/dist/dos/os/svardos/20240915/sv-repo.iso"
       FLOPPY="/home/ben/dist/dos/os/svardos/20240915/disk1.img"
       MACH="pc-i440fx-9.2,dump-guest-core=off,mem-merge=off,usb=off"
       SAND="on,obsolete=deny,elevateprivileges=deny,spawn=deny"
       SAND="${SAND},resourcecontrol=deny"
       SDL_AUDIODRIVER=alsa qemu-system-i386                          \
           -accel kvm                                                 \
           -machine "$MACH"                                           \
           -machine pcspk-audiodev=1                                  \
           -overcommit mem-lock=off                                   \
           -no-user-config                                            \
           -sandbox "$SAND"                                           \
           -msg timestamp=on                                          \
           -cpu max                                                   \
           -m 32M                                                     \
           -global i8042.kbd-throttle=on                              \
           -audiodev alsa,id=1                                        \
           -device sb16,audiodev=1                                    \
           -device VGA                                                \
           -drive format=raw,file="$FLOPPY",if=none,id=floppy1        \
           -device floppy,unit=0,drive=floppy1                        \
           -global isa-fdc.bootindexA=0                               \
           -drive format=raw,file="$DISK",if=none,id=disk1            \
           -device ide-hd,drive=disk1,bootindex=1                     \
           -drive file="$CDROM",media=cdrom,if=none,id=cd1            \
           -device ide-cd,drive=cd1,bootindex=2                       \
           -display sdl,gl=on,grab-mod=rctrl                          \
           -rtc base=localtime
       __EOF__
           $ chmod a+rx qemu-svardos.sh
           $ ./qemu-svardos.sh
       
       At the welcome screen, I press Enter to select English.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-1.png
       
       At the keyboard layout screen, I press Enter to select English (US).
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-2.png
       
       At the installation screen, I press Enter to Install SvarDOS.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-3.png
       
       At the partition screen, I select Run the FDISK partitioning tool,
       then press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-4.png
       
       At FDISK introduction, I press N to disable FAT32,
       then press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-1.png
       
       At FDISK Options, I press Enter to Create DOS partition or
       Logical DOS Drive.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-2.png
       
       At Create DOS Partition or Logical DOS Drive, I press 1 to
       Create Primary DOS Partition, then press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-3.png
       
       At Create Primary DOS Partition, I press Enter to use the maximum
       available size for a Primary DOS Partition and make the partition
       active.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-4.png
       
       At the partition screen, I press ESC to continue.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-5.png
       
       At FDISK Options, I press ESC to exit FDISK.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-2.png
       
       At You MUST restart your system for your changes to take effect,
       I press ESC to exit FDISK.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/fdisk-6.png
       
       At Your computer will reboot now, I press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-5.png
       
       At the welcome screen, I press Enter to select English.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-1.png
       
       At the keyboard layout screen, I press Enter to select English (US).
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-2.png
       
       At the installation screen, I press Enter to Install SvarDOS.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-3.png
       
       At the disk screen, I press Enter to select C: [2047 MiB, hda0]
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-6.png
       
       At the format screen, I press Enter to Format drive C:
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-7.png
       
       At the installation of SvarDOS to C: screen, I press Enter
       to Install SvarDOS.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-8.png
       
       It installs 32 packages.  When it is done, it shows a screen
       Your computer will reboot now.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-9.png
       
       I close the QEMU window to power off the virtual machine.
       
       This is equivalent to turning off the power while a PC is running. 
       By default, SvarDOS does synchronous I/O and does not use a cache.
       When at the prompt, the data is already written to disk, so it is OK
       to abruptly power off the machine.
       
       I edit the shell script to make the floppy the last boot option.
       
           $ ed qemu-svardos.sh
           1798
           /bootindexA/s/=0/=9/
           w
           1798
           q
       
       I run the shell script to start qemu again:
       
           $ ./qemu-svardos.sh
       
       It takes a moment to do the post-install steps.  When finished,
       it shows SvarDOS has been installed. Restart your computer now.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-10.png
       
       I run FDAPM to do a cold boot.
       
           C:\TEMP>\SVARDOS\FDAPM COLDboot
       
       It boots to the Welcome to SvarDOS screen.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-11.png
       
       The first thing i would like to do is enable access to the optical
       drive.  Unfortunately, the driver is not included on the install
       floppy.  I will need to copy it in place from the Linux host.  I
       close the QEMU window to power off the virtual machine.
       
       I create scripts to mount and unmount the disk image on the Linux
       host.  My uid and gid are both 1000.  Adjust the script to match
       yours.
       
           $ cat >mount-svardos.sh <<__EOF__
       #!/bin/sh
       disk="/home/ben/Qemu/svardos/svardos.raw"
       log="/mnt/fuse/svardos.log"
       dir="/mnt/svardos"
       part="1"
       
       # truncate log
       cat /dev/null >"$log"
       
       losetup -f "$disk"
       
       # wait a second, then probe the partitions
       sleep 1
       loop=$(losetup -j "$disk" | cut -d : -f 1)
       kpartx -av "$loop" >"$log" 2>&1
       
       # find the loop device
       loopdev=$(awk -v p=$part '
       /^add map / {
           i++
           parts[i] = $3
       }
       END {
           print parts[p]
       }' "$log")
       loopdev="/dev/mapper/$loopdev"
       
       # mount it
       mount -o uid=1000,gid=1000 "$loopdev" "$dir"
       __EOF__
           $ chmod a+rx mount-svardos.sh
           $ cat >unmount-svardos.sh <<__EOF__
       #!/bin/sh
       disk="/home/ben/Qemu/svardos/svardos.raw"
       dir="/mnt/svardos"
       
       # unmount the filesystem
       umount "$dir"
       
       # find loop device
       loop=$(losetup -j "$disk" | cut -d : -f 1)
       
       # detach loop device
       kpartx -d "$loop"
       losetup -d "$loop"
       __EOF__
           $ chmod a+rx unmount-svardos.sh
       
       To actually mount this disk image, i need to run these scripts as
       user root.  The first time around i need to create directories for
       the mount point and log file.
       
           $ su -
           # mkdir -p /mnt/svardos
           # mkdir -p /mnt/fuse
       
       Next i mount the disk image, the package ISO, copy the CD driver
       package, unmount everything, and exit the root shell.
       
           # /home/ben/mount-svardos.sh
           # mount -o loop,ro -t iso9660 \
               /home/ben/dist/dos/os/svardos/20240915/sv-repo.iso /mnt/cdrom
           # cp /mnt/cdrom/videcdd.svp /mnt/svardos/
           # umount /mnt/cdrom
           # /home/ben/unmount-svardos.sh
           # exit
       
       I boot SvarDOS to the welcome screen again.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-11.png
       
       I install the CD driver packages.
       
           C:\>pkg install videcdd.svp
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-12.png
       
       I use the excellent SVED editor to enable the CD driver in CONFIG.SYS.
       
           C:\>copy CONFIG.SYS CONFIG.BAK
           C:\>sved CONFIG.SYS
       
       I use the arrow keys to navigate to the ;DEVICE=C:\DRIVERS\VIDECDD...
       line.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-13.png
       
       I press Backspace to delete the leading ; character, uncommenting line
       DEVICE=C:\DRIVERS\VIDECDD\VIDE-CDD.SYS /D:SVCD0001
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-14.png
       
       I press Esc to open the SVED menu, press Down to select Save, and
       press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-15.png
       
       I press Esc to open the SVED menu, press Up to select Quit, and
       press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-16.png
       
       I use SVED to enable the CD driver in AUTOEXEC.BAT.
       
           C:\>copy AUTOEXEC.BAT AUTOEXEC.BAK
           C:\>sved AUTOEXEC.BAT
       
       I use the arrow keys to navigate to the REM SHSUCDX ... line.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-17.png
       
       I press the Backspace key 4 times to remove the "REM " prefix.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-18.png
       
       I press Esc to open the SVED menu, press Down to select Save, and
       press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-19.png
       
       I press Esc to open the SVED menu, press Up to select Quit, and
       press Enter.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-20.png
       
       I use FDAPM to do a cold boot.
       
           C:\>SVARDOS\FDAPM COLDboot
       
       I install the unzip program from CD.
       
           C:\>pkg install D:\unzip.svp
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-21.png
       
       I get the disk geometry from FDISK.
       
           C:\>FDISK /INFO
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/svardos-22.png
       
       Note the text "geometry 520/128/63" in the output.
       
       I close the QEMU window to power off the virtual machine.
       
       # Configure SvarDOS in DOSBox-X 
       
       I run dosbox-x to create an initial default configuration.
       
           $ dosbox-x
       
       This opens an initial DOSBox-X window.
       
   IMG gopher://tilde.pink/I/~bencollver/log/2025-02-22-install-svardos-in-virtual-machine/dosbox-1.png
       
       I exit DOSBox-X.
       
           Z:\>exit
       
       I make a backup copy of the DOSBox-X default configuration.
       
           $ cp .config/dosbox-x/dosbox-x-2025.02.01{,-orig}.conf
       
       I make the SvarDOS specific DOSBox-X configuration.
       
           $ cp .config/dosbox-x/dosbox-x-2025.02.01{,-svardos}.conf
       
       I edit the SvarDOS specific DOSBox-X configuration.  I change the
       memory size from 16 to 32M to match the qemu virtual machine.
       DOSBox-X needs the geometry for the raw disk image.  Note that FDISK
       in qemu reported "geometry 520/128/63" and that the sector size is
       512 bytes.  Thus the parameters "-size 512,63,128,520".
       
           $ ed .config/dosbox-x/dosbox-x-2025.02.01-svardos.conf
           104643
           /^memsize                   = 16/s/16/32/
           $
           
           a
       imgmount c /home/ben/Qemu/svardos/svardos.raw -size 512,63,128,520
       imgmount d /home/ben/dist/dos/os/svardos/20240915/sv-repo.iso -t iso -fs iso
       boot c:
       .
           w
           104814
           q
       
       I create a shell script and run it to start dosbox-x.
       
           $ cat >dosbox-svardos.sh <<__EOF__
       #!/bin/sh
       dosbox-x -conf /home/ben/.config/dosbox-x/dosbox-x-2025.02.01-svardos.conf
       __EOF__
           $ chmod a+rx dosbox-svardos.sh
           $ ./dosbox-svardos.sh
       
       That's it!
       
       # Configure SvarDOS Real Mode (16-bit)
       
       I can optionally configure dosbox-x to emulate a 16-bit 8086 processor.
       To do so, it is necessary to disable HIMEMX.SYS in CONFIG.SYS because it
       requires a 32-bit processor.  For the same reason it is also
       necessary to disable the CDROM driver in CONFIG.SYS and AUTOEXEC.BAT.
       Then i edit the dosbox-x-2025.02.01-svardos.conf file, changing
       memsize = 1 and cputype = 8086 to specify an 8086 processor with 1M of
       memory.
       
       Below is an article about CD-ROM drives on retro hardware.  The CD-ROM
       drives on 8086 and 80286 PCs were typically single-speed drives using
       proprietary controllers and drivers.
       
  HTML CD-ROM Drives In 286 And 386 PCs
       
       # Notes
       
       These steps create two virtual machines, one using dosbox-x and the
       other using qemu.  These both use the same disk image.  Make sure to
       power off one before powering on the other.
       
       
       The qemu virtual machine is accelerated using Linux KVM, which runs
       faster.
       
       The dosbox-x virtual machine provides a more accurate BIOS.  If your
       keyboard has a Num Lock key, then you can use Alt Codes to enter
       special characters in DOSBox-X.
       
  TEXT Alt code
       
       Alt codes do not work in qemu nor VirtualBox because of BIOS bugs.
       
  HTML VirtualBox BIOS bug that breaks Alt codes
       
       On a tangent, the calvin editor suffers screen corruption because of
       a bug in VirtualBox's CGA BIOS, INT 10, AH 05h,
       SELECT ACTIVE DISPLAY PAGE.
       
  TEXT VirtualBox CGA BIOS bug and calvin workaround
       
       I intentionally avoided network configuration in order to
       "keep it simple."
       
       
       The SvarDOS shell is brutally minimal.  The package CD includes 4dos
       for a more full-featured shell.
       
       
       tags: bencollver,retrocomputing,technical
       
       # Tags
       
   DIR bencollver
   DIR retrocomputing
   DIR technical