GithubHelp home page GithubHelp logo

ted-chang / matrix Goto Github PK

View Code? Open in Web Editor NEW
33.0 7.0 6.0 813 KB

Matrix, the name originated from the film "The Matrix", is a personal operating system project.

License: GNU General Public License v2.0

Shell 0.69% Makefile 2.50% C 95.16% Assembly 1.65%
operating-system

matrix's Introduction

Build Prerequisites
===================

The list of RPM packages dependencies can be installed with:

	$ ./install-deps.sh

Building matrix
===============

To get available make targets, run the following command.

	$ make help

To build everything

	$ make all

To build subsystem, for example, kernel

	$ make kernel

To make the essential initrd

	$ ./tools/make_initrd bin/init init bin/crond crond bin/echo echo \
	  bin/unit_test unit_test bin/ls ls bin/cat cat bin/clear clear \
	  bin/shutdown shutdown bin/mkdir mkdir bin/date date bin/mount mount \
	  bin/umount umount bin/mknod mknod bin/dd dd bin/lsmod lsmod bin/initrd

Testing matrix
==============

To build bochs
--------------

	$ wget https://sourceforge.net/projects/bochs/files/bochs/2.6.9/bochs-2.6.9.tar.gz
	$ tar xzvf bochs-2.6.9.tar.gz
	$ cd bochs-2.6.9
	$ ./configure --help
	$ ./configure --enable-x86-64 \
	  --enable-smp \
	  --enable-debugger \
	  --enable-iodebug \
	  --enable-disasm \
	  --enable-readline
	$ make
	$ sudo make install

To create bochs image
---------------------

	$ bximage -hd=50M matrix-hd.img
	========================================================================
	                                bximage
	  Disk Image Creation / Conversion / Resize and Commit Tool for Bochs
	         $Id: bximage.cc 13069 2017-02-12 16:51:52Z vruppert $
	========================================================================

	1. Create new floppy or hard disk image
	2. Convert hard disk image to other format (mode)
	3. Resize hard disk image
	4. Commit 'undoable' redolog to base image
	5. Disk image info

	0. Quit

	Please choose one [0] 1

	Create image

	Do you want to create a floppy disk image or a hard disk image?
	Please type hd or fd. [hd]

	What kind of image should I create?
	Please type flat, sparse, growing, vpc or vmware4. [flat]

	Enter the hard disk size in megabytes, between 10 and 8257535
	[50]

	What should be the name of the image?
	[matrix-hd.img]

	Creating hard disk image 'matrix-hd.img' with CHS=101/16/63

	The following line should appear in your bochsrc:
	  ata0-master: type=disk, path="matrix-hd.img", mode=flat	

To install grub2 on image
-------------------------

	$ sudo losetup --show --find images/matrix-hd.img
	/dev/loop2
	$ sudo fdisk /dev/loop2
	Command (m for help): o
	Building a new DOS disklabel with disk identifier 0x3e537798.

	Command (m for help): n
	Command (m for help): w
	The partition table has been altered!

	Calling ioctl() to re-read partition table.

	WARNING: Re-reading the partition table failed with error 22: Invalid argument.
	The kernel still uses the old table. The new table will be used at
	the next reboot or after you run partprobe(8) or kpartx(8)
	Syncing disks.
	Command (m for help): w

	$ sudo mkfs -t vfat /dev/loop2
	$ sudo mount /dev/loop2 /mnt
	$ sudo mkdir -p /mnt/boot/grub2
	$ sudo grub2-install --force --boot-directory=/mnt /dev/loop2
	$ sudo cp tools/grub.cfg /mnt/boot/grub2
	
To boot matrix
--------------

	$ sudo cp bin/matrix /mnt/boot
	$ sudo cp bin/initrd /mnt/boot
	$ cp tools/{bochsrc.bxrc,.bochsrc.bxrc}
	$ ./run_bochs.sh

What architecture does matrix support now?

At this moment matrix only support the x86 architecture.

How to debug matrix?

When matrix booting it will config the serial port and write logs to 
the serial port. If you are debugging with physical machine, you can 
use a serial line. If you are debugging with bochs, you can redirect 
the output to a file.

How to create a bochs vm using the image?

Create a file bochsrc.bxrc and write the configuration into the file. 
You can refer to the documents on bochs site. Also there is a bochs 
configuration file in tools directory.

***

Organization of the Matrix sources

The sdk\ directory contains a number of shared user mode startup code
for applications. sdk\include contains all the headers shared between
user mode and kernel mode components. sdk\libc contains the standard C
library code that don't need runtime environments(i.e. no memory related
stuff).

The uspace\ directory contains code for all the applications

The drivers\ directory contains all the drivers for Matrix

The kernel\ directory contains the Matrix kernel sources.

The primary Matrix source components are organized as follows:

    hal\    - Hardware abstract layer
    mm\	    - Memory management stuff
    proc\   - Process, thread management and also scheduler
    sys\    - System call, timer, utility, etc
    fs\	    - File System related stuff
    loader\ - ELF loader, load the ELF file to process' address space
    time\   - Time management code
    libc\   - Place holder, actual code is in sdk\libc directory
    dbgk\   - Kernel debugger support

    include\- Kernel-only include files
    rtl\    - Kernel run-time support
    init\   - Kernel startup code

***

matrix's People

Contributors

ted-chang avatar

Stargazers

Eason Wang avatar Arun avatar  avatar Derek avatar  avatar Emrick avatar Classic avatar jay zhang avatar  avatar Zhengxiang Zhou avatar 冯立 avatar astrotycoon avatar Melanie Gagne avatar TomShine avatar  avatar  avatar Curie avatar 游~游~游 avatar  avatar 春天 avatar Leslie avatar Chen Chenglong avatar dennis zhuang avatar 郑小则 avatar foodotbar avatar Chenfei avatar Tree avatar cfr avatar youfu avatar Boyin Chen avatar codingcat avatar can. avatar KokaKiwi avatar

Watchers

James Cloos avatar  avatar  avatar youfu avatar 郑小则 avatar 郝志鹏 avatar  avatar

matrix's Issues

some configuration is wrong

Dear Sir:
You compile the kernel into bin/obji386, but in update_img.sh you use the initrd at the path of bin/
Frankly speaking, it may frighten some young learner for they overestimate its difficulty. Please...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.