The freele OS Operating System by Zhang Tong Hao muge0913 http://blog.csdn.net/muge0913 released, only for the exchange of learning, do not commercial purposes !!
Recently, many companies have released their own operating systems, showing the importance of the operating system, so I plan to write a simple operating system. The only feeling after writing this operating system is: the underlying programming environment is poor, or it is easier to develop upper-layer applications :). The source code is uploaded to the Internet to share with you. If you have any errors, please correct them. :) or if you have any good suggestions, please send your email:
Zth@pku.edu.cn or muge0913@sina.com
Get source code: Github: https://github.com/muge0913/freele-os
Blog: http://blog.csdn.net/muge0913/article/details/18713017
Freele OS introduction and instructions for use pdf: http://download.csdn.net/detail/muge0913/6878381
I. freele OS Development Environment
1. ubuntu 10.04
2. Development tools: arm-linux-gcc-4.3.2, dnw, minicom
3. Development Board: tiny6410 RAM256MB ROM 2 GB
Ii. freele OS implementation functions
1. K9K8G08U0A MLC2 driver
2. MMU memory re ing
3. Buddy + Slab + Malloc Memory Management Mechanism
4. system clock and system timer
5. process management and scheduling (FCFS)
6. Storage Device Driver framework
7. File System Framework
8. ROMFS File System
I simply implemented the most important components of the operating system, such as memory management, process management, and file system. Of course there are some I/O operations J. Memory Management uses the buddy + slab + malloc method. The FCFS method used for process scheduling. Add a romfs under the entire file system framework. Of course, you can add other file systems under the file system framework.
The system definition supports three processes (you can modify a macro definition to support different processes), where programs 1 and 2 are stored in romfs. in the imgfile system, the names are task_ont.bin and task_two.bin. During the startup process, the kernel reads programs 1 and 2 from the romfs file system and loads them into the memory. Then, the scheduler schedules the original kernel processes and processes 1 and 2 respectively. Among them, process 1 only prints the letter, Program 2 only prints the B letter, and the kernel's original process control flow light is executed.
Iii. freele OS directory structure
Freeleos adopts Directory management similar to linux.
Boot: Kernel startup: bootsect. Sclosck. S nand. c sdram. S
Fs: File System related files: fs_frame.cramfs.c romfs. c
Include: System header file: dr_frame.helf.h fs_frame.h irq. h sched. h string. h
Init: The system mainly initializes main. c.
Kernel: kernel main function implementation code: blk_drv Device Driver folder, chr_drv character device driver folder,
Dr_frame.c exec. c irq_k1.c sched_test.csys_timer.c trap. S vsprintf. c
Lib: Library
Mm: Related to memory management: memory. CMU. c
Tools: stores tools that generate romfs. img. Filesystemgenromfs. c task_one.c task_two.c
4. Code display
5. How to Run freele OS
1. Download the boot program source code sys_bootsect-0.02.tar.gz
2. Download the internal source code freele-os-0.01.tar.gz
3. download the file system romfs. img
4. Connect tiny6410 to your computer
5. Open the ubuntu terminal and run the following command to open minicom
$ Sudo minicom
6. tiny6410 power on to enter the download program mode,
1. Select v to enter the uboot download mode.
2. Compile sys_bootsect-0.02.tar.gz and download the Development Board through dnw.
$ Sudo dnw-f sys_bootsect.bin
3. Select k to enter the download kernel mode, but at this time we download the rom. img
$ Sudo dnw-f romfs. img
Note: romfs. img can be downloaded or generated from freele-OS source code.
4. Start tiny6410 from nand flash. You will see the following
1. Select y to move the downloaded romfs. img to the specified place. Friendly Development Board is so bad. Many programs are not open-source, so I can only download romfs. img in this way !!
2. Go back to step 6 compile and download the program compiled by freele-os-0.01.tar.gz
$ Sudo dnw-f freele_kernel.bin
3. Finally, let tiny6410 start from nand flash and select n as shown in the figure for the 10-step operation.
4. Running Effect: 1st displays the effects of process 1 and process 2. 2nd figure shows the effect of the original kernel process (it is not clear about the pixel problem of the mobile phone, but it is actually a streaming light J)
PS: currently, the uploaded source code only supports tiny6410. To run the code on other platforms, you only need to modify the corresponding driver.