szhou42 / osdev

Hobby os project with GUI
GNU General Public License v3.0
397 stars 63 forks source link

edu OS

An operating system based on Brans' Kernel Development Tutorial
Click me to see the video demo!

Future goals:

  1. Userspace, Port Newlib, Multi-process, multi-thread, IPC, write syscalls, etc(process related stuff)
  2. Implement a hobby level TCP/IP stack(Ethernet/ARP/DHCP/IP/UDP/TCP with congestion control and everything..)
  3. Graphical User Interface(C/S GUI Server, Composite via IPC, now the GUI is in kernel)
  4. Write three GUI user apps(Shell, TCP ChatRoom, Text Editor)

Screenshots

Alt text Alt text Alt text

How to run and test edu OS kernel

Preparation(Ubuntu14.04 is a recommended environment for compiling and running edu os)

eduos use elf-i686-gcc as cross-compiler, please build the cross compiler on your system first.
Remember to replace "CC=i686-pc-btos-gcc" in Makefile with your cross compiler.

How to build a cross compiler
Or, a rewritten/translated version of the above wiki article in Simplified Chinese

Link: 环境搭建与交叉编译器 Download password: 7ksb

Then, install nasm

sudo apt-get install nasm

Run the following script to generate 4 hard disk image

./mkext2image.sh

Run the following script to setup the tap network device

./setup_tap_device.sh

Note: The path of executable qemu-bridge-helper may vary, and so you should manually replace this path in qemu_run.sh, kvm.sh and debug_qemu.sh first. Use this command to find the path of qemu-bridge-helper

cd ~
find . -iname qemu-bridge-helper

If you would like to run the os in GUI mode, set the constant GUI_MODE (defined in kmain.c) to 1. If you would like to run the os in Network mode, set the constant NETWORK_MODE (defined in kmain.c) to 1.

Now run the following script to compile the kernel

./compile.sh

And then choose one of the following simulator to boot edu os. QEMU is more recommended.

QEMU

  1. Run sudo apt-get install qemu-system
  2. Run ./qemu_run.sh to boot edu os(or ./kvm.sh if your environment supports kvm)

Debug with QEMU

  1. run ./debug_qemu.sh

Plan

Mem management

       0 Higher half loader [✔]
       1 physical memory management [✔]
       2 paging(virtual memory management) [✔]
       3 kmalloc [✔]

Filesystem

       0 PCI Enumerate,R/W [✔]
       1 ATA/DMA Driver [✔]
       2 Ext2 Filesystem [✔]
       3 Virtual Filesystem [✔]

Graphical Interface

       0 vesa driver, 1024 * 768 color(32-bit color),framebuffer mode [✔]
       1 Milestone(try loading and showing a wallpaper from hardisk!) [✔]
       2 Windows compositor, support fonts, buttons,and etc [✔]
       3 Write a shell []
       4 Write a file browser []

Miscellaneous

       1 Usermode [✔]
       1 Multi-tasking/Simple scheduler []
       2 Executable loader(elf) [✔]
       3 spinlock, mutex, and other pthread primitives []
       4 Add more syscalls, like fork/exec, open, read, etc.. []
       5 Port newlib []
       6 Write or port some baisc utilities such asenv, rm, cp, mkdir, reboot []
       7 Real time clock [✔]
       9 stadard input/output stuff []

Network protocols

       0 Send/Recv raw packets [✔]
       1 IP [✔]
       2 UDP [✔]
       3 ARP [✔]
       4 DHCP [✔]
       5 TCP []
       6 HTTP []