Sunday, May 12, 2013

Use bochs on Ubuntu

Install packages:

sudo apt-get install bochs
sudo apt-get install bochs-x
sudo apt-get install bochs-sdl
sudo apt-get install bochs-term

BIOS ROM image is installed by package bochsbios.
  -  /usr/share/bochs/BIOS-qemu-latest
  -  /usr/share/bochs/BIOS-bochs-legacy
  -  /usr/share/bochs/BIOS-bochs-latest
  -  …

/etc/bochs-init/bochsrc: is NOT loaded.

Multiple display libraries are supported (e.g. sdl, x, term). You can change it by setting "display_library".

if you use term as display library, to quit simulation, run command "kill -HUP <process_id>" in a separate console.

Create an empty floppy image: dd if=/dev/zero of=flooy-drive/floppy.img bs=512 count=1

Copy binary to the floppy image: dd if=<name>.bin of=floppy-drive/floppy.img

Cygwin notes

mount a windows directory: mount -o noacl -f "c:/Program Files" "/mount/programfiles"

Disable permission check when accessing Windows files:
  - Add the following line to /etc/fstab:  none /cygdrive cygdrive binary,posix=0,user,noacl 0 0 

Symbolic links:

A useful script:

#! /bin/bash

function conv() { 
  file="$1" 
  target="$(readlink $file)" 
  echo "file is $file; target is $target" 
  rm "$file" 
  #ln -s "$target" "$file" 
  # mkshortcut -n "$file" "$target" 
  winEscapedTarget="${target//\//\\}" #convert to windows path separator 
  winEscapedTarget="${winEscapedTarget//\\\\/\\}" #change \\ to \ 
  winEscapedFile="${file//\//\\}" #convert to windows path separator 
  winEscapedFile="${winEscapedFile//\\\\/\\}" #change \\ to \ 
  echo /cygdrive/c/Windows/System32/cmd.exe /c mklink "$winEscapedFile" "$winEscapedTarget" 
  /cygdrive/c/Windows/System32/cmd.exe /c mklink "$winEscapedFile" "$winEscapedTarget" 
  echo "re-link is done!" 
}

if [ $# -gt 0 ]; then 
  basedir="$1" 
  if [ -d "$basedir" ]; then 
    cd "$basedir" 
    if [ $? -ne 0 ]; then 
      echo "cannot cd to $basedir" 
      exit 1 
    fi 
  elif [ -f "$basedir" ]; then 
    cd "`dirname $basedir`" 
    file="`basename $basedir`" 
    echo "pwd is `pwd`" 
    conv "$file" 
    exit 0 
  else 
    echo "parameters are invalid" 
    exit 1 
  fi 
fi