LanOS -- Clarify the knowledge points series of linux0.12
这个工程的目标是梳理《Linux源码剖析》的知识点并从0.12版本的源码中抠出部分代码构建一个
能用现代linux发行版方便编译的迷你系统,从而验证各个知识点
bilibili video tutorial
Reference resources
- "Linux Source Code Analysis" latest electronic version
- linux 0.1x source code
- oldlinux official website
- ORANGE'S: Implementation of an Operating System
Thank you Dr. Zhao Jiong, Teacher Yu Yuan, Mr. Hideshi Kawahiro, and the highest respect!
Features of this tutorial
- A lot of references to the design ideas of linux0.12 to create demos, which will help you read the linux source code later
- Re-implement as much as possible code implemented in Linux with C to improve readability and reduce learning costs
- Use docker to compile, making the compilation environment very easy to build
Ultra-fast compilation method (relying on docker & networking)
Execute the following command to pull the code and compile (it will be slower to execute make_os.sh for the first time because you want to pull the docker compiled image)
git clone https://github.com/freelw/LanOS.git
cd LanOS
./make_os.sh
Execution effect
dantadeMacBook-Pro:yard danta$ git clone https://github.com/freelw/LanOS.git
Cloning into 'LanOS'...
remote: Enumerating objects: 517, done.
remote: Counting objects: 100% (517/517), done.
remote: Compressing objects: 100% (322/322), done.
remote: Total 1316 (delta 304), reused 379 (delta 181), pack-reused 799
Receiving objects: 100% (1316/1316), 2.78 MiB | 42.00 KiB/s, done.
Resolving deltas: 100% (788/788), done.
dantadeMacBook-Pro:yard danta$ cd LanOS
dantadeMacBook-Pro:LanOS danta$ ./make_os.sh
builing lan os...
cleaning temp files...
file [a.vfd] is our os image with a simple ramdisk filesystem.
Knowledge Points Catalog
- How to compile and run demo
- Clarify the Linux 0.12 knowledge point series to make assembly to C no longer far
- Clarify the a20 address line of Linux0.12 knowledge point series
- Clarify the initialization and clock interrupt of 8259A in Linux0.12 knowledge point series
- 8259A principle detailed description
- Online related information sorting
Blood and tears
- Jump to user mode
- Preliminary debugging fork
- fork+Copy on write
- About global variables
Other Instructions
- How to compile a custom binary file
Todo
print_str implementation done 20200224 print_num implementation done 20200224 lan_fs implementation done 20200224 exec implementation done 20200224 exit implementation done 20200304
Final effect display
There are simple shells and file systems that can execute ls programs
Support exec system calls, can execute applications
During the running of one executable program, execute another program, indicating that multitasking is supported
Implementation of loop program
See here for details
Final demo link
See here for details
Historical demo order
- asm_int_80
- asm_call_c
- lds_test
- protect_mode_demo
- protect_mode_cpp_demo
- a20_not_open
- a20_open
- mm
- user_mode_demo
- fork_demo
- cp_on_write
- print_str_demo
- fs_demo
- exec_demo
- shell_demo
- ls_demo
- exit_demo
- common_header_demo
B website document
- 01 Goals & Preparations
- 02 Comparison of two directions
- 03 Control binary files
- 04 Protect mode quick
- 05 A20 address line
- 06 8259A
- 07 mm