|
Downloads
Source Code
Screen Shots
The Forum
Beans'OS forum
About author
|
Welcome to Beans'OS
The Beans' Operating System is an Open Source project aimed at
building a "simple and complete" operating system on x86 architecture, for
fun of the guys who are interested in low level programming. the purpose
of this project is researching
and practising, only the "basic but
correct" code is to be expected. Therefore, the kernel would never copy or port
any other
source code of famous open source OS. but the drivers may limitedly refer
to some code from experimental OS which has already given up its copyright.
The source code of beans' is written by C and Assemble languages.
Beans'OS is developed under the GNU General Public License. There is a copy of GPL in the source
code package.
NOTE: The applications that use kernel services or libs using
system calls are not a part of this project and the copy right of them
belongs to their author.
Kernel of beans'OS ,some user spaces lib and applications are built and
tested in the linux environment. and to be written into a floppy image, the
floppy image is bootable, can be tested in a real PC with x86 CPU using a
real floppy. as well as the virtual machines using the image.
Current Achievement
Kernel part
*Memory Management:
Use First Matching method manage the 4k size pages.
Use Slab structures manage small size memory allocation.
Page allocations delay until a page fault happen.
*Process Management:
Use Feed back priority arithmetic to organize the multi-processes.
Every process has its own 2G virtual address of user space and 2G
virtual address of kernel space.
After a process exitting, the resource of the process will be
called back. At system level, the memory leak will be prevented.
Sleep and wakeup are enabled.
Kernel can load and execute the ELF format executable file linked
in use of the default ld script under linux(four section are needed at
least: data, rodata, bss, text).
*Access protection:
Support all the functions offered by protection mode of x86 to
protect memory operation, IO operation and soft interrupt operation.
At kernel mode, all resource can be access but at user mode, only
the resource belong to the current process can be accessed.
*File system
A read-only dos fat12 has be driven, it is compatible with the file
system supported by windows and linux, so you can mount beans' image to those
system and access files.
*Drivers
Mouse, keyboard, character console, timer, floppy and the interrupts
controller.
*System call
Until now, support a little system call:
print, exit, pause, brk, get_command_param, get_heap_size
*Kernel libs
Functions for memory management and string operation, also there
are some math functions.
User part
*Libs
Some common functions.
Port glibc's memory management part.
*Demos
The basic demos show how to program for beans', they are:
1, Huge number adding program.
2, A program lists all the result of multiplication from 1 to 9.
3, Josephus question, which acts how to use a circle list. it is the test
demo for malloc and free.
Parts of POSIX will be supported More and more.
Develop Tools
Redhat linux(Fedora core 1 with kernel 2.4.22-1.2115.nptl)
Gcc 3.3.2
Nasm 0.98.38
GNU ld 2.14.90.0.6
Test Tools
Computer 1: compatible PC
p4 1.8G
512M RAM
MSI main-board
Nec ISA floppy driver
Any ps2 mouse and keyboard
Computer 2: DELL OPTIPLEX GX620
p4 3.0
1G RAM
VMware 4.0.5 linux-version
VMware 5.0.0 windows-version
Bochs x86 Emulator 2.3 linux-version
Bochs x86 Emulator 2.3 windows-version
How to compile the kernel of beans'OS and make a bootable image?
Under linux, this is so easy.
1, Change dir to src/beans
2, Use "make" command, this will build three new files: kernel,
bootsect, setup
besides the kernel, the bootsect and setup are made to be the "boot program and the
kernel loader"
3, According to the cue of the makefile's output, use "./makeimg
xx.img" this will make a new bootable floppy image named "xx.img".
makeimg is a tool, its source code is in dir src/tool.
Some one has a successful experience to compiler this kernel under
windows but I never do that. Maybe you should find the gcc and nasm for
windows version.
How to write applications for beans'OS?
1, Write your
application normally as write it for linux.
2, Include "applib.h"
as a header file.
3, Add a macro "APP_ENTRY"
before the first function of your program. (normally, this should be after
the statement of global variables).
4, Use gcc as the
compiler, add the following option:
-ffreestanding -nostdlib -fno-builtin -nostdinc -fno-exceptions
-Wall
5, Use ld as the
linker, add the following option:
-Ttext 0x80000000 -e app_entry
All beans' applications begin from virtual addr 2G
6, Set the executable file's
extend name as ".ex"
For example: you should give the name "hello.ex" for
your first "hello world" program.
7, Mount the
bootable kernel image to linux. and copy your program to the mount dir
For example: you make a kernel and use "./makeimg
bootimg.img" to get a bootable floppy image named "bootimg.img". Also, you
make an application named "hello.ex",you should input as following:
mount bootimg.img /mnt -o loop
cp hello.ex /mnt/hello.ex
umount bootimg.img
Make sure the umount operation success, if umount fails, you may still
open or use the files under /mnt dir
8, Now, you have
got a bootable image include the kernel and the filesystem.
If you want to run it in a real PC, you should insert a floppy disk into
your old floppy driver and use the command:
"cat bootimg.img > /dev/fd0"
this command will dupe the
floppy image to a real floppy disk. then, set the
computer boot sequence in bios, move the "floppy boot" first, reboot.
If you has a virtual machine, you can set the bootable image
as the virtual machine's floppy disk, and reboot the virtual machine
9, After startup of beans'OS , like unix shell, you can use some command
listed at screen. Use "cd dir" to the dir which contains your hello.ex and type
"hello.ex" . that's all.
Anyway, the demos in src/app/ is the best example, read the Makefile
and Rules.make of them. they are all very simple.
How to join this project and write something for the kernel?
1, Write me a mail to this address beansos@gmail.com.
2, Write and test your codes, if you think these codes work well, you can
submit it at the forum"code submit" place( Code Submit ) using ".tar.gz" format.
also, a "readme" file is necessary. if they are really good enough,
your
codes will be added to kernel when next version comes out.
3, Never forget to upgrade your code.
Page maintained by Shaojie Zhou |