Index: contrib/conf/HelenOS.amd64.simics
===================================================================
--- contrib/conf/HelenOS.amd64.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/HelenOS.amd64.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,57 @@
+#
+# Simics 3.0 AMD64 configuration
+#
+
+$num_cpus      = 2
+$cpu_class     = "x86-hammer"
+$freq_mhz      = 50
+
+add-directory "%simics%/targets/x86-440bx/images"
+
+import-isa-components
+import-pci-components
+import-std-components
+import-x86-components
+
+$system = (create-x86-apic-system memory_megs = 256
+                                  rtc_time = "2006-03-12 10:00:00 UTC"
+                                  break_on_reboot = 1
+                                  bios = "rombios-2.65.2.3")
+
+$count = 0
+$create_command = ("create-" + $cpu_class + "-cpu")
+while $count < $num_cpus {
+    $cpu[$count] = ($create_command cpu_frequency = $freq_mhz)
+    $system.connect ("cpu" + $count) $cpu[$count]
+    $count += 1
+}
+
+$nb = (create-north-bridge-443bx-agp)
+$vga = (create-agp-voodoo3)
+$nb.connect agp-slot0 $vga
+
+$sb = (create-south-bridge-piix4)
+$sio = (create-std-super-io)
+$cdrom = (create-std-ide-cdrom)
+
+$console = (create-std-graphics-console)
+$console.connect mouse $sio mse-console
+$console.connect keyboard $sio kbd-console
+$console.connect $vga
+
+$system.connect chipset $nb
+$system.connect interrupt $sb
+$system.connect reset $sio
+
+$nb.connect pci-slot7 $sb
+
+$sb.connect $sio
+$sb.connect ide0-slave $cdrom
+
+instantiate-components
+
+run-python-file "%simics%/home/scripts/cdrom_bootloader.py"
+@install_cdrom_bootloader((conf.cpu0,))
+
+new-file-cdrom "image.iso" image
+cd0.insert image
Index: contrib/conf/HelenOS.ppc32.simics
===================================================================
--- contrib/conf/HelenOS.ppc32.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/HelenOS.ppc32.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,32 @@
+#
+# Simics 3.0 PPC32 simple configuration
+#
+
+$cpu_class     = "ppc750"
+$freq_mhz      = 50
+$image         = "image.boot"
+$image_offset  = -0x7a000000
+
+add-directory "%simics%/targets/ppc64-simple/images"
+
+import-std-components
+import-ppc-simple-components
+
+$system = (create-ppc-simple cpu_class = $cpu_class
+                             cpu_frequency = $freq_mhz
+                             memory_megs = 256)
+
+$cpu = ($system.get-component-object "cpu")
+
+$system.connect uart0 (create-std-text-console)
+
+instantiate-components
+
+$start = (load-binary $image $image_offset)
+$cpu->msr = ($cpu->msr | (1 << 13) | (1 << 5) | (1 << 4))
+$cpu.set-pc $start - $image_offset
+
+@itlb = conf.cpu0.itlb
+@itlb[0] = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
+@conf.cpu0.itlb = itlb
+
Index: contrib/conf/SPMIPS.simics
===================================================================
--- contrib/conf/SPMIPS.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/SPMIPS.simics	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,14 @@
+run-python-file ../scripts/extrapath.py
+
+add-directory ../../import/mips
+read-configuration spmips.conf
+
+set-pc (cpu0.load-binary ../../../SPARTAN/kernel.bin)
+
+# Setup uart to use 8 bits
+@conf.tty0.lcr = 0xf;
+
+# Set date
+rtc0.set-date-time 2001 01 01 01 01 01
+@century = 20
+@ignore=SIM_set_attribute_idx(conf.rtc0, "nvram", 0x32, century)
Index: contrib/conf/bootindy
===================================================================
--- contrib/conf/bootindy	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/bootindy	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,2 @@
+Without this the indy will not boot
+echo 1 > /proc/sys/net/ipv4/ip_no_pmtu_disc
Index: contrib/conf/dot.bochsrc
===================================================================
--- contrib/conf/dot.bochsrc	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/dot.bochsrc	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,719 @@
+# You may now use double quotes around pathnames, in case
+# your pathname includes spaces.
+
+#=======================================================================
+# CONFIG_INTERFACE
+#
+# The configuration interface is a series of menus or dialog boxes that
+# allows you to change all the settings that control Bochs's behavior.
+# There are two choices of configuration interface: a text mode version
+# called "textconfig" and a graphical version called "wx".  The text
+# mode version uses stdin/stdout and is always compiled in.  The graphical
+# version is only available when you use "--with-wx" on the configure 
+# command.  If you do not write a config_interface line, Bochs will 
+# choose a default for you.
+#
+# NOTE: if you use the "wx" configuration interface, you must also use
+# the "wx" display library.
+#=======================================================================
+config_interface: textconfig
+#config_interface: wx
+
+#=======================================================================
+# DISPLAY_LIBRARY
+#
+# The display library is the code that displays the Bochs VGA screen.  Bochs 
+# has a selection of about 10 different display library implementations for 
+# different platforms.  If you run configure with multiple --with-* options, 
+# the display_library command lets you choose which one you want to run with.
+# If you do not write a display_library line, Bochs will choose a default for
+# you.
+#
+# The choices are: 
+#   x              use X windows interface, cross platform
+#   win32          use native win32 libraries
+#   carbon         use Carbon library (for MacOS X)
+#   beos           use native BeOS libraries
+#   macintosh      use MacOS pre-10
+#   amigaos        use native AmigaOS libraries
+#   sdl            use SDL library, cross platform
+#   svga           use SVGALIB library for Linux, allows graphics without X11
+#   term           text only, uses curses/ncurses library, cross platform
+#   rfb            provides an interface to AT&T's VNC viewer, cross platform
+#   wx             use wxWindows library, cross platform
+#   nogui          no display at all
+#
+# NOTE: if you use the "wx" configuration interface, you must also use
+# the "wx" display library.
+#=======================================================================
+#display_library: amigaos
+#display_library: beos
+#display_library: carbon
+#display_library: macintosh
+#display_library: nogui
+#display_library: rfb
+#display_library: sdl
+#display_library: term
+#display_library: win32
+#display_library: wx
+display_library: x 
+
+cpu: count=8, ips=10000000
+
+#=======================================================================
+# ROMIMAGE:
+# You now need to load a ROM BIOS into F0000-FFFFF. Normally, you can
+# use a precompiled BIOS in the bios/ directory of the source tree,
+# named BIOS-bochs-latest.
+# You can also use the environment variable $BXSHARE to specify the
+# location of the BIOS.
+#=======================================================================
+romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
+#romimage: file=$BXSHARE/BIOS-bochs-8-processors, address=0xf0000
+#romimage: file=bios/P4SMT, address=0xf0000
+
+#=======================================================================
+# MEGS
+# set this to the default number of Megabytes of memory you want
+# to emulate.  You may also pass the '-megs xyz' option to bochs
+#
+# The default is 32MB, most OS's won't need more than that. 
+#=======================================================================
+#megs: 256
+#megs: 128
+#megs: 64
+megs: 32
+#megs: 16
+#megs: 8
+
+#=======================================================================
+# OPTROMIMAGE[1-4]:
+# You may now load up to 4 optional ROM images. Be sure to use a 
+# read-only area, typically between C8000 and EFFFF. These optional
+# ROM images should not overwrite the rombios (located at
+# F0000-FFFFF) and the videobios (located at C0000-C7FFF).
+# Those ROM images will be initialized by the bios if they contain 
+# the right signature (0x55AA).
+# It can also be a convenient way to upload some arbitary code/data
+# in the simulation, that can be retrieved by the boot loader
+#=======================================================================
+#optromimage1: file=optionalrom.bin, address=0xd0000
+#optromimage2: file=optionalrom.bin, address=0xd1000
+#optromimage3: file=optionalrom.bin, address=0xd2000
+#optromimage4: file=optionalrom.bin, address=0xd3000
+
+#=======================================================================
+# VGAROMIMAGE
+# You now need to load a VGA ROM BIOS into C0000.
+#=======================================================================
+vgaromimage: $BXSHARE/VGABIOS-lgpl-latest
+#vgaromimage: bios/VGABIOS-elpin-2.40
+#vgaromimage: $BXSHARE/VGABIOS-elpin-2.40
+
+#=======================================================================
+# FLOPPYA:
+# Point this to pathname of floppy image file or device
+# This should be of a bootable floppy(image/device) if you're 
+# booting from 'a'.
+#
+# You can set the initial status of the media to 'ejected' or 'inserted'.
+#   floppya: 2_88=path, status=ejected             (2.88M 3.5" floppy)
+#   floppya: 1_44=path, status=inserted            (1.44M 3.5" floppy)
+#   floppya: 1_2=path, status=ejected              (1.2M  5.25" floppy)
+#   floppya: 720k=path, status=inserted            (720K  3.5" floppy)
+#   floppya: 360k=path, status=inserted            (360K  5.25" floppy)
+#   floppya: 320k=path, status=inserted            (320K  5.25" floppy)
+#   floppya: 180k=path, status=inserted            (180K  5.25" floppy)
+#   floppya: 160k=path, status=inserted            (160K  5.25" floppy)
+#
+# The path should be the name of a disk image file.  On unix, you can use
+# a raw device name such as /dev/fd0 on Linux.  On WinNT and Win2k, use
+# drive letters such as a: or b: as the path.  Raw floppy access is not
+# supported on Windows 95 and 98.
+#=======================================================================
+#floppya: 1_44=image.boot, status=inserted
+#floppya: 1_44=/dev/fd0, status=inserted
+
+#=======================================================================
+# FLOPPYB:
+# See FLOPPYA above for syntax
+#=======================================================================
+#floppyb: 1_44=b:, status=inserted
+#floppyb: 1_44=b.img, status=inserted
+
+#=======================================================================
+# ATA0, ATA1, ATA2, ATA3
+# ATA controller for hard disks and cdroms
+#
+# ata[0-3]: enabled=[0|1], ioaddr1=addr, ioaddr2=addr, irq=number
+# 
+# These options enables up to 4 ata channels. For each channel
+# the two base io addresses and the irq must be specified.
+# 
+# ata0 is enabled by default, with ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
+#
+# Examples:
+#   ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
+#   ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
+#   ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
+#   ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9
+#=======================================================================
+ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
+ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
+ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
+ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
+
+#=======================================================================
+# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
+#
+# This defines the type and characteristics of all attached ata devices:
+#   type=       type of attached device [disk|cdrom] 
+#   mode=       only valid for disks [flat|concat|external|dll|sparse|vmware3]
+#   mode=       only valid for disks [undoable|growing|volatile]
+#   path=       path of the image
+#   cylinders=  only valid for disks
+#   heads=      only valid for disks
+#   spt=        only valid for disks
+#   status=     only valid for cdroms [inserted|ejected]
+#   biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
+#   translation=type of transation of the bios, only for disks [none|lba|large|rechs|auto]
+#   model=      string returned by identify device command
+#   journal=    optional filename of the redolog for undoable and volatile disks
+#   
+# Point this at a hard disk image file, cdrom iso file, or physical cdrom
+# device.  To create a hard disk image, try running bximage.  It will help you
+# choose the size and then suggest a line that works with it.
+#
+# In UNIX it may be possible to use a raw device as a Bochs hard disk, 
+# but WE DON'T RECOMMEND IT.  In Windows there is no easy way.
+#
+# In windows, the drive letter + colon notation should be used for cdroms.
+# Depending on versions of windows and drivers, you may only be able to 
+# access the "first" cdrom in the system.  On MacOSX, use path="drive"
+# to access the physical drive.
+#
+# The path, cylinders, heads, and spt are mandatory for type=disk
+# The path is mandatory for type=cdrom
+#
+# Default values are:
+#   mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
+#
+# The biosdetect option has currently no effect on the bios
+#
+# Examples:
+#   ata0-master: type=disk, mode=flat, path=10M.sample, cylinders=306, heads=4, spt=17
+#   ata0-slave:  type=disk, mode=flat, path=20M.sample, cylinders=615, heads=4, spt=17
+#   ata1-master: type=disk, mode=flat, path=30M.sample, cylinders=615, heads=6, spt=17
+#   ata1-slave:  type=disk, mode=flat, path=46M.sample, cylinders=940, heads=6, spt=17
+#   ata2-master: type=disk, mode=flat, path=62M.sample, cylinders=940, heads=8, spt=17
+#   ata2-slave:  type=disk, mode=flat, path=112M.sample, cylinders=900, heads=15, spt=17
+#   ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63
+#   ata3-slave:  type=cdrom, path=iso.sample, status=inserted
+#=======================================================================
+ata0-master: type=cdrom, path="image.iso", status=inserted
+#ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17
+#ata0-slave: type=cdrom, path=D:, status=inserted
+#ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted
+#ata0-slave: type=cdrom, path="drive", status=inserted
+#ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted 
+
+#=======================================================================
+# BOOT:
+# This defines your boot drive.  
+# You can either boot from 'floppy', 'disk' or 'cdrom'
+# legacy 'a' and 'c' are also supported
+# Examples:
+#   boot: floppy
+#   boot: disk
+#   boot: cdrom
+#   boot: c
+#   boot: a
+#=======================================================================
+boot: cdrom
+#boot: disk
+
+#=======================================================================
+# IPS:
+# Emulated Instructions Per Second.  This is the number of IPS that bochs
+# is capable of running on your machine.  Read the note in config.h
+# on how to find this.  Make sure to recompile after.
+#
+# IPS is used to calibrate many time-dependent events within the bochs 
+# simulation.  For example, changing IPS affects the frequency of VGA
+# updates, the duration of time before a key starts to autorepeat, and 
+# the measurement of BogoMips and other benchmarks.
+#
+# Examples:
+# Machine                                         Mips
+# ________________________________________________________________
+# 650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66 2 to 2.5 Mips
+# 400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3  1 to 1.8 Mips
+# 166Mhz 64bit Sparc with Solaris 2.x             approx 0.75 Mips
+# 200Mhz Pentium with Linux 2.x                   approx 0.5 Mips
+#
+#=======================================================================
+ips: 2500000
+
+#=======================================================================
+# CLOCK:
+# This defines the parameters of the clock inside Bochs:
+#
+#  SYNC:
+#  TO BE COMPLETED (see Greg explaination in bug #536329)
+#
+#  TIME0:
+#  Specifies the start (boot) time of the virtual machine. Use a time 
+#  value as returned by the time(2) system call. If no time0 value is 
+#  set or if time0 equal to 1 (special case) or if time0 equal 'local', 
+#  the simulation will be started at the current local host time.
+#  If time0 equal to 2 (special case) or if time0 equal 'utc',
+#  the simulation will be started at the current utc time.
+#
+# Syntax:
+#  clock: sync=[none|slowdown|realtime], time0=[timeValue|local|utc]
+#
+# Example:
+#   clock: sync=none,     time0=local       # Now (localtime)
+#   clock: sync=slowdown, time0=315529200   # Tue Jan  1 00:00:00 1980
+#   clock: sync=none,     time0=631148400   # Mon Jan  1 00:00:00 1990
+#   clock: sync=realtime, time0=938581955   # Wed Sep 29 07:12:35 1999
+#   clock: sync=realtime, time0=946681200   # Sat Jan  1 00:00:00 2000
+#   clock: sync=none,     time0=1           # Now (localtime)
+#   clock: sync=none,     time0=utc         # Now (utc/gmt)
+# 
+# Default value are sync=none, time0=local
+#=======================================================================
+clock: sync=none, time0=local
+
+
+#=======================================================================
+# FLOPPY_BOOTSIG_CHECK: disabled=[0|1]
+# Enables or disables the 0xaa55 signature check on boot floppies
+# Defaults to disabled=0
+# Examples:
+#   floppy_bootsig_check: disabled=0
+#   floppy_bootsig_check: disabled=1
+#=======================================================================
+#floppy_bootsig_check: disabled=1
+floppy_bootsig_check: disabled=1
+
+#=======================================================================
+# LOG:
+# Give the path of the log file you'd like Bochs debug and misc. verbage
+# to be written to.  If you really don't want it, make it /dev/null. :^(
+#
+# Examples:
+#   log: ./bochs.out
+#   log: /dev/tty
+#=======================================================================
+#log: /dev/null
+log: bochsout.txt
+
+#=======================================================================
+# LOGPREFIX:
+# This handles the format of the string prepended to each log line.
+# You may use those special tokens :
+#   %t : 11 decimal digits timer tick
+#   %i : 8 hexadecimal digits of cpu0 current eip
+#   %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
+#   %d : 5 characters string of the device, between brackets
+# 
+# Default : %t%e%d
+# Examples:
+#   logprefix: %t-%e-@%i-%d
+#   logprefix: %i%e%d
+#=======================================================================
+#logprefix: %t%e%d
+
+#=======================================================================
+# LOG CONTROLS
+#
+# Bochs now has four severity levels for event logging.
+#   panic: cannot proceed.  If you choose to continue after a panic, 
+#          don't be surprised if you get strange behavior or crashes.
+#   error: something went wrong, but it is probably safe to continue the
+#          simulation.
+#   info: interesting or useful messages.
+#   debug: messages useful only when debugging the code.  This may
+#          spit out thousands per second.
+#
+# For events of each level, you can choose to crash, report, or ignore.
+# TODO: allow choice based on the facility: e.g. crash on panics from
+#       everything except the cdrom, and only report those.
+#
+# If you are experiencing many panics, it can be helpful to change
+# the panic action to report instead of fatal.  However, be aware
+# that anything executed after a panic is uncharted territory and can 
+# cause bochs to become unstable.  The panic is a "graceful exit," so
+# if you disable it you may get a spectacular disaster instead.
+#=======================================================================
+panic: action=report
+error: action=report
+info: action=report
+debug: action=ignore
+#pass: action=fatal
+
+#=======================================================================
+# DEBUGGER_LOG:
+# Give the path of the log file you'd like Bochs to log debugger output.
+# If you really don't want it, make it /dev/null or '-'. :^(
+#
+# Examples:
+#   debugger_log: ./debugger.out
+#=======================================================================
+#debugger_log: /dev/null
+#debugger_log: debugger.out
+debugger_log: -
+
+#=======================================================================
+# COM1:
+# This defines a serial port (UART type 16550A). You can specify a device
+# to use as com1. This can be a real serial line, or a pty.  To use a pty
+# (under X/Unix), create two windows (xterms, usually).  One of them will
+# run bochs, and the other will act as com1. Find out the tty the com1
+# window using the `tty' command, and use that as the `dev' parameter.
+# Then do `sleep 1000000' in the com1 window to keep the shell from
+# messing with things, and run bochs in the other window.  Serial I/O to
+# com1 (port 0x3f8) will all go to the other window.
+#=======================================================================
+#com1: enabled=1, dev=/dev/ttyp9
+
+
+#=======================================================================
+# PARPORT1:
+# This defines a parallel (printer) port. When turned on and an output file is
+# defined the emulated printer port sends characters printed by the guest OS
+# into the output file. On some platforms a device filename can be used to
+# send the data to the real parallel port (e.g. "/dev/lp0" on Linux, "lpt1" on
+# win32 platforms).
+#
+# Examples:
+#   parport1: enabled=1, file="parport.out"
+#   parport1: enabled=1, file="/dev/lp0"
+#   parport1: enabled=0
+#=======================================================================
+parport1: enabled=1, file="parport.out"
+
+#=======================================================================
+# SB16:
+# This defines the SB16 sound emulation. It can have several of the
+# following properties.
+# All properties are in the format sb16: property=value
+# midi: The filename is where the midi data is sent. This can be a
+#       device or just a file if you want to record the midi data.
+# midimode:
+#      0=no data
+#      1=output to device (system dependent. midi denotes the device driver)
+#      2=SMF file output, including headers
+#      3=output the midi data stream to the file (no midi headers and no
+#        delta times, just command and data bytes)
+# wave: This is the device/file where wave output is stored
+# wavemode:
+#      0=no data
+#      1=output to device (system dependent. wave denotes the device driver)
+#      2=VOC file output, incl. headers
+#      3=output the raw wave stream to the file
+# log:  The file to write the sb16 emulator messages to.
+# loglevel:
+#      0=no log
+#      1=only midi program and bank changes
+#      2=severe errors
+#      3=all errors
+#      4=all errors plus all port accesses
+#      5=all errors and port accesses plus a lot of extra info
+# dmatimer:
+#      microseconds per second for a DMA cycle.  Make it smaller to fix
+#      non-continous sound.  750000 is usually a good value.  This needs a
+#      reasonably correct setting for IPS.
+#
+# For an example look at the next line:
+#=======================================================================
+
+#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000
+
+#=======================================================================
+# VGA_UPDATE_INTERVAL:
+# Video memory is scanned for updates and screen updated every so many
+# virtual seconds.  The default is 300000, about 3Hz.  This is generally
+# plenty.  Keep in mind that you must tweak the 'ips:' directive
+# to be as close to the number of emulated instructions-per-second
+# your workstation can do, for this to be accurate.
+#
+# Examples:
+#   vga_update_interval: 250000
+#=======================================================================
+vga_update_interval: 300000
+
+# using for Winstone '98 tests
+#vga_update_interval:  100000
+
+#=======================================================================
+# KEYBOARD_SERIAL_DELAY:
+# Approximate time in microseconds that it takes one character to
+# be transfered from the keyboard to controller over the serial path.
+# Examples:
+#   keyboard_serial_delay: 200
+#=======================================================================
+keyboard_serial_delay: 250
+
+#=======================================================================
+# KEYBOARD_PASTE_DELAY:
+# Approximate time in microseconds between attempts to paste
+# characters to the keyboard controller. This leaves time for the
+# guest os to deal with the flow of characters.  The ideal setting
+# depends on how your operating system processes characters.  The
+# default of 100000 usec (.1 seconds) was chosen because it works 
+# consistently in Windows.
+#
+# If your OS is losing characters during a paste, increase the paste
+# delay until it stops losing characters.
+#
+# Examples:
+#   keyboard_paste_delay: 100000
+#=======================================================================
+keyboard_paste_delay: 100000
+
+#=======================================================================
+# FLOPPY_COMMAND_DELAY:
+# Time in microseconds to wait before completing some floppy commands
+# such as read/write/seek/etc, which normally have a delay associated.
+# I had this hardwired to 50,000 before.
+#
+# Examples:
+#   floppy_command_delay: 50000
+#=======================================================================
+floppy_command_delay: 500
+
+#=======================================================================
+# MOUSE: 
+# This option prevents Bochs from creating mouse "events" unless a mouse
+# is  enabled. The hardware emulation itself is not disabled by this.
+# You can turn the mouse on by setting enabled to 1, or turn it off by
+# setting enabled to 0. Unless you have a particular reason for enabling
+# the mouse by default, it is recommended that you leave it off.
+# You can also toggle the mouse usage at runtime (middle mouse button on
+# X11 and SDL, F12 on Win32).
+#
+# Examples:
+#   mouse: enabled=1
+#   mouse: enabled=0
+#=======================================================================
+mouse: enabled=0
+
+#=======================================================================
+# private_colormap: Request that the GUI create and use it's own
+#                   non-shared colormap.  This colormap will be used
+#                   when in the bochs window.  If not enabled, a
+#                   shared colormap scheme may be used.  Not implemented
+#                   on all GUI's.
+#
+# Examples:
+#   private_colormap: enabled=1
+#   private_colormap: enabled=0
+#=======================================================================
+private_colormap: enabled=0
+
+#=======================================================================
+# fullscreen: ONLY IMPLEMENTED ON AMIGA
+#             Request that Bochs occupy the entire screen instead of a 
+#             window.
+#
+# Examples:
+#   fullscreen: enabled=0
+#   fullscreen: enabled=1
+#=======================================================================
+#fullscreen: enabled=0
+#screenmode: name="sample"
+
+#=======================================================================
+# ne2k: NE2000 compatible ethernet adapter
+#
+# Examples:
+# ne2k: ioaddr=IOADDR, irq=IRQ, mac=MACADDR, ethmod=MODULE, ethdev=DEVICE, script=SCRIPT
+#
+# ioaddr, irq: You probably won't need to change ioaddr and irq, unless there
+# are IRQ conflicts.
+#
+# mac: The MAC address MUST NOT match the address of any machine on the net.
+# Also, the first byte must be an even number (bit 0 set means a multicast
+# address), and you cannot use ff:ff:ff:ff:ff:ff because that's the broadcast
+# address.  For the ethertap module, you must use fe:fd:00:00:00:01.  There may
+# be other restrictions too.  To be safe, just use the b0:c4... address.
+#
+# ethdev: The ethdev value is the name of the network interface on your host
+# platform.  On UNIX machines, you can get the name by running ifconfig.  On
+# Windows machines, you must run niclist to get the name of the ethdev.
+# Niclist source code is in misc/niclist.c and it is included in Windows 
+# binary releases.
+#
+# script: The script value is optionnal, and is the name of a script that 
+# is executed after bochs initialize the network interface. You can use 
+# this script to configure this network interface, or enable masquerading.
+# This is mainly useful for the tun/tap devices that only exist during
+# Bochs execution. The network interface name is supplied to the script
+# as first parameter
+#=======================================================================
+# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=fbsd, ethdev=en0 #macosx
+# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0
+# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
+# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD
+# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
+# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=tun0, script=./tunconfig
+
+#=======================================================================
+# KEYBOARD_MAPPING:
+# This enables a remap of a physical localized keyboard to a 
+# virtualized us keyboard, as the PC architecture expects.
+# If enabled, the keymap file must be specified.
+# 
+# Examples:
+#   keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map
+#=======================================================================
+keyboard_mapping: enabled=0, map=
+
+#=======================================================================
+# KEYBOARD_TYPE:
+# Type of keyboard return by a "identify keyboard" command to the
+# keyboard controler. It must be one of "xt", "at" or "mf".
+# Defaults to "mf". It should be ok for almost everybody. A known
+# exception is french macs, that do have a "at"-like keyboard.
+#
+# Examples:
+#   keyboard_type: mf
+#=======================================================================
+#keyboard_type: mf
+
+#=======================================================================
+# USER_SHORTCUT:
+# This defines the keyboard shortcut to be sent when you press the "user"
+# button in the headerbar. The shortcut string can be a combination of
+# these key names: "alt", "bksp", "ctrl", "del", "esc", "f1", "f4", "tab"
+# and "win". Up to 3 keys can be pressed at a time.
+#
+# Example:
+#   user_shortcut: keys=ctrlaltdel
+#=======================================================================
+#user_shortcut: keys=ctrlaltdel
+
+#=======================================================================
+# other stuff
+#=======================================================================
+#magic_break: enabled=1
+#cmosimage: cmos.img
+#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
+#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
+#i440fxsupport: enabled=1
+usb1: enabled=1, ioaddr=0xFF80, irq=10
+#text_snapshot_check: enable
+
+#=======================================================================
+# for Macintosh, use the style of pathnames in the following
+# examples.
+#
+# vgaromimage: :bios:VGABIOS-elpin-2.40
+# romimage: file=:bios:BIOS-bochs-latest, address=0xf0000
+# floppya: 1_44=[fd:], status=inserted
+#=======================================================================
+
+
+#=======================================================================
+#
+# The following directives are DEPRECATED 
+# Please convert them to the new syntax  or remove them
+#
+#=======================================================================
+
+#=======================================================================
+#
+# The DISKC option is deprecated. Use ATA* options instead.
+#
+# DISKC: file=, cyl=, heads=, spt=
+# Point this at a hard disk image file.  To create 
+# a hard disk image, try running bximage.  It will help you choose the
+# size and then suggest a diskc line that works with it.
+#
+# In UNIX it may be possible to use a raw device as a Bochs hard disk, 
+# but WE DON'T RECOMMEND IT.  In Windows there is no easy way.
+#
+# Examples:
+#   diskc: file=10M.sample, cyl=306, heads=4, spt=17
+#   diskc: file=20M.sample, cyl=615, heads=4, spt=17
+#   diskc: file=30M.sample, cyl=615, heads=6, spt=17
+#   diskc: file=46M.sample, cyl=940, heads=6, spt=17
+#   diskc: file=62M.sample, cyl=940, heads=8, spt=17
+#   diskc: file=112M.sample, cyl=900, heads=15, spt=17
+#   diskc: file=483M.sample, cyl=1024, heads=15, spt=63
+#=======================================================================
+#diskc: file="30M.sample", cyl=615, heads=6, spt=17
+
+#=======================================================================
+#
+# The DISKD option is deprecated. Use ATA* options instead.
+#
+# DISKD:
+# See DISKC above for syntax
+#
+# NOTE: diskd and cdromd must not be used together!
+#=======================================================================
+#diskd: file="diskd.img", cyl=615, heads=6, spt=17
+
+#=======================================================================
+#
+# The CDROMD option is deprecated. Use ATA* options instead.
+#
+# CDROMD:
+#
+# cdromd: dev=/dev/cdrom, status=inserted
+# cdromd: dev=/dev/cdrom, status=ejected
+# cdromd: dev=e:, status=ejected
+#
+# In windows, the drive letter + colon notation should be used for cdroms.
+# Depending on versions of windows and drivers, you may only be able to 
+# access the "first" cdrom in the system.  On MacOSX, use path="drive"
+# to access the physical drive.
+#
+# NOTE: diskd and cdromd must not be used together!
+#=======================================================================
+#cdromd: dev=D:, status=inserted
+#cdromd: dev=/dev/cdrom, status=inserted
+#cdromd: dev="drive", status=inserted
+
+#=======================================================================
+#
+# The TIME0 directive is DEPRECATED. Use the CLOCK directive instead
+#
+# TIME0:
+# Specifies the start (boot) time of the virtual machine. Use a time 
+# value as returned by the time(2) system call. If no time0 value is 
+# set or if time0 equal to 1 (special case), the simulation will be
+# started at the current time of the host. 
+#
+# Examples:
+#   time0: 1           # Now
+#   time0: 315529200   # Tue Jan  1 00:00:00 1980
+#   time0: 631148400   # Mon Jan  1 00:00:00 1990
+#   time0: 938581955   # Wed Sep 29 07:12:35 1999
+#   time0: 946681200   # Sat Jan  1 00:00:00 2000
+#=======================================================================
+#time0: 938581955
+
+#=======================================================================
+#
+# The PIT directive is DEPRECATED. Use the CLOCK directive instead
+#
+# PIT:
+# The PIT is the programmable interval timer.  It has an option that tries to
+# keep the PIT in sync with real time.  This feature is still experimental,
+# but it may be useful if you want to prevent Bochs from running too fast, for
+# example a DOS video game.  Be aware that with the realtime pit option, your
+# simulation will not be repeatable; this can a problem if you are debugging.
+#=======================================================================
+#pit: realtime=1
+
+#=======================================================================
+# NEWHARDDRIVESUPPORT: enabled=[0|1]
+# The old harddrive code is not maintened any more.
+# Default value is enabled=1
+#=======================================================================
+#newharddrivesupport: enabled=1
+
Index: contrib/conf/gxemul.sh
===================================================================
--- contrib/conf/gxemul.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/gxemul.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+gxemul $@ -E testmips -X image.boot 
Index: contrib/conf/msim.conf
===================================================================
--- contrib/conf/msim.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/msim.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,11 @@
+#
+# MSIM configuration script
+#
+
+add dcpu mips1
+
+add rwm	mainmem		0x0			8M		load	"/dev/zero"
+add rom startmem	0x1fc00000	1024k	load	"image.boot" 
+
+add dprinter printer 0x10000000
+add dkeyboard keyboard 0x10000000 2
Index: contrib/conf/pearpc.conf
===================================================================
--- contrib/conf/pearpc.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/pearpc.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,7 @@
+ppc_start_resolution = "800x600x32"
+pci_ide0_master_installed = 0
+
+prom_bootmethod = "force"
+prom_loadfile = "image.boot"
+
+key_toggle_mouse_grab = "F11"
Index: contrib/conf/simics.conf
===================================================================
--- contrib/conf/simics.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/simics.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,25 @@
+# Test machine features
+#  - Standard PC system
+#  - 256 Mb memory
+#  - 40 MHz processor(s)
+#  - AM79C960 NIC (ISA Lance)
+#  - Voodoo3 PCI graphics device
+
+@num_processors = 2 
+#@num_processors = 1
+
+@if not "cpu_class"               in dir(): cpu_class = "x86-hammer"
+@if not "clock_freq_mhz"          in dir(): clock_freq_mhz = 40
+@if not "memory_megs"             in dir(): memory_megs = 256
+
+@if not "cdrom_image"             in dir(): cdrom_image = "image.iso"
+@if not "use_voodoo3_pci"         in dir(): use_voodoo3_pci = 1
+@if not "use_voodoo3_agp"         in dir(): use_voodoo3_agp = 0
+
+run-command-file ../x86-test-machine/pc-common.simics
+run-python-file ../scripts/cdrom_bootloader.py
+
+@install_cdrom_bootloader((conf.cpu0,))
+@if cdrom_image != None:
+	eval_cli_line("new-file-cdrom %s image" % cdrom_image)
+	eval_cli_line("cd0.insert image")
Index: contrib/conf/ski.conf
===================================================================
--- contrib/conf/ski.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/ski.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,11 @@
+load HelenOS/boot/kernel.bin
+romload HelenOS/uspace/ns/ns 0x400000
+romload HelenOS/uspace/init/init 0x800000
+romload HelenOS/uspace/console/console 0xc00000
+romload HelenOS/uspace/fb/fb 0x1000000
+romload HelenOS/uspace/kbd/kbd 0x1400000
+romload HelenOS/uspace/tetris/tetris 0x1800000
+romload HelenOS/uspace/klog/klog 0x1c00000
+romload HelenOS/uspace/ipcc/ipcc 0x2000000
+
+
Index: contrib/conf/spmips.conf
===================================================================
--- contrib/conf/spmips.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/spmips.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,263 @@
+OBJECT cpu0 TYPE mips-4kc {
+	freq-mhz: 10
+	queue: cpu0
+	physical-memory: phys-mem0
+}
+
+OBJECT phys-mem0 TYPE memory-space {
+	map: ((0x18000020,      pic0,         0,         0x20,          1),
+              (0x18000021,      pic0,         0,         0x21,          1),
+              (0x180000a0,      pic0,         0,         0xa0,          1),
+              (0x180000a1,      pic0,         0,         0xa1,          1),
+              (0x180004d0,      pic0,         0,        0x4d0,          1),
+              (0x180004d1,      pic0,         0,        0x4d1,          1),
+              (0x18000070,      rtc0,         0,            0,          1),
+              (0x18000071,      rtc0,         0,            1,          1),
+              (0x180003f8,      tty0,         0,            0,          1),
+              (0x180003f9,      tty0,         0,            1,          1),
+              (0x180003fa,      tty0,         0,            2,          1),
+              (0x180003fb,      tty0,         0,            3,          1),
+              (0x180003fc,      tty0,         0,            4,          1),
+              (0x180003fd,      tty0,         0,            5,          1),
+              (0x180003fe,      tty0,         0,            6,          1),
+              (0x180003ff,      tty0,         0,            7,          1),
+              (0x1c000000,      hfs0,         0,            0,         16),
+	      (0x01000000,	initmem0,     0,	    0,	0x100000))
+}
+
+OBJECT cbus-space TYPE memory-space {
+	map: ((0x1f000000,    malta0,         0,            0,   0xc00000),
+              (0x1fc00000,      rom0,         0,            0,   0x400000))
+}
+
+OBJECT memory0 TYPE ram {
+	image: memory0-image
+}
+OBJECT memory0-image TYPE image {
+	queue: cpu0
+	size: 0x08000000
+}
+
+OBJECT initmem0 TYPE ram {
+	image: initmem0-image
+}
+OBJECT initmem0-image TYPE image {
+	queue: cpu0
+	size: 0x100000
+	files: (("../../../uspace/init/init", "ro", 0,0))
+}
+
+OBJECT rom0 TYPE rom {
+	image: rom0-image
+}
+OBJECT rom0-image TYPE image {
+	queue: cpu0
+	size: 0x00400000
+}
+
+OBJECT tty0 TYPE NS16550 {
+	irq-dev: pic0
+	irq-level: 4
+	queue: cpu0
+	console: con0
+	recorder: rec0
+}
+
+OBJECT pic0 TYPE i8259x2 {
+	queue: cpu0
+       	irq-dev: gt64120-0
+        # It seems like Linux expects the master 8259 to have VBA 0.
+        # Maybe that would be set up by YAMON?
+        vba: (0, 1)
+}
+
+OBJECT con0 TYPE xterm-console {
+        title: "mips32-test-machine"
+        bg-color: "black"
+	fg-color: "green"
+	queue: cpu0
+ 	device: tty0
+	output-timeout: 120
+}
+
+OBJECT rtc0 TYPE DS12887 {
+	irq-dev: pic0
+	irq-level: 8
+	queue: cpu0
+}
+
+OBJECT malta0 TYPE malta {
+	console: display0
+}
+
+OBJECT display0 TYPE xterm-console {
+        title: "MALTA Display"
+	bg-color: "black"
+	fg-color: "red"
+	width: 8
+	height: 1
+	scrollbar: 0
+	x11-font: "-*-*-*-r-*-*-*-240-*-*-m-*-*-*"
+	win32-font: "Lucida Console:Bold:48"
+	queue: cpu0
+	output-timeout: 120
+}
+
+# PCI buses
+OBJECT pci-bus0 TYPE pci-bus {
+	queue: cpu0
+        bridge: gt64120-0-pci-0-0
+        interrupt: gt64120-0-pci-0-0
+        conf-space: pci-bus0-conf-space
+        memory-space: pci-bus0-memory-space
+        io-space: pci-bus0-io-space
+
+        pci-devices: ((0, 0, gt64120-0-pci-0-0),
+                      (0, 1, gt64120-0-pci-0-1))
+}
+
+OBJECT pci-bus0-conf-space TYPE memory-space {
+        queue: cpu0
+}
+
+OBJECT pci-bus1-conf-space TYPE memory-space {
+        queue: cpu0
+}
+
+OBJECT pci-bus0-memory-space TYPE memory-space {
+        queue: cpu0
+}
+
+OBJECT pci-bus1 TYPE pci-bus {
+	queue: cpu0
+        bridge: gt64120-0-pci-1-0
+        interrupt: gt64120-0-pci-1-0
+        conf-space: pci-bus1-conf-space
+        memory-space: pci-bus1-memory-space
+        io-space: pci-bus1-io-space
+
+        pci-devices: ((0, 0, gt64120-0-pci-1-0),
+                      (0, 1, gt64120-0-pci-1-1))
+}
+
+OBJECT pci-bus1-memory-space TYPE memory-space {
+        queue: cpu0
+}
+
+OBJECT pci-bus0-io-space TYPE memory-space {
+        queue: cpu0
+}
+
+OBJECT pci-bus1-io-space TYPE memory-space {
+        queue: cpu0
+}
+
+# GT64120 chipset
+OBJECT gt64120-0 TYPE GT64120 {
+        queue: cpu0
+        cpu-mem: phys-mem0
+
+        pci-0-0: gt64120-0-pci-0-0
+        pci-0-1: gt64120-0-pci-0-1
+        pci-1-0: gt64120-0-pci-1-0
+        pci-1-1: gt64120-0-pci-1-1
+
+        scs0: memory0
+        cs3: cbus-space
+        bootcs: cbus-space
+        pci-0-conf: pci-bus0-conf-space
+        pci-0-io: pci-bus0-io-space
+        pci-0-memory: pci-bus0-memory-space
+        pci-1-conf: pci-bus1-conf-space
+        pci-1-io: pci-bus1-io-space
+        pci-1-memory: pci-bus1-memory-space
+
+        irq-dev: cpu0
+        irq-level: 2
+
+        # Little endian
+        cpu_interface_configuration: 0x00041000
+
+        # Map 128MB RAM.
+        scs10-high-decode-address: 0x40
+        scs0-low-decode-address: 0x0
+        scs0-high-decode-address: 0x7f
+
+        # Map the internal registers at 0x1be00000.
+        internal-space-decode: 0xdf
+
+        # Disable host-PCI mappings
+        pci-0-io-high-decode-address:       0
+        pci-0-io-low-decode-address:        1
+        pci-0-io-remap:                     1
+        pci-0-memory-0-high-decode-address: 0
+        pci-0-memory-0-low-decode-address:  1
+        pci-0-memory-0-remap:               1
+        pci-0-memory-1-high-decode-address: 0
+        pci-0-memory-1-low-decode-address:  1
+        pci-0-memory-1-remap:               1
+        pci-1-io-high-decode-address:       0
+        pci-1-io-low-decode-address:        1
+        pci-1-io-remap:                     1
+        pci-1-memory-0-high-decode-address: 0
+        pci-1-memory-0-low-decode-address:  1
+        pci-1-memory-0-remap:               1
+        pci-1-memory-1-high-decode-address: 0
+        pci-1-memory-1-low-decode-address:  1
+        pci-1-memory-1-remap:               1
+
+        # Disable PCI-host mappings
+        pci-0-base-address-registers-enable: 0x1ff
+        pci-1-base-address-registers-enable: 0x1ff
+}
+
+OBJECT gt64120-0-pci-0-0 TYPE GT64120-pci {
+        queue: cpu0
+
+        gt64120: gt64120-0
+        bridge-num: 0
+        function-num: 0
+
+        pci-bus: pci-bus0
+}
+
+OBJECT gt64120-0-pci-0-1 TYPE GT64120-pci {
+        queue: cpu0
+
+        gt64120: gt64120-0
+        bridge-num: 0
+        function-num: 1
+
+        pci-bus: pci-bus0
+}
+
+OBJECT gt64120-0-pci-1-0 TYPE GT64120-pci {
+        queue: cpu0
+
+        gt64120: gt64120-0
+        bridge-num: 1
+        function-num: 0
+
+        pci-bus: pci-bus1
+}
+
+OBJECT gt64120-0-pci-1-1 TYPE GT64120-pci {
+        queue: cpu0
+
+        gt64120: gt64120-0
+        bridge-num: 1
+        function-num: 1
+
+        pci-bus: pci-bus1
+}
+
+# Various
+OBJECT rec0 TYPE recorder {
+}
+
+OBJECT hfs0 TYPE hostfs {
+}
+
+OBJECT sim TYPE sim {
+	handle-outside-memory: 1
+}
Index: contrib/conf/vmware.conf
===================================================================
--- contrib/conf/vmware.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/conf/vmware.conf	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,15 @@
+#!/opt/vmware/bin/vmware
+config.version = "8"
+virtualHW.version = "4"
+scsi0.present = "FALSE"
+memsize = "96"
+ide0:0.present = "FALSE"
+ide1:0.present = "FALSE"
+floppy0.startConnected = "TRUE"
+floppy0.fileType = "file"
+floppy0.fileName = "image.bin"
+sound.present = "FALSE"
+displayName = "HelenOS"
+guestOS = "other"
+nvram = "HelenOS.nvram"
+isolation.tools.hgfs.disable = "TRUE"
Index: contrib/toolchain/toolchain.amd64.sh
===================================================================
--- contrib/toolchain/toolchain.amd64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.amd64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="amd64"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.ia32.sh
===================================================================
--- contrib/toolchain/toolchain.ia32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.ia32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="i686"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-pc-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.ia64.sh
===================================================================
--- contrib/toolchain/toolchain.ia64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.ia64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+INCLUDES="ia64-pc-gnu-linux_includes.tar.bz2"
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+INCLUDES_SOURCE="http://download.decky.cz/"
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="ia64"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-pc-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+INCLUDESDIR="${WORKDIR}/include"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${INCLUDES}" ]; then
+    wget -c "${INCLUDES_SOURCE}${INCLUDES}"
+    check_error $? "Error downloading includes."
+fi
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvjf "${INCLUDES}"
+check_error $? "Error unpacking includes."
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj "--with-headers=${INCLUDESDIR}" --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.mipseb32.sh
===================================================================
--- contrib/toolchain/toolchain.mipseb32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.mipseb32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="mips"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-sgi-irix5"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.mipsel32.sh
===================================================================
--- contrib/toolchain/toolchain.mipsel32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.mipsel32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="mipsel"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.ppc32.sh
===================================================================
--- contrib/toolchain/toolchain.ppc32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.ppc32.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="ppc"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.ppc64.sh
===================================================================
--- contrib/toolchain/toolchain.ppc64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.ppc64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.16.1"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="ppc64"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
Index: contrib/toolchain/toolchain.sparc64.sh
===================================================================
--- contrib/toolchain/toolchain.sparc64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
+++ contrib/toolchain/toolchain.sparc64.sh	(revision d4625c6466c2684bc8a9f130ff9ab4be0a7c470c)
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Cross-Compiler Toolchain for ${PLATFORM}
+#  by Martin Decky <martin@decky.cz>
+#
+#  GPL'ed, copyleft
+#
+
+
+check_error() {
+    if [ "$1" -ne "0" ]; then
+	echo
+	echo "Script failed: $2"
+	exit
+    fi
+}
+
+BINUTILS_VERSION="2.17"
+GCC_VERSION="4.1.1"
+
+BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz"
+GCC="gcc-core-${GCC_VERSION}.tar.bz2"
+
+BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/"
+GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
+
+PLATFORM="sparc64"
+WORKDIR=`pwd`
+TARGET="${PLATFORM}-linux-gnu"
+HOST="i686-pc-linux-gnu"
+PREFIX="/usr/local/${PLATFORM}"
+BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
+GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+OBJDIR="${WORKDIR}/gcc-obj"
+
+echo ">>> Downloading tarballs"
+
+if [ ! -f "${BINUTILS}" ]; then
+    wget -c "${BINUTILS_SOURCE}${BINUTILS}"
+    check_error $? "Error downloading binutils."
+fi
+if [ ! -f "${GCC}" ]; then
+    wget -c "${GCC_SOURCE}${GCC}"
+    check_error $? "Error downloading GCC."
+fi
+
+echo ">>> Creating destionation directory"
+if [ ! -d "${PREFIX}" ]; then
+    mkdir -p "${PREFIX}" 
+    test -d "${PREFIX}"
+    check_error $? "Unable to create ${PREFIX}."
+fi
+
+echo ">>> Creating GCC work directory"
+if [ ! -d "${OBJDIR}" ]; then
+    mkdir -p "${OBJDIR}"
+    test -d "${OBJDIR}"
+    check_error $? "Unable to create ${OBJDIR}."
+fi
+
+echo ">>> Unpacking tarballs"
+tar -xvzf "${BINUTILS}"
+check_error $? "Error unpacking binutils."
+tar -xvjf "${GCC}"
+check_error $? "Error unpacking GCC."
+
+echo ">>> Compiling and installing binutils"
+cd "${BINUTILSDIR}"
+check_error $? "Change directory failed."
+./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
+check_error $? "Error configuring binutils."
+make all install
+check_error $? "Error compiling/installing binutils."
+
+echo ">>> Compiling and installing GCC"
+cd "${OBJDIR}"
+check_error $? "Change directory failed."
+"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj --without-headers --disable-shared
+check_error $? "Error configuring GCC."
+PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
+check_error $? "Error compiling/installing GCC."
+
+echo
+echo ">>> Cross-compiler for ${TARGET} installed."
