By 9 Linux-0.11 experiential learning operating system

Brief introduction

The fall of 2019, I taught a course at HIT operating system, feeling their tutorials and experimental design of the operating system as an entry is a good choice (although it is based on older Linux-0.11 written). Experimental substantially cover the core concepts of operating systems, such as start, interrupt, peripheral IO, context switching / system calls, process management and scheduling, interprocess communication, memory management / address conversion, and file systems. And a description of each experiment in textbooks has a corresponding, but doing it very smooth. After I finished compiled some resources, we hope to help some of the self-study students.


Guidance materials

The course materials used are Li Zhijun Liu Hongwei and compiled the "Caozuoxitong principle, implement and Practice" (ISBN: 978-7-04-049245-3), you can here get. In addition to the experimental and the corresponding course, the book is still the final design of the four major items, including kernel-level threads, virtual memory, implement the GUI and network protocols.

In addition, Zhao Jiong edited "Linux kernel entirely Notes - kernel version 0.11" is also a good reference book, you can here get.


Experiment Resources

You can Hack-Linux-0.11 access to the tools needed development environment, as well as the reference code for each experiment, the effect of examples and considerations. Description of the warehouse layout is as follows:

  1. oslab.zip: original Linux code is 0.11 and tools in GNU / Linux you need to develop, such as Bochs 2.3.7 and GCC 3.4.

  2. tmp /: miscellaneous, and the main experiment does not matter.

  3. . Lab 6.Ext Print paging status /: 6 after completion of the pilot, I designed the experiment a printed page address translation.

  4. Other experiments on eight eight catalog of the book corresponds to each directory contains is relative to the original Linux 0.11 file changes , in addition to a README.md, describes the considerations and examples of the experiment results.


By using rsyncand the cpkind of tools, we can easily modify the original Linux 0.11 code and run the modified kernel. For example, on my machine, you can run the Lab 6.Ext following bash command corresponding kernel:

qiuhaoli@VM:~/tmp/oslab$ rsync -a ../Hack-Linux-0.11/Lab\ 6.Ext.\ Print\ paging\ status/linux-0.11/ ./linux-0.11/

qiuhaoli@VM:~/tmp/oslab$ sudo ./mount-hdc 

qiuhaoli@VM:~/tmp/oslab$ cd ./hdc/usr/include/

qiuhaoli@VM:~/tmp/oslab/hdc/usr/include$ sudo cp ../../../../Hack-Linux-0.11/Lab\ 6.Ext.\ Print\ paging\ status/hdc/usr/include/* .

qiuhaoli@VM:~/tmp/oslab/hdc/usr/include$ cd ../../..

qiuhaoli@VM:~/tmp/oslab$ cd linux-0.11/

qiuhaoli@VM:~/tmp/oslab/linux-0.11$ make && ../run


Environment to build

After this download oslab.zip, you can refer to the HIT-MANUAL complete build experimental environment. Note that you may encounter problems in the lack of 32-bit libraries build process, you can specify the installation by a corresponding 32-bit versions of libraries or multilibresolved, such as:

qiuhaoli@VM:~/tmp$ sudo apt install  gcc-multilib linux-libc-dev:i386


In addition, some header files or libraries are placed in different GNU / Linux distributions, or different versions of the system position may be different, for example, /usr/include/asmand /usr/include/asm-genericcan do some links:

qiuhaoli@VM:~/tmp$ ln -s /usr/include/asm-generic /usr/include/asm


Finally, when you do not know a file or folder that corresponds to the library, you can use apt-filethis tool to find, for example:

qiuhaoli@VM:~/tmp$ apt-file search /usr/include/asm

gcc-multilib: /usr/include/asm
linux-libc-dev: /usr/include/asm-generic/auxvec.h
...




P.S.

Although these are good experimental design, but because of the age-old platform and code, as well as some of the features of C itself, in the course of the experiment will always encounter some problems left over by history or design flaws. I'm trying to use based on RISC-V platform Rust write a teaching-oriented operating system, now beginning, if you are also interested in this, please contact me!

Guess you like

Origin www.cnblogs.com/liqiuhao/p/12128070.html