XDU-OS-Course-Design
Due to the impact of COVID-19, the operating system class has to be conducted at home. According to convention, it should be carried out in the computer room, because the computer room has been tempered by the students and should be relatively stable, and the computer room is generally more consistent with the software provided by the teacher.
However, someone completed this course setting at home, using VMware15 and Ubuntu18.04 that he had already installed, which was seriously incompatible with the course video version. He stepped on countless pitfalls and reinstalled it more than ten times. Now I use my painful experience to fill the hole for everyone.
In the moment of operation error, start another day . Before doing the $k$ experiment, please put the $i$ experiment ( $forall i, ileqslant k$ ) read all the guides.
Pre-pre-experiment and precautions!
There are a few small experiments before the formal experiment. Here are some precautions. If you don’t encounter it, it does not mean that you won’t encounter it in the subsequent experiments:
- Memory 2-4G (if the computer is often turned on, the kernel is recommended to have black screen, the kernel is booting black screen), 4-6 cores, at least 35G for hard disk (experts can not have 35G), network bridge mode;
- VMware uses versions 14 and 15, and Ubuntu 18+ versions can all move forward steadily. The file above provides an Ubuntu mirror , and VMware can download it by itself;
- The VMware Tools installation is likely to not work, please click on the previous article to handle it;
- VMware Tools drag files may be stuck . Please restart the kill process. Repeat n times and you will always succeed once. Remember to write the screenshot into the report.
- How to transfer files when VMware Tools is frequently stuck? Uncle Wen will go there;
- VMware is slow in "inside the wall" and please save yourself.
A place beyond law The download speed is touching and the machine can enter A place beyond law Refer to the previous article; - Recovery of virtual machine by mistake: Menu bar -> File -> Scan the virtual machine (scan in the installation path of your original virtual machine);
- If the hard disk is not large enough, please see the VMware virtual machine expands the disk space of the Ubuntu system.
Why not use the school version ?
- Your computer environment!=The computer environment of the school;
- The software and kernel versions provided by the school are extremely old, and there is no guarantee of any problems;
- If you use partly school versions, partly non-school versions will usually make you furious and difficult to suppress your emotions.
LAB1 kernel compilation
Tips:
Don’t compile the kernel provided by the school. Download the latest one from the official website or use it provided by me in the folder “LAB1 kernel compilation” (otherwise there will be inconsistencies in the gcc version, compilation errors, etc.). It is strongly recommended to choose the 4 version (there will not be too many mistakes compared with the lower version, and the advantages compared with the 5 version are reflected in the second experiment);
It is recommended to watch the school video first, understand the steps, and then refer to the CSDN Tutorial 4 version kernel and the CSDN Tutorial 5 version kernel to complete the kernel compilation;
To compile 5 versions under Ubuntu in environment 18.04:
sudo apt-get install gcc make libncurses5-dev openssl libssl-dev
sudo apt-get install build-essential
sudo apt-get install pkg-config
sudo apt-get install libc6-dev
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install libelf-dev
- Efficiency improvement tool : multi-threaded compilation (provided that you have multiple cores when configuring), please do this when making (if 4 cores are written -j4, if x cores are written -jy, where y≤x):
- Why don't you see the option when you start the computer: Follow the ".LAB1 kernel compilation" operation, find "/etc/default", enter grub, and count the 7th line from top to bottom GRUB_TIMEOUT_STYLE=hidden with # annotation.
—Why compile different kernels?
—It is difficult to complete the school’s complete work. Different kernel versions have bonus points, and the new kernel version is simple.
LAB2 system call
Tips:
- It is strongly recommended to use the 4th version kernel for compilation, because the system call code modifications of the higher version are different, while there are few tutorials for the 5th version;
- After watching the school video, watch the system call added on Ubuntu 18.04.
LAB3 kernel module
There are two parts of this experiment. The first one is as follows what the teacher said, and the main one is the second one.
The biggest benefit of this experiment is that there is no need to compile the kernel;
Refer to the two methods of adding system calls under Linux/Ubuntu18.04 (kernel compilation method | module addition) and [using kernel module method to add simple system calls;
Note: First, follow the blog prompts to find the available system call number, look at the address of the system call table through the command given by the blog (if there are multiple table addresses, look at the most normal name), and be sure to directly modify the blog code based on the blog code running first.
LAB4 device driver
- It is important to understand what the teacher said before starting;
- unlocked_ioctl error (warning error is error), int->long, refer to the ioctl and unlock_ioctl functions to discuss;
- If the function parameter table is empty, remember to write void, sometimes it will also report an error;
- I have provided relevant source code for reference only. It involves information such as name and student number, and the variable names are quite special, so I have to write it with the teacher;
- lab4 is the test code, and it is also for reference only.