Skip to content

alpine9000/BitOS

Repository files navigation

BitOS - The operating system for the BitMachine SH7058 emulator 
===============================================================

Copyright (C) Enable Software Pty Ltd 2014

BitOS is a very basic newlib based operating system. BitMachine is browser based emulator that emulates a basic SH7058 "like" computer.

The operating system emulates file I/O, graphics, keyboard, mouse and sound. The most significant thing is can do is recompile itself (except newlib) using GCC.

It was hacked together to excerise the BitMachine SH7058 instruction set emulation.

Please refer to LICENSE for software license details for all files except those listed below:

libbitmachine/argv.c   - Copyright (C) 1992, 2001 Free Software Foundation, Inc (GNU Library General Public License v2 - LICENSES/LGPL-2.0.txt)
libbitmachine/malloc.c - Written by Doug Lea and released to the public domain
newlib-2.0.0-r/*       - Copyright (C) 1991 Free Software Foundation, Inc. (GNU LIBRARY GENERAL PUBLIC LICENSE v2 - newlib-2.0.0-r/COPYING)
apps/wolf/wolf.cpp     - Copyright (c) 2004-2007, Lode Vandevenne. (Simplified BSD License)
apps/wolf/media/*      - Copyright (C) Id Software, Inc. (LIMITED USE SOFTWARE LICENSE AGREEMENT - apps/wolf/media/LICENSE.DOC)
apps/bemacs/*          - Various authors, released to the public domain (apps/bemacs/README.original)
apps/bemacs/dirname.c  - Copyright (C) 2001 Matt Kraai. (GNU General Public License v2 LICENSES/gpl-2.0.txt)
external/bin2c.c       - Written by sandro AT sigala DOT it - BEER-WARE LICENSE

If you are distributing this software, the safest course of action would be to distribute it under the terms of the GNU GENERAL PUBLIC LICENSE v3 (LICENSES/gpl-3.0.txt) with all of the above copyright notices and licenses included in some form of documenation or similar (To meet the conditions of the BSD licensed stuff).

Notes:
------
o Built on OSX El Capitan 10.11.2
o You need a google drive with a folder called ~/Google Drive/BitFS that syncs from your build machine

*Install xcode from app store

(1) install xcode command line tools
=====================================
xcode-select --install
mkdir ~/Projects
mkdir ~/Projects/bitos-build/
mkdir ~/Projects/bitos-build/src
cd ~/Projects
git clone https://github.com/alpine9000/BitOS.git

(2) build external components
==============================

cd ~/Projects/BitOS/external
make # This will take hours to complete

 Make will download and install the following:
 o wget-1.16 -> /usr/local
 o osx gcc-5.3.0 -> /usr/local
 o sh-elf cross gcc-5.3.0 -> /usr/local/sh-elf
 o sh-elf cross binutils-2.25 -> /usr/local/sh-elf
 o sh-elf newlib-2.0.0 -> /usr/local/sh-elf
 o sh-elf readline-6.3 -> /usr/local/sh-elf

 It will also build the following ready for hosting on BitOS:
 o gcc-5.3.0
 o bintils-2.25
 o make-4.1

(3) make filesystem.zip
========================
cd ~/Projects/BitOS
make gdrivefs # This will copy filesystem.zip to ~/Google Drive/BitFS

(4) Setting local filesystem
=============================
* Navigate to https://alpine9000.github.io/BitMachine/ (Chrome works best)
* Menu "Drive" -> "Initialise Filesystem from Google Grive"

(5) Rebuild bitos in BitMachine
================================
* Navigate to https://alpine9000.github.io/BitMachine/ (Chrome works best)
* Menu "Drive" -> "Boot BitOS from Google Drive"
cd /usr/local/src/BitOS
make elf
* Menu "Drive" -> "Boot BitOS from Local"

You are now running bitos built on bitos (-:

(6) Other things to try
========================

bemacs - emacs "like" editor (modified from Ersatz emacs - https://github.com/stangelandcl/ersatz-emacs)
rwolf - simple raycasting demo (http://lodev.org/cgtutor/raycasting.html)
si - Start of a Space Invaders tribute
ls/dir/cat/rm/mkdir/pwd/mv/cp/ps/kill - simple unix inspired commands
kernel - boot a new kernel

(7) Current test regime
========================

# Build hello.c
cd /usr/local/home
make
/usr/local/home/hello

# Auto tests
mkdir /usr/local/home/tests
# From javascript console
Unzip("/gdrive/tests.zip", "/bitfs/usr/local/home/tests")
# Back to bsh
cd /usr/local/home/tests
rt -r

# Torture test (Rebuild BitOS in two threads at the same time, N = 2 times)
test 2

(8) Some BitMachine stuff to try from the javascript console
=============================================================
kernel.init() // Enable stack tracing
kernel.PrintThreadTable() // Prints information about the running threads
kernel.DumpStack() // Shows the stack traces of each running thread